x11-apps-7.7+5+nmu1ubuntu1/0000775000000000000000000000000012656635744012213 5ustar x11-apps-7.7+5+nmu1ubuntu1/bitmap/0000775000000000000000000000000012656635743013466 5ustar x11-apps-7.7+5+nmu1ubuntu1/bitmap/RotateRight0000664000000000000000000000151512456374665015650 0ustar #define RotateRight_width 30 #define RotateRight_height 30 static char RotateRight_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x80, 0x1d, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0xdc, 0x01, 0x00, 0xfc, 0xbf, 0x03, 0x00, 0xfe, 0x5f, 0x07, 0x00, 0xab, 0xaa, 0x0e, 0x80, 0x55, 0x55, 0x1d, 0xc0, 0xaa, 0xaa, 0x0e, 0xe0, 0xff, 0x5f, 0x07, 0xf0, 0xff, 0xbf, 0x03, 0xb0, 0x06, 0xdc, 0x01, 0x70, 0x07, 0xee, 0x00, 0xb0, 0x06, 0x77, 0x00, 0x70, 0x87, 0x3b, 0x00, 0xb0, 0x86, 0x1d, 0x00, 0x70, 0x87, 0x0f, 0x00, 0xb0, 0x86, 0x07, 0x00, 0x70, 0x07, 0x00, 0x00, 0xb0, 0x06, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x70, 0x07, 0x00, 0x00, 0x30, 0x06, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/bitmap/Requests.h0000664000000000000000000000727412456374665015465 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Davor Matic, MIT X Consortium */ #ifndef _Requests_h #define _Requests_h typedef int (*DrawOnePointProc)(Widget, Position, Position, int); typedef int (*DrawTwoPointProc)(Widget, Position, Position, Position, Position, int); typedef int (*InterfaceProc)(Widget); typedef struct { Boolean success; Position at_x, at_y; Position from_x, from_y, to_x, to_y; XtPointer draw; int value; Time btime; int state; } BWStatus; extern void OnePointEngage ( Widget w, BWStatus *status, XtPointer draw, int *state ); extern void OnePointTerminate ( Widget w, BWStatus *status, XtPointer draw ); extern void OnePointTerminateTransparent ( Widget w, BWStatus *status, XtPointer draw ); extern void DragOnePointEngage ( Widget w, BWStatus *status, XtPointer draw, int *state ); extern void DragOnePointTerminate ( Widget w, BWStatus *status, XtPointer client_data ); extern void TwoPointsEngage ( Widget w, BWStatus *status, XtPointer draw, int *state ); extern void TwoPointsTerminate ( Widget w, BWStatus *status, XtPointer draw ); extern void TwoPointsTerminateTransparent ( Widget w, BWStatus *status, XtPointer draw ); extern void TwoPointsTerminateTimed ( Widget w, BWStatus *status, XtPointer draw ); extern void DragTwoPointsEngage ( Widget w, BWStatus *status, XtPointer draw, int *state ); extern void DragTwoPointsTerminate ( Widget w, BWStatus *status, XtPointer draw ); extern void Interface ( Widget w, BWStatus *status, XtPointer action ); extern void Paste ( Widget w, Position at_x, Position at_y, int value ); extern void BWDragMarked(Widget w, Position at_x, Position at_y); extern void BWDragStored(Widget w, Position at_x, Position at_y); extern void BWCopy(Widget w, Position at_x, Position at_y, int value); extern void BWMove(Widget w, Position at_x, Position at_y, int value); extern void BWRestore(Widget w, Position at_x, Position at_y, int value); extern void BWDrawPoint(Widget w, Position x, Position y, bit value); extern void BWBlindLine(Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value); extern void BWDrawHotSpot(Widget w, Position x, Position y, int value); extern void BWZoomIn(Widget w, Position from_x, Position from_y, Position to_x, Position to_y); extern void OnePointHandler(Widget w, XtPointer client_data, XEvent *event, Boolean *cont); extern void TwoPointsHandler(Widget w, XtPointer client_data, XEvent *event, Boolean *cont); extern void DragTwoPointsHandler(Widget w, XtPointer client_data, XEvent *event, Boolean *cont); #endif /* _Requests_h */ x11-apps-7.7+5+nmu1ubuntu1/bitmap/Handlers.c0000664000000000000000000004262612456374665015405 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Davor Matic, MIT X Consortium */ #include #include #include "BitmapP.h" #include #include #define min(x, y) (((int)(x) < (int)(y)) ? (x) : (y)) #define max(x, y) (((int)(x) > (int)(y)) ? (x) : (y)) #include "Requests.h" /***************************************************************************** * Handlers * *****************************************************************************/ #define QueryInSquare(BW, x, y, square_x, square_y)\ ((InBitmapX(BW, x) == (square_x)) &&\ (InBitmapY(BW, y) == (square_y))) static void DragOnePointHandler(Widget w, XtPointer client_data, XEvent *event, Boolean *cont) /* ARGSUSED */ { BWStatus *status = (BWStatus *)client_data; BitmapWidget BW = (BitmapWidget) w; if (DEBUG) fprintf(stderr, "D1PH "); switch (event->type) { case ButtonPress: if (event->xbutton.state != status->state) return; if (!QuerySet(status->at_x, status->at_y)) { BWStoreToBuffer(w); status->value = Value(BW, event->xbutton.button); status->btime = event->xbutton.time; status->at_x = InBitmapX(BW, event->xbutton.x); status->at_y = InBitmapY(BW, event->xbutton.y); status->success = status->draw ? True : False; if (status->draw) (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, status->value); } break; case ButtonRelease: if (QuerySet(status->at_x, status->at_y)) { status->value = Value(BW, event->xbutton.button); status->btime = event->xbutton.time; status->at_x = InBitmapX(BW, event->xbutton.x); status->at_y = InBitmapY(BW, event->xbutton.y); status->success = status->draw ? True : False; /* SUPPRESS 701 */ BWTerminateRequest(w, TRUE); } break; case MotionNotify: if (QuerySet(status->at_x, status->at_y)) { if (!QueryInSquare(BW, event->xmotion.x, event->xmotion.y, status->at_x, status->at_y)) { status->at_x = InBitmapX(BW, event->xmotion.x); status->at_y = InBitmapY(BW, event->xmotion.y); if (status->draw) (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, status->value); } } break; } } void DragOnePointEngage(Widget w, BWStatus *status, XtPointer draw, int *state) { status->at_x = NotSet; status->at_y = NotSet; status->draw = draw; status->success = False; status->state = *state; XtAddEventHandler(w, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, FALSE, DragOnePointHandler, (XtPointer)status); } /* ARGSUSED */ void DragOnePointTerminate(Widget w, BWStatus *status, XtPointer draw) { if (status->success) { BWChangeNotify(w); BWSetChanged(w); } XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, FALSE, DragOnePointHandler, (XtPointer)status); } void OnePointHandler(Widget w, XtPointer client_data, XEvent *event, Boolean *cont) /* ARGSUSED */ { BWStatus *status = (BWStatus *)client_data; BitmapWidget BW = (BitmapWidget) w; if (DEBUG) fprintf(stderr, "1PH "); switch (event->type) { case Expose: if (QuerySet(status->at_x, status->at_y)) { BWClip(w, event->xexpose.x, event->xexpose.y, event->xexpose.width, event->xexpose.height); if (status->draw) (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); BWUnclip(w); } break; case ButtonPress: if (event->xbutton.state != status->state) return; if (!QuerySet(status->at_x, status->at_y)) { status->value = Value(BW, event->xbutton.button); status->btime = event->xbutton.time; status->at_x = InBitmapX(BW, event->xbutton.x); status->at_y = InBitmapY(BW, event->xbutton.y); if (status->draw) (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); } break; case ButtonRelease: if (QuerySet(status->at_x, status->at_y)) { if (status->draw) (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); status->value = Value(BW, event->xbutton.button); status->btime = event->xbutton.time; status->at_x = InBitmapX(BW, event->xbutton.x); status->at_y = InBitmapY(BW, event->xbutton.y); status->success = True; BWTerminateRequest(w, TRUE); } break; case MotionNotify: if (QuerySet(status->at_x, status->at_y)) { if (!QueryInSquare(BW, event->xmotion.x, event->xmotion.y, status->at_x, status->at_y)) { if (status->draw) (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); status->at_x = InBitmapX(BW, event->xmotion.x); status->at_y = InBitmapY(BW, event->xmotion.y); if (status->draw) (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); } } break; } } void OnePointEngage(Widget w, BWStatus *status, XtPointer draw, int *state) { status->at_x = NotSet; status->at_y = NotSet; status->draw = draw; status->success = False; status->state = *state; XtAddEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, OnePointHandler, (XtPointer)status); } #if 0 void OnePointImmediateEngage(Widget w, BWStatus *status, XtPointer draw, int *state) { status->at_x = 0; status->at_y = 0; status->draw = draw; status->success = False; status->state = *state; if (status->draw) (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); XtAddEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, OnePointHandler, (XtPointer)status); } #endif void OnePointTerminate(Widget w, BWStatus *status, XtPointer draw) { if (status->success && draw) { BWStoreToBuffer(w); (*(DrawOnePointProc)draw)(w, status->at_x, status->at_y, status->value); BWChangeNotify(w); BWSetChanged(w); } else if (QuerySet(status->at_x, status->at_y)) if (status->draw) (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, OnePointHandler, (XtPointer)status); } void OnePointTerminateTransparent(Widget w, BWStatus *status, XtPointer draw) { if (status->success && draw) (*(DrawOnePointProc)draw)(w, status->at_x, status->at_y, status->value); else if (QuerySet(status->at_x, status->at_y)) if (status->draw) (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, OnePointHandler, (XtPointer)status); } void TwoPointsHandler(Widget w, XtPointer client_data, XEvent *event, Boolean *cont) /* ARGSUSED */ { BitmapWidget BW = (BitmapWidget) w; BWStatus *status = (BWStatus *)client_data; if (DEBUG) fprintf(stderr, "2PH "); switch (event->type) { case Expose: if (QuerySet(status->from_x, status->from_y) && QuerySet(status->to_x, status->to_y)) { BWClip(w, event->xexpose.x, event->xexpose.y, event->xexpose.width, event->xexpose.height); if (status->draw) (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); BWUnclip(w); } break; case ButtonPress: if (event->xbutton.state != status->state) return; if (!QuerySet(status->from_x, status->from_y)) { status->value = Value(BW, event->xbutton.button); status->btime = event->xbutton.time; status->from_x = InBitmapX(BW, event->xbutton.x); status->from_y = InBitmapY(BW, event->xbutton.y); status->to_x = InBitmapX(BW, event->xbutton.x); status->to_y = InBitmapY(BW, event->xbutton.y); if (status->draw) (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); } break; case ButtonRelease: if (QuerySet(status->from_x, status->from_y)) { if (status->draw) (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); status->value = Value(BW, event->xbutton.button); status->btime = event->xbutton.time; status->to_x = InBitmapX(BW, event->xbutton.x); status->to_y = InBitmapY(BW, event->xbutton.y); status->success = True; BWTerminateRequest(w, TRUE); } break; case MotionNotify: if (QuerySet(status->from_x, status->from_y)) { if (QuerySet(status->to_x, status->to_y)) { if (!QueryInSquare(BW, event->xmotion.x, event->xmotion.y, status->to_x, status->to_y)) { if (status->draw) (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); status->to_x = InBitmapX(BW, event->xmotion.x); status->to_y = InBitmapY(BW, event->xmotion.y); if (status->draw) (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); } } else { status->to_x = InBitmapX(BW, event->xmotion.x); status->to_y = InBitmapY(BW, event->xmotion.y); if (status->draw) (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); } } break; } } void TwoPointsEngage(Widget w, BWStatus *status, XtPointer draw, int *state) { status->from_x = NotSet; status->from_y = NotSet; status->to_x = NotSet; status->to_y = NotSet; status->draw = draw; status->success = False; status->state = *state; XtAddEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, TwoPointsHandler, (XtPointer)status); } void TwoPointsTerminate(Widget w, BWStatus *status, XtPointer draw) { if (status->success && draw) { BWStoreToBuffer(w); (*(DrawTwoPointProc)draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); BWChangeNotify(w); BWSetChanged(w); } else if (QuerySet(status->from_x, status->from_y) && QuerySet(status->to_x, status->to_y)) if (status->draw) (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, TwoPointsHandler, (XtPointer)status); } void TwoPointsTerminateTransparent(Widget w, BWStatus *status, XtPointer draw) { if (status->success && draw) (*(DrawTwoPointProc)draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); else if (QuerySet(status->from_x, status->from_y) && QuerySet(status->to_x, status->to_y)) if (status->draw) (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, TwoPointsHandler, (XtPointer)status); } void TwoPointsTerminateTimed(Widget w, BWStatus *status, XtPointer draw) { if (status->success && draw) (*(DrawTwoPointProc)draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->btime); else if (QuerySet(status->from_x, status->from_y) && QuerySet(status->to_x, status->to_y)) if (status->draw) (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, TwoPointsHandler, (XtPointer)status); } /* ARGSUSED */ void Interface(Widget w, BWStatus *status, XtPointer action) { (*(InterfaceProc)action)(w); } void Paste(Widget w, Position at_x, Position at_y, int value) { BitmapWidget BW = (BitmapWidget) w; BWStatus *my_status; BWRequest request; my_status = (BWStatus *) BW->bitmap.request_stack[BW->bitmap.current].status; my_status->draw = NULL; request = (BWRequest) BW->bitmap.request_stack[BW->bitmap.current].request->terminate_client_data; BWTerminateRequest(w, FALSE); if ((at_x == max(BW->bitmap.mark.from_x, min(at_x, BW->bitmap.mark.to_x))) && (at_y == max(BW->bitmap.mark.from_y, min(at_y, BW->bitmap.mark.to_y)))) { BWStatus *status; if (DEBUG) fprintf(stderr, "Prepaste request: %s\n", request); BWEngageRequest(w, request, False, (char *)&(my_status->state), sizeof(int)); status = (BWStatus *) BW->bitmap.request_stack[BW->bitmap.current].status; status->at_x = at_x; status->at_y = at_y; status->value = value; (*(DrawOnePointProc)status->draw) (w, at_x, at_y, Highlight); } else { BWStatus *status; BWEngageRequest(w, MarkRequest, False, (char *)&(my_status->state), sizeof(int)); status = (BWStatus *) BW->bitmap.request_stack[BW->bitmap.current].status; status->from_x = status->to_x = at_x; status->from_y = status->to_y = at_y; status->value = value; (*(DrawTwoPointProc)status->draw) (w, at_x, at_y, at_x, at_y, Highlight); } } void DragTwoPointsHandler(Widget w, XtPointer client_data, XEvent *event, Boolean *cont) /* ARGSUSED */ { BitmapWidget BW = (BitmapWidget) w; BWStatus *status = (BWStatus *)client_data; if (DEBUG) fprintf(stderr, "D2PH "); switch (event->type) { case ButtonPress: if (event->xbutton.state != status->state) return; if (!QuerySet(status->from_x, status->from_y)) { BWStoreToBuffer(w); status->value = Value(BW, event->xbutton.button); status->btime = event->xbutton.time; status->from_x = InBitmapX(BW, event->xbutton.x); status->from_y = InBitmapY(BW, event->xbutton.y); status->to_x = InBitmapX(BW, event->xbutton.x); status->to_y = InBitmapY(BW, event->xbutton.y); status->success = status->draw ? True : False; if (status->draw) (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); } break; case ButtonRelease: if (QuerySet(status->from_x, status->from_y)) { status->value = Value(BW, event->xbutton.button); status->btime = event->xbutton.time; status->from_x = status->to_x; status->from_y = status->to_y; status->to_x = InBitmapX(BW, event->xbutton.x); status->to_y = InBitmapY(BW, event->xbutton.y); status->success = True; BWTerminateRequest(w, TRUE); } break; case MotionNotify: if (QuerySet(status->from_x, status->from_y)) { if (QuerySet(status->to_x, status->to_y)) { if (!QueryInSquare(BW, event->xmotion.x, event->xmotion.y, status->to_x, status->to_y)) { status->from_x = status->to_x; status->from_y = status->to_y; status->to_x = InBitmapX(BW, event->xmotion.x); status->to_y = InBitmapY(BW, event->xmotion.y); if (status->draw) (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); } } } break; } } void DragTwoPointsEngage(Widget w, BWStatus *status, XtPointer draw, int *state) { status->from_x = NotSet; status->from_y = NotSet; status->to_x = NotSet; status->to_y = NotSet; status->draw = draw; status->success = False; status->state = *state; XtAddEventHandler(w, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, FALSE, DragTwoPointsHandler, (XtPointer)status); } void DragTwoPointsTerminate(Widget w, BWStatus *status, XtPointer draw) { if (status->success && draw) { if ((status->from_x != status->to_x) || (status->from_y != status->to_y)) (*(DrawTwoPointProc)draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); BWChangeNotify(w); BWSetChanged(w); } XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, FALSE, DragTwoPointsHandler, (XtPointer)status); } /*****************************************************************************/ x11-apps-7.7+5+nmu1ubuntu1/bitmap/RotateLeft0000664000000000000000000000151212456374665015462 0ustar #define RotateLeft_width 30 #define RotateLeft_height 30 static char RotateLeft_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0xc0, 0x1d, 0x00, 0x00, 0xe0, 0x0e, 0x00, 0x00, 0x70, 0xff, 0x0f, 0x00, 0xb8, 0xfe, 0x1f, 0x00, 0x5c, 0x55, 0x35, 0x00, 0xae, 0xaa, 0x6a, 0x00, 0x5c, 0x55, 0xd5, 0x00, 0xb8, 0xfe, 0xff, 0x01, 0x70, 0xff, 0xff, 0x03, 0xe0, 0x0e, 0x58, 0x03, 0xc0, 0x1d, 0xb8, 0x03, 0x80, 0x3b, 0x58, 0x03, 0x00, 0x77, 0xb8, 0x03, 0x00, 0x6e, 0x58, 0x03, 0x00, 0x7c, 0xb8, 0x03, 0x00, 0x78, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x18, 0x03, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/bitmap/CutPaste.c0000664000000000000000000001210712456374665015364 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Davor Matic, MIT X Consortium */ #include #include #include #include "BitmapP.h" #include #include #define min(x, y) (((x) < (y)) ? (x) : (y)) #define max(x, y) (((x) > (y)) ? (x) : (y)) /***************************************************************************** * Cut and Paste * *****************************************************************************/ /* ARGSUSED */ static Boolean ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, XtPointer *val_ret, unsigned long *length, int *format) { XPointer *value = (XPointer *)val_ret; BitmapWidget BW = (BitmapWidget) w; Pixmap *pixmap; char *data; XImage *image; Dimension width, height; switch (*target) { /* XA_TARGETS undefined ?!? case XA_TARGETS: *type = XA_ATOM; *value = (XPointer) bitmapClassRec.bitmap_class.targets; *length = bitmapClassRec.bitmap_class.num_targets; *format = 32; return True; */ case XA_BITMAP: case XA_PIXMAP: if (BWQueryMarked(w)) { width = BW->bitmap.mark.to_x - BW->bitmap.mark.from_x + 1; height = BW->bitmap.mark.to_y - BW->bitmap.mark.from_y + 1; data = CreateCleanData(Length(width, height)); image = CreateBitmapImage(BW, data, width, height); CopyImageData(BW->bitmap.image, image, BW->bitmap.mark.from_x, BW->bitmap.mark.from_y, BW->bitmap.mark.to_x, BW->bitmap.mark.to_y, 0, 0); pixmap = (Pixmap *) XtMalloc(sizeof(Pixmap)); *pixmap = GetPixmap(BW, image); DestroyBitmapImage(&image); } else if (BWQueryStored(w)) { pixmap = (Pixmap *) XtMalloc(sizeof(Pixmap)); *pixmap = GetPixmap(BW, BW->bitmap.storage); } else return False; *type = XA_PIXMAP; *value = (XPointer) pixmap; *length = 1; *format = 32; return True; default: return False; } } /* ARGSUSED */ static void LoseSelection(Widget w, Atom selection) { BitmapWidget BW = (BitmapWidget) w; if (DEBUG) fprintf(stderr, "Lost Selection\n"); BW->bitmap.selection.own = False; BWUnmark(w); } /* ARGSUSED */ static void SelectionDone(Widget w, Atom *selection, Atom *target) { /* Done Automatically ?!? BitmapWidget BW = (BitmapWidget) w; if (*target != XA_TARGETS) XtFree(BW->bitmap.value); */ } void BWGrabSelection(Widget w, Time btime) { BitmapWidget BW = (BitmapWidget) w; BW->bitmap.selection.own = XtOwnSelection(w, XA_PRIMARY, btime, ConvertSelection, (XtLoseSelectionProc)LoseSelection, SelectionDone); if (DEBUG && BW->bitmap.selection.own) fprintf(stderr, "Own the selection\n"); } /* ARGSUSED */ static void SelectionCallback(Widget w, XtPointer cldat, Atom *selection, Atom *type, XtPointer val, unsigned long *length, int *format) { XPointer value = (XPointer)val; BitmapWidget BW = (BitmapWidget) w; Pixmap *pixmap; switch (*type) { case XA_BITMAP: case XA_PIXMAP: DestroyBitmapImage(&BW->bitmap.storage); pixmap = (Pixmap *) value; BW->bitmap.storage = GetImage(BW, *pixmap); XFree((char *)pixmap); break; default: XtWarning(" selection request failed. BitmapWidget"); break; } BW->bitmap.selection.limbo = FALSE; } void BWRequestSelection(Widget w, Time btime, Boolean wait) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.selection.own) BWStore(w); else { XtGetSelectionValue(w, XA_PRIMARY, XA_PIXMAP, SelectionCallback, NULL, btime); BW->bitmap.selection.limbo = TRUE; if (wait) while (BW->bitmap.selection.limbo) { XEvent event; XtNextEvent(&event); XtDispatchEvent(&event); } } } /* ARGSUSED */ /* Returns true if there is a transferable selection */ Boolean BWQuerySelection(Widget w, Time btime) { /* To be written. XA_TARGETS to be used. So far undefined ?!? */ return True; } /*****************************************************************************/ x11-apps-7.7+5+nmu1ubuntu1/bitmap/Excl0000664000000000000000000000206412456374665014307 0ustar #define Excl_width 40 #define Excl_height 32 static char Excl_bits[] = { 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x80, 0xc3, 0x01, 0x00, 0x00, 0xc0, 0x99, 0x03, 0x00, 0x00, 0xc0, 0x34, 0x03, 0x00, 0x00, 0xe0, 0x6a, 0x07, 0x00, 0x00, 0x70, 0x76, 0x0e, 0x00, 0x00, 0x70, 0x6a, 0x0e, 0x00, 0x00, 0x38, 0x76, 0x1c, 0x00, 0x00, 0x18, 0x6a, 0x18, 0x00, 0x00, 0x1c, 0x76, 0x38, 0x00, 0x00, 0x0e, 0x6a, 0x70, 0x00, 0x00, 0x06, 0x76, 0x60, 0x00, 0x00, 0x07, 0x6a, 0xe0, 0x00, 0x80, 0x03, 0x76, 0xc0, 0x01, 0x80, 0x03, 0x6a, 0xc0, 0x01, 0xc0, 0x01, 0x76, 0x80, 0x03, 0xc0, 0x00, 0x6a, 0x00, 0x03, 0xe0, 0x00, 0x34, 0x00, 0x07, 0x70, 0x00, 0x18, 0x00, 0x0e, 0x70, 0x00, 0x00, 0x00, 0x0e, 0x38, 0x00, 0x3c, 0x00, 0x1c, 0x1c, 0x00, 0x76, 0x00, 0x38, 0x1c, 0x00, 0x6a, 0x00, 0x38, 0x0e, 0x00, 0x76, 0x00, 0x70, 0x0e, 0x00, 0x3c, 0x00, 0x70, 0x1e, 0x00, 0x00, 0x00, 0x78, 0xfe, 0xff, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0xff, 0x3f}; x11-apps-7.7+5+nmu1ubuntu1/bitmap/compile0000755000000000000000000001624512656634574015053 0ustar #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/bitmap/app-defaults/0000775000000000000000000000000012520516423016032 5ustar x11-apps-7.7+5+nmu1ubuntu1/bitmap/app-defaults/Bitmap-color0000664000000000000000000000065712456374665020337 0ustar ! The App-defaults file for Bitmap on a color screen. #include "Bitmap" *background: medium blue *foreground: cyan *borderColor: plum *frame: deep sky blue *highlight: magenta *Command.background: purple *Toggle.background: purple *MenuButton.background: purple *Command.foreground: white *Toggle.foreground: white *MenuButton.foreground: white *status.foreground: green *Dialog.icon.foreground: pale green *bitmap.stippled: off x11-apps-7.7+5+nmu1ubuntu1/bitmap/app-defaults/Bitmap0000664000000000000000000001457512456374665017227 0ustar ! The App-defaults file for Bitmap. *TransientShell.allowShellResize: True *shapeStyle: oval *cursor: left_ptr *pane.orientation: horizontal *Form*top: ChainTop *Form*bottom: ChainTop *Form*left: ChainLeft *Form*right: ChainLeft *MenuButton.leftBitmap: menu12 *form*width: 120 *form*height: 15 *baseTranslations:#override\ Ctrlc: do-quit()\n\ q: do-quit()\n\ Ctrln: do-new()\n\ Ctrlf: do-load()\n\ Ctrli: do-insert()\n\ Ctrls: do-save()\n\ Ctrlw: do-save-as()\n\ Ctrlr: do-resize()\n\ Ctrlx: do-rescale()\n\ Ctrle: do-filename()\n\ Ctrlb: do-basename()\n\ Metai: switch-image()\n\ Metag: switch-grid()\n\ Metad: switch-dashed()\n\ Metaa: switch-axes()\n\ Metas: switch-stippled()\n\ Metap: switch-proportional()\n\ Metaz: switch-zoom()\n\ Metac: do-cut()\n\ Metaw: do-copy()\n\ Metay: do-paste() *Toggle.translations: : highlight(WhenUnset)\n\ : unhighlight()\n\ ,: set() notify() *MenuButton.translations:: highlight()\n\ : reset()\n\ Any: reset() fix-menu() PopupMenu() *Dialog*baseTranslations:#override\ Return: set-dialog-button(okay, yes, retry)\n\ Ctrlg: set-dialog-button(cancel, abort) *image*baseTranslations:#override\ ,: switch-image() *image*width: 0 *image*height: 0 *image*Label.internalWidth: 0 *image*Label.internalHeight: 0 *image*normalImage.foreground: white *image*normalImage.background: black *image*invertedImage.foreground: black *image*invertedImage.background: white *bitmap.cursor: tcross *bitmap.dashes: Dashes *bitmap.stipple: Stipple *bitmap.stippled: on *TransientShell.width: 300 *input*icon: Term *qsave*icon: Term *error*icon: Excl *Dialog.yes.label: Yes *Dialog.no.label: No *Dialog.okay.label: OK *Dialog.abort.label: Abort *Dialog.cancel.label: Cancel *Dialog.retry.label: Retry *MenuButton.width: 58 *SimpleMenu.width: 0 *SimpleMenu.height: 0 *SimpleMenu.cursor: hand2 *SimpleMenu.line.height: 0 *fileButton.label: File *fileButton.menuName: fileMenu *editButton.label: Edit *editButton.fromHoriz: fileButton *editButton.menuName: editMenu *formy.status*top: ChainTop *formy.status*bottom: ChainTop *formy.status*left: ChainLeft *formy.status*right: ChainRight *status.fromHoriz: editButton *status.borderWidth: 0 *SmeBSB.HorizontalMargins: 32 *fileMenu.new.label: New (Ctrl-N)... *fileMenu.load.label: Load (Ctrl-F)... *fileMenu.insert.label: Insert (Ctrl-I)... *fileMenu.save.label: Save (Ctrl-S) *fileMenu.saveAs.label: Save As (Ctrl-W)... *fileMenu.resize.label: Resize (Ctrl-R)... *fileMenu.rescale.label: Rescale (Ctrl-X)... *fileMenu.filename.label: Filename (Ctrl-E)... *fileMenu.basename.label: Basename (Ctrl-B)... *fileMenu.quit.label: Quit (Ctrl-C, Q) *editMenu.image.label: Image (Meta-I) *editMenu.grid.label: Grid (Meta-G) *editMenu.dashed.label: Dashed (Meta-D) *editMenu.axes.label: Axes (Meta-A) *editMenu.stippled.label: Stippled (Meta-S) *editMenu.proportional.label: Proportional (Meta-P) *editMenu.zoom.label: Zoom (Meta-Z) *editMenu.cut.label: Cut (Meta-C) *editMenu.copy.label: Copy (Meta-W) *editMenu.paste.label: Paste (Meta-Y, Ctrl-mb) *form.clear.label: Clear *form.set.fromVert: clear *form.set.label: Set *form.invert.fromVert: set *form.invert.label: Invert *form.mark.vertDistance: 10 *form.mark.fromVert: invert *form.mark.label: Mark *form.unmark.fromVert: mark *form.unmark.label: Unmark *form.copy.vertDistance: 10 *form.copy.fromVert: unmark *form.copy.radioGroup: mark *form.copy.label: Copy *form.move.fromVert: copy *form.move.radioGroup: copy *form.move.label: Move *form.flipHoriz.vertDistance: 10 *form.flipHoriz.width: 36 *form.flipHoriz.height: 36 *form.flipHoriz.fromVert: move *form.flipHoriz.bitmap: FlipHoriz *form.up.vertDistance: 10 *form.up.width: 36 *form.up.height: 36 *form.up.fromVert: move *form.up.fromHoriz: flipHoriz *form.up.bitmap: Up *form.flipVert.vertDistance: 10 *form.flipVert.width: 36 *form.flipVert.height: 36 *form.flipVert.fromVert: move *form.flipVert.fromHoriz: up *form.flipVert.bitmap: FlipVert *form.left.width: 36 *form.left.height: 36 *form.left.fromVert: flipHoriz *form.left.bitmap: Left *form.fold.width: 36 *form.fold.height: 36 *form.fold.fromVert: up *form.fold.fromHoriz: left *form.fold.bitmap: Fold *form.right.width: 36 *form.right.height: 36 *form.right.fromVert: flipVert *form.right.fromHoriz: fold *form.right.bitmap: Right *form.rotateLeft.width: 36 *form.rotateLeft.height: 36 *form.rotateLeft.fromVert: left *form.rotateLeft.bitmap: RotateLeft *form.down.width: 36 *form.down.height: 36 *form.down.fromVert: fold *form.down.fromHoriz: rotateLeft *form.down.bitmap: Down *form.rotateRight.width: 36 *form.rotateRight.height: 36 *form.rotateRight.fromVert: right *form.rotateRight.fromHoriz: down *form.rotateRight.bitmap: RotateRight *form.point.vertDistance: 10 *form.point.fromVert: rotateLeft *form.point.radioGroup: move *form.point.label: Point *form.curve.fromVert: point *form.curve.radioGroup: point *form.curve.label: Curve *form.line.fromVert: curve *form.line.radioGroup: curve *form.line.label: Line *form.rectangle.fromVert: line *form.rectangle.radioGroup: line *form.rectangle.label: Rectangle *form.filledRectangle.fromVert: rectangle *form.filledRectangle.radioGroup: rectangle *form.filledRectangle.label: Filled Rectangle *form.circle.fromVert: filledRectangle *form.circle.radioGroup: filledRectangle *form.circle.label: Circle *form.filledCircle.fromVert: circle *form.filledCircle.radioGroup: circle *form.filledCircle.label: Filled Circle *form.floodFill.fromVert: filledCircle *form.floodFill.radioGroup: filledCircle *form.floodFill.label: Flood Fill *form.setHotSpot.vertDistance: 10 *form.setHotSpot.fromVert: floodFill *form.setHotSpot.radioGroup: floodFill *form.setHotSpot.label: Set Hot Spot *form.clearHotSpot.fromVert: setHotSpot *form.clearHotSpot.label: Clear Hot Spot *form.undo.vertDistance: 10 *form.undo.fromVert: clearHotSpot *form.undo.label: Undo x11-apps-7.7+5+nmu1ubuntu1/bitmap/app-defaults/Bitmap-nocase0000664000000000000000000001467012456374665020471 0ustar ! ! ! The App-defaults file for Bitmap for use on file systems ! that are not case sensitive. *TransientShell.allowShellResize: True *shapeStyle: oval *cursor: left_ptr *pane.orientation: horizontal *Form*top: ChainTop *Form*bottom: ChainTop *Form*left: ChainLeft *Form*right: ChainLeft *MenuButton.leftBitmap: menu12 *form*width: 120 *form*height: 15 *baseTranslations:#override\ Ctrlc: do-quit()\n\ q: do-quit()\n\ Ctrln: do-new()\n\ Ctrlf: do-load()\n\ Ctrli: do-insert()\n\ Ctrls: do-save()\n\ Ctrlw: do-save-as()\n\ Ctrlr: do-resize()\n\ Ctrlx: do-rescale()\n\ Ctrle: do-filename()\n\ Ctrlb: do-basename()\n\ Metai: switch-image()\n\ Metag: switch-grid()\n\ Metad: switch-dashed()\n\ Metaa: switch-axes()\n\ Metas: switch-stippled()\n\ Metap: switch-proportional()\n\ Metaz: switch-zoom()\n\ Metac: do-cut()\n\ Metaw: do-copy()\n\ Metay: do-paste() *Toggle.translations: : highlight(WhenUnset)\n\ : unhighlight()\n\ ,: set() notify() *MenuButton.translations:: highlight()\n\ : reset()\n\ Any: reset() fix-menu() PopupMenu() *Dialog*baseTranslations:#override\ Return: set-dialog-button(okay, yes, retry)\n\ Ctrlg: set-dialog-button(cancel, abort) *image*baseTranslations:#override\ ,: switch-image() *image*width: 0 *image*height: 0 *image*Label.internalWidth: 0 *image*Label.internalHeight: 0 *image*normalImage.foreground: white *image*normalImage.background: black *image*invertedImage.foreground: black *image*invertedImage.background: white *bitmap.cursor: tcross *bitmap.dashes: Dashes *bitmap.stipple: Stippler *bitmap.stippled: on *TransientShell.width: 300 *input*icon: Term *qsave*icon: Term *error*icon: Excl *Dialog.yes.label: Yes *Dialog.no.label: No *Dialog.okay.label: OK *Dialog.abort.label: Abort *Dialog.cancel.label: Cancel *Dialog.retry.label: Retry *MenuButton.width: 58 *SimpleMenu.width: 0 *SimpleMenu.height: 0 *SimpleMenu.cursor: hand2 *SimpleMenu.line.height: 0 *fileButton.label: File *fileButton.menuName: fileMenu *editButton.label: Edit *editButton.fromHoriz: fileButton *editButton.menuName: editMenu *formy.status*top: ChainTop *formy.status*bottom: ChainTop *formy.status*left: ChainLeft *formy.status*right: ChainRight *status.fromHoriz: editButton *status.borderWidth: 0 *SmeBSB.HorizontalMargins: 32 *fileMenu.new.label: New (Ctrl-N)... *fileMenu.load.label: Load (Ctrl-F)... *fileMenu.insert.label: Insert (Ctrl-I)... *fileMenu.save.label: Save (Ctrl-S) *fileMenu.saveAs.label: Save As (Ctrl-W)... *fileMenu.resize.label: Resize (Ctrl-R)... *fileMenu.rescale.label: Rescale (Ctrl-X)... *fileMenu.filename.label: Filename (Ctrl-E)... *fileMenu.basename.label: Basename (Ctrl-B)... *fileMenu.quit.label: Quit (Ctrl-C, Q) *editMenu.image.label: Image (Meta-I) *editMenu.grid.label: Grid (Meta-G) *editMenu.dashed.label: Dashed (Meta-D) *editMenu.axes.label: Axes (Meta-A) *editMenu.stippled.label: Stippled (Meta-S) *editMenu.proportional.label: Proportional (Meta-P) *editMenu.zoom.label: Zoom (Meta-Z) *editMenu.cut.label: Cut (Meta-C) *editMenu.copy.label: Copy (Meta-W) *editMenu.paste.label: Paste (Meta-Y, Ctrl-mb) *form.clear.label: Clear *form.set.fromVert: clear *form.set.label: Set *form.invert.fromVert: set *form.invert.label: Invert *form.mark.vertDistance: 10 *form.mark.fromVert: invert *form.mark.label: Mark *form.unmark.fromVert: mark *form.unmark.label: Unmark *form.copy.vertDistance: 10 *form.copy.fromVert: unmark *form.copy.radioGroup: mark *form.copy.label: Copy *form.move.fromVert: copy *form.move.radioGroup: copy *form.move.label: Move *form.flipHoriz.vertDistance: 10 *form.flipHoriz.width: 36 *form.flipHoriz.height: 36 *form.flipHoriz.fromVert: move *form.flipHoriz.bitmap: FlipHoriz *form.up.vertDistance: 10 *form.up.width: 36 *form.up.height: 36 *form.up.fromVert: move *form.up.fromHoriz: flipHoriz *form.up.bitmap: Up *form.flipVert.vertDistance: 10 *form.flipVert.width: 36 *form.flipVert.height: 36 *form.flipVert.fromVert: move *form.flipVert.fromHoriz: up *form.flipVert.bitmap: FlipVert *form.left.width: 36 *form.left.height: 36 *form.left.fromVert: flipHoriz *form.left.bitmap: Left *form.fold.width: 36 *form.fold.height: 36 *form.fold.fromVert: up *form.fold.fromHoriz: left *form.fold.bitmap: Fold *form.right.width: 36 *form.right.height: 36 *form.right.fromVert: flipVert *form.right.fromHoriz: fold *form.right.bitmap: Right *form.rotateLeft.width: 36 *form.rotateLeft.height: 36 *form.rotateLeft.fromVert: left *form.rotateLeft.bitmap: RotateLeft *form.down.width: 36 *form.down.height: 36 *form.down.fromVert: fold *form.down.fromHoriz: rotateLeft *form.down.bitmap: Down *form.rotateRight.width: 36 *form.rotateRight.height: 36 *form.rotateRight.fromVert: right *form.rotateRight.fromHoriz: down *form.rotateRight.bitmap: RotateRight *form.point.vertDistance: 10 *form.point.fromVert: rotateLeft *form.point.radioGroup: move *form.point.label: Point *form.curve.fromVert: point *form.curve.radioGroup: point *form.curve.label: Curve *form.line.fromVert: curve *form.line.radioGroup: curve *form.line.label: Line *form.rectangle.fromVert: line *form.rectangle.radioGroup: line *form.rectangle.label: Rectangle *form.filledRectangle.fromVert: rectangle *form.filledRectangle.radioGroup: rectangle *form.filledRectangle.label: Filled Rectangle *form.circle.fromVert: filledRectangle *form.circle.radioGroup: filledRectangle *form.circle.label: Circle *form.filledCircle.fromVert: circle *form.filledCircle.radioGroup: circle *form.filledCircle.label: Filled Circle *form.floodFill.fromVert: filledCircle *form.floodFill.radioGroup: filledCircle *form.floodFill.label: Flood Fill *form.setHotSpot.vertDistance: 10 *form.setHotSpot.fromVert: floodFill *form.setHotSpot.radioGroup: floodFill *form.setHotSpot.label: Set Hot Spot *form.clearHotSpot.fromVert: setHotSpot *form.clearHotSpot.label: Clear Hot Spot *form.undo.vertDistance: 10 *form.undo.fromVert: clearHotSpot *form.undo.label: Undo x11-apps-7.7+5+nmu1ubuntu1/bitmap/ChangeLog0000664000000000000000000010424512456374754015246 0ustar commit 2f5eae70cd2e9c1e09dcbd8a2a58eaf58207fe00 Author: Alan Coopersmith Date: Fri Jan 16 21:57:03 2015 -0800 bitmap 1.0.8 Signed-off-by: Alan Coopersmith commit dacae58710f7033d5295c50cf6262783350e938d Author: Alan Coopersmith Date: Mon Dec 29 18:28:00 2014 -0800 Stop memory leak in XmuWriteBitmapDataToFile() StripFilename() allocates a new string for its result, so after we're done with it, free it instead of just losing the pointer to it. Fixes errors found by Oracle Parfait 1.5.1 bug checking tool: Error: Memory leak (CWE 401) Memory leak of pointer basename allocated with StripFilename(filename) at line 712 of Bitmap.c in function 'XmuWriteBitmapDataToFile'. basename allocated at line 691 with StripFilename(filename). basename leaks when i >= data_length at line 702. Error: Memory leak (CWE 401) Memory leak of pointer basename allocated with StripFilename(filename) at line 715 of Bitmap.c in function 'XmuWriteBitmapDataToFile'. basename allocated at line 691 with StripFilename(filename). Signed-off-by: Alan Coopersmith commit 8df1a843a3a9f92399113688a350873a141bf995 Author: Alan Coopersmith Date: Mon Dec 29 18:15:57 2014 -0800 Stop memory leaks from XtNewString(StripFilename(filename)) StripFilename() already allocates a new string for its result, we don't need to duplicate it and then lose the pointer to the first one. Fixes errors found by Oracle Parfait 1.5.1 bug checking tool: Error: Memory leak (CWE 401) Memory leak of pointer pointer allocated with StripFilename(filename) at line 1119 of Bitmap.c in function 'BWReadFile'. pointer allocated at line 1106 with StripFilename(filename). pointer leaks when StripFilename(filename) != NULL at line 1106. Error: Memory leak (CWE 401) Memory leak of pointer pointer allocated with StripFilename(filename) at line 1119 of Bitmap.c in function 'BWReadFile'. pointer allocated at line 1106 with StripFilename(filename). Error: Memory leak (CWE 401) Memory leak of pointer pointer allocated with StripFilename(filename) at line 1222 of Bitmap.c in function 'BWWriteFile'. pointer allocated at line 1202 with StripFilename(filename). pointer leaks when StripFilename(filename) != NULL at line 1202. Error: Memory leak (CWE 401) Memory leak of pointer pointer allocated with StripFilename(filename) at line 1222 of Bitmap.c in function 'BWWriteFile'. pointer allocated at line 1202 with StripFilename(filename). Signed-off-by: Alan Coopersmith commit a0db0f6c7996b282aa9027d3b670597d88fe3353 Author: Alan Coopersmith Date: Sun Jun 1 21:03:14 2014 -0700 autogen.sh: Honor NOCONFIGURE=1 See http://people.gnome.org/~walters/docs/build-api.txt Signed-off-by: Alan Coopersmith commit 8fb1efccb5f24eab51cefafedb1a5a60217db35f Author: Alan Coopersmith Date: Sun Jun 1 21:03:13 2014 -0700 configure: Drop AM_MAINTAINER_MODE Signed-off-by: Alan Coopersmith commit d0911d130b870da0951b56f5103c6b4dfb9eeb28 Author: Jeremy Huddleston Sequoia Date: Wed Jan 1 23:02:48 2014 -0800 Use '& 7' instead '% 8' to silence clang analyzer warning Graphics.c:569:10: warning: The result of the '<<' expression is undefined while (!QueryFlood(BW, x, y, value) && (x < x_right)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~ Graphics.c:470:7: note: expanded from macro 'QueryFlood' ((GetBit(BW->bitmap.image, x, y) !=\ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Graphics.c:66:9: note: expanded from macro 'GetBit' (1 << ((x) % 8))) ? 1 : 0)) ~~^~~~~~~~~~~~ Signed-off-by: Jeremy Huddleston Sequoia commit e3fe79502a4a1b0f0b148659948d541ce26ed7bf Author: Jeremy Huddleston Sequoia Date: Wed Jan 1 22:58:23 2014 -0800 Demacro modernization of NewSList to plug a memory leak during error handling atobm.c:248:6: warning: Potential leak of memory pointed to by 'slist' NewSList (); ^~~~~~~~~~~ atobm.c:209:3: note: expanded from macro 'NewSList' fprintf (stderr, "%s: unable to allocate char array\n", \ ^~~~~~~ atobm.c:259:6: warning: Potential leak of memory pointed to by 'old' NewSList (); ^~~~~~~~~~~ atobm.c:209:3: note: expanded from macro 'NewSList' fprintf (stderr, "%s: unable to allocate char array\n", \ ^~~~~~~ atobm.c:259:6: warning: Potential leak of memory pointed to by 'slist' NewSList (); ^~~~~~~~~~~ atobm.c:209:3: note: expanded from macro 'NewSList' fprintf (stderr, "%s: unable to allocate char array\n", \ ^~~~~~~ 3 warnings generated. Signed-off-by: Jeremy Huddleston Sequoia commit a59538d5d57bd2f8b2101e398a97fe8466b8eef7 Author: Jeremy Huddleston Sequoia Date: Wed Jan 1 22:43:26 2014 -0800 Silence -Wbad-function-cast Signed-off-by: Jeremy Huddleston Sequoia commit e7086abb4576a777a4b0aff8553047077cdd08ce Author: Jeremy Huddleston Sequoia Date: Wed Jan 1 22:29:45 2014 -0800 Avoid shadow declarations Bitmap.c:906:17: warning: declaration shadows a local variable [-Wshadow] unsigned char *image_data; ^ Bitmap.c:799:11: note: previous declaration is here char *image_data, *buffer_data; ^ Bitmap.c:907:8: warning: declaration shadows a local variable [-Wshadow] char *buffer_data; ^ Bitmap.c:799:24: note: previous declaration is here char *image_data, *buffer_data; ^ Signed-off-by: Jeremy Huddleston Sequoia commit 1e236565459d10c7ad85ebed285d2acfc4b15b69 Author: Jeremy Huddleston Sequoia Date: Wed Jan 1 22:27:36 2014 -0800 assert to avoid a NULL dereference Bitmap.c:1246:8: warning: Dereference of null pointer **str = '\0'; ~~~~~~^~~~~~ 1 warning generated. Signed-off-by: Jeremy Huddleston Sequoia commit 15d326027827c168511f923e72c64e2131515e19 Author: Alan Coopersmith Date: Mon Nov 4 23:14:22 2013 -0800 Print which option was in error along with usage message Signed-off-by: Alan Coopersmith Reviewed-by: Gaetan Nadon commit 64bc2b97d408d6fea16716e37f7b5ff1661d57fd Author: Gaetan Nadon Date: Fri Oct 25 21:51:37 2013 -0400 config: replace deprecated use of AC_OUTPUT with AC_CONFIG_FILES Fix Automake warning: AC_OUTPUT should be used without arguments. www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Files Signed-off-by: Gaetan Nadon commit a78fc882fac9a3334a77744be4c617b51997a5bb Author: Eric S. Raymond Date: Thu Jun 6 14:24:08 2013 -0400 Use table markup in preference to various low-level constructions. commit 10584a7e5f476c5adb5ec6de9f0b519380abd6df Author: Alan Coopersmith Date: Fri May 17 21:12:44 2013 -0700 bitmap 1.0.7 Signed-off-by: Alan Coopersmith commit d028190d036f25472dba587863322a8fe03dda95 Author: Alan Coopersmith Date: Sun Apr 21 15:02:52 2013 -0700 Mark usage() functions as noreturn, as suggested by gcc Signed-off-by: Alan Coopersmith commit f36566239cc9119882a36273c3eefb90962d6ee5 Author: Alan Coopersmith Date: Sun Apr 21 14:52:01 2013 -0700 Simplify & unify error path between mktemp & mkstemp versions This also now catches errors when fopen() or fdopen() fail, before we try to fwrite() to a null FILE pointer. Signed-off-by: Alan Coopersmith commit 249695649bb25f500d1525f655ca317428ea6044 Author: Alan Coopersmith Date: Sun Apr 21 14:46:24 2013 -0700 Fix genererate typo in bmtoa error messages Signed-off-by: Alan Coopersmith commit 7b5ba88d06ca88e11a8127d12f3d7685a473684e Author: Alan Coopersmith Date: Sun Jan 20 23:16:46 2013 -0800 Combine usage messages into a single string Signed-off-by: Alan Coopersmith commit 0d42abaefc427f7c354f4cff3d098775df5c9cb4 Author: Bjarni Ingi Gislason Date: Sat Sep 22 19:46:01 2012 -0400 bitmap.man: Fix some typos. Remove stray backslash. (Added sometime between X11R4 and X11R5; 21+ years old.) Use two spaces between sentences, not one or two or three. Signed-off-by: Bjarni Ingi Gislason Signed-off-by: James Cloos commit 53d99608451ade88d59d8baae6fc543d6922fb0a Author: Alan Coopersmith Date: Tue May 29 23:22:35 2012 -0700 Fix pixmap leak in error paths of BWGetUnzoomedPixmap Found by Parfait 0.5.0.1 bug checking tool: Leaked X Resource pix at line 393 of Bitmap.c in function 'BWGetUnzoomedPixmap'. pix initialized at line 388 with XCreatePixmap(...). at line 414 of Bitmap.c in function 'BWGetUnzoomedPixmap'. pix initialized at line 409 with XCreatePixmap(...). Signed-off-by: Alan Coopersmith commit a7909448b89f42ad0bb4834e347e6d3ecb20d7da Author: Alan Coopersmith Date: Thu Mar 8 21:40:10 2012 -0800 bitmap 1.0.6 Signed-off-by: Alan Coopersmith commit 67ab447959b62454f4e0273177baa19711babb96 Author: Alan Coopersmith Date: Tue Dec 20 21:47:56 2011 -0800 Use lrint() from math library if available Moves -lm from being hardcoded in Makefile.am to being added via AC_SEARCH_LIBS in configure.ac setting it in $(MATH_LIBS) Using lrint() [returns long int] instead of rint() [returns double] clears a bunch of gcc warnings of the form: "cast from function call of type ‘double’ to non-matching type ‘short int’" Signed-off-by: Alan Coopersmith commit 1c2b70d13c42f5461a2d7c3cae7adf8d9b2e3cea Author: Alan Coopersmith Date: Fri Oct 14 22:48:31 2011 -0700 Constify strings in atobm Signed-off-by: Alan Coopersmith commit 3fc1a649f1e81c4d93c6e00119267208877a8f02 Author: Alan Coopersmith Date: Fri Oct 14 22:38:44 2011 -0700 Constify strings in bmtoa Signed-off-by: Alan Coopersmith commit a8ee8e937e8d939522f18fa5723afea084221467 Author: Alan Coopersmith Date: Fri Oct 14 21:25:06 2011 -0700 Strip trailing whitespace Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' git diff -w & git diff -b show no diffs from this change Signed-off-by: Alan Coopersmith commit 64eacd3665306283d126d0df7cf63a071e576c38 Author: Alan Coopersmith Date: Fri Oct 14 21:22:26 2011 -0700 Constify filename string handling Signed-off-by: Alan Coopersmith commit ca7bf97b6e83b25e7142b321e5f2325b1e47c2d0 Author: Alan Coopersmith Date: Fri Oct 14 21:03:48 2011 -0700 Add const to char * in BWRequest typedef Fixes many gcc --Wwrite-string warnings of the form: Bitmap.c: In function ‘BWTPaste’: Bitmap.c:1913:7: warning: passing argument 2 of ‘BWEngageRequest’ discards qualifiers from pointer target type Bitmap.h:190:16: note: expected ‘BWRequest’ but argument is of type ‘const char *’ Signed-off-by: Alan Coopersmith commit 6e997556a17a1b4a9d6773602af770b9e9f3751e Author: Gaetan Nadon Date: Fri Mar 4 20:44:37 2011 -0500 man: use correct section number when referring to X Signed-off-by: Gaetan Nadon commit 98e43d4e49c599fc633b4bb9c58d99abbdd0068a Author: Alan Coopersmith Date: Thu Feb 17 23:38:40 2011 -0800 atobm only depends on xproto, not x11 It only includes , no headers or functions from libX11. Due to a typo in Makefile.am (also fixed) it wasn't actually linking with libX11 even though it had x11 in its PKG_CHECK_MODULES list. Signed-off-by: Alan Coopersmith commit b3f10a08922f568b7cbc791354cf0d4267cd88c1 Author: Alan Coopersmith Date: Sat Jan 15 10:19:20 2011 -0800 Use autoconf standard HAVE_MKSTEMP define instead of old imake HAS_MKSTEMP Signed-off-by: Alan Coopersmith commit ff81a4e4e894915bb6b8aece8314ca1a854140a4 Author: Alan Coopersmith Date: Sat Jan 15 10:16:17 2011 -0800 config: Add missing AC_CONFIG_SRCDIR Regroup AC statements under the Autoconf initialization section. Regroup AM statements under the Automake initialization section. Signed-off-by: Alan Coopersmith commit 2afe9a69417cbd25fc5379faf22eba1a8e94b348 Author: Alan Coopersmith Date: Fri Jan 14 14:05:14 2011 -0800 Use fputs instead of fprintf with no format arg to print usage message. Clear gcc warning of: BitEdit.c:986: warning: format not a string literal and no format arguments Signed-off-by: Alan Coopersmith Reviewed-by: Dirk Wallenstein commit fcfa5f0dee6549994d8c4640fb61612d33369e74 Author: Alan Coopersmith Date: Fri Jan 14 14:00:30 2011 -0800 Call snprintf() directly instead of XmuSnprintf() All platforms still supported by X.Org have long had snprintf() Signed-off-by: Alan Coopersmith commit e3ecaf24ea4187516a1a0679783278e34e56499f Author: Trevor Woerner Date: Sat Jan 8 20:15:50 2011 -0500 Remove unused, leaky scanline. The pointer, scanline, doesn't appear to be used anymore, and is leaking memory. Signed-off-by: Trevor Woerner Reviewed-by: Adam Jackson Signed-off-by: Alan Coopersmith commit f705edec1b9aa80d3b93f587048ad33887aca5b6 Author: Gaetan Nadon Date: Wed Jan 12 16:28:01 2011 -0500 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS This silences an Autoconf warning commit 0a2eef9a48863dde8b3c7f60f5eb3b9a667fa505 Author: Gaetan Nadon Date: Wed Jan 12 15:29:49 2011 -0500 config: replace deprecated AC_HELP_STRING with AS_HELP_STRING This silences an Automake warning. Signed-off-by: Gaetan Nadon commit 38f9d56ce050baabc72254240df875a3450f798e Author: Gaetan Nadon Date: Wed Jan 12 13:10:21 2011 -0500 config: remove AC_PROG_CC as it overrides AC_PROG_C_C99 XORG_STRICT_OPTION from XORG_DEFAULT_OPTIONS calls AC_PROG_C_C99. This sets gcc with -std=gnu99. If AC_PROG_CC macro is called afterwards, it resets CC to gcc. Signed-off-by: Gaetan Nadon commit 2fee85a59998a805ca8161606c5c32953f02f659 Author: Gaetan Nadon Date: Wed Jan 12 11:54:40 2011 -0500 config: use AC_PROG_INSTALL now supplied by XORG_DEFAULT_OPTIONS It depends on util-macros 1.8 or later The existing statement can now be removed from the configuration file. Signed-off-by: Gaetan Nadon commit 99be515efe95cb3eb4bcb29b2bc194f416b31758 Author: Alan Coopersmith Date: Thu Oct 7 20:04:23 2010 -0700 bitmap 1.0.5 Signed-off-by: Alan Coopersmith commit de28fe485f07bb9f5a326fb9fed87a3aa8a8f1b5 Author: Gaetan Nadon Date: Tue Jul 20 18:45:18 2010 -0400 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon commit 824fa229593040c2d8a795dadc359aa313fd182d Author: Gaetan Nadon Date: Mon Aug 9 20:26:12 2010 -0400 Remove unused file bitmap.icon The file originally came with the the rest of the source in 2003 Two years later it was added to EXTRA_DIST without explanantion It has never been installed and is not present in Debian distro It's not used during configuration and not used by the build. Reviewed-by: Alan Coopersmith Signed-off-by: Gaetan Nadon commit 3216eaa1b5bbb7ce5038caf9fbf22ae248eba1b6 Author: Gaetan Nadon Date: Mon Aug 9 17:37:04 2010 -0400 man: remove whitespace as per git diff --check Reviewed-by: Alan Coopersmith Signed-off-by: Gaetan Nadon commit 18cf79ac73c59829603cd56a04ab3b79a4a6a3c3 Author: Gaetan Nadon Date: Mon Aug 9 17:24:30 2010 -0400 make: reshuffle lines and shorten the makefile The previous patch did some aesthetic damage to it. Reviewed-by: Alan Coopersmith Signed-off-by: Gaetan Nadon commit 7c55725e4eaf2296d4ea047a155d0ec7bc4976fd Author: Gaetan Nadon Date: Mon Aug 9 16:30:19 2010 -0400 config: simplify building of shadow man pages Store the shadow files in git as any other man page. Move man pages to man dir and use the common makefile Local fix for bug 5628 in commit d8f719a352cd4d4ace60566b73a077175940a351 is not required as the problem has been fixed in util-macros d9062e4077ebfd0985baf8418f3d0f111b9ddbba Reviewed-by: Alan Coopersmith Signed-off-by: Gaetan Nadon commit 85b1eda6ac104850add5a98fc4caca7f59d7cb19 Author: Gaetan Nadon Date: Sun Aug 8 10:15:51 2010 -0400 config: merge BITMAP dependencies into one statement PKG_CHECK_MODULES will merge -I and lib directives. It will also AC_SUBST BITMAP_CFLAGS and BITMAP_LIBS Signed-off-by: Gaetan Nadon commit d4de9e32fd109562a31609b338843b396c848995 Author: Alan Coopersmith Date: Thu Jul 1 16:05:01 2010 -0700 bitmap calls Xmu functions directly so should include in PKG_CHECK_MODULES Signed-off-by: Alan Coopersmith commit 5eb2fe08c0210ae110ae75ac52ed6a8db298c178 Author: Alan Coopersmith Date: Wed Jun 30 23:25:03 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS The existing statement can now be removed from the configuration file. Use automake provided $(AM_V_GEN) and XORG_DEFAULT_OPTIONS provided $(SED) Enables silent rule and use platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit 8aa8f77d4570a0a5030ec825bc8785ac03079267 Author: Gaetan Nadon Date: Sat Dec 19 20:48:47 2009 -0500 configure.ac: use backticks rather than $() for cmd subs Use "$PKG_CONFIG" rather than hard coded "pkg-config" Signed-off-by: Gaetan Nadon commit 5fae54a562f9dcb4b9c5e5a21c604e9a2ef924b7 Author: Gaetan Nadon Date: Thu Nov 26 09:19:52 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit 7077c21c0803ac7ff56edba75bfa4e18949e0ae7 Author: Gaetan Nadon Date: Wed Oct 28 14:09:07 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit dbbb35c25e8e0159b09a6756a143ac43720fe41a Author: Gaetan Nadon Date: Tue Oct 27 15:07:24 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit b14f17671753e5c9c393fd1e972da93d8d94a366 Author: Gaetan Nadon Date: Mon Oct 26 22:08:37 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit 8218cc8ac7e6763c068ad0cbae81c07de899ca62 Author: Gaetan Nadon Date: Thu Oct 22 12:34:14 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit 05b524c70ec06d18ca1d305c98bcd480e2482eb2 Author: Gaetan Nadon Date: Sun Sep 27 16:09:14 2009 -0400 Makefile.am: do not include autogen.sh in distribution #24183 This is a private build script that should not be distributed commit 7c4c903a1612528e09858554c6fdaab05d2ba095 Author: Alan Coopersmith Date: Tue Sep 22 19:49:57 2009 -0700 bitmap 1.0.4 Signed-off-by: Alan Coopersmith commit 4abbf05633f16cae587f9f24881d18c22e43800d Author: Alan Coopersmith Date: Tue Sep 22 19:39:08 2009 -0700 Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS Signed-off-by: Alan Coopersmith commit fb4778c1a6a114df03f3cefc87e747fab983355f Author: Alan Coopersmith Date: Tue Sep 22 19:30:35 2009 -0700 Strip RCS/CVS ids Signed-off-by: Alan Coopersmith commit 948a119b19bf2e1822c63c2e6e86482e36df0cc0 Author: Alan Coopersmith Date: Tue Sep 22 19:25:04 2009 -0700 Fill in COPYING, README, & AUTHORS Signed-off-by: Alan Coopersmith commit 8337c277db59b5fb8e13428ab65a43725546bcdb Author: Paulo Cesar Pereira de Andrade Date: Tue Jan 13 14:29:53 2009 -0200 Rename app-defaults files to match "pattern" used on other applications. commit e23fbaa033e064efc7fcfa6ec49901c241736340 Author: Paulo Cesar Pereira de Andrade Date: Mon Jan 12 16:11:00 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, and corrects make distcheck. commit 7527b67979d61609bff5bc8c54d2b11874a7bbfa Author: James Cloos Date: Wed Aug 20 10:32:48 2008 -0400 xaw8 is gone, use xaw7 commit 3dc6744ae0332efc9c4a621401c1257e4d4c3c6d Author: Julien Cristau Date: Fri May 16 14:22:16 2008 +0200 $(builddir) is the current directory Apparently automake doesn't always export the builddir variable. This fixes my previous commit. commit 3154399310460759466d66cb17e723548e205776 Author: Julien Cristau Date: Sun Apr 20 19:25:40 2008 +0200 Fix build with builddir != srcdir commit 5d6bff83b62c3c9626503b36d2e5190a602bf43b Author: Julien Cristau Date: Sun Apr 20 19:22:40 2008 +0200 Fix typo in bitmap.man commit 8003d22d2c12fe47d1fc06216c60dc813ed39f98 Author: Jeremy Huddleston Date: Thu Mar 27 19:22:22 2008 -0700 Build fix for case-insensitive file systems commit 088006f9bb62db2523117dac568d028bd96db488 Author: James Cloos Date: Thu Dec 6 15:51:03 2007 -0500 Add missing PHONY line for automatic ChangeLog generation commit d79bd0857961669aff4c155f4c3205af4c89b18e Author: Alan Coopersmith Date: Fri Aug 10 15:47:13 2007 -0700 Add AM_PROG_CC_C_O to configure.ac to make automake-1.10 happier Makefile.am:53: compiling `atobm.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.ac' commit 0fa2f5aa4b0e62ceb4685123182bf018c27e293a Author: Alan Coopersmith Date: Tue Jan 23 13:42:25 2007 -0800 Version bump: 1.0.3 commit 4d02bf25b4e64d0a3fb2270491d3dbe4fc18effc Author: Alan Coopersmith Date: Tue Jan 23 13:42:01 2007 -0800 Replace static changelog with dist-hook to generate from git log commit 2c5045d72ee4120c52cfc7e008237a438a1c2d30 Author: Alan Coopersmith Date: Mon Jan 22 19:45:08 2007 -0800 Remove on/off form of options from bitmap.man man page Turns out the previous formatting error that hid these was an attempt to comment them out since they aren't implemented, so we'll just delete them. commit 5c1c01c8222eac13e9a65a36d3b953ae6f75ae6b Author: Alan Coopersmith Date: Tue Jan 2 14:37:42 2007 -0800 renamed: .cvsignore -> .gitignore commit ad55b1108f61ae0e3643bdffe430c71973d3d7ae Author: Eric S. Raymond Date: Tue Jan 2 14:34:17 2007 -0800 Bug 9511: Garbled macro invocation in bitmap.1x manual page. commit 3537d2121dcc68e3ecb93eaa2b341d759b0fbc88 Author: Adam Jackson Date: Fri May 12 16:19:54 2006 +0000 Bump to 1.0.2 commit d8f719a352cd4d4ace60566b73a077175940a351 Author: Kevin E Martin Date: Tue May 9 21:55:08 2006 +0000 Bug #5628 Shadow pages not created correctly when MANDIR & MANSUFFIX don't match. commit 545a878fa367a32059b33a21b9253a69ed95ccf6 Author: Kevin E Martin Date: Wed Dec 21 02:29:42 2005 +0000 Update package version for X11R7 release. commit 038d4cc67674fcecd638489625cedfdc57f4bcea Author: Adam Jackson Date: Mon Dec 19 16:22:39 2005 +0000 Stub COPYING files commit ab8a9596b7c9729914b1444208521e939f35535f Author: Kevin E Martin Date: Thu Dec 15 00:24:01 2005 +0000 Update package version number for final X11R7 release candidate. commit d1ae6091d49c8af843e6895cb438225078a0f797 Author: Kevin E Martin Date: Wed Dec 7 16:17:58 2005 +0000 Change to use the app-defaults default dir configured in libXt. commit 07cfe6f6de483aefcc18836fd3f03bdc5d6cd823 Author: Kevin E Martin Date: Tue Dec 6 22:48:16 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit f0e1e5f67882635777fa9a25496265a661c40a02 Author: Kevin E Martin Date: Sat Dec 3 05:49:15 2005 +0000 Update package version number for X11R7 RC3 release. commit d1dac2d6d7470212e3b2366702923a03950b9834 Author: Alan Coopersmith Date: Mon Nov 28 22:01:36 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit c361bb94796e409437ac71714c9a3746da0136dc Author: Eric Anholt Date: Mon Nov 21 10:34:55 2005 +0000 Another pass at .cvsignores for apps. commit eb1544cfc467a48074e11118a85fec3b4980460d Author: Eric Anholt Date: Sun Nov 20 22:08:47 2005 +0000 Add/improve .cvsignore files for apps. commit 0909ff9192c30720ce6a82043d10b4f7ce6fab83 Author: Kevin E Martin Date: Wed Oct 19 02:47:47 2005 +0000 Update package version number for RC1 release. commit 905ded4a3825727326ccacd48a76ca221ff59a81 Author: Alan Coopersmith Date: Tue Oct 18 00:32:54 2005 +0000 Change default install dir for app-default files from $(sysconfdir)/X11/app-defaults to $(libdir)/X11/app-defaults to match the monolith & allow localization commit fde7c43f092eba195a4a93391d9518f321ec9e40 Author: Alan Coopersmith Date: Mon Oct 17 23:56:19 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 0dbcf2d9436b3860ed33563e0f2daf0b2bc78dd9 Author: Alan Coopersmith Date: Mon Oct 17 21:13:15 2005 +0000 Rename .shadows.DONE to shadows.DONE to avoid some make's thinking it's a suffix rule (reported by Matthieu Herrb) commit 00b3817d8c24dd400ff870bb02bc1c6ba2db1f05 Author: Alan Coopersmith Date: Fri Oct 14 01:12:07 2005 +0000 Add shadow man pages for atobm and bmtoa. commit ba5f0c8d40af187191bcda8c8e72b3e554f3c50a Author: Alan Coopersmith Date: Fri Oct 14 00:25:41 2005 +0000 Use sed to fill in variables in man page commit 358ae071207882e6202bfaa4c0dd341f7239c307 Author: Kevin E Martin Date: Tue Oct 4 23:15:11 2005 +0000 Add bitmap.icon to EXTRA_DIST commit c3f282e1aa6176896089ea79be84b7250888a65c Author: Kristian Høgsberg Date: Thu Sep 29 18:22:01 2005 +0000 Add Bitmap-nocase app default file to APPDEFAULTFILES. commit 53c51b2407108d9bcdca53c4d3757449465b3417 Author: Alan Coopersmith Date: Mon Aug 1 20:25:27 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit 5135ddd5eb135237ea780d7e8c4a4074557ac23c Author: Kevin E Martin Date: Fri Jul 29 21:22:28 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit 6df7e0644c9f0ce2f306331910d8adf903610c1a Author: Alan Coopersmith Date: Tue Jul 26 15:44:01 2005 +0000 Replace more GNU make-ism's with more portable macros commit 55c2178d52dd695a31676bb7b48c1d19b3c77152 Author: Alan Coopersmith Date: Sat Jul 16 22:07:12 2005 +0000 Add #ifdef HAVE_CONFIG_H/#include "config.h" to files that need it to get HAS_MKSTEMP defined in modular builds. commit 40fc1a66cc817dad40851d61011e0a90fa48fe46 Author: Alan Coopersmith Date: Sat Jul 16 22:00:11 2005 +0000 Convert more app-defaults rules to work with non-GNU make commit 1bef5390ae91148e61c613235e7db3729d7e8781 Author: Alan Coopersmith Date: Sat Jul 16 21:59:14 2005 +0000 Define HAS_MKSTEMP if mkstemp() is present (needed for improved protection against tempfile race conditions in many places) commit cc48a5df41c59071eab0f58818366e10cb1ff4ac Author: Søren Sandmann Pedersen Date: Fri Jul 15 16:52:07 2005 +0000 Add dependency on xbitmaps commit c6129c090ad25cd2f8b191f503ac6e8cd452a31d Author: Søren Sandmann Pedersen Date: Wed Jul 6 15:47:38 2005 +0000 Build system for bitmap commit 9b6257bdb5461131e42a3d81330c76d7a2bc670a Author: Egbert Eich Date: Fri Apr 23 19:54:31 2004 +0000 Merging XORG-CURRENT into trunk commit 5285b60deac481a96007a45bad4da61e8ead2552 Author: Egbert Eich Date: Sun Mar 14 08:34:49 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit 9f0d53b85896e1c67f770b45edc0dfa5373110c0 Author: Egbert Eich Date: Wed Mar 3 12:12:50 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit 632e06aaad484b25e1c1931a8eb579679372d416 Author: Egbert Eich Date: Thu Feb 26 13:36:15 2004 +0000 readding XFree86's cvs IDs commit c83dc161b34afe817ed47abacbf5bad132c73888 Author: Egbert Eich Date: Thu Feb 26 09:23:53 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit a9a10f80d2b5d444c38eb54e99a6bccb07e0cbd6 Author: Kaleb Keithley Date: Tue Nov 25 19:29:01 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit 5b64274abaf585d108e65cb1dae497e74cad856e Author: Kaleb Keithley Date: Fri Nov 14 16:48:57 2003 +0000 XFree86 4.3.0.1 commit 0bd1f9d8ccaf46397745779f5964f3b843186896 Author: Kaleb Keithley Date: Fri Nov 14 16:48:57 2003 +0000 Initial revision commit 9711ac0a780f686806c135045d2db9b99fbe923f Author: Kaleb Keithley Date: Fri Nov 14 15:54:52 2003 +0000 R6.6 is the Xorg base-line x11-apps-7.7+5+nmu1ubuntu1/bitmap/depcomp0000755000000000000000000005601612656634574015052 0ustar #! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/bitmap/Left0000664000000000000000000000147012456374665014306 0ustar #define Left_width 30 #define Left_height 30 static char Left_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0xc0, 0x1d, 0x00, 0x00, 0xe0, 0x0e, 0x00, 0x00, 0x70, 0x07, 0x00, 0x00, 0xb8, 0xff, 0xff, 0x1f, 0x5c, 0xff, 0xff, 0x0f, 0xae, 0xaa, 0xaa, 0x06, 0x57, 0x55, 0x55, 0x03, 0xae, 0xaa, 0xaa, 0x06, 0x5c, 0xff, 0xff, 0x0f, 0xb8, 0xff, 0xff, 0x1f, 0x70, 0x07, 0x00, 0x00, 0xe0, 0x0e, 0x00, 0x00, 0xc0, 0x1d, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/bitmap/Term0000664000000000000000000000155312456374665014325 0ustar #define Term_width 32 #define Term_height 32 static char Term_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x1f, 0x04, 0x00, 0x00, 0x20, 0xe4, 0xff, 0xff, 0x27, 0x14, 0x00, 0x00, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0x80, 0x00, 0x28, 0x14, 0x80, 0x00, 0x28, 0x14, 0x80, 0x00, 0x28, 0x14, 0x80, 0x00, 0x28, 0x14, 0x00, 0x00, 0x28, 0x14, 0x80, 0x00, 0x28, 0x14, 0x00, 0x00, 0x28, 0xe4, 0xff, 0xff, 0x27, 0x04, 0x00, 0x00, 0x20, 0xf8, 0xff, 0xff, 0x1f, 0xfe, 0xff, 0xff, 0x7f, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0xc0, 0x5f, 0x02, 0x00, 0x00, 0x40, 0xfa, 0xff, 0xff, 0x5f, 0xae, 0xaa, 0xaa, 0x6a, 0x56, 0x55, 0x55, 0x55, 0xab, 0xaa, 0xaa, 0xea, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/bitmap/config.guess0000775000000000000000000012367212514123564016003 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-11-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/bitmap/ReqMach.c0000664000000000000000000001652512456374665015164 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Davor Matic, MIT X Consortium */ #include #include #include #include #include "BitmapP.h" #include #include /*****************************************************************************\ * Request Machine: stacks up and handles requests from application calls. * \*****************************************************************************/ /* * Searches for a request record of a request specified by its name. * Returns a pointer to the record or NULL if the request was not found. */ static BWRequestRec * FindRequest(BWRequest name) { int i; for (i = 0; i < bitmapClassRec.bitmap_class.num_requests; i++) if (!strcmp(name, bitmapClassRec.bitmap_class.requests[i].name)) return &bitmapClassRec.bitmap_class.requests[i]; return NULL; } /* * Adds a request to the request stack and does proper initializations. * Returns TRUE if the request was found and FALSE otherwise. */ Boolean BWAddRequest(Widget w, BWRequest name, Boolean trap, XtPointer call_data, Cardinal call_data_size) { BitmapWidget BW = (BitmapWidget) w; BWRequestRec *request; request = FindRequest(name); if(request) { if (DEBUG) fprintf(stderr, "Adding... Cardinal: %d\n", BW->bitmap.cardinal + 1); BW->bitmap.request_stack = (BWRequestStack *) XtRealloc((char *)BW->bitmap.request_stack, (++BW->bitmap.cardinal + 1) * sizeof(BWRequestStack)); BW->bitmap.request_stack[BW->bitmap.cardinal].request = request; BW->bitmap.request_stack[BW->bitmap.cardinal].status = XtMalloc(request->status_size); BW->bitmap.request_stack[BW->bitmap.cardinal].trap = trap; BW->bitmap.request_stack[BW->bitmap.cardinal].call_data = XtMalloc(call_data_size); memmove( BW->bitmap.request_stack[BW->bitmap.cardinal].call_data, call_data, call_data_size); return True; } else { XtWarning("bad request name. BitmapWidget"); return False; } } /* * Engages the request designated by the current parameter. * Returnes TRUE if the request has an engage function and FALSE otherwise. */ static Boolean Engage(BitmapWidget BW, Cardinal current) { BW->bitmap.current = current; if (DEBUG) fprintf(stderr, "Request: %s\n", BW->bitmap.request_stack[current].request->name); if (BW->bitmap.request_stack[current].request->engage) { (*BW->bitmap.request_stack[current].request->engage) ((Widget) BW, BW->bitmap.request_stack[current].status, BW->bitmap.request_stack[current].request->engage_client_data, BW->bitmap.request_stack[current].call_data); return True; } else return False; } /* Boolean BWTerminateRequest(); Boolean BWRemoveRequest(); */ /* * Scans down the request stack removing all requests untill it finds * one to be trapped. */ static void TrappingLoop(BitmapWidget BW) { if (DEBUG) fprintf(stderr, "Scanning... Current: %d\n", BW->bitmap.current); if ((BW->bitmap.current > 0) && (!BW->bitmap.request_stack[BW->bitmap.current--].trap)) { BWRemoveRequest((Widget) BW); TrappingLoop(BW); } else if (BW->bitmap.cardinal > 0) { if (DEBUG) fprintf(stderr, "Trapping... Current: %d\n", BW->bitmap.current+1); if(!Engage(BW, ++BW->bitmap.current)) BWTerminateRequest((Widget) BW, True); } } /* * Terimantes the current request and continues with next request if con = TRUE * Returnes TRUE if there is any number of requests left on the stack. */ Boolean BWTerminateRequest(Widget w, Boolean cont) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.current > 0) { if (DEBUG) fprintf(stderr, "Terminating... Current: %d\n", BW->bitmap.current); if (BW->bitmap.request_stack[BW->bitmap.current].request->terminate) (*BW->bitmap.request_stack[BW->bitmap.current].request->terminate) (w, BW->bitmap.request_stack[BW->bitmap.current].status, BW->bitmap.request_stack[BW->bitmap.current].request->terminate_client_data); if (cont) { if (BW->bitmap.current == BW->bitmap.cardinal) TrappingLoop(BW); else { if (DEBUG) fprintf(stderr, "Continuing... Current: %d\n", BW->bitmap.current+1); if (!Engage(BW, ++BW->bitmap.current)) BWTerminateRequest(w, True); } } else BW->bitmap.current = 0; } return BW->bitmap.current; } /* * Simple interface to BWTerminateRequest that takes only a widget. */ void BWAbort(Widget w) { BWTerminateRequest(w, True); } /* * Removes the top request from the request stack. If the request is active * it will terminate it. * Returns TRUE if the number of requests left on the stack != 0. */ Boolean BWRemoveRequest(Widget w) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.cardinal > 0) { if (DEBUG) fprintf(stderr, "Removing... Cardinal: %d\n", BW->bitmap.cardinal); if (BW->bitmap.current == BW->bitmap.cardinal) BWTerminateRequest(w, False); if (BW->bitmap.request_stack[BW->bitmap.cardinal].request->remove) (*BW->bitmap.request_stack[BW->bitmap.cardinal].request->remove) (w, BW->bitmap.request_stack[BW->bitmap.cardinal].status, BW->bitmap.request_stack[BW->bitmap.cardinal].request->remove_client_data); XtFree(BW->bitmap.request_stack[BW->bitmap.cardinal].status); XtFree(BW->bitmap.request_stack[BW->bitmap.cardinal].call_data); BW->bitmap.request_stack = (BWRequestStack *) XtRealloc((char *)BW->bitmap.request_stack, (--BW->bitmap.cardinal + 1) * sizeof(BWRequestStack)); return True; } else return False; } void BWRemoveAllRequests(Widget w) { while (BWRemoveRequest(w)) {/* removes all requests from the stack */} } /* * Adds the request to the stack and performs engaging ritual. * Returns TRUE if the request was found, FALSE otherwise. */ Boolean BWEngageRequest(Widget w, BWRequest name, Boolean trap, XtPointer call_data, Cardinal call_data_size) { BitmapWidget BW = (BitmapWidget) w; if (BWAddRequest(w, name, trap, call_data, call_data_size)) { BWTerminateRequest(w, False); if (DEBUG) fprintf(stderr, "Engaging... Cardinal: %d\n", BW->bitmap.cardinal); if (!Engage(BW, BW->bitmap.cardinal)) BWTerminateRequest(w, True); return True; } else return False; } /************************* End of the Request Machine ************************/ x11-apps-7.7+5+nmu1ubuntu1/bitmap/Stipple0000664000000000000000000000014012456374665015025 0ustar #define Stipple_width 2 #define Stipple_height 2 static char Stipple_bits[] = { 0x01, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/bitmap/Up0000664000000000000000000000146212456374665014001 0ustar #define Up_width 30 #define Up_height 30 static char Up_bits[] = { 0x00, 0x40, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x5c, 0x07, 0x00, 0x00, 0xae, 0x0e, 0x00, 0x00, 0x57, 0x1d, 0x00, 0x80, 0xab, 0x3a, 0x00, 0xc0, 0x5d, 0x77, 0x00, 0xe0, 0xbe, 0xef, 0x00, 0x70, 0x5f, 0xdf, 0x01, 0xb0, 0xbb, 0xbb, 0x01, 0xf0, 0x59, 0xf3, 0x01, 0xf0, 0xb8, 0xe3, 0x01, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x18, 0x03, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/bitmap/autogen.sh0000775000000000000000000000032112456374665015464 0ustar #! /bin/sh srcdir=`dirname $0` test -z "$srcdir" && srcdir=. ORIGDIR=`pwd` cd $srcdir autoreconf -v --install || exit 1 cd $ORIGDIR || exit $? if test -z "$NOCONFIGURE"; then $srcdir/configure "$@" fi x11-apps-7.7+5+nmu1ubuntu1/bitmap/Bitmap.h0000664000000000000000000002725612456374665015070 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Davor Matic, MIT X Consortium */ #ifndef _Bitmap_h #define _Bitmap_h /**************************************************************** * * Bitmap widget * ****************************************************************/ #include /* Resources: Name Class RepType Default Value ---- ----- ------- ------------- background Background Pixel XtDefaultBackground foreground Foredround Pixel XtDefaultForeground highlight Highlight Pixel XtDefaultForeground frame Frame Pixel XtDefaultForeground border BorderColor Pixel XtDefaultForeground borderWidth BorderWidth Dimension 1 mappedWhenManaged MappedWhenManaged Boolean True resize Resize Boolean True sensitive Sensitive Boolean True width Width Dimension 0 height Height Dimension 0 size Size String 32x32 squareWidht SquareWidht Dimension 16 squareHeight SquareHeight Dimension 16 x Position Position 320 y Position Position 320 xHot XHot Position NotSet yHot YHot Position NotSet margin Margin Dimension 16 grid Grid Boolean True gridTolerance GridTolerance Dimension 8 dashed Dashed Boolean True dashes Dashes Bitmap XtUnspecifiedPixmap stippled Stippled Boolean True stipple Stipple Bitmap XtUnspecifiedPixmap proportional Proportional Boolean True axes Axes Boolean True button1Function Button1Function ButtonFunction Set button2Function Button2Function ButtonFunction Invert button3Function Button3Function ButtonFunction Clear button4Function Button4Function ButtonFunction Invert button5Function Button5Function ButtonFunction Invert filename Filename String None basename Basename String None */ /* define any special resource names here that are not in */ #define XtNbitmapResource "bitmapResource" #define XtNstipple "stipple" #define XtNstippled "stippled" #define XtNdashes "dashes" #define XtNdashed "dashed" #define XtNgrid "grid" #define XtNgridTolerance "gridTolerance" #define XtNaxes "axes" #define XtNbitmapSize "bitmapSize" #define XtNsize "size" #define XtNsquareWidth "squareWidth" #define XtNsquareHeight "squareHeight" #define XtNxHot "xHot" #define XtNyHot "yHot" #define XtNbutton1Function "button1Function" #define XtNbutton2Function "button2Function" #define XtNbutton3Function "button3Function" #define XtNbutton4Function "button4Function" #define XtNbutton5Function "button5Function" #define XtNfilename "filename" #define XtNbasename "basename" #define XtNmouseForeground "mouseForeground" #define XtNmouseBackground "mouseBackground" #define XtNframe "frame" #define XtNmargin "margin" #define XtNproportional "proportional" #define XtCBitmapResource "BitmapResource" #define XtCHighlight "Highlight" #define XtCStipple "Stipple" #define XtCStippled "Stippled" #define XtCDashes "Dashes" #define XtCDashed "Dashed" #define XtCGrid "Grid" #define XtCGridTolerance "GridTolerance" #define XtCAxes "Axes" #define XtBitmapSize "BitmapSize" #define XtCSize "Size" #define XtCSquareWidth "SquareWidth" #define XtCSquareHeight "SquareHeight" #define XtCXHot "XHot" #define XtCYHot "YHot" #define XtCButton1Function "Button1Function" #define XtCButton2Function "Button2Function" #define XtCButton3Function "Button3Function" #define XtCButton4Function "Button4Function" #define XtCButton5Function "Button5Function" #define XtCFilename "Filename" #define XtCBasename "Basename" #define XtCFrame "Frame" #ifndef XtCMargin #define XtCMargin "Margin" #endif #define XtCProportional "Proportional" #define XtRButtonFunction "ButtonFunction" /* bitmap defines */ #define NotSet -1 #define Clear 0 #define Set 1 #define Invert 2 #define Highlight 3 #define On True #define Off False #define XtClear "clear" #define XtSet "set" #define XtInvert "invert" #define MarkRequest "MarkRequest" #define StoreRequest "StoreRequest" #define RestoreRequest "RestoreRequest" #define CopyRequest "CopyRequest" #define MoveRequest "MoveRequest" #define PointRequest "PointRequest" #define LineRequest "LineRequest" #define CurveRequest "CurveRequest" #define RectangleRequest "RectangleRequest" #define FilledRectangleRequest "FilledRectangleRequest" #define CircleRequest "CircleRequest" #define FilledCircleRequest "FilledCircleRequest" #define FloodFillRequest "FloodFillRequest" #define HotSpotRequest "HotSpotRequest" #define ZoomInRequest "ZoomInRequest" #define PasteRequest "PasteRequest" #define ImmediateCopyRequest "ImmediateCopyRequest" #define ImmediateMoveRequest "ImmediateMoveRequest" /* bitmap exports */ typedef struct _BWRequestRec BWRequestRec; typedef const char *BWRequest; /* declare specific BitmapWidget class and instance datatypes */ typedef struct _BitmapClassRec *BitmapWidgetClass; typedef struct _BitmapRec *BitmapWidget; /* declare the class constant */ extern WidgetClass bitmapWidgetClass; extern Boolean BWEngageRequest(Widget w, BWRequest name, Boolean trap, XtPointer call_data, Cardinal call_data_size); extern Boolean BWTerminateRequest(Widget w, Boolean cont); extern void BWUp ( Widget w ); extern void BWDown ( Widget w ); extern void BWLeft ( Widget w ); extern void BWRight ( Widget w ); extern void BWRotateRight ( Widget w ); extern void BWRotateLeft ( Widget w ); extern void BWSwitchGrid ( Widget w ); extern void BWGrid ( Widget w, Boolean _switch ); extern void BWSwitchDashed ( Widget w ); extern void BWDashed ( Widget w, Boolean _switch ); extern void BWSwitchAxes ( Widget w ); extern void BWAxes ( Widget w, Boolean _switch ); extern void BWRedrawAxes( Widget w ); extern void BWDrawLine ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value ); extern void BWDrawRectangle ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value ); extern void BWDrawFilledRectangle ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value ); extern void BWDrawCircle ( Widget w, Position origin_x, Position origin_y, Position point_x, Position point_y, int value ); extern void BWDrawFilledCircle ( Widget w, Position origin_x, Position origin_y, Position point_x, Position point_y, int value ); extern void BWFloodFill ( Widget w, Position x, Position y, int value ); extern void BWMark ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y ); extern void BWMarkAll ( Widget w ); extern void BWUnmark ( Widget w ); extern void BWSelect ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y, Time btime ); extern void BWStore ( Widget w ); extern void BWStoreToBuffer ( Widget w ); extern void BWUndo ( Widget w ); extern void BWResize ( Widget w, Dimension width, Dimension height ); extern void BWClip ( Widget w, Position x, Position y, Dimension width, Dimension height ); extern void BWUnclip ( Widget w ); extern void BWGrabSelection ( Widget w, Time btime ); extern void BWRequestSelection ( Widget w, Time btime, Boolean wait ); extern void BWSetChanged ( Widget w ); extern Boolean BWQueryChanged ( Widget w ); extern int BWReadFile ( Widget w, _Xconst _XtString filename, _Xconst _XtString basename ); extern int BWWriteFile ( Widget w, _Xconst _XtString filename, _Xconst _XtString basename ); extern String BWUnparseStatus ( Widget w ); extern String BWGetFilename ( Widget w, String *str ); extern String BWGetBasename ( Widget w, String *str ); extern void BWChangeBasename ( Widget w, _Xconst _XtString str ); extern void BWRemoveAllRequests ( Widget w ); extern void BWClearHotSpot ( Widget w ); extern Boolean BWQueryMarked ( Widget w ); extern void BWFold ( Widget w ); extern void BWClear ( Widget w ); extern void BWSet ( Widget w ); extern void BWInvert ( Widget w ); extern void BWFlipHoriz ( Widget w ); extern void BWFlipVert ( Widget w ); extern void BWClearMarked ( Widget w ); extern Boolean BWAddRequest ( Widget w, BWRequest name, Boolean trap, XtPointer call_data, Cardinal call_data_size ); extern void BWChangeNotify ( Widget w ); extern Pixmap BWGetUnzoomedPixmap ( Widget w ); extern void BWClearChanged ( Widget w ); extern Boolean BWQueryStored ( Widget w ); extern Boolean BWQueryStippled ( Widget w ); extern void BWSwitchStippled ( Widget w ); extern void BWRedrawMark ( Widget w ); extern Boolean BWQueryAxes ( Widget w ); extern void BWHighlightAxes ( Widget w ); extern String BWGetFilepath ( Widget w, String *str ); extern void BWZoomOut ( Widget w ); extern void BWZoomMarked ( Widget w ); extern void BWRescale ( Widget w, Dimension width, Dimension height ); extern Boolean BWQueryZooming ( Widget w ); extern void BWRedrawGrid ( Widget w, Position x, Position y, Dimension width, Dimension height ); extern void BWRedrawSquares ( Widget w, Position x, Position y, Dimension width, Dimension height ); extern void BWRedrawHotSpot ( Widget w ); extern void BWSetHotSpot(Widget w, Position x, Position y); extern Boolean BWQueryGrid ( Widget w ); extern Boolean BWQueryDashed ( Widget w ); extern Boolean BWQueryProportional ( Widget w ); extern void BWSwitchProportional ( Widget w ); extern void BWDrawGrid ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y ); extern void BWChangeFilename ( Widget w, _Xconst _XtString str ); extern Boolean BWParseSize ( String size, Dimension *width, Dimension *height ); extern Boolean BWQuerySelection ( Widget w, Time btime ); extern int BWStoreFile ( Widget w, _Xconst _XtString filename, _Xconst _XtString *basename ); extern void BWNotify ( Widget w, XtActionProc proc ); extern void BWTMark ( Widget w, XEvent *event, String *params, Cardinal *num_params ); extern void BWTMarkAll ( Widget w, XEvent *event, String *params, Cardinal *num_params ); extern void BWTUnmark ( Widget w, XEvent *event, String *params, Cardinal *num_params ); extern void BWTPaste ( Widget w, XEvent *event, String *params, Cardinal *num_params ); extern void BWDebug ( Widget w, XEvent *event, String *params, Cardinal *num_params ); extern void BWAbort ( Widget w ); extern Boolean BWRemoveRequest ( Widget w ); extern void BWRedraw ( Widget w ); extern Pixmap BWGetPixmap( Widget w ); #endif /* _Bitmap_h */ x11-apps-7.7+5+nmu1ubuntu1/bitmap/bmtoa.c0000664000000000000000000001134312456374665014737 0ustar /* Copyright 1988, 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * bmtoa - bitmap to ascii filter * Author: Jim Fulton, MIT X Consortium */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #include #ifndef HAVE_MKSTEMP extern char *mktemp(); #endif static char *ProgramName; static void print_scanline (unsigned int width, unsigned int height, unsigned const char *data, const char *chars); static void _X_NORETURN usage (void) { fprintf (stderr, "usage: %s [-options ...] [filename]\n\n%s\n", ProgramName, "where options include:\n" " -chars cc chars to use for 0 and 1 bits, respectively\n"); exit (1); } static char * copy_stdin (void) { #ifdef WIN32 static char tmpfilename[] = "/temp/bmtoa.XXXXXX"; #else static char tmpfilename[] = "/tmp/bmtoa.XXXXXX"; #endif char buf[BUFSIZ]; FILE *fp = NULL; int nread, nwritten; #ifndef HAVE_MKSTEMP if (mktemp (tmpfilename) != NULL) fp = fopen (tmpfilename, "w"); #else int fd; if ((fd = mkstemp(tmpfilename)) >= 0) fp = fdopen(fd, "w"); #endif if (fp == NULL) { fprintf (stderr, "%s: unable to generate temporary file for stdin.\n", ProgramName); exit (1); } while (1) { buf[0] = '\0'; nread = fread (buf, 1, sizeof buf, stdin); if (nread <= 0) break; nwritten = fwrite (buf, 1, nread, fp); if (nwritten != nread) { fprintf (stderr, "%s: error copying stdin to file (%d of %d chars)\n", ProgramName, nwritten, nread); (void) fclose (fp); (void) unlink (tmpfilename); exit (1); } } (void) fclose (fp); return tmpfilename; } int main (int argc, char *argv[]) { const char *filename = NULL; int isstdin = 0; const char *chars = "-#"; int i; unsigned int width, height; unsigned char *data; int x_hot, y_hot; int status; ProgramName = argv[0]; for (i = 1; i < argc; i++) { const char *arg = argv[i]; if (arg[0] == '-') { switch (arg[1]) { case '\0': filename = NULL; continue; case 'c': if (++i >= argc) { fprintf(stderr, "%s: -chars requires an argument\n", ProgramName); usage (); } chars = argv[i]; continue; default: fprintf(stderr, "%s: unrecognized option '%s'\n", ProgramName, argv[i]); usage (); } } else { filename = arg; } } if (strlen (chars) != 2) { fprintf (stderr, "%s: bad character list \"%s\", must have exactly 2 characters\n", ProgramName, chars); exit (1); } if (!filename) { filename = copy_stdin (); isstdin = 1; } status = XmuReadBitmapDataFromFile (filename, &width, &height, &data, &x_hot, &y_hot); if (isstdin) (void) unlink (filename); /* don't need it anymore */ if (status != BitmapSuccess) { fprintf (stderr, "%s: unable to read bitmap from file \"%s\"\n", ProgramName, isstdin ? "(stdin)" : filename); exit (1); } print_scanline (width, height, data, chars); exit (0); } static void print_scanline (unsigned int width, unsigned int height, unsigned const char *data, const char *chars) { unsigned const char *dp = data; int row, column; static unsigned const char masktable[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; int padded = ((width & 7) != 0); for (row = 0; row < height; row++) { for (column = 0; column < width; column++) { int i = (column & 7); if (*dp & masktable[i]) { putchar (chars[1]); } else { putchar (chars[0]); } if (i == 7) dp++; } putchar ('\n'); if (padded) dp++; } return; } x11-apps-7.7+5+nmu1ubuntu1/bitmap/FlipHoriz0000664000000000000000000000150712456374665015323 0ustar #define FlipHoriz_width 30 #define FlipHoriz_height 30 static char FlipHoriz_bits[] = { 0x00, 0x80, 0x07, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x80, 0x1d, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0xdc, 0x01, 0xc0, 0xff, 0xbf, 0x03, 0xe0, 0xff, 0x5f, 0x07, 0xb0, 0xaa, 0xaa, 0x0e, 0x58, 0x55, 0x55, 0x1d, 0xac, 0xaa, 0xaa, 0x0e, 0xfe, 0xff, 0x5f, 0x07, 0xff, 0xff, 0xbf, 0x03, 0x6b, 0x00, 0xdc, 0x01, 0x77, 0x00, 0xee, 0x00, 0x6b, 0x00, 0x77, 0x00, 0x77, 0x80, 0x3b, 0x00, 0x6b, 0x80, 0x1d, 0x00, 0x77, 0x80, 0x0f, 0x00, 0x6b, 0x80, 0x07, 0x00, 0xff, 0x1f, 0x00, 0x00, 0xfe, 0x0f, 0x00, 0x00, 0xac, 0x06, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb0, 0x06, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/bitmap/Dashes0000664000000000000000000000013512456374665014620 0ustar #define Dashes_width 2 #define Dashes_height 2 static char Dashes_bits[] = { 0x01, 0x02}; x11-apps-7.7+5+nmu1ubuntu1/bitmap/BitmapP.h0000664000000000000000000001367412456374665015207 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Davor Matic, MIT X Consortium */ #ifndef _BitmapP_h #define _BitmapP_h #define bit int #include "Bitmap.h" #include "Requests.h" #include typedef struct { Atom *targets; Cardinal num_targets; BWRequestRec *requests; Cardinal num_requests; BWRequestRec *request[100]; } BitmapClassPart; /* Full class record declaration */ typedef struct _BitmapClassRec { CoreClassPart core_class; SimpleClassPart simple_class; BitmapClassPart bitmap_class; } BitmapClassRec; extern BitmapClassRec bitmapClassRec; typedef void (*EngageProc)(Widget, BWStatus *, XtPointer, int *); typedef void (*TerminateProc)( Widget, BWStatus *, XtPointer); typedef void (*RemoveProc)(Widget w, BWStatus *, XtPointer); /**********/ struct _BWRequestRec { char *name; int status_size; EngageProc engage; XtPointer engage_client_data; TerminateProc terminate; XtPointer terminate_client_data; RemoveProc remove; XtPointer remove_client_data; } ; typedef struct { Position from_x, from_y, to_x, to_y; } BWArea; typedef struct { BWRequestRec *request; XtPointer status; Boolean trap; XtPointer call_data; } BWRequestStack; typedef struct { XImage *image, *buffer; XPoint hot; Position at_x, at_y; Boolean fold; Boolean grid; Boolean changed; } BWZoom; typedef struct { Boolean own; Boolean limbo; } BWSelection; /* New fields for the Bitmap widget record */ typedef struct { /* resources */ Pixel foreground_pixel; Pixel highlight_pixel; Pixel frame_pixel; Pixmap stipple; Boolean stippled; Boolean proportional; Boolean grid; Dimension grid_tolerance; Pixmap dashes; Boolean dashed; Boolean axes; Boolean resize; Dimension margin, squareW, squareH, width, height; XPoint hot; int button_function[5]; String filename, basename; /* private state */ String size; Position horizOffset, vertOffset; XtActionProc notify; BWRequestStack *request_stack; Cardinal cardinal, current; /*Boolean trapping;*/ XImage *image, *buffer, *storage; XPoint buffer_hot; BWArea mark, buffer_mark; GC drawing_gc; GC highlighting_gc; GC frame_gc; GC axes_gc; Boolean changed; Boolean fold; Boolean zooming; BWZoom zoom; XtPointer *value; char status[80]; BWSelection selection; Boolean stipple_change_expose_event; } BitmapPart; /* Full instance record declaration */ typedef struct _BitmapRec { CorePart core; SimplePart simple; BitmapPart bitmap; } BitmapRec; /* Private functions */ #define Length(width, height)\ (((int)(width) + 7) / 8 * (height)) #define InBitmapX(BW, x)\ (Position)(min((Position)((Dimension)(max(BW->bitmap.horizOffset,x) -\ BW->bitmap.horizOffset) /\ BW->bitmap.squareW), BW->bitmap.width - 1)) #define InBitmapY(BW, y)\ (Position)(min((Position)((Dimension)(max(BW->bitmap.vertOffset, y) -\ BW->bitmap.vertOffset) /\ BW->bitmap.squareH), BW->bitmap.height - 1)) #define InWindowX(BW, x)\ (Position) (BW->bitmap.horizOffset + ((x) * BW->bitmap.squareW)) #define InWindowY(BW, y)\ (Position) (BW->bitmap.vertOffset + ((y) * BW->bitmap.squareH)) #define GetPixmap(BW, image)\ XCreateBitmapFromData(XtDisplay(BW), XtWindow(BW),\ image->data, image->width, image->height) #define QuerySet(x, y) (((x) != NotSet) && ((y) != NotSet)) #define bit int #define QueryZero(x, y) (((x) == 0) || ((y) == 0)) #define Swap(x, y) {Position t; t = x; x = y; y = t;} #define QuerySwap(x, y) if(x > y) Swap(x, y) #define QueryInBitmap(BW, x, y)\ (((x) >= 0) && ((x) < BW->bitmap.image->width) &&\ ((y) >= 0) && ((y) < BW->bitmap.image->height)) #define Value(BW, button) (BW->bitmap.button_function[button - 1]) #define CreateCleanData(length) XtCalloc(length, sizeof(char)) XImage *CreateBitmapImage(BitmapWidget BW, char *data, Dimension width, Dimension height); void DestroyBitmapImage(XImage **image); void TransferImageData(XImage *source, XImage *destination); void CopyImageData(XImage *source, XImage *destination, Position from_x, Position from_y, Position to_x, Position to_y, Position at_x, Position at_y); XImage *GetImage(BitmapWidget BW, Pixmap pixmap); XImage *ConvertToBitmapImage(BitmapWidget BW, XImage *image); XImage *ScaleBitmapImage(BitmapWidget BW, XImage *src, double scale_x, double scale_y); extern Boolean DEBUG; #endif /* _BitmapP_h */ x11-apps-7.7+5+nmu1ubuntu1/bitmap/config.h.in0000664000000000000000000000337212656634574015517 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `lrint' function. */ #undef HAVE_LRINT /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `mkstemp' function. */ #undef HAVE_MKSTEMP /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION x11-apps-7.7+5+nmu1ubuntu1/bitmap/Graphics.c0000664000000000000000000011666012456374665015405 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Davor Matic, MIT X Consortium */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include "BitmapP.h" #include "Bitmap.h" #include "Requests.h" #include #include #ifndef abs #define abs(x) (((x) > 0) ? (x) : -(x)) #endif #define min(x, y) (((int)(x) < (int)(y)) ? (x) : (y)) #define max(x, y) (((int)(x) > (int)(y)) ? (x) : (y)) #ifndef rint # if HAVE_LRINT # define rint(x) lrint(x) # else # define rint(x) floor(x + 0.5) # endif #endif #ifdef __clang__ /* clang doesn't like (int)floor(d) */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wbad-function-cast" #endif /*****************************************************************************\ * Graphics * \*****************************************************************************/ #define GetBit(image, x, y)\ ((bit)((*(image->data + (x) / 8 + (y) * image->bytes_per_line) &\ (1 << ((x) & 7))) ? 1 : 0)) #if 0 bit BWGetBit(Widget w, Position x, Position y) { BitmapWidget BW = (BitmapWidget) w; if (QueryInBitmap(BW, x, y)) return GetBit(BW->bitmap.image, x, y); else return NotSet; } #endif #define InvertBit(image, x, y)\ (*(image->data + (x) / 8 + (y) * image->bytes_per_line) ^=\ (bit) (1 << ((x) % 8))) #define SetBit(image, x, y)\ (*(image->data + (x) / 8 + (y) * image->bytes_per_line) |=\ (bit) (1 << ((x) % 8))) #define ClearBit(image, x, y)\ (*(image->data + (x) / 8 + (y) * image->bytes_per_line) &=\ (bit)~(1 << ((x) % 8))) #define HighlightSquare(BW, x, y)\ XFillRectangle(XtDisplay(BW), XtWindow(BW),\ BW->bitmap.highlighting_gc,\ InWindowX(BW, x), InWindowY(BW, y),\ BW->bitmap.squareW, BW->bitmap.squareH) /* void HighlightSquare(BitmapWidget BW, Position x, Position y) { XFillRectangle(XtDisplay(BW), XtWindow(BW), BW->bitmap.highlighting_gc, InWindowX(BW, x), InWindowY(BW, y), BW->bitmap.squareW, BW->bitmap.squareH); } */ #define DrawSquare(BW, x, y)\ XFillRectangle(XtDisplay(BW), XtWindow(BW),\ BW->bitmap.drawing_gc,\ InWindowX(BW, x), InWindowY(BW, y),\ BW->bitmap.squareW, BW->bitmap.squareH) /* void DrawSquare(BitmapWidget BW, Position x, Position y) { XFillRectangle(XtDisplay(BW), XtWindow(BW), BW->bitmap.drawing_gc, InWindowX(BW, x), InWindowY(BW, y), BW->bitmap.squareW, BW->bitmap.squareH); } */ #define InvertPoint(BW, x, y)\ {InvertBit(BW->bitmap.image, x, y); DrawSquare(BW, x, y);} #define DrawPoint(BW, x, y, value)\ if (GetBit(BW->bitmap.image, x, y) != value)\ InvertPoint(BW, x, y) void BWDrawPoint(Widget w, Position x, Position y, bit value) { BitmapWidget BW = (BitmapWidget) w; if (QueryInBitmap(BW, x, y)) { if (value == Highlight) HighlightSquare(BW, x, y); else DrawPoint(BW, x, y, value); } } static XPoint * HotSpotShape(BitmapWidget BW, Position x, Position y) { static XPoint points[5]; points[0].x = InWindowX(BW, x); points[0].y = InWindowY(BW, y + 1.0/2); points[1].x = InWindowX(BW, x + 1.0/2); points[1].y = InWindowY(BW, y + 1); points[2].x = InWindowX(BW, x + 1); points[2].y = InWindowY(BW, y + 1.0/2); points[3].x = InWindowX(BW, x + 1.0/2); points[3].y = InWindowY(BW, y); points[4].x = InWindowX(BW, x); points[4].y = InWindowY(BW, y + 1.0/2); return points; } #define DrawHotSpot(BW, x, y)\ XFillPolygon(XtDisplay(BW), XtWindow(BW), BW->bitmap.drawing_gc,\ HotSpotShape(BW, x, y), 5, Convex, CoordModeOrigin) #define HighlightHotSpot(BW, x, y)\ XFillPolygon(XtDisplay(BW), XtWindow(BW), BW->bitmap.highlighting_gc,\ HotSpotShape(BW, x, y), 5, Convex, CoordModeOrigin) /* XImage *CreateBitmapImage(); void DestroyBitmapImage(); */ void BWRedrawHotSpot(Widget w) { BitmapWidget BW = (BitmapWidget) w; if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)) DrawHotSpot(BW, BW->bitmap.hot.x, BW->bitmap.hot.y); } void BWClearHotSpot(Widget w) { BitmapWidget BW = (BitmapWidget) w; if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)) { DrawHotSpot(BW, BW->bitmap.hot.x, BW->bitmap.hot.y); BW->bitmap.hot.x = BW->bitmap.hot.y = NotSet; } } void BWDrawHotSpot(Widget w, Position x, Position y, int value) { BitmapWidget BW = (BitmapWidget) w; if (QueryInBitmap(BW, x, y)) { if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y) && ((BW->bitmap.hot.x == x) && (BW->bitmap.hot.y == y))) { if ((value == Clear) || (value == Invert)) { BWClearHotSpot(w); } } else if ((value == Set) || (value == Invert)) { BWClearHotSpot(w); DrawHotSpot(BW, x, y); BW->bitmap.hot.x = x; BW->bitmap.hot.y = y; } if (value == Highlight) HighlightHotSpot(BW, x, y); } } void BWSetHotSpot(Widget w, Position x, Position y) { if (QuerySet(x, y)) BWDrawHotSpot(w, x, y, Set); else BWClearHotSpot(w); } /* high level procedures */ void BWRedrawSquares(Widget w, Position x, Position y, Dimension width, Dimension height) { BitmapWidget BW = (BitmapWidget) w; Position from_x = InBitmapX(BW, x); Position from_y = InBitmapY(BW, y); Position to_x = InBitmapX(BW, x + width); Position to_y = InBitmapY(BW, y + height); QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); from_x = max(0, from_x); from_y = max(0, from_y); to_x = min(BW->bitmap.image->width - 1, to_x); to_y = min(BW->bitmap.image->height - 1, to_y); for (x = from_x; x <= to_x; x++) for (y = from_y; y <= to_y; y++) if (GetBit(BW->bitmap.image, x, y)) DrawSquare(BW, x, y); } void BWDrawGrid(Widget w, Position from_x, Position from_y, Position to_x, Position to_y) { BitmapWidget BW = (BitmapWidget) w; int i; QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); from_x = max(0, from_x); from_y = max(0, from_y); to_x = min(BW->bitmap.image->width - 1, to_x); to_y = min(BW->bitmap.image->height - 1, to_y); for(i = from_x + (from_x == 0); i <= to_x; i++) XDrawLine(XtDisplay(BW), XtWindow(BW), BW->bitmap.frame_gc, InWindowX(BW, i), InWindowY(BW, from_y), InWindowX(BW, i), InWindowY(BW, to_y + 1)); for(i = from_y + (from_y == 0); i <= to_y; i++) XDrawLine(XtDisplay(BW), XtWindow(BW), BW->bitmap.frame_gc, InWindowX(BW, from_x), InWindowY(BW, i), InWindowX(BW, to_x + 1), InWindowY(BW, i)); } void BWRedrawGrid(Widget w, Position x, Position y, Dimension width, Dimension height) { BitmapWidget BW = (BitmapWidget) w; Position from_x = InBitmapX(BW, x); Position from_y = InBitmapY(BW, y); Position to_x = InBitmapX(BW, x + width); Position to_y = InBitmapY(BW, y + height); if (BW->bitmap.grid) BWDrawGrid(w, from_x, from_y, to_x, to_y); } void BWDrawLine(Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value) { Position i; register double x, y; double dx, dy, delta; dx = to_x - from_x; dy = to_y - from_y; x = from_x + 0.5; y = from_y + 0.5; delta = max(abs(dx), abs(dy)); if (delta > 0) { dx /= delta; dy /= delta; for(i = 0; i <= delta; i++) { BWDrawPoint(w, (Position) x, (Position) y, value); x += dx; y += dy; } } else BWDrawPoint(w, from_x, from_y, value); } void BWBlindLine(Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value) { Position i; register double x, y; double dx, dy, delta; dx = to_x - from_x; dy = to_y - from_y; x = from_x + 0.5; y = from_y + 0.5; delta = max(abs(dx), abs(dy)); if (delta > 0) { dx /= delta; dy /= delta; x += dx; y += dy; for(i = 1; i <= delta; i++) { BWDrawPoint(w, (Position) x, (Position) y, value); x += dx; y += dy; } } else BWDrawPoint(w, from_x, from_y, value); } void BWDrawRectangle(Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value) { register Position i; Dimension delta, width, height; QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); width = to_x - from_x; height = to_y - from_y; delta = max(width, height); if (!QueryZero(width, height)) { for (i = 0; (int)i < (int)delta; i++) { if ((int)i < (int)width) { BWDrawPoint(w, from_x + i, from_y, value); BWDrawPoint(w, to_x - i, to_y, value); } if ((int)i < (int)height) { BWDrawPoint(w, from_x, to_y - i, value); BWDrawPoint(w, to_x, from_y + i, value); } } } else BWDrawLine(w, from_x, from_y, to_x, to_y, value); } void BWDrawFilledRectangle(Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value) { register Position x, y; QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); for (x = from_x; x <= to_x; x++) for (y = from_y; y <= to_y; y++) BWDrawPoint(w, x, y, value); } void BWDrawCircle(Widget w, Position origin_x, Position origin_y, Position point_x, Position point_y, int value) { register Position i, delta; Dimension dx, dy, half; double radius; dx = abs(point_x - origin_x); dy = abs(point_y - origin_y); radius = sqrt((double) ((int)dx * (int)dx + (int)dy * (int)dy)); if (radius < 1.0) { BWDrawPoint(w, origin_x, origin_y, value); } else { BWDrawPoint(w, origin_x - (Position) floor(radius), origin_y, value); BWDrawPoint(w, origin_x + (Position) floor(radius), origin_y, value); BWDrawPoint(w, origin_x, origin_y - (Position) floor(radius), value); BWDrawPoint(w, origin_x, origin_y + (Position) floor(radius), value); } half = radius / sqrt(2.0); for(i = 1; (int)i <= (int)half; i++) { delta = sqrt(radius * radius - i * i); BWDrawPoint(w, origin_x - delta, origin_y - i, value); BWDrawPoint(w, origin_x - delta, origin_y + i, value); BWDrawPoint(w, origin_x + delta, origin_y - i, value); BWDrawPoint(w, origin_x + delta, origin_y + i, value); if (i != delta) { BWDrawPoint(w, origin_x - i, origin_y - delta, value); BWDrawPoint(w, origin_x - i, origin_y + delta, value); BWDrawPoint(w, origin_x + i, origin_y - delta, value); BWDrawPoint(w, origin_x + i, origin_y + delta, value); } } } void BWDrawFilledCircle(Widget w, Position origin_x, Position origin_y, Position point_x, Position point_y, int value) { register Position i, j, delta; Dimension dx, dy; double radius; dx = abs(point_x - origin_x); dy = abs(point_y - origin_y); radius = sqrt((double) ((int)dx * (int)dx + (int)dy * (int)dy)); for(j = origin_x - (Position) floor(radius); j <= origin_x + (Position) floor(radius); j++) BWDrawPoint(w, j, origin_y, value); for(i = 1; i <= (Position) floor(radius); i++) { delta = sqrt(radius * radius - i * i); for(j = origin_x - delta; j <= origin_x + delta; j++) { BWDrawPoint(w, j, origin_y - i, value); BWDrawPoint(w, j, origin_y + i, value); } } } #define QueryFlood(BW, x, y, value)\ ((GetBit(BW->bitmap.image, x, y) !=\ (value & 1)) && QueryInBitmap(BW, x, y)) #define Flood(BW, x, y, value)\ {if (value == Highlight) HighlightSquare(BW, x, y);\ else InvertPoint(BW, x, y);} /* static void FloodLoop(BitmapWidget BW, Position x, Position y, int value) { if (QueryFlood(BW, x, y, value)) { Flood(BW, x, y, value); FloodLoop(BW, x, y - 1, value); FloodLoop(BW, x - 1, y, value); FloodLoop(BW, x, y + 1, value); FloodLoop(BW, x + 1, y, value); } } */ static void FloodLoop(BitmapWidget BW, Position x, Position y, int value) { Position save_x, save_y, x_left, x_right; if (QueryFlood(BW, x, y, value)) Flood(BW, x, y, value) save_x = x; save_y = y; x++; while (QueryFlood(BW, x, y, value)) { Flood(BW, x, y, value); x++; } x_right = --x; x = save_x; x--; while (QueryFlood(BW, x, y, value)) { Flood(BW, x, y, value); x--; } x_left = ++x; x = x_left; y = save_y; y++; while (x <= x_right) { Boolean flag = False; Position x_enter; while (QueryFlood(BW, x, y, value) && (x <= x_right)) { flag = True; x++; } if (flag) { if ((x == x_right) && QueryFlood(BW, x, y, value)) FloodLoop(BW, x, y, value); else FloodLoop(BW, x - 1, y, value); } x_enter = x; while (!QueryFlood(BW, x, y, value) && (x < x_right)) x++; if (x == x_enter) x++; } x = x_left; y = save_y; y--; while (x <= x_right) { Boolean flag = False; Position x_enter; while (QueryFlood(BW, x, y, value) && (x <= x_right)) { flag = True; x++; } if (flag) { if ((x == x_right) && QueryFlood(BW, x, y, value)) FloodLoop(BW, x, y, value); else FloodLoop(BW, x - 1, y, value); } x_enter = x; while (!QueryFlood(BW, x, y, value) && (x < x_right)) x++; if (x == x_enter) x++; } } void BWFloodFill(Widget w, Position x, Position y, int value) { BitmapWidget BW = (BitmapWidget) w; int pixel; pixel = GetBit(BW->bitmap.image, x, y); if (value == Invert) FloodLoop(BW, x, y, (pixel ? Clear : Set)); else if (value != pixel) FloodLoop(BW, x, y, value); } #define QueryHotInMark(BW)\ ((BW->bitmap.hot.x == max(BW->bitmap.mark.from_x,\ min(BW->bitmap.hot.x, BW->bitmap.mark.to_x)))\ &&\ (BW->bitmap.hot.y == max(BW->bitmap.mark.from_y,\ min(BW->bitmap.hot.y, BW->bitmap.mark.to_y)))) void BWUp(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; bit first, up, down=0; Position from_x, from_y, to_x, to_y; if (BWQueryMarked(w)) { from_x = BW->bitmap.mark.from_x; from_y = BW->bitmap.mark.from_y; to_x = BW->bitmap.mark.to_x; to_y = BW->bitmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = BW->bitmap.width - 1; to_y = BW->bitmap.height - 1; } if ((to_y - from_y) == 0) return; for(x = from_x; x <= to_x; x++) { first = up = GetBit(BW->bitmap.image, x, to_y); for(y = to_y - 1; y >= from_y; y--) { down = GetBit(BW->bitmap.image, x, y); if (up != down) InvertPoint(BW, x, y); up =down; } if(first != down) InvertPoint(BW, x, to_y); } if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y) && !BWQueryMarked(w)) BWSetHotSpot(w, BW->bitmap.hot.x, (BW->bitmap.hot.y - 1 + BW->bitmap.image->height) % BW->bitmap.image->height); } void BWDown(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; bit first, down, up=0; Position from_x, from_y, to_x, to_y; if (BWQueryMarked(w)) { from_x = BW->bitmap.mark.from_x; from_y = BW->bitmap.mark.from_y; to_x = BW->bitmap.mark.to_x; to_y = BW->bitmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = BW->bitmap.width - 1; to_y = BW->bitmap.height - 1; } if ((to_y - from_y) == 0) return; for(x = from_x; x <= to_x; x++) { first = down = GetBit(BW->bitmap.image, x, from_y); for(y = from_y + 1; y <= to_y; y++) { up = GetBit(BW->bitmap.image, x, y); if (down != up) InvertPoint(BW, x, y); down = up; } if(first != up) InvertPoint(BW, x, from_y); } if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y) && !BWQueryMarked(w)) BWSetHotSpot(w, BW->bitmap.hot.x, (BW->bitmap.hot.y + 1) % BW->bitmap.image->height); } void BWLeft(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; bit first, left, right=0; Position from_x, from_y, to_x, to_y; if (BWQueryMarked(w)) { from_x = BW->bitmap.mark.from_x; from_y = BW->bitmap.mark.from_y; to_x = BW->bitmap.mark.to_x; to_y = BW->bitmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = BW->bitmap.width - 1; to_y = BW->bitmap.height - 1; } if ((to_x - from_x) == 0) return; for(y = from_y; y <= to_y; y++) { first = left = GetBit(BW->bitmap.image, to_x, y); for(x = to_x - 1; x >= from_x; x--) { right = GetBit(BW->bitmap.image, x, y); if (left != right) InvertPoint(BW, x, y); left = right; } if(first != right) InvertPoint(BW, to_x, y); } if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y) && !BWQueryMarked(w)) BWSetHotSpot(w, (BW->bitmap.hot.x - 1 + BW->bitmap.image->width) % BW->bitmap.image->width, BW->bitmap.hot.y); } void BWRight(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; bit first, right, left=0; Position from_x, from_y, to_x, to_y; if (BWQueryMarked(w)) { from_x = BW->bitmap.mark.from_x; from_y = BW->bitmap.mark.from_y; to_x = BW->bitmap.mark.to_x; to_y = BW->bitmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = BW->bitmap.width - 1; to_y = BW->bitmap.height - 1; } if ((to_x - from_x) == 0) return; for(y = from_y; y <= to_y; y++) { first = right = GetBit(BW->bitmap.image, from_x, y); for(x = from_x + 1; x <= to_x; x++) { left = GetBit(BW->bitmap.image, x, y); if (right != left) InvertPoint(BW, x, y); right = left; } if(first != left) InvertPoint(BW, from_x, y); } if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y) && !BWQueryMarked(w)) BWSetHotSpot(w, (BW->bitmap.hot.x + 1) % BW->bitmap.image->width, BW->bitmap.hot.y); } /* void TransferImageData(); */ void BWFold(Widget w) { BitmapWidget BW = (BitmapWidget) w; Position x, y, new_x, new_y; Dimension horiz, vert; char *storage_data; XImage *storage; storage_data = CreateCleanData(Length(BW->bitmap.image->width, BW->bitmap.image->height)); storage = CreateBitmapImage(BW, storage_data, (Dimension) BW->bitmap.image->width, (Dimension) BW->bitmap.image->height); TransferImageData(BW->bitmap.image, storage); BW->bitmap.fold ^= True; horiz = (BW->bitmap.image->width + BW->bitmap.fold) / 2; vert = (BW->bitmap.image->height + BW->bitmap.fold) / 2; for (x = 0; x < BW->bitmap.image->width; x++) for (y = 0; y < BW->bitmap.image->height; y++) { new_x = (int)(x + horiz) % (int)BW->bitmap.image->width; new_y = (int)(y + vert) % (int)BW->bitmap.image->height; if(GetBit(BW->bitmap.image, new_x, new_y) != GetBit(storage, x, y)) InvertPoint(BW, new_x, new_y); } DestroyBitmapImage(&storage); if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)) BWSetHotSpot(w, (Position) ((int)(BW->bitmap.hot.x+horiz) %(int)BW->bitmap.image->width), (Position) ((int)(BW->bitmap.hot.y+vert) %(int)BW->bitmap.image->height) ); } void BWClear(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; int i, length; length = Length(BW->bitmap.image->width, BW->bitmap.image->height); for (x = 0; x < BW->bitmap.image->width; x++) for (y = 0; y < BW->bitmap.image->height; y++) if (GetBit(BW->bitmap.image, x, y)) DrawSquare(BW, x, y); for (i = 0; i < length; i++) BW->bitmap.image->data[i] = 0; } void BWSet(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; int i, length; length = Length(BW->bitmap.image->width, BW->bitmap.image->height); for (x = 0; x < BW->bitmap.image->width; x++) for (y = 0; y < BW->bitmap.image->height; y++) if (!GetBit(BW->bitmap.image, x, y)) DrawSquare(BW, x, y); for (i = 0; i < length; i++) BW->bitmap.image->data[i] = (char)255; } void BWRedraw(Widget w) { BitmapWidget BW = (BitmapWidget) w; XClearArea(XtDisplay(BW), XtWindow(BW), 0, 0, BW->core.width, BW->core.height, True); } void BWInvert(Widget w) { BitmapWidget BW = (BitmapWidget) w; int i, length; length = Length(BW->bitmap.image->width, BW->bitmap.image->height); XFillRectangle(XtDisplay(BW), XtWindow(BW), BW->bitmap.drawing_gc, InWindowX(BW, 0), InWindowY(BW, 0), InWindowX(BW, BW->bitmap.image->width) - InWindowX(BW, 0), InWindowY(BW, BW->bitmap.image->height) - InWindowY(BW, 0)); for (i = 0; i < length; i++) BW->bitmap.image->data[i] ^= 255; } void BWFlipHoriz(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; Position from_x, from_y, to_x, to_y; float half; if (BWQueryMarked(w)) { from_x = BW->bitmap.mark.from_x; from_y = BW->bitmap.mark.from_y; to_x = BW->bitmap.mark.to_x; to_y = BW->bitmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = BW->bitmap.width - 1; to_y = BW->bitmap.height - 1; } half = (float) (to_y - from_y) / 2.0 + 0.5; if (half == 0.0) return; for (x = from_x; x <= to_x; x++) for (y = 0; y < half; y++) if (GetBit(BW->bitmap.image, x, from_y + y) != GetBit(BW->bitmap.image, x, to_y - y)) { InvertPoint(BW, x, from_y + y); InvertPoint(BW, x, to_y - y); } if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y) && !BWQueryMarked(w)) BWSetHotSpot(w, BW->bitmap.hot.x, BW->bitmap.image->height - 1 - BW->bitmap.hot.y); } void BWFlipVert(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; Position from_x, from_y, to_x, to_y; float half; if (BWQueryMarked(w)) { from_x = BW->bitmap.mark.from_x; from_y = BW->bitmap.mark.from_y; to_x = BW->bitmap.mark.to_x; to_y = BW->bitmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = BW->bitmap.width - 1; to_y = BW->bitmap.height - 1; } half = (float) (to_x - from_x) / 2.0 + 0.5; if (half == 0) return; for (y = from_y; y <= to_y; y++) for (x = 0; x < half; x++) if (GetBit(BW->bitmap.image, from_x + x, y) != GetBit(BW->bitmap.image, to_x - x, y)) { InvertPoint(BW, from_x + x, y); InvertPoint(BW, to_x - x, y); } if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y) && !BWQueryMarked(w)) BWSetHotSpot(w, BW->bitmap.image->width - 1 - BW->bitmap.hot.x, BW->bitmap.hot.y); } void BWRotateRight(Widget w) { BitmapWidget BW = (BitmapWidget) w; Position x, y, delta, shift, tmp; Position half_width, half_height; XPoint hot; bit quad1, quad2, quad3, quad4; Position from_x, from_y, to_x, to_y; if (BWQueryMarked(w)) { from_x = BW->bitmap.mark.from_x; from_y = BW->bitmap.mark.from_y; to_x = BW->bitmap.mark.to_x; to_y = BW->bitmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = BW->bitmap.width - 1; to_y = BW->bitmap.height - 1; } half_width = floor((to_x - from_x) / 2.0 + 0.5); half_height = floor((to_y - from_y ) / 2.0 + 0.5); shift = min((Position)(to_x - from_x), (Position)(to_y - from_y )) % 2; delta = min((Position) half_width, (Position) half_height) - shift; for (x = 0; x <= delta; x++) { for (y = 1 - shift; y <= delta; y++) { quad1 = GetBit(BW->bitmap.image, from_x + (Position)half_width + x, from_y + (Position)half_height + y); quad2 = GetBit(BW->bitmap.image, from_x + (Position)half_width + y, from_y + (Position)half_height - shift - x); quad3 = GetBit(BW->bitmap.image, from_x + (Position)half_width - shift - x, from_y + (Position)half_height - shift - y); quad4 = GetBit(BW->bitmap.image, from_x + (Position)half_width - shift - y, from_y + (Position)half_height + x); if (quad1 != quad2) InvertPoint(BW, from_x + (Position)half_width + x, from_y + (Position)half_height + y); if (quad2 != quad3) InvertPoint(BW, from_x + (Position)half_width + y, from_y + (Position)half_height - shift - x); if (quad3 != quad4) InvertPoint(BW, from_x + (Position)half_width - shift - x, from_y + (Position)half_height - shift - y); if (quad4 != quad1) InvertPoint(BW, from_x + (Position)half_width - shift - y, from_y + (Position)half_height + x); } } if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y) && !BWQueryMarked(w)) { hot.x = BW->bitmap.hot.x - half_width; hot.y = BW->bitmap.hot.y - half_height; if (hot.x >= 0) hot.x += shift; if (hot.y >= 0) hot.y += shift; tmp = hot.x; hot.x = - hot.y; hot.y = tmp; if (hot.x > 0) hot.x -= shift; if (hot.y > 0) hot.y -= shift; hot.x += half_width; hot.y += half_height; if (QueryInBitmap(BW, hot.x, hot.y)) BWSetHotSpot(w, hot.x, hot.y); } } void BWRotateLeft(Widget w) { BitmapWidget BW = (BitmapWidget) w; Position x, y,delta, shift, tmp; Position half_width, half_height; XPoint hot; bit quad1, quad2, quad3, quad4; Position from_x, from_y, to_x, to_y; if (BWQueryMarked(w)) { from_x = BW->bitmap.mark.from_x; from_y = BW->bitmap.mark.from_y; to_x = BW->bitmap.mark.to_x; to_y = BW->bitmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = BW->bitmap.width - 1; to_y = BW->bitmap.height - 1; } half_width = floor((to_x - from_x) / 2.0 + 0.5); half_height = floor((to_y - from_y ) / 2.0 + 0.5); shift = min((Position)(to_x - from_x), (Position)(to_y - from_y )) % 2; delta = min((Position) half_width, (Position) half_height) - shift; for (x = 0; x <= delta; x++) { for (y = 1 - shift; y <= delta; y++) { quad1 = GetBit(BW->bitmap.image, from_x + (Position)half_width + x, from_y + (Position)half_height + y); quad2 = GetBit(BW->bitmap.image, from_x + (Position)half_width + y, from_y + (Position)half_height - shift - x); quad3 = GetBit(BW->bitmap.image, from_x + (Position)half_width - shift - x, from_y + (Position)half_height - shift - y); quad4 = GetBit(BW->bitmap.image, from_x + (Position)half_width - shift - y, from_y + (Position)half_height + x); if (quad1 != quad4) InvertPoint(BW, from_x + (Position)half_width + x, from_y + (Position)half_height + y); if (quad2 != quad1) InvertPoint(BW, from_x + (Position)half_width + y, from_y + (Position)half_height - shift - x); if (quad3 != quad2) InvertPoint(BW, from_x + (Position)half_width - shift - x, from_y + (Position)half_height - shift - y); if (quad4 != quad3) InvertPoint(BW, from_x + (Position)half_width - shift - y, from_y + (Position)half_height + x); } } if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y) && !BWQueryMarked(w)) { hot.x = BW->bitmap.hot.x - half_width; hot.y = BW->bitmap.hot.y - half_height; if (hot.x >= 0) hot.x += shift; if (hot.y >= 0) hot.y += shift; tmp = hot.x; hot.x = hot.y; hot.y = - tmp; if (hot.x > 0) hot.x -= shift; if (hot.y > 0) hot.y -= shift; hot.x += half_width; hot.y += half_height; if (QueryInBitmap(BW, hot.x, hot.y)) BWSetHotSpot(w, hot.x, hot.y); } } void CopyImageData(XImage *source, XImage *destination, Position from_x, Position from_y, Position to_x, Position to_y, Position at_x, Position at_y) { Position x, y, delta_x, delta_y; delta_x = to_x - from_x + 1; delta_y = to_y - from_y + 1; for (x = 0; x < delta_x; x++) for (y = 0; y < delta_y; y++) if (GetBit(source, from_x + x, from_y + y)) SetBit(destination, at_x + x, at_y + y); else ClearBit(destination, at_x + x, at_y + y); } XImage * ConvertToBitmapImage(BitmapWidget BW, XImage *image) { XImage *bitmap_image; char *data; Position x, y; data = CreateCleanData(Length(image->width, image->height)); bitmap_image = CreateBitmapImage(BW, data, (Dimension) image->width, (Dimension) image->height); for (x = 0; x < min(image->width, bitmap_image->width); x++) for (y = 0; y < min(image->height, bitmap_image->height); y++) if ((XGetPixel(image, x, y) != 0) != GetBit(bitmap_image, x, y)) InvertBit(bitmap_image, x, y); return bitmap_image; } void TransferImageData(XImage *source, XImage *destination) { Position x, y; for (x = 0; x < min(source->width, destination->width); x++) for (y = 0; y < min(source->height, destination->height); y++) if (GetBit(source, x, y) != GetBit(destination, x, y)) InvertBit(destination, x, y); } void BWStore(Widget w) { BitmapWidget BW = (BitmapWidget) w; Dimension width, height; char *storage_data; if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y)) { DestroyBitmapImage(&BW->bitmap.storage); width = BW->bitmap.mark.to_x - BW->bitmap.mark.from_x + 1; height = BW->bitmap.mark.to_y - BW->bitmap.mark.from_y + 1; storage_data = CreateCleanData(Length(width, height)); BW->bitmap.storage = CreateBitmapImage(BW, storage_data, width, height); CopyImageData(BW->bitmap.image, BW->bitmap.storage, BW->bitmap.mark.from_x, BW->bitmap.mark.from_y, BW->bitmap.mark.to_x, BW->bitmap.mark.to_y, 0, 0); } } void BWClearMarked(Widget w) { BitmapWidget BW = (BitmapWidget) w; if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y)) BWDrawFilledRectangle(w, BW->bitmap.mark.from_x, BW->bitmap.mark.from_y, BW->bitmap.mark.to_x, BW->bitmap.mark.to_y, Clear); } void BWDragMarked(Widget w, Position at_x, Position at_y) { BitmapWidget BW = (BitmapWidget) w; if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y)) BWDrawRectangle(w, at_x, at_y, at_x + BW->bitmap.mark.to_x - BW->bitmap.mark.from_x, at_y + BW->bitmap.mark.to_y - BW->bitmap.mark.from_y, Highlight); } void BWDragStored(Widget w, Position at_x, Position at_y) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.storage) BWDrawRectangle(w, at_x, at_y, at_x + BW->bitmap.storage->width - 1, at_y + BW->bitmap.storage->height - 1, Highlight); } static void DrawImageData(BitmapWidget BW, XImage *image, Position at_x, Position at_y, int value) { Position x, y; Boolean C, S, I, H; bit A, B; C = value == Clear; S = value == Set; I = value == Invert; H = value == Highlight; for (x = 0; x < image->width; x++) for (y = 0; y < image->height; y++) { A = GetBit(image, x, y); B = GetBit(BW->bitmap.image, at_x + x, at_y + y); if ((A & C) | ((A | B) & S) | ((A ^ B) & I) | ((A | B) & H)) value = (A & H) ? Highlight : Set; else value = Clear; BWDrawPoint((Widget) BW, at_x + x, at_y + y, value); } } void BWRestore(Widget w, Position at_x, Position at_y, int value) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.storage) { DrawImageData(BW, BW->bitmap.storage, at_x, at_y, value); /*DestroyBitmapImage(&BW->bitmap.storage);*/ } } void BWCopy(Widget w, Position at_x, Position at_y, int value) { BitmapWidget BW = (BitmapWidget) w; XImage *storage; char *storage_data; Dimension width, height; if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y)) { width = BW->bitmap.mark.to_x - BW->bitmap.mark.from_x + 1; height = BW->bitmap.mark.to_y - BW->bitmap.mark.from_y + 1; storage_data = CreateCleanData(Length(width, height)); storage = CreateBitmapImage(BW, storage_data, width, height); CopyImageData(BW->bitmap.image, storage, BW->bitmap.mark.from_x, BW->bitmap.mark.from_y, BW->bitmap.mark.to_x, BW->bitmap.mark.to_y, 0, 0); DrawImageData(BW, storage, at_x, at_y, value); DestroyBitmapImage(&storage); } } /* void BWMark(); */ void BWMove(Widget w, Position at_x, Position at_y, int value) { BitmapWidget BW = (BitmapWidget) w; XImage *storage; char *storage_data; Dimension width, height; if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y)) { width = BW->bitmap.mark.to_x - BW->bitmap.mark.from_x + 1; height = BW->bitmap.mark.to_y - BW->bitmap.mark.from_y + 1; storage_data = CreateCleanData(Length(width, height)); storage = CreateBitmapImage(BW, storage_data, width, height); CopyImageData(BW->bitmap.image, storage, BW->bitmap.mark.from_x, BW->bitmap.mark.from_y, BW->bitmap.mark.to_x, BW->bitmap.mark.to_y, 0, 0); BWDrawFilledRectangle(w, BW->bitmap.mark.from_x, BW->bitmap.mark.from_y, BW->bitmap.mark.to_x, BW->bitmap.mark.to_y, Clear); DrawImageData(BW, storage, at_x, at_y, value); BWMark(w, at_x, at_y, at_x + BW->bitmap.mark.to_x - BW->bitmap.mark.from_x, at_y + BW->bitmap.mark.to_y - BW->bitmap.mark.from_y); DestroyBitmapImage(&storage); } } void BWRedrawMark(Widget w) { BitmapWidget BW = (BitmapWidget) w; if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y)) XFillRectangle(XtDisplay(BW), XtWindow(BW), BW->bitmap.highlighting_gc, InWindowX(BW, BW->bitmap.mark.from_x), InWindowY(BW, BW->bitmap.mark.from_y), InWindowX(BW, BW->bitmap.mark.to_x + 1) - InWindowX(BW, BW->bitmap.mark.from_x), InWindowY(BW, BW->bitmap.mark.to_y + 1) - InWindowY(BW, BW->bitmap.mark.from_y)); } void BWStoreToBuffer(Widget w) { BitmapWidget BW = (BitmapWidget) w; memmove( BW->bitmap.buffer->data, BW->bitmap.image->data, Length(BW->bitmap.image->width, BW->bitmap.image->height)); BW->bitmap.buffer_hot = BW->bitmap.hot; BW->bitmap.buffer_mark = BW->bitmap.mark; } void BWUnmark(Widget w) { BitmapWidget BW = (BitmapWidget) w; BW->bitmap.buffer_mark = BW->bitmap.mark; if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y)) { XFillRectangle(XtDisplay(BW), XtWindow(BW), BW->bitmap.highlighting_gc, InWindowX(BW, BW->bitmap.mark.from_x), InWindowY(BW, BW->bitmap.mark.from_y), InWindowX(BW, BW->bitmap.mark.to_x + 1) - InWindowX(BW, BW->bitmap.mark.from_x), InWindowY(BW, BW->bitmap.mark.to_y + 1) - InWindowY(BW, BW->bitmap.mark.from_y)); BW->bitmap.mark.from_x = BW->bitmap.mark.from_y = NotSet; BW->bitmap.mark.to_x = BW->bitmap.mark.to_y = NotSet; } } void BWMark(Widget w, Position from_x, Position from_y, Position to_x, Position to_y) { BitmapWidget BW = (BitmapWidget) w; BWUnmark(w); if (QuerySet(from_x, from_y)) { if ((from_x == to_x) && (from_y == to_y)) { /* BW->bitmap.mark.from_x = 0; BW->bitmap.mark.from_y = 0; BW->bitmap.mark.to_x = BW->bitmap.image->width - 1; BW->bitmap.mark.to_y = BW->bitmap.image->height - 1; */ return; } else { QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); from_x = max(0, from_x); from_y = max(0, from_y); to_x = min(BW->bitmap.image->width - 1, to_x); to_y = min(BW->bitmap.image->height - 1, to_y); BW->bitmap.mark.from_x = from_x; BW->bitmap.mark.from_y = from_y; BW->bitmap.mark.to_x = to_x; BW->bitmap.mark.to_y = to_y; } XFillRectangle(XtDisplay(BW), XtWindow(BW), BW->bitmap.highlighting_gc, InWindowX(BW, BW->bitmap.mark.from_x), InWindowY(BW, BW->bitmap.mark.from_y), InWindowX(BW, BW->bitmap.mark.to_x + 1) - InWindowX(BW, BW->bitmap.mark.from_x), InWindowY(BW, BW->bitmap.mark.to_y +1) - InWindowY(BW, BW->bitmap.mark.from_y)); } } void BWMarkAll(Widget w) { BitmapWidget BW = (BitmapWidget) w; BWMark(w, 0, 0, BW->bitmap.image->width - 1, BW->bitmap.image->height - 1); } void BWUndo(Widget w) { BitmapWidget BW = (BitmapWidget) w; Position x, y; char *tmp_data; XPoint tmp_hot; BWArea tmp_mark; tmp_data = BW->bitmap.image->data; BW->bitmap.image->data = BW->bitmap.buffer->data; BW->bitmap.buffer->data = tmp_data; tmp_hot = BW->bitmap.hot; tmp_mark = BW->bitmap.mark; for (x = 0; x < BW->bitmap.image->width; x++) for (y = 0; y < BW->bitmap.image->height; y++) if (GetBit(BW->bitmap.image, x, y) != GetBit(BW->bitmap.buffer, x, y)) DrawSquare(BW, x, y); BWSetHotSpot(w, BW->bitmap.buffer_hot.x, BW->bitmap.buffer_hot.y); /* BWMark(w, BW->bitmap.buffer_mark.from_x, BW->bitmap.buffer_mark.from_y, BW->bitmap.buffer_mark.to_x, BW->bitmap.buffer_mark.to_y); */ BW->bitmap.buffer_hot = tmp_hot; BW->bitmap.buffer_mark= tmp_mark; } void BWHighlightAxes(Widget w) { BitmapWidget BW = (BitmapWidget) w; XDrawLine(XtDisplay(BW), XtWindow(BW), BW->bitmap.axes_gc, InWindowX(BW, 0), InWindowY(BW, 0), InWindowX(BW, BW->bitmap.width), InWindowY(BW, BW->bitmap.height)); XDrawLine(XtDisplay(BW), XtWindow(BW), BW->bitmap.axes_gc, InWindowX(BW, BW->bitmap.width), InWindowY(BW, 0), InWindowX(BW, 0), InWindowY(BW, BW->bitmap.height)); XDrawLine(XtDisplay(BW), XtWindow(BW), BW->bitmap.axes_gc, InWindowX(BW, 0), InWindowY(BW, (float)BW->bitmap.height / 2.0), InWindowX(BW, BW->bitmap.width), InWindowY(BW, (float)BW->bitmap.height / 2.0)); XDrawLine(XtDisplay(BW), XtWindow(BW), BW->bitmap.axes_gc, InWindowX(BW, (float)BW->bitmap.width / 2.0), InWindowY(BW, 0), InWindowX(BW, (float)BW->bitmap.width / 2.0), InWindowY(BW, BW->bitmap.height)); } typedef struct { Position *x, *y; Dimension *width, *height; } Table; XImage * ScaleBitmapImage(BitmapWidget BW, XImage *src, double scale_x, double scale_y) { char *data; XImage *dst; Table table; Position x, y, w, h; Dimension width, height; bit pixel; width = max(rint(scale_x * src->width), 1); height = max(rint(scale_y * src->height), 1); data = CreateCleanData(Length(width, height)); dst = CreateBitmapImage(BW, data, width, height); /* * It would be nice to check if width or height < 1.0 and * average the skipped pixels. But, it is slow as it is now. */ if (scale_x == 1.0 && scale_y == 1.0) memmove( dst->data, src->data, Length(width, height)); else { table.x = (Position *) XtMalloc(sizeof(Position) * src->width); table.y = (Position *) XtMalloc(sizeof(Position) * src->height); table.width = (Dimension *) XtMalloc(sizeof(Dimension) * src->width); table.height = (Dimension *) XtMalloc(sizeof(Dimension) * src->height); for (x = 0; x < src->width; x++) { table.x[x] = rint(scale_x * x); table.width[x] = rint(scale_x * (x + 1)) - rint(scale_x * x); } for (y = 0; y < src->height; y++) { table.y[y] = rint(scale_y * y); table.height[y] = rint(scale_y * (y + 1)) - rint(scale_y * y); } for (x = 0; x < src->width; x++) for (y = 0; y < src->height; y++) { pixel = GetBit(src, x, y); for (w = 0; (int)w < (int)table.width[x]; w++) for (h = 0; (int)h < (int)table.height[y]; h++) if (pixel) SetBit(dst, table.x[x] + w, table.y[y] + h); } XtFree((char *)table.x); XtFree((char *)table.y); XtFree((char *)table.width); XtFree((char *)table.height); } return (dst); } /*****************************************************************************/ x11-apps-7.7+5+nmu1ubuntu1/bitmap/Fold0000664000000000000000000000147012456374665014300 0ustar #define Fold_width 30 #define Fold_height 30 static char Fold_bits[] = { 0xff, 0x3f, 0xff, 0x3f, 0xff, 0xff, 0xff, 0x3f, 0x57, 0xf5, 0xab, 0x3a, 0xab, 0xff, 0x7f, 0x35, 0xd7, 0x3f, 0xff, 0x3a, 0xab, 0x03, 0x70, 0x35, 0x57, 0x07, 0xb8, 0x3a, 0xbb, 0x0e, 0x5c, 0x37, 0x7f, 0x1d, 0xae, 0x3f, 0xfb, 0x3a, 0xd7, 0x37, 0xdf, 0xf5, 0xeb, 0x3e, 0x9b, 0xeb, 0x75, 0x36, 0x1f, 0xd7, 0x3a, 0x3e, 0x1f, 0xae, 0x1d, 0x3e, 0x0e, 0xfc, 0x0e, 0x1c, 0x0e, 0xdc, 0x0f, 0x1c, 0x1f, 0x6e, 0x1d, 0x3e, 0x1f, 0xd7, 0x3a, 0x3e, 0x9b, 0xeb, 0x75, 0x36, 0xdf, 0xf5, 0xeb, 0x3e, 0xfb, 0x3a, 0xd7, 0x37, 0x7f, 0x1d, 0xae, 0x3f, 0xbb, 0x0e, 0x5c, 0x37, 0x57, 0x07, 0xb8, 0x3a, 0xab, 0x03, 0x70, 0x35, 0xd7, 0x3f, 0xff, 0x3a, 0xab, 0xff, 0x7f, 0x35, 0x57, 0xf5, 0xab, 0x3a, 0xff, 0xff, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f}; x11-apps-7.7+5+nmu1ubuntu1/bitmap/AUTHORS0000664000000000000000000000012112456374665014531 0ustar bitmap: Davor Matic, MIT X Consortium atobm/bmtoa: Jim Fulton, MIT X Consortium x11-apps-7.7+5+nmu1ubuntu1/bitmap/man/0000775000000000000000000000000012656635743014241 5ustar x11-apps-7.7+5+nmu1ubuntu1/bitmap/man/bitmap.man0000664000000000000000000005756612456374665016236 0ustar .\" Copyright 1993, 1998 The Open Group .\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" .\" .TH BITMAP 1 __xorgversion__ .SH NAME bitmap, bmtoa, atobm \- bitmap editor and converter utilities for the X Window System .SH SYNOPSIS .B bitmap [ .I \-options \&.\|.\|. ] [ .I filename ] [ .I basename ] .sp .B bmtoa [ .B \-chars \&.\|.\|. ] [ .I filename ] .sp .B atobm [ .B \-chars .I cc ] [ .B \-name .I variable ] [ .B \-xhot .I number ] [ .B \-yhot .I number ] [ .I filename ] .SH DESCRIPTION The \fIbitmap\fP program is a rudimentary tool for creating or editing rectangular images made up of 1's and 0's. Bitmaps are used in X for defining clipping regions, cursor shapes, icon shapes, and tile and stipple patterns. .PP The \fIbmtoa\fP and \fIatobm\fP filters convert \fIbitmap\fP files (FILE FORMAT) to and from ASCII strings. They are most commonly used to quickly print out bitmaps and to generate versions for including in text. .SH COMMAND LINE OPTIONS \fIBitmap\fP supports the standard X Toolkit command line arguments (see \fIX\fP(__miscmansuffix__)). The following additional arguments are supported as well. .TP 4 .B \-size\fI WIDTHxHEIGHT\fP Specifies size of the grid in squares. .TP 4 .B \-sw\fI dimension\fP Specifies the width of squares in pixels. .TP 4 .B \-sh\fI dimension\fP Specifies the height of squares in pixels. .TP 4 .B \-gt\fI dimension\fP Grid tolerance. If the square dimensions fall below the specified value, grid will be automatically turned off. .TP 4 .B \-grid, +grid Turns on or off the grid lines. .TP 4 .B \-axes, +axes Turns on or off the major axes. .TP 4 .B \-dashed, +dashed Turns on or off dashing for the frame and grid lines. .TP 4 .B \-stippled, +stippled Turns on or off stippling of highlighted squares. .TP 4 .B \-proportional, +proportional Turns proportional mode on or off. If proportional mode is on, square width is equal to square height. If proportional mode is off,\fI bitmap\fP will use the smaller square dimension, if they were initially different. .TP 4 .B \-dashes\fI filename\fP Specifies the bitmap to be used as a stipple for dashing. .TP 4 .B \-stipple\fI filename\fP Specifies the bitmap to be used as a stipple for highlighting. .TP 4 .B \-hl\fI color\fP Specifies the color used for highlighting. .TP 4 .B \-fr\fI color\fP Specifies the color used for the frame and grid lines. .TP 4 .B filename Specifies the bitmap to be initially loaded into the program. If the file does not exist,\fI bitmap\fP will assume it is a new file. .TP 4 .B basename Specifies the basename to be used in the C code output file. If it is different than the basename in the working file,\fI bitmap\fP will change it when saving the file. .PP \fIBmtoa\fP accepts the following option: .TP 4 .B \-chars \fIcc\fP This option specifies the pair of characters to use in the string version of the bitmap. The first character is used for 0 bits and the second character is used for 1 bits. The default is to use dashes (\-) for 0's and sharp signs (#) for 1's. .PP \fIAtobm\fP accepts the following options: .TP 4 .B \-chars \fIcc\fP This option specifies the pair of characters to use when converting string bitmaps into arrays of numbers. The first character represents a 0 bit and the second character represents a 1 bit. The default is to use dashes (\-) for 0's and sharp signs (#) for 1's. .TP 4 .B \-name \fIvariable\fP This option specifies the variable name to be used when writing out the bitmap file. The default is to use the basename of the \fIfilename\fP command line argument or leave it blank if the standard input is read. .TP 4 .B \-xhot \fInumber\fP This option specifies the X coordinate of the hotspot. Only positive values are allowed. By default, no hotspot information is included. .TP 4 .B \-yhot \fInumber\fP This option specifies the Y coordinate of the hotspot. Only positive values are allowed. By default, no hotspot information is included. .SH USAGE \fIBitmap\fP displays grid in which each square represents a single bit in the picture being edited. Actual size of the bitmap image, as it would appear normally and inverted, can be obtained by pressing\fB Meta-I\fP key. You are free to move the image popup out of the way to continue editing. Pressing the left mouse button in the popup window or\fB Meta-I\fP again will remove the real size bitmap image. .PP If the bitmap is to be used for defining a cursor, one of the squares in the images may be designated as the hot spot. This determines where the cursor is actually pointing. For cursors with sharp tips (such as arrows or fingers), this is usually at the end of the tip; for symmetric cursors (such as crosses or bullseyes), this is usually at the center. .PP Bitmaps are stored as small C code fragments suitable for including in applications. They provide an array of bits as well as symbolic constants giving the width, height, and hot spot (if specified) that may be used in creating cursors, icons, and tiles. .SH EDITING To edit a bitmap image simply click on one of the buttons with drawing commands (\fBPoint, Curve, Line, Rectangle,\fP etc.) and move the pointer into the bitmap grid window. Press one of the buttons on your mouse and the appropriate action will take place. You can either set, clear or invert the gird squares. Setting a grid square corresponds to setting a bit in the bitmap image to 1. Clearing a grid square corresponds to setting a bit in the bitmap image to 0. Inverting a grid square corresponds to changing a bit in the bitmap image from 0 to 1 or 1 to 0, depending what its previous state was. The default behavior of mouse buttons is as specified below. .sp .nf MouseButton1 Set MouseButton2 Invert MouseButton3 Clear MouseButton4 Clear MouseButton5 Clear .fi .sp This default behavior can be changed by setting the button function resources. An example is provided below. .sp .nf bitmap*button1Function: Set bitmap*button2Function: Clear bitmap*button3Function: Invert etc. .fi .sp The button function applies to all drawing commands, including copying, moving and pasting, flood filling and setting the hot spot. .SH DRAWING COMMANDS Here is the list of drawing commands accessible through the buttons at the left side of the application's window. Some commands can be aborted by pressing A inside the bitmap window, allowing the user to select different guiding points where applicable. .TP 4 .B Clear This command clears all bits in the bitmap image. The grid squares will be set to the background color. Pressing C inside the bitmap window has the same effect. .TP 4 .B Set This command sets all bits in the bitmap image. The grid squares will be set to the foreground color. Pressing S inside the bitmap window has the same effect. .TP 4 .B Invert This command inverts all bits in the bitmap image. The grid squares will be inverted appropriately. Pressing I inside the bitmap window has the same effect. .TP 4 .B Mark This command is used to mark an area of the grid by dragging out a rectangular shape in the highlighting color. Once the area is marked, it can be operated on by a number of commands (see \fBUp, Down, Left, Right, Rotate, Flip, Cut,\fP etc.) Only one marked area can be present at any time. If you attempt to mark another area, the old mark will vanish. The same effect can be achieved by pressing\fB Shift-MouseButton1\fP and dragging out a rectangle in the grid window. Pressing\fB Shift-MouseButton2\fP will mark the entire grid area. .TP 4 .B Unmark This command will cause the marked area to vanish. The same effect can be achieved by pressing\fB Shift-MouseButton3\fP. .TP 4 .B Copy This command is used to copy an area of the grid from one location to another. If there is no marked grid area displayed,\fB Copy\fP behaves just like\fB Mark\fP described above. Once there is a marked grid area displayed in the highlighting color, this command has two alternative behaviors. If you click a mouse button inside the marked area, you will be able to drag the rectangle that represents the marked area to the desired location. After you release the mouse button, the area will be copied. If you click outside the marked area,\fB Copy\fP will assume that you wish to mark a different region of the bitmap image, thus it will behave like\fB Mark\fP again. .TP 4 .B Move This command is used to move an area of the grid from one location to another. Its behavior resembles the behavior of\fB Copy\fP command, except that the marked area will be moved instead of copied. .TP 4 .B Flip Horizontally This command will flip the bitmap image with respect to the horizontal axes. If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing H inside the bitmap window has the same effect. .TP 4 .B Up This command moves the bitmap image one pixel up. If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing UpArrow inside the bitmap window has the same effect. .TP 4 .B Flip Vertically This command will flip the bitmap image with respect to the vertical axes. If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing V inside the bitmap window has the same effect. .TP 4 .B Left This command moves the bitmap image one pixel to the left. If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing LeftArrow inside the bitmap window has the same effect. .TP 4 .B Fold This command will fold the bitmap image so that the opposite corners become adjacent. This is useful when creating bitmap images for tiling. Pressing F inside the bitmap window has the same effect. .TP 4 .B Right This command moves the bitmap image one pixel to the right. If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing RightArrow inside the bitmap window has the same effect. .TP 4 .B Rotate Left This command rotates the bitmap image 90 degrees to the left (counter clockwise.) If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing L inside the bitmap window has the same effect. .TP 4 .B Down This command moves the bitmap image one pixel down. If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing DownArrow inside the bitmap window has the same effect. .TP 4 .B Rotate Right This command rotates the bitmap image 90 degrees to the right (clockwise.) If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing R inside the bitmap window has the same effect. .TP 4 .B Point This command will change the grid squares underneath the mouse pointer if a mouse button is being pressed down. If you drag the mouse button continuously, the line may not be continuous, depending on the speed of your system and frequency of mouse motion events. .TP 4 .B Curve This command will change the grid squares underneath the mouse pointer if a mouse button is being pressed down. If you drag the mouse button continuously, it will make sure that the line is continuous. If your system is slow or\fI bitmap\fP receives very few mouse motion events, it might behave quite strangely. .TP 4 .B Line This command will change the gird squares in a line between two squares. Once you press a mouse button in the grid window,\fI bitmap\fP will highlight the line from the square where the mouse button was initially pressed to the square where the mouse pointer is located. By releasing the mouse button you will cause the change to take effect, and the highlighted line will disappear. .TP 4 .B Rectangle This command will change the gird squares in a rectangle between two squares. Once you press a mouse button in the grid window,\fI bitmap\fP will highlight the rectangle from the square where the mouse button was initially pressed to the square where the mouse pointer is located. By releasing the mouse button you will cause the change to take effect, and the highlighted rectangle will disappear. .TP 4 .B Filled Rectangle This command is identical to\fB Rectangle\fP, except at the end the rectangle will be filled rather than outlined. .TP 4 .B Circle This command will change the gird squares in a circle between two squares. Once you press a mouse button in the grid window,\fI bitmap\fP will highlight the circle from the square where the mouse button was initially pressed to the square where the mouse pointer is located. By releasing the mouse button you will cause the change to take effect, and the highlighted circle will disappear. .TP 4 .B Filled Circle This command is identical to\fB Circle\fP, except at the end the circle will be filled rather than outlined. .TP 4 .B Flood Fill This command will flood fill the connected area underneath the mouse pointer when you click on the desired square. Diagonally adjacent squares are not considered to be connected. .TP 4 .B Set Hot Spot This command designates one square in the grid as the hot spot if this bitmap image is to be used for defining a cursor. Pressing a mouse button in the desired square will cause a diamond shape to be displayed. .TP 4 .B Clear Hot Spot This command removes any designated hot spot from the bitmap image. .TP 4 .B Undo This command will undo the last executed command. It has depth one, that is, pressing\fB Undo\fP after\fB Undo\fP will undo itself. .SH FILE MENU The File menu commands can be accessed by pressing the File button and selecting the appropriate menu entry, or by pressing Ctrl key with another key. These commands deal with files and global bitmap parameters, such as size, basename, filename etc. .TP 4 .B New This command will clear the editing area and prompt for the name of the new file to be edited. It will not load in the new file. .TP 4 .B Load This command is used to load a new bitmap file into the bitmap editor. If the current image has not been saved, user will be asked whether to save or ignore the changes. The editor can edit only one file at a time. If you need interactive editing, run a number of editors and use cut and paste mechanism as described below. .TP 4 .B Insert This command is used to insert a bitmap file into the image being currently edited. After being prompted for the filename, click inside the grid window and drag the outlined rectangle to the location where you want to insert the new file. .TP 4 .B Save This command will save the bitmap image. It will not prompt for the filename unless it is said to be . If you leave the filename undesignated or \-, the output will be piped to stdout. .TP 4 .B Save As This command will save the bitmap image after prompting for a new filename. It should be used if you want to change the filename. .TP 4 .B Resize This command is used to resize the editing area to the new number of pixels. The size should be entered in the WIDTHxHEIGHT format. The information in the image being edited will not be lost unless the new size is smaller that the current image size. The editor was not designed to edit huge files. .TP 4 .B Rescale This command is used to rescale the editing area to the new width and height. The size should be entered in the WIDTHxHEIGHT format. It will not do antialiasing and information will be lost if you rescale to the smaller sizes. Feel free to add you own algorithms for better rescaling. .TP 4 .B Filename This command is used to change the filename without changing the basename nor saving the file. If you specify \- for a filename, the output will be piped to stdout. .TP 4 .B Basename This command is used to change the basename, if a different one from the specified filename is desired. .TP 4 .B Quit This command will terminate the bitmap application. If the file was not saved, user will be prompted and asked whether to save the image or not. This command is preferred over killing the process. .SH EDIT MENU The Edit menu commands can be accessed by pressing the Edit button and selecting the appropriate menu entry, or by pressing Meta key with another key. These commands deal with editing facilities such as grid, axes, zooming, cut and paste, etc. .TP 4 .B Image This command will display the image being edited and its inverse in its actual size in a separate window. The window can be moved away to continue with editing. Pressing the left mouse button in the image window will cause it to disappear from the screen. .TP 4 .B Grid This command controls the grid in the editing area. If the grid spacing is below the value specified by gridTolerance resource (8 by default), the grid will be automatically turned off. It can be enforced by explicitly activating this command. .TP 4 .B Dashed This command controls the stipple for drawing the grid lines. The stipple specified by dashes resource can be turned on or off by activating this command. .TP 4 .B Axes This command controls the highlighting of the main axes of the image being edited. The actual lines are not part of the image. They are provided to aid user when constructing symmetrical images, or whenever having the main axes highlighted helps your editing. .TP 4 .B Stippled This command controls the stippling of the highlighted areas of the bitmap image. The stipple specified by stipple resource can be turned on or off by activating this command. .TP 4 .B Proportional This command controls the proportional mode. If the proportional mode is on, width and height of all image squares are forced to be equal, regardless of the proportions of the bitmap window. .TP 4 .B Zoom This command controls the zoom mode. If there is a marked area of the image already displayed, bitmap will automatically zoom into it. Otherwise, user will have to highlight an area to be edited in the zoom mode and bitmap will automatically switch into it. One can use all the editing commands and other utilities in the zoom mode. When you zoom out, undo command will undo the whole zoom session. .TP 4 .B Cut This commands cuts the contents of the highlighted image area into the internal cut and paste buffer. .TP 4 .B Copy This command copies the contents of the highlighted image area into the internal cut and paste buffer. .TP 4 .B Paste This command will check if there are any other bitmap applications with a highlighted image area, or if there is something in the internal cut and paste buffer and copy it to the image. To place the copied image, click in the editing window and drag the outlined image to the position where you want to place i, and then release the button. .SH CUT AND PASTE Bitmap supports two cut and paste mechanisms; the internal cut and paste and the global X selection cut and paste. The internal cut and paste is used when executing copy and move drawing commands and also cut and copy commands from the edit menu. The global X selection cut and paste is used whenever there is a highlighted area of a bitmap image displayed anywhere on the screen. To copy a part of image from another bitmap editor simply highlight the desired area by using the Mark command or pressing the shift key and dragging the area with the left mouse button. When the selected area becomes highlighted, any other applications (such as xterm, etc.) that use primary selection will discard their selection values and unhighlight the appropriate information. Now, use the Paste command for the Edit menu or control mouse button to copy the selected part of image into another (or the same) bitmap application. If you attempt to do this without a visible highlighted image area, the bitmap will fall back to the internal cut and paste buffer and paste whatever was there stored at the moment. .SH WIDGETS Below is the widget structure of the \fIbitmap\fP application. Indentation indicates hierarchical structure. The widget class name is given first, followed by the widget instance name. All widgets except the bitmap widget are from the standard Athena widget set. .sp .nf Bitmap bitmap TransientShell image Box box Label normalImage Label invertedImage TransientShell input Dialog dialog Command okay Command cancel TransientShell error Dialog dialog Command abort Command retry TransientShell qsave Dialog dialog Command yes Command no Command cancel Paned parent Form formy MenuButton fileButton SimpleMenu fileMenu SmeBSB new SmeBSB load SmeBSB insert SmeBSB save SmeBSB saveAs SmeBSB resize SmeBSB rescale SmeBSB filename SmeBSB basename SmeLine line SmeBSB quit MenuButton editButton SimpleMenu editMenu SmeBSB image SmeBSB grid SmeBSB dashed SmeBSB axes SmeBSB stippled SmeBSB proportional SmeBSB zoom SmeLine line SmeBSB cut SmeBSB copy SmeBSB paste Label status Pane pane Bitmap bitmap Form form Command clear Command set Command invert Toggle mark Command unmark Toggle copy Toggle move Command flipHoriz Command up Command flipVert Command left Command fold Command right Command rotateLeft Command down Command rotateRight Toggle point Toggle curve Toggle line Toggle rectangle Toggle filledRectangle Toggle circle Toggle filledCircle Toggle floodFill Toggle setHotSpot Command clearHotSpot Command undo .fi .SH COLORS If you would like bitmap to be viewable in color, include the following in the #ifdef COLOR section of the file you read with xrdb: .sp 1 *customization: \-color .sp 1 .br This will cause bitmap to pick up the colors in the app-defaults color customization file: .sp 1 __apploaddir__/Bitmap-color .sp 1 .fi .SH BITMAP WIDGET Bitmap widget is a stand-alone widget for editing raster images. It is not designed to edit large images, although it may be used in that purpose as well. It can be freely incorporated with other applications and used as a standard editing tool. The following are the resources provided by the bitmap widget. .sp .TS lb lb l l. Bitmap Widget Header file Bitmap.h Class bitmapWidgetClass Class Name Bitmap Superclass Bitmap .TE All the Simple Widget resources plus .\|.\|. .TS lb lb lb lb lb l l l l l. Name Class Type Default Value foreground Foreground Pixel XtDefaultForeground highlight Highlight Pixel XtDefaultForeground framing Framing Pixel XtDefaultForeground gridTolerance GridTolerance Dimension 8 size Size String 32x32 dashed Dashed Boolean True grid Grid Boolean True stippled Stippled Boolean True proportional Proportional Boolean True axes Axes Boolean False squareWidth SquareWidth Dimension 16 squareHeight SquareHeight Dimension 16 margin Margin Dimension 16 xHot XHot Position NotSet (\-1) yHot YHot Position NotSet (\-1) button1Function Button1Function DrawingFunction Set button2Function Button2Function DrawingFunction Invert button3Function Button3Function DrawingFunction Clear button4Function Button4Function DrawingFunction Invert button5Function Button5Function DrawingFunction Invert filename Filename String None ("") basename Basename String None ("") .TE .SH AUTHOR Davor Matic, MIT X Consortium x11-apps-7.7+5+nmu1ubuntu1/bitmap/man/atobm.man0000664000000000000000000000006012456374665016035 0ustar .so man__appmansuffix__/bitmap.__appmansuffix__ x11-apps-7.7+5+nmu1ubuntu1/bitmap/man/bmtoa.man0000664000000000000000000000006012456374665016035 0ustar .so man__appmansuffix__/bitmap.__appmansuffix__ x11-apps-7.7+5+nmu1ubuntu1/bitmap/man/Makefile.am0000664000000000000000000000277412456374665016310 0ustar # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice (including the next # paragraph) shall be included in all copies or substantial portions of the # Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. # appmandir = $(APP_MAN_DIR) appman_PRE = bitmap.man atobm.man bmtoa.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure SUFFIXES = .$(APP_MAN_SUFFIX) .man .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/bitmap/Bitmap.c0000664000000000000000000014457012456374665015062 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Davor Matic, MIT X Consortium */ #include #include #include #include #include #include #include #include #include "BitmapP.h" #include "Bitmap.h" #include #include #include #define min(x, y) ((((int)(x)) < (int)(y)) ? (x) : (y)) #define max(x, y) ((((int)(x)) > (int)(y)) ? (x) : (y)) Boolean DEBUG; #define DefaultGridTolerance 8 #define DefaultBitmapSize "16x16" #define FallbackBitmapWidth 16 #define FallbackBitmapHeight 16 #define DefaultGrid TRUE #define DefaultDashed TRUE #define DefaultStippled TRUE #define DefaultProportional TRUE #define DefaultAxes FALSE #define DefaultMargin 16 #define DefaultSquareWidth 16 #define DefaultSquareHeight 16 #define DefaultFilename "" #define Offset(field) XtOffsetOf(BitmapRec, bitmap.field) static XtResource resources[] = { {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), Offset(foreground_pixel), XtRString, XtDefaultForeground}, {XtNhighlight, XtCHighlight, XtRPixel, sizeof(Pixel), Offset(highlight_pixel), XtRString, XtDefaultForeground}, {XtNframe, XtCFrame, XtRPixel, sizeof(Pixel), Offset(frame_pixel), XtRString, XtDefaultForeground}, {XtNgridTolerance, XtCGridTolerance, XtRDimension, sizeof(Dimension), Offset(grid_tolerance), XtRImmediate, (XtPointer) DefaultGridTolerance}, {XtNsize, XtCSize, XtRString, sizeof(String), Offset(size), XtRImmediate, (XtPointer) DefaultBitmapSize}, {XtNdashed, XtCDashed, XtRBoolean, sizeof(Boolean), Offset(dashed), XtRImmediate, (XtPointer) DefaultDashed}, {XtNgrid, XtCGrid, XtRBoolean, sizeof(Boolean), Offset(grid), XtRImmediate, (XtPointer) DefaultGrid}, {XtNstippled, XtCStippled, XtRBoolean, sizeof(Boolean), Offset(stippled), XtRImmediate, (XtPointer) DefaultStippled}, {XtNproportional, XtCProportional, XtRBoolean, sizeof(Boolean), Offset(proportional), XtRImmediate, (XtPointer) DefaultProportional}, {XtNaxes, XtCAxes, XtRBoolean, sizeof(Boolean), Offset(axes), XtRImmediate, (XtPointer) DefaultAxes}, {XtNsquareWidth, XtCSquareWidth, XtRDimension, sizeof(Dimension), Offset(squareW), XtRImmediate, (XtPointer) DefaultSquareWidth}, {XtNsquareHeight, XtCSquareHeight, XtRDimension, sizeof(Dimension), Offset(squareH), XtRImmediate, (XtPointer) DefaultSquareHeight}, {XtNmargin, XtCMargin, XtRDimension, sizeof(Dimension), Offset(margin), XtRImmediate, (XtPointer) DefaultMargin}, {XtNxHot, XtCXHot, XtRPosition, sizeof(Position), Offset(hot.x), XtRImmediate, (XtPointer) NotSet}, {XtNyHot, XtCYHot, XtRPosition, sizeof(Position), Offset(hot.y), XtRImmediate, (XtPointer) NotSet}, {XtNbutton1Function, XtCButton1Function, XtRButtonFunction, sizeof(int), Offset(button_function[0]), XtRImmediate, (XtPointer) Set}, {XtNbutton2Function, XtCButton2Function, XtRButtonFunction, sizeof(int), Offset(button_function[1]), XtRImmediate, (XtPointer) Invert}, {XtNbutton3Function, XtCButton3Function, XtRButtonFunction, sizeof(int), Offset(button_function[2]), XtRImmediate, (XtPointer) Clear}, {XtNbutton4Function, XtCButton4Function, XtRButtonFunction, sizeof(int), Offset(button_function[3]), XtRImmediate, (XtPointer) Clear}, {XtNbutton5Function, XtCButton5Function, XtRButtonFunction, sizeof(int), Offset(button_function[4]), XtRImmediate, (XtPointer) Clear}, {XtNfilename, XtCFilename, XtRString, sizeof(String), Offset(filename), XtRImmediate, (XtPointer) DefaultFilename}, {XtNbasename, XtCBasename, XtRString, sizeof(String), Offset(basename), XtRImmediate, (XtPointer) DefaultFilename}, {XtNdashes, XtCDashes, XtRBitmap, sizeof(Pixmap), Offset(dashes), XtRImmediate, (XtPointer) XtUnspecifiedPixmap}, {XtNstipple, XtCStipple, XtRBitmap, sizeof(Pixmap), Offset(stipple), XtRImmediate, (XtPointer) XtUnspecifiedPixmap}, }; #undef Offset static XtActionsRec actions[] = { {"mark", (XtActionProc)BWTMark}, {"mark-all", (XtActionProc)BWTMarkAll}, {"unmark", (XtActionProc)BWTUnmark}, {"paste", (XtActionProc)BWTPaste}, {"bw-debug", (XtActionProc)BWDebug}, {"abort", (XtActionProc)BWAbort}, {"store-to-buffer", (XtActionProc)BWStoreToBuffer}, {"change-notify", (XtActionProc)BWChangeNotify}, {"set-changed", (XtActionProc)BWSetChanged}, {"up", (XtActionProc)BWUp}, {"down", (XtActionProc)BWDown}, {"left", (XtActionProc)BWLeft}, {"right", (XtActionProc)BWRight}, {"fold", (XtActionProc)BWFold}, {"flip-horiz", (XtActionProc)BWFlipHoriz}, {"flip-vert", (XtActionProc)BWFlipVert}, {"rotate-right", (XtActionProc)BWRotateRight}, {"rotate-left", (XtActionProc)BWRotateLeft}, {"set", (XtActionProc)BWSet}, {"clear", (XtActionProc)BWClear}, {"invert", (XtActionProc)BWInvert}, {"undo", (XtActionProc)BWUndo}, {"redraw", (XtActionProc)BWRedraw}, }; static char translations1[] = "\ Shift: mark()\n\ Shift: mark-all()\n\ Shift: unmark()\n\ Ctrl: paste()\n\ Ctrll: redraw()\n\ d: bw-debug()\n\ a: abort()\n\ Up: store-to-buffer()\ up()\ change-notify()\ set-changed()\n\ KP_Up: store-to-buffer()\ up()\ change-notify()\ set-changed()\n\ Down: store-to-buffer()\ down()\ change-notify()\ set-changed()\n\ KP_Down: store-to-buffer()\ down()\ change-notify()\ set-changed()\n\ Left: store-to-buffer()\ left()\ change-notify()\ set-changed()\n\ KP_Left: store-to-buffer()\ left()\ change-notify()\ set-changed()\n\ Right: store-to-buffer()\ right()\ change-notify()\ set-changed()\n\ KP_Right: store-to-buffer()\ right()\ change-notify()\ set-changed()\n\ f: store-to-buffer()\ fold()\ change-notify()\ set-changed()\n\ h: store-to-buffer()\ flip-horiz()\ change-notify()\ set-changed()\n\ "; static char translations2[] = "v: store-to-buffer()\ flip-vert()\ change-notify()\ set-changed()\n\ r: store-to-buffer()\ rotate-right()\ change-notify()\ set-changed()\n\ l: store-to-buffer()\ rotate-left()\ change-notify()\ set-changed()\n\ s: store-to-buffer()\ set()\ change-notify()\ set-changed()\n\ c: store-to-buffer()\ clear()\ change-notify()\ set-changed()\n\ i: store-to-buffer()\ invert()\ change-notify()\ set-changed()\n\ u: undo()\ change-notify()\ set-changed()\n\ "; static Atom targets[] = { XA_BITMAP, XA_PIXMAP }; #include "Requests.h" static BWRequestRec requests[] = { {MarkRequest, sizeof(BWStatus), TwoPointsEngage, (XtPointer) BWDrawRectangle, TwoPointsTerminateTimed, (XtPointer) BWSelect, NULL, (XtPointer) NULL}, {RestoreRequest, sizeof(BWStatus), OnePointEngage, (XtPointer) BWDragStored, OnePointTerminate, (XtPointer) BWRestore, NULL, (XtPointer) NULL}, {ImmediateCopyRequest, sizeof(BWStatus), OnePointEngage, (XtPointer) BWDragMarked, OnePointTerminate, (XtPointer) BWCopy, NULL, (XtPointer) NULL}, {ImmediateMoveRequest, sizeof(BWStatus), OnePointEngage, (XtPointer) BWDragMarked, OnePointTerminate, (XtPointer) BWMove, NULL, (XtPointer) NULL}, {CopyRequest, sizeof(BWStatus), DragOnePointEngage, (XtPointer) Paste, DragOnePointTerminate, (XtPointer) ImmediateCopyRequest, Interface, (XtPointer) BWUnmark}, {MoveRequest, sizeof(BWStatus), DragOnePointEngage, (XtPointer) Paste, DragOnePointTerminate, (XtPointer) ImmediateMoveRequest, Interface, (XtPointer) BWUnmark}, {PointRequest, sizeof(BWStatus), DragOnePointEngage, (XtPointer) BWDrawPoint, DragOnePointTerminate, (XtPointer) BWDrawPoint, NULL, (XtPointer) NULL}, {CurveRequest, sizeof(BWStatus), DragTwoPointsEngage, (XtPointer) BWBlindLine, DragTwoPointsTerminate, (XtPointer) BWBlindLine, NULL, (XtPointer) NULL}, {LineRequest, sizeof(BWStatus), TwoPointsEngage, (XtPointer) BWDrawLine, TwoPointsTerminate, (XtPointer) BWDrawLine, NULL, (XtPointer) NULL}, {RectangleRequest, sizeof(BWStatus), TwoPointsEngage, (XtPointer) BWDrawRectangle, TwoPointsTerminate, (XtPointer) BWDrawRectangle, NULL, (XtPointer) NULL}, {FilledRectangleRequest, sizeof(BWStatus), TwoPointsEngage, (XtPointer) BWDrawRectangle, TwoPointsTerminate, (XtPointer) BWDrawFilledRectangle, NULL, (XtPointer) NULL}, {CircleRequest, sizeof(BWStatus), TwoPointsEngage, (XtPointer) BWDrawCircle, TwoPointsTerminate, (XtPointer) BWDrawCircle, NULL, (XtPointer) NULL}, {FilledCircleRequest, sizeof(BWStatus), TwoPointsEngage, (XtPointer) BWDrawCircle, TwoPointsTerminate, (XtPointer) BWDrawFilledCircle, NULL, (XtPointer) NULL}, {FloodFillRequest, sizeof(BWStatus), OnePointEngage, (XtPointer) NULL, OnePointTerminate, (XtPointer) BWFloodFill, NULL, (XtPointer) NULL}, {HotSpotRequest, sizeof(BWStatus), OnePointEngage, (XtPointer) BWDrawHotSpot, OnePointTerminate, (XtPointer) BWDrawHotSpot, NULL, (XtPointer) NULL}, {ZoomInRequest, sizeof(BWStatus), TwoPointsEngage, (XtPointer) BWDrawRectangle, TwoPointsTerminate, (XtPointer) BWZoomIn, NULL, (XtPointer) NULL}, }; static void ClassInitialize(void); static void Initialize(Widget wrequest, Widget wnew, ArgList argv, Cardinal *argc); static void Redisplay(Widget w, XEvent *event, Region region); static void Resize(Widget w); static void Destroy(Widget w); static void Refresh(BitmapWidget BW, Position x, Position y, Dimension width, Dimension height); static Boolean SetValues(Widget old, Widget request, Widget new, ArgList args, Cardinal *num_args); BitmapClassRec bitmapClassRec = { { /* core fields */ /* superclass */ (WidgetClass) &simpleClassRec, /* class_name */ "Bitmap", /* widget_size */ sizeof(BitmapRec), /* class_initialize */ ClassInitialize, /* class_part_initialize */ NULL, /* class_inited */ FALSE, /* initialize */ Initialize, /* initialize_hook */ NULL, /* realize */ XtInheritRealize, /* actions */ actions, /* num_actions */ XtNumber(actions), /* resources */ resources, /* num_resources */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, /* compress_exposure */ FALSE, /* compress_enterleave */ TRUE, /* visible_interest */ TRUE, /* destroy */ Destroy, /* resize */ Resize, /* expose */ Redisplay, /* set_values */ SetValues, /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ NULL , /* set in code */ /* query_geometry */ XtInheritQueryGeometry, /* display_accelerator */ XtInheritDisplayAccelerator, /* extension */ NULL, }, { /* empty */ XtInheritChangeSensitive, }, { /* targets */ targets, /* num_trets */ XtNumber(targets), /* requests */ requests, /* num_requests */ XtNumber(requests), } }; WidgetClass bitmapWidgetClass = (WidgetClass) &bitmapClassRec; /* ARGSUSED */ void BWDebug(Widget w, XEvent *event, String *params, Cardinal *num_params) { DEBUG ^= True; } Pixmap BWGetPixmap(Widget w) { BitmapWidget BW = (BitmapWidget) w; return GetPixmap(BW, BW->bitmap.zoom.image); } Pixmap BWGetUnzoomedPixmap(Widget w) { BitmapWidget BW = (BitmapWidget) w; GC gc; Pixmap pix; if (BW->bitmap.zooming) { pix = XCreatePixmap(XtDisplay(w), XtWindow(w), BW->bitmap.zoom.image->width, BW->bitmap.zoom.image->height, 1); if (!(gc = XCreateGC(XtDisplay(w), pix, (unsigned long) 0, (XGCValues *) 0))) { XFreePixmap(XtDisplay(w), pix); return (Pixmap) None; } XPutImage(XtDisplay(w), pix, gc, BW->bitmap.zoom.image, 0, 0, 0, 0, BW->bitmap.zoom.image->width, BW->bitmap.zoom.image->height); XPutImage(XtDisplay(w), pix, gc, BW->bitmap.image, 0, 0, BW->bitmap.zoom.at_x, BW->bitmap.zoom.at_y, BW->bitmap.image->width, BW->bitmap.image->height); } else { pix = XCreatePixmap(XtDisplay(w), XtWindow(w), BW->bitmap.image->width, BW->bitmap.image->height, 1); if (! (gc = XCreateGC(XtDisplay(w), pix, (unsigned long) 0, (XGCValues *) 0))){ XFreePixmap(XtDisplay(w), pix); return (Pixmap) None; } XPutImage(XtDisplay(w), pix, gc, BW->bitmap.image, 0, 0, 0, 0, BW->bitmap.image->width, BW->bitmap.image->height); } XFreeGC(XtDisplay(w), gc); return(pix); } XImage * GetImage(BitmapWidget BW, Pixmap pixmap) { Window root; int x, y; unsigned int width, height, border_width, depth; XImage *source, *image; XGetGeometry(XtDisplay(BW), pixmap, &root, &x, &y, &width, &height, &border_width, &depth); source = XGetImage(XtDisplay(BW), pixmap, x, y, width, height, 1, XYPixmap); image = ConvertToBitmapImage(BW, source); return image; } XImage * CreateBitmapImage(BitmapWidget BW, char *data, Dimension width, Dimension height) { XImage *image = XCreateImage(XtDisplay(BW), DefaultVisual(XtDisplay(BW), DefaultScreen(XtDisplay(BW))), 1, XYBitmap, 0, data, width, height, 8, ((int)width + 7) / 8); image->height = height; image->width = width; image->depth = 1; image->xoffset = 0; image->format = XYBitmap; image->data = (char *)data; image->byte_order = LSBFirst; image->bitmap_unit = 8; image->bitmap_bit_order = LSBFirst; image->bitmap_pad = 8; image->bytes_per_line = ((int)width + 7) / 8; return image; } void DestroyBitmapImage(XImage **image) { /*XDestroyImage(*image);*/ if (image) { if (*image) { if ((*image)->data) XtFree((*image)->data); XtFree((char *)*image); } *image = NULL; } } #if 0 XImage * BWGetImage(Widget w, XEvent *event, String *params, Cardinal *num_params) { BitmapWidget BW = (BitmapWidget) w; return BW->bitmap.image; } #endif void BWChangeNotify(Widget w) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.notify) (*BW->bitmap.notify)(w, NULL, NULL, NULL); } void BWNotify(Widget w, XtActionProc proc) { BitmapWidget BW = (BitmapWidget) w; BW->bitmap.notify = proc; } void BWSetChanged(Widget w) { BitmapWidget BW = (BitmapWidget) w; BW->bitmap.changed = True; } Boolean BWQueryChanged(Widget w) { BitmapWidget BW = (BitmapWidget) w; return BW->bitmap.changed; } void BWClearChanged(Widget w) { BitmapWidget BW = (BitmapWidget) w; BW->bitmap.changed = False; } Boolean BWQueryStored(Widget w) { BitmapWidget BW = (BitmapWidget) w; return (BW->bitmap.storage != NULL); } Boolean BWQueryStippled(Widget w) { BitmapWidget BW = (BitmapWidget) w; return BW->bitmap.stippled; } static void RedrawStippled(BitmapWidget BW) { XExposeEvent event; event.type = Expose; event.display = XtDisplay((Widget)BW); event.window = XtWindow((Widget)BW); event.x = 0; event.y = 0; event.width = BW->core.width; event.height = BW->core.height; event.count = 0; BWRedrawMark((Widget)BW); BW->bitmap.stipple_change_expose_event = True; XtDispatchEvent((XEvent *)&event); BW->bitmap.stipple_change_expose_event = False; } void BWSwitchStippled(Widget w) { BitmapWidget BW = (BitmapWidget) w; RedrawStippled(BW); BW->bitmap.stippled ^= True; XSetFillStyle(XtDisplay(BW), BW->bitmap.highlighting_gc, (BW->bitmap.stippled ? FillStippled : FillSolid)); RedrawStippled(BW); } void BWSelect(Widget w, Position from_x, Position from_y, Position to_x, Position to_y, Time btime) { BWMark(w, from_x, from_y, to_x, to_y); BWGrabSelection(w, btime); } Boolean BWQueryAxes(Widget w) { BitmapWidget BW = (BitmapWidget) w; return BW->bitmap.axes; } void BWSwitchAxes(Widget w) { BitmapWidget BW = (BitmapWidget) w; BW->bitmap.axes ^= True; BWHighlightAxes(w); } void BWAxes(Widget w, Boolean _switch) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.axes != _switch) BWSwitchAxes(w); } void BWRedrawAxes(Widget w) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.axes) BWHighlightAxes(w); } #if 0 void BWPutImage(BitmapWidget w, Display *display, Drawable drawable, GC gc, Position x, Position y) { BitmapWidget BW = (BitmapWidget) w; XPutImage(display, drawable, gc, BW->bitmap.image, 0, 0, x, y, BW->bitmap.image->width, BW->bitmap.image->height); } #endif static String StripFilename(_Xconst _XtString filename) { const char *begin = strrchr(filename, '/'); const char *end; char *result; int length; if (filename) { begin = (begin ? begin + 1 : filename); end = strchr(begin, '.'); /* change to strrchr to allow longer names */ length = (end ? (end - begin) : strlen (begin)); result = (char *) XtMalloc (length + 1); strncpy (result, begin, length); result [length] = '\0'; return (result); } else return (NULL); } static int XmuWriteBitmapDataToFile(_Xconst _XtString filename, _Xconst _XtString basename, int width, int height, char *datap, int x_hot, int y_hot) { FILE *file; int i, data_length; data_length = Length(width, height); if(!filename || !strcmp(filename, "") || !strcmp(filename, "-")) { file = stdout; filename = "dummy"; } else file = fopen(filename, "w+"); if (file) { String new_basename; if (!basename || !strcmp(basename, "") || !strcmp(basename, "-")) basename = new_basename = StripFilename(filename); else new_basename = NULL; fprintf(file, "#define %s_width %d\n", basename, width); fprintf(file, "#define %s_height %d\n", basename, height); if (QuerySet(x_hot, y_hot)) { fprintf(file, "#define %s_x_hot %d\n", basename, x_hot); fprintf(file, "#define %s_y_hot %d\n", basename, y_hot); } fprintf(file, "static unsigned char %s_bits[] = {\n 0x%02x", basename, (unsigned char) datap[0]); for(i = 1; i < data_length; i++) { fprintf(file, ","); fprintf(file, (i % 12) ? " " : "\n "); fprintf(file, "0x%02x", (unsigned char) datap[i]); } fprintf(file, "};\n"); if (file != stdout) fclose(file); XtFree(new_basename); return BitmapSuccess; } return 1; } /* * */ /* ARGSUSED */ static void CvtStringToButtonFunction(XrmValuePtr args, /* not used */ Cardinal *num_args, /* not used */ XrmValuePtr from_val, XrmValuePtr to_val) { static int button_function; char lower_name[80]; XmuCopyISOLatin1Lowered (lower_name, (char*)from_val->addr); if (!strcmp(lower_name, XtClear)) { button_function = Clear; to_val->addr = (XPointer) &button_function; to_val->size = sizeof(button_function); return; } if (!strcmp(lower_name, XtSet)) { button_function = Set; to_val->addr = (XPointer) &button_function; to_val->size = sizeof(button_function); return; } if (!strcmp(lower_name, XtInvert)) { button_function = Invert; to_val->addr = (XPointer) &button_function; to_val->size = sizeof(button_function); return; } XtStringConversionWarning(from_val->addr, XtRButtonFunction); button_function = Clear; to_val->addr = (XPointer) &button_function; to_val->size = sizeof(button_function); } static void ClassInitialize(void) { char *tm_table = XtMalloc(strlen(translations1) + strlen(translations2) + 1); strcpy(tm_table, translations1); strcat(tm_table, translations2); bitmapClassRec.core_class.tm_table = tm_table; XawInitializeWidgetSet(); XtAddConverter(XtRString, XtRButtonFunction, CvtStringToButtonFunction, NULL, 0); DEBUG = False; } static void SetSizeFromSizeResource(BitmapWidget bw) { if (BWParseSize(bw->bitmap.size, &bw->bitmap.width, &bw->bitmap.height) == False) { bw->bitmap.width = FallbackBitmapWidth; bw->bitmap.height = FallbackBitmapHeight; XtWarning("Cannot parse the size resource. BitmapWidget"); } } /* ARGSUSED */ static void Initialize(Widget wrequest, Widget wnew, ArgList argv, Cardinal *argc) { BitmapWidget new = (BitmapWidget) wnew; XGCValues values; XtGCMask mask; char *image_data, *buffer_data; new->bitmap.stipple_change_expose_event = False; new->bitmap.notify = NULL; new->bitmap.cardinal = 0; new->bitmap.current = 0; new->bitmap.fold = False; new->bitmap.changed = False; new->bitmap.zooming = False; new->bitmap.selection.own = False; new->bitmap.selection.limbo = False; new->bitmap.request_stack = (BWRequestStack *) XtMalloc(sizeof(BWRequestStack)); new->bitmap.request_stack[0].request = NULL; new->bitmap.request_stack[0].call_data = NULL; new->bitmap.request_stack[0].trap = False; SetSizeFromSizeResource(new); new->core.width = new->bitmap.width * new->bitmap.squareW + 2 * new->bitmap.margin; new->core.height = new->bitmap.height * new->bitmap.squareH + 2 * new->bitmap.margin; new->bitmap.hot.x = new->bitmap.hot.y = NotSet; new->bitmap.buffer_hot.x = new->bitmap.buffer_hot.y = NotSet; new->bitmap.mark.from_x = new->bitmap.mark.from_y = NotSet; new->bitmap.mark.to_x = new->bitmap.mark.to_y = NotSet; new->bitmap.buffer_mark.from_x = new->bitmap.buffer_mark.from_y = NotSet; new->bitmap.buffer_mark.to_x = new->bitmap.buffer_mark.to_y = NotSet; values.foreground = new->bitmap.foreground_pixel; values.background = new->core.background_pixel; values.foreground ^= values.background; values.function = GXxor; mask = GCForeground | GCBackground | GCFunction; new->bitmap.drawing_gc = XCreateGC(XtDisplay(new), RootWindow(XtDisplay(new), DefaultScreen(XtDisplay(new))), mask, &values); values.foreground = new->bitmap.highlight_pixel; values.background = new->core.background_pixel; values.foreground ^= values.background; values.function = GXxor; mask = GCForeground | GCBackground | GCFunction; if (new->bitmap.stipple != XtUnspecifiedPixmap) { values.stipple = new->bitmap.stipple; mask |= GCStipple | GCFillStyle; } values.fill_style = (new->bitmap.stippled ? FillStippled : FillSolid); new->bitmap.highlighting_gc = XCreateGC(XtDisplay(new), RootWindow(XtDisplay(new), DefaultScreen(XtDisplay(new))), mask, &values); values.foreground = new->bitmap.frame_pixel; values.background = new->core.background_pixel; values.foreground ^= values.background; mask = GCForeground | GCBackground | GCFunction; if (new->bitmap.dashes != XtUnspecifiedPixmap) { values.stipple = new->bitmap.dashes; mask |= GCStipple | GCFillStyle; } values.fill_style = (new->bitmap.dashed ? FillStippled : FillSolid); new->bitmap.frame_gc = XCreateGC(XtDisplay(new), RootWindow(XtDisplay(new), DefaultScreen(XtDisplay(new))), mask, &values); values.foreground = new->bitmap.highlight_pixel; values.background = new->core.background_pixel; values.foreground ^= values.background; mask = GCForeground | GCBackground | GCFunction; new->bitmap.axes_gc = XCreateGC(XtDisplay(new), RootWindow(XtDisplay(new), DefaultScreen(XtDisplay(new))), mask, &values); image_data = CreateCleanData(Length(new->bitmap.width, new->bitmap.height)); buffer_data = CreateCleanData(Length(new->bitmap.width, new->bitmap.height)); new->bitmap.storage = NULL; new->bitmap.image = CreateBitmapImage(new, image_data, new->bitmap.width, new->bitmap.height); new->bitmap.buffer = CreateBitmapImage(new, buffer_data, new->bitmap.width, new->bitmap.height); /* Read file */ { int status; XImage *image, *buffer; unsigned char *image_data2; char *buffer_data2; unsigned int width, height; int x_hot, y_hot; status = XmuReadBitmapDataFromFile(new->bitmap.filename, &width, &height, &image_data2, &x_hot, &y_hot); if (status == BitmapSuccess) { buffer_data2 = CreateCleanData(Length(width, height)); image = CreateBitmapImage(new, (char *)image_data2, width, height); buffer = CreateBitmapImage(new, buffer_data2, width, height); TransferImageData(new->bitmap.image, buffer); DestroyBitmapImage(&new->bitmap.image); DestroyBitmapImage(&new->bitmap.buffer); new->bitmap.image = image; new->bitmap.buffer = buffer; new->bitmap.width = width; new->bitmap.height = height; new->bitmap.hot.x = x_hot; new->bitmap.hot.y = y_hot; new->bitmap.changed = False; new->bitmap.zooming = False; } new->bitmap.filename = XtNewString(new->bitmap.filename); if (!strcmp(new->bitmap.basename, "")) { new->bitmap.basename = StripFilename(new->bitmap.filename); } else new->bitmap.basename = XtNewString(new->bitmap.basename); } Resize((Widget)new); } /* returns False if the format is wrong */ Boolean BWParseSize(String size, Dimension *width, Dimension *height) { int x, y; unsigned int w, h; int status; status = XParseGeometry(size, &x, &y, &w, &h); if (status & (WidthValue | HeightValue)) { *width = (Dimension) w; *height = (Dimension) h; return True; } else return False; } Boolean BWQueryMarked(Widget w) { BitmapWidget BW = (BitmapWidget) w; return QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y); } static void FixMark(BitmapWidget BW) { if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y)) { BW->bitmap.mark.from_x = min(BW->bitmap.mark.from_x, BW->bitmap.image->width); BW->bitmap.mark.from_y = min(BW->bitmap.mark.from_y, BW->bitmap.image->height); BW->bitmap.mark.to_x = min(BW->bitmap.mark.to_x, BW->bitmap.image->width); BW->bitmap.mark.to_y = min(BW->bitmap.mark.to_y, BW->bitmap.image->height); if((BW->bitmap.mark.from_x == BW->bitmap.mark.from_y) && (BW->bitmap.mark.to_x == BW->bitmap.mark.to_y)) BW->bitmap.mark.from_x = BW->bitmap.mark.from_y = BW->bitmap.mark.to_x = BW->bitmap.mark.to_y = NotSet; } } /* ARGSUSED */ int BWStoreFile(Widget w, _Xconst _XtString filename, _Xconst _XtString *basename) { BitmapWidget BW = (BitmapWidget) w; int status; unsigned char *storage_data; unsigned int width, height; int x_hot, y_hot; status = XmuReadBitmapDataFromFile(filename, &width, &height, &storage_data, &x_hot, &y_hot); if (status == BitmapSuccess) { DestroyBitmapImage(&BW->bitmap.storage); BW->bitmap.storage = CreateBitmapImage(BW, (char *)storage_data, width, height); return BitmapSuccess; } else XtWarning(" read file failed. BitmapWidget"); return status; } String BWUnparseStatus(Widget w) { BitmapWidget BW = (BitmapWidget) w; snprintf(BW->bitmap.status, sizeof(BW->bitmap.status), "Filename: %s Basename: %s Size: %dx%d", (strcmp(BW->bitmap.filename, "") ? BW->bitmap.filename : ""), (strcmp(BW->bitmap.basename, "") ? BW->bitmap.basename : ""), BW->bitmap.width, BW->bitmap.height); return BW->bitmap.status; } void BWChangeFilename(Widget w, _Xconst _XtString str) { BitmapWidget BW = (BitmapWidget) w; if (str) { XtFree(BW->bitmap.filename); BW->bitmap.filename = XtNewString( str); } } void BWChangeBasename(Widget w, _Xconst _XtString str) { BitmapWidget BW = (BitmapWidget) w; if (str) { XtFree(BW->bitmap.basename); BW->bitmap.basename = XtNewString(str); } } int BWReadFile(Widget w, _Xconst _XtString filename, _Xconst _XtString basename) /* ARGSUSED */ { BitmapWidget BW = (BitmapWidget) w; int status; XImage *image, *buffer; unsigned char *image_data; char *buffer_data; unsigned int width, height; int x_hot, y_hot; if (!filename) filename = BW->bitmap.filename; status = XmuReadBitmapDataFromFile(filename, &width, &height, &image_data, &x_hot, &y_hot); if (status == BitmapSuccess) { buffer_data = CreateCleanData(Length(width, height)); image = CreateBitmapImage(BW, (char *)image_data, width, height); buffer = CreateBitmapImage(BW, buffer_data, width, height); TransferImageData(BW->bitmap.image, buffer); DestroyBitmapImage(&BW->bitmap.image); DestroyBitmapImage(&BW->bitmap.buffer); BW->bitmap.image = image; BW->bitmap.buffer = buffer; BW->bitmap.width = width; BW->bitmap.height = height; BW->bitmap.hot.x = x_hot; BW->bitmap.hot.y = y_hot; BW->bitmap.changed = False; BW->bitmap.zooming = False; XtFree(BW->bitmap.filename); BW->bitmap.filename = XtNewString(filename); XtFree(BW->bitmap.basename); BW->bitmap.basename = StripFilename(filename); BWUnmark(w); Resize((Widget)BW); if (BW->core.visible) { XClearArea(XtDisplay(BW), XtWindow(BW), 0, 0, BW->core.width, BW->core.height, True); } return BitmapSuccess; } else XtWarning(" read file failed. BitmapWidget"); return status; } #if 0 void BWSetImage(Widget w, XImage *image) { BitmapWidget BW = (BitmapWidget) w; XImage *buffer; char *buffer_data; buffer_data = CreateCleanData(Length(image->width, image->height)); buffer = CreateBitmapImage(BW, buffer_data, (Dimension) image->width, (Dimension) image->height); TransferImageData(BW->bitmap.image, buffer); DestroyBitmapImage(&BW->bitmap.image); DestroyBitmapImage(&BW->bitmap.buffer); BW->bitmap.image = image; BW->bitmap.buffer = buffer; BW->bitmap.width = image->width; BW->bitmap.height = image->height; Resize((Widget)BW); if (BW->core.visible) { XClearArea(XtDisplay(BW), XtWindow(BW), 0, 0, BW->core.width, BW->core.height, True); } } #endif int BWWriteFile(Widget w, _Xconst _XtString filename, _Xconst _XtString basename) { BitmapWidget BW = (BitmapWidget) w; char *data; XImage *image; XPoint hot; int status; if (BW->bitmap.zooming) { data = XtMalloc(Length(BW->bitmap.zoom.image->width, BW->bitmap.zoom.image->height)); memmove( data, BW->bitmap.zoom.image->data, Length(BW->bitmap.zoom.image->width, BW->bitmap.zoom.image->height)); image = CreateBitmapImage(BW, data, (Dimension) BW->bitmap.zoom.image->width, (Dimension) BW->bitmap.zoom.image->height); CopyImageData(BW->bitmap.image, image, 0, 0, BW->bitmap.image->width - 1, BW->bitmap.image->height - 1, BW->bitmap.zoom.at_x, BW->bitmap.zoom.at_y); if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)) { hot.x = BW->bitmap.hot.x + BW->bitmap.zoom.at_x; hot.y = BW->bitmap.hot.y + BW->bitmap.zoom.at_y; } else hot = BW->bitmap.zoom.hot; } else { image = BW->bitmap.image; hot = BW->bitmap.hot; } if (!filename) filename = BW->bitmap.filename; else { XtFree(BW->bitmap.filename); BW->bitmap.filename = XtNewString(filename); XtFree(BW->bitmap.basename); BW->bitmap.basename = StripFilename(filename); } if (!basename) basename = BW->bitmap.basename; else { XtFree(BW->bitmap.basename); BW->bitmap.basename = XtNewString(basename); } if (DEBUG) fprintf(stderr, "Saving filename: %s %s\n", filename, basename); status = XmuWriteBitmapDataToFile(filename, basename, image->width, image->height, image->data, hot.x, hot.y); if (BW->bitmap.zooming) DestroyBitmapImage(&image); if (status == BitmapSuccess) BW->bitmap.changed = False; return status; } String BWGetFilename(Widget w, String *str) { BitmapWidget BW = (BitmapWidget) w; *str = XtNewString(BW->bitmap.filename); return *str; } String BWGetFilepath(Widget w, String *str) { BitmapWidget BW = (BitmapWidget) w; String end; *str = XtNewString(BW->bitmap.filename); assert(*str); end = strrchr(*str, '/'); if (end) *(end + 1) = '\0'; else **str = '\0'; return *str; } String BWGetBasename(Widget w, String *str) { BitmapWidget BW = (BitmapWidget) w; *str = XtNewString(BW->bitmap.basename); return *str; } static void FixHotSpot(BitmapWidget BW) { if (!QueryInBitmap(BW, BW->bitmap.hot.x, BW->bitmap.hot.y)) BW->bitmap.hot.x = BW->bitmap.hot.y = NotSet; } static void ZoomOut(BitmapWidget BW) { CopyImageData(BW->bitmap.image, BW->bitmap.zoom.image, 0, 0, BW->bitmap.image->width - 1, BW->bitmap.image->height - 1, BW->bitmap.zoom.at_x, BW->bitmap.zoom.at_y); DestroyBitmapImage(&BW->bitmap.image); DestroyBitmapImage(&BW->bitmap.buffer); BW->bitmap.image = BW->bitmap.zoom.image; BW->bitmap.buffer = BW->bitmap.zoom.buffer; BW->bitmap.width = BW->bitmap.image->width; BW->bitmap.height = BW->bitmap.image->height; BW->bitmap.fold = BW->bitmap.zoom.fold; BW->bitmap.changed |= BW->bitmap.zoom.changed; BW->bitmap.grid = BW->bitmap.zoom.grid; if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)) { BW->bitmap.hot.x += BW->bitmap.zoom.at_x; BW->bitmap.hot.y += BW->bitmap.zoom.at_y; } else BW->bitmap.hot = BW->bitmap.zoom.hot; BW->bitmap.mark.from_x = NotSet; BW->bitmap.mark.from_y = NotSet; BW->bitmap.mark.to_x = NotSet; BW->bitmap.mark.to_y = NotSet; BW->bitmap.zooming = False; } void BWZoomOut(Widget w) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.zooming) { ZoomOut(BW); Resize((Widget)BW); if (BW->core.visible) XClearArea(XtDisplay(BW), XtWindow(BW), 0, 0, BW->core.width, BW->core.height, True); } } void BWZoomMarked(Widget w) { BitmapWidget BW = (BitmapWidget) w; BWZoomIn(w, BW->bitmap.mark.from_x, BW->bitmap.mark.from_y, BW->bitmap.mark.to_x, BW->bitmap.mark.to_y); } void BWZoomIn(Widget w, Position from_x, Position from_y, Position to_x, Position to_y) { BitmapWidget BW = (BitmapWidget) w; XImage *image, *buffer; Dimension width, height; char *image_data, *buffer_data; if (BW->bitmap.zooming) ZoomOut(BW); QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); from_x = max(0, from_x); from_y = max(0, from_y); to_x = min(BW->bitmap.width - 1, to_x); to_y = min(BW->bitmap.height - 1, to_y); width = to_x - from_x + 1; height = to_y - from_y + 1; image_data = CreateCleanData(Length(width, height)); buffer_data = CreateCleanData(Length(width, height)); image = CreateBitmapImage(BW, image_data, width, height); buffer = CreateBitmapImage(BW, buffer_data, width, height); CopyImageData(BW->bitmap.image, image, from_x, from_y, to_x, to_y, 0, 0); CopyImageData(BW->bitmap.buffer, buffer, from_x, from_y, to_x, to_y, 0, 0); BW->bitmap.zoom.image = BW->bitmap.image; BW->bitmap.zoom.buffer = BW->bitmap.buffer; BW->bitmap.zoom.at_x = from_x; BW->bitmap.zoom.at_y = from_y; BW->bitmap.zoom.fold = BW->bitmap.fold; BW->bitmap.zoom.changed = BW->bitmap.changed; BW->bitmap.zoom.hot = BW->bitmap.hot; BW->bitmap.zoom.grid = BW->bitmap.grid; BW->bitmap.image = image; BW->bitmap.buffer = buffer; BW->bitmap.width = width; BW->bitmap.height = height; BW->bitmap.changed = False; BW->bitmap.hot.x -= from_x; BW->bitmap.hot.y -= from_y; BW->bitmap.mark.from_x = NotSet; BW->bitmap.mark.from_y = NotSet; BW->bitmap.mark.to_x = NotSet; BW->bitmap.mark.to_y = NotSet; BW->bitmap.zooming = True; BW->bitmap.grid = True; /* potencially true, could use a resource here */ FixHotSpot(BW); Resize((Widget)BW); if (BW->core.visible) XClearArea(XtDisplay(BW), XtWindow(BW), 0, 0, BW->core.width, BW->core.height, True); } void BWRescale(Widget w, Dimension width, Dimension height) { BitmapWidget BW = (BitmapWidget) w; XImage *image, *buffer; char *buffer_data; if (BW->bitmap.zooming) ZoomOut(BW); image = ScaleBitmapImage(BW, BW->bitmap.image, (double) width / (double) BW->bitmap.image->width, (double) height / (double) BW->bitmap.image->height); buffer_data = CreateCleanData(Length(image->width, image->height)); buffer = CreateBitmapImage(BW, buffer_data, (Dimension) image->width, (Dimension) image->height); TransferImageData(BW->bitmap.buffer, buffer); DestroyBitmapImage(&BW->bitmap.image); DestroyBitmapImage(&BW->bitmap.buffer); BW->bitmap.image = image; BW->bitmap.buffer = buffer; BW->bitmap.width = image->width; BW->bitmap.height = image->height; FixHotSpot(BW); FixMark(BW); Resize((Widget)BW); if (BW->core.visible) XClearArea(XtDisplay(BW), XtWindow(BW), 0, 0, BW->core.width, BW->core.height, True); } Boolean BWQueryZooming(Widget w) { BitmapWidget BW = (BitmapWidget) w; return BW->bitmap.zooming; } static void ResizeGrid(BitmapWidget BW, Dimension width, Dimension height) { XImage *image, *buffer; char *image_data, *buffer_data; if (BW->bitmap.zooming) ZoomOut(BW); image_data = CreateCleanData(Length(width, height)); buffer_data = CreateCleanData(Length(width, height)); image = CreateBitmapImage(BW, image_data, width, height); buffer = CreateBitmapImage(BW, buffer_data, width, height); TransferImageData(BW->bitmap.image, image); TransferImageData(BW->bitmap.buffer, buffer); DestroyBitmapImage(&BW->bitmap.image); DestroyBitmapImage(&BW->bitmap.buffer); BW->bitmap.image = image; BW->bitmap.buffer = buffer; BW->bitmap.width = width; BW->bitmap.height = height; FixHotSpot(BW); FixMark(BW); } void BWResize(Widget w, Dimension width, Dimension height) { BitmapWidget BW = (BitmapWidget) w; ResizeGrid(BW, width, height); Resize((Widget)BW); if (BW->core.visible) XClearArea(XtDisplay(BW), XtWindow(BW), 0, 0, BW->core.width, BW->core.height, True); } static void Destroy(Widget w) { BitmapWidget BW = (BitmapWidget) w; XFreeGC(XtDisplay(w), BW->bitmap.drawing_gc); XFreeGC(XtDisplay(w), BW->bitmap.highlighting_gc); XFreeGC(XtDisplay(w), BW->bitmap.frame_gc); XFreeGC(XtDisplay(w), BW->bitmap.axes_gc); BWRemoveAllRequests(w); XtFree(BW->bitmap.filename); XtFree(BW->bitmap.basename); } static void Resize(Widget w) { BitmapWidget BW = (BitmapWidget) w; Dimension squareW, squareH; squareW = max(1, ((int)BW->core.width - 2 * (int)BW->bitmap.margin) / (int)BW->bitmap.width); squareH = max(1, ((int)BW->core.height - 2 * (int)BW->bitmap.margin) / (int)BW->bitmap.height); if (BW->bitmap.proportional) BW->bitmap.squareW = BW->bitmap.squareH = min(squareW, squareH); else { BW->bitmap.squareW = squareW; BW->bitmap.squareH = squareH; } BW->bitmap.horizOffset = max((Position)BW->bitmap.margin, (Position)(BW->core.width - BW->bitmap.width * BW->bitmap.squareW) / 2); BW->bitmap.vertOffset = max((Position)BW->bitmap.margin, (Position)(BW->core.height - BW->bitmap.height * BW->bitmap.squareH) / 2); BW->bitmap.grid &= ((BW->bitmap.squareW > BW->bitmap.grid_tolerance) && (BW->bitmap.squareH > BW->bitmap.grid_tolerance)); } /* ARGSUSED */ static void Redisplay(Widget w, XEvent *event, Region region) { BitmapWidget BW = (BitmapWidget) w; if(event->type == Expose && BW->core.visible) if (BW->bitmap.stipple_change_expose_event == False) Refresh(BW, event->xexpose.x, event->xexpose.y, event->xexpose.width, event->xexpose.height); } void BWClip(Widget w, Position x, Position y, Dimension width, Dimension height) { Position from_x, from_y, to_x, to_y; BitmapWidget BW = (BitmapWidget) w; XRectangle rectangle; from_x = InBitmapX(BW, x); from_y = InBitmapY(BW, y); to_x = InBitmapX(BW, x + width); to_y = InBitmapY(BW, y + height); QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); from_x = max(0, from_x); from_y = max(0, from_y); to_x = min(BW->bitmap.width - 1, to_x); to_y = min(BW->bitmap.height - 1, to_y); rectangle.x = InWindowX(BW, from_x); rectangle.y = InWindowY(BW, from_y); rectangle.width = InWindowX(BW, to_x + 1) - InWindowX(BW, from_x); rectangle.height = InWindowY(BW, to_y + 1) - InWindowY(BW, from_y); XSetClipRectangles(XtDisplay(BW), BW->bitmap.highlighting_gc, 0, 0, &rectangle, 1, Unsorted); XSetClipRectangles(XtDisplay(BW), BW->bitmap.drawing_gc, 0, 0, &rectangle, 1, Unsorted); XSetClipRectangles(XtDisplay(BW), BW->bitmap.frame_gc, 0, 0, &rectangle, 1, Unsorted); XSetClipRectangles(XtDisplay(BW), BW->bitmap.axes_gc, 0, 0, &rectangle, 1, Unsorted); } void BWUnclip(Widget w) { BitmapWidget BW = (BitmapWidget) w; XRectangle rectangle; rectangle.x = InWindowX(BW, 0); rectangle.y = InWindowY(BW, 0); rectangle.width = InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0); rectangle.height = InWindowY(BW, BW->bitmap.height) - InWindowY(BW, 0); XSetClipRectangles(XtDisplay(BW), BW->bitmap.highlighting_gc, 0, 0, &rectangle, 1, Unsorted); XSetClipRectangles(XtDisplay(BW), BW->bitmap.drawing_gc, 0, 0, &rectangle, 1, Unsorted); XSetClipRectangles(XtDisplay(BW), BW->bitmap.frame_gc, 0, 0, &rectangle, 1, Unsorted); XSetClipRectangles(XtDisplay(BW), BW->bitmap.axes_gc, 0, 0, &rectangle, 1, Unsorted); } static void Refresh(BitmapWidget BW, Position x, Position y, Dimension width, Dimension height) { XRectangle rectangle; rectangle.x = min(x, InWindowX(BW, InBitmapX(BW, x))); rectangle.y = min(y, InWindowY(BW, InBitmapY(BW, y))); rectangle.width = max(x + width, InWindowX(BW, InBitmapX(BW, x + width)+1)) - rectangle.x; rectangle.height = max(y + height, InWindowY(BW, InBitmapY(BW, y + height)+1)) - rectangle.y; XClearArea(XtDisplay(BW), XtWindow(BW), rectangle.x, rectangle.y, rectangle.width, rectangle.height, False); XSetClipRectangles(XtDisplay(BW), BW->bitmap.frame_gc, 0, 0, &rectangle, 1, Unsorted); XDrawRectangle(XtDisplay(BW), XtWindow(BW), BW->bitmap.frame_gc, InWindowX(BW, 0) - 1, InWindowY(BW, 0) - 1, InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0) + 1, InWindowY(BW, BW->bitmap.height) - InWindowY(BW, 0) + 1); BWClip((Widget) BW, x, y, width, height); BWRedrawGrid((Widget) BW, x, y, width, height); BWRedrawSquares((Widget) BW, x, y, width, height); BWRedrawMark((Widget) BW); BWRedrawHotSpot((Widget) BW); BWRedrawAxes((Widget) BW); BWUnclip((Widget) BW); } Boolean BWQueryGrid(Widget w) { BitmapWidget BW = (BitmapWidget) w; return BW->bitmap.grid; } void BWSwitchGrid(Widget w) { BitmapWidget BW = (BitmapWidget) w; BW->bitmap.grid ^= TRUE; BWDrawGrid(w, 0, 0, BW->bitmap.image->width - 1, BW->bitmap.image->height - 1); } void BWGrid(Widget w, Boolean _switch) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.grid != _switch) BWSwitchGrid(w); } Boolean BWQueryDashed(Widget w) { BitmapWidget BW = (BitmapWidget) w; return (BW->bitmap.dashed); } void BWSwitchDashed(Widget w) { BitmapWidget BW = (BitmapWidget) w; XRectangle rectangle; BWRedrawGrid(w, 0, 0, BW->bitmap.width - 1, BW->bitmap.height - 1); rectangle.x = 0; rectangle.y = 0; rectangle.width = BW->core.width; rectangle.height = BW->core.height; XSetClipRectangles(XtDisplay(BW), BW->bitmap.frame_gc, 0, 0, &rectangle, 1, Unsorted); XDrawRectangle(XtDisplay(BW), XtWindow(BW), BW->bitmap.frame_gc, InWindowX(BW, 0) - 1, InWindowY(BW, 0) - 1, InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0) + 1, InWindowY(BW, BW->bitmap.height) - InWindowY(BW, 0) + 1); BW->bitmap.dashed ^= True; XSetFillStyle(XtDisplay(BW), BW->bitmap.frame_gc, (BW->bitmap.dashed ? FillStippled : FillSolid)); XDrawRectangle(XtDisplay(BW), XtWindow(BW), BW->bitmap.frame_gc, InWindowX(BW, 0) - 1, InWindowY(BW, 0) - 1, InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0) + 1, InWindowY(BW, BW->bitmap.height) - InWindowY(BW, 0) + 1); BWUnclip(w); BWRedrawGrid(w, 0, 0, BW->bitmap.width - 1, BW->bitmap.height - 1); } void BWDashed(Widget w, Boolean _switch) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.dashed != _switch) BWSwitchDashed(w); } static Boolean SetValues(Widget old, Widget request, Widget new, ArgList args, Cardinal *num_args) /* ARGSUSED */ { BitmapWidget oldbw = (BitmapWidget) old; BitmapWidget newbw = (BitmapWidget) new; Boolean resize = False; Boolean redisplay = False; #define NE(field) (oldbw->field != newbw->field) if (NE(bitmap.grid)) BWSwitchGrid(old); if (NE(bitmap.dashed)) BWSwitchDashed(old); if (NE(bitmap.axes)) BWSwitchAxes(old); if (NE(bitmap.stippled)) BWSwitchStippled(old); if (NE(bitmap.proportional)) resize = True; if (NE(bitmap.filename) || NE(bitmap.basename) || NE(bitmap.size)) BWChangeNotify(old); if (NE(bitmap.filename)) { if (newbw->bitmap.filename) { XtFree(oldbw->bitmap.filename); newbw->bitmap.filename = XtNewString(newbw->bitmap.filename); } else newbw->bitmap.filename = oldbw->bitmap.filename; } if (NE(bitmap.basename)) { if (newbw->bitmap.basename) { XtFree(oldbw->bitmap.basename); newbw->bitmap.basename = XtNewString(newbw->bitmap.basename); } else newbw->bitmap.basename = oldbw->bitmap.basename; } if (NE(bitmap.size)) { Dimension width, height; if (BWParseSize(newbw->bitmap.size, &width, &height)) { ResizeGrid(newbw, width, height); resize = True; } } if (NE(bitmap.margin) || NE(bitmap.grid_tolerance) || NE(bitmap.squareW) || NE(bitmap.squareH) || NE(core.height) || NE(core.width)) resize = True; if (NE(bitmap.hot.x) || NE(bitmap.hot.y)) BWSetHotSpot(old, newbw->bitmap.hot.x, newbw->bitmap.hot.y); if (NE(bitmap.foreground_pixel) || NE(core.background_pixel)) { XSetForeground(XtDisplay(new), newbw->bitmap.drawing_gc, newbw->bitmap.foreground_pixel ^ newbw->core.background_pixel); redisplay = True; } if (NE(bitmap.frame_pixel) || NE(core.background_pixel)) { XSetForeground(XtDisplay(new), newbw->bitmap.frame_gc, newbw->bitmap.frame_pixel ^ newbw->core.background_pixel); redisplay = True; } if (NE(bitmap.dashes)) { XSetStipple(XtDisplay(new), newbw->bitmap.frame_gc, newbw->bitmap.dashes); redisplay = True; } if (NE(bitmap.highlight_pixel) || NE(core.background_pixel)) { RedrawStippled(newbw); XSetForeground(XtDisplay(new), newbw->bitmap.highlighting_gc, newbw->bitmap.highlight_pixel ^ newbw->core.background_pixel); RedrawStippled(newbw); } if (NE(bitmap.stipple)) { RedrawStippled(newbw); XSetStipple(XtDisplay(new), newbw->bitmap.highlighting_gc, newbw->bitmap.stipple); RedrawStippled(newbw); } if (resize) Resize((Widget)newbw); return (redisplay || resize); #undef NE } Boolean BWQueryProportional(Widget w) { BitmapWidget BW = (BitmapWidget) w; return (BW->bitmap.proportional); } void BWSwitchProportional(Widget w) { BitmapWidget BW = (BitmapWidget) w; BW->bitmap.proportional ^= True; Resize((Widget)BW); if (BW->core.visible) XClearArea(XtDisplay(BW), XtWindow(BW), 0, 0, BW->core.width, BW->core.height, True); } #if 0 void BWProportional(Widget w, Boolean _switch) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.proportional != _switch) BWSwitchProportional(w); } #endif void BWTPaste(Widget w, XEvent *event, String *params, Cardinal *num_params) { BitmapWidget BW = (BitmapWidget) w; BWRequestSelection(w, event->xbutton.time, TRUE); if (!BWQueryStored(w)) return; BWEngageRequest(w, RestoreRequest, False, (char *)&(event->xbutton.state), sizeof(int)); OnePointHandler(w, (BWStatus*) BW->bitmap.request_stack[BW->bitmap.current].status, event, NULL); } void BWTMark(Widget w, XEvent *event, String *params, Cardinal *num_params) { BitmapWidget BW = (BitmapWidget) w; BWEngageRequest(w, MarkRequest, False, (char *)&(event->xbutton.state), sizeof(int)); TwoPointsHandler(w, (BWStatus*) BW->bitmap.request_stack[BW->bitmap.current].status, event, NULL); } void BWTMarkAll(Widget w, XEvent *event, String *params, Cardinal *num_params) { BWMarkAll(w); BWGrabSelection(w, event->xkey.time); } void BWTUnmark(Widget w, XEvent *event, String *params, Cardinal *num_params) { BWUnmark(w); } /*****************************************************************************/ x11-apps-7.7+5+nmu1ubuntu1/bitmap/config.sub0000775000000000000000000010622312514123564015437 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-12-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/bitmap/atobm.c0000664000000000000000000001741012456374665014740 0ustar /* Copyright 1988, 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * atobm - ascii to bitmap filter * Author: Jim Fulton, MIT X Consortium */ #include #include #include #include #include static char *ProgramName; static void doit(FILE *fp, const char *filename, const char *chars, int xhot, int yhot, const char *name); static void _X_NORETURN _X_COLD usage (const char *msg) { if (msg) fprintf(stderr, "%s: %s\n", ProgramName, msg); fprintf (stderr, "usage: %s [-options ...] [filename]\n\n%s\n", ProgramName, "where options include:\n" " -chars cc chars to use for 0 and 1 bits, respectively\n" " -name variable name to use in bitmap file\n" " -xhot number x position of hotspot\n" " -yhot number y position of hotspot\n"); exit (1); } static void _X_NORETURN _X_COLD missing_arg (const char *option) { char msg[32]; snprintf(msg, sizeof(msg), "%s requires an argument", option); usage(msg); } static char * cify_name (char *name) { int length = name ? strlen (name) : 0; int i; for (i = 0; i < length; i++) { /* strncpy (result, begin, length); */ char c = name[i]; if (!((isascii(c) && isalnum(c)) || c == '_')) name[i] = '_'; } return name; } static char * StripName(char *name) { char *begin = strrchr(name, '/'); char *end, *result; int length; begin = (begin ? begin+1 : name); end = strchr(begin, '.'); /* change to strrchr to allow longer names */ length = (end ? (end - begin) : strlen (begin)); result = (char *) malloc (length + 1); strncpy (result, begin, length); result [length] = '\0'; return (result); } int main (int argc, char *argv[]) { int i; int xhot = -1, yhot = -1; char *filename = NULL; const char *chars = "-#"; const char *name = NULL; FILE *fp; ProgramName = argv[0]; for (i = 1; i < argc; i++) { char *arg = argv[i]; if (arg[0] == '-') { switch (arg[1]) { case '\0': filename = NULL; continue; case 'c': if (++i >= argc) missing_arg("-chars"); chars = argv[i]; continue; case 'n': if (++i >= argc) missing_arg("-name"); name = argv[i]; continue; case 'x': if (++i >= argc) missing_arg("-xhot"); xhot = atoi (argv[i]); continue; case 'y': if (++i >= argc) missing_arg("-yhot"); yhot = atoi (argv[i]); continue; default: fprintf(stderr, "%s: unrecognized option '%s'\n", ProgramName, argv[i]); usage (NULL); } } else { filename = arg; } } if (strlen (chars) != 2) { fprintf (stderr, "%s: bad character list \"%s\", must have exactly 2 characters\n", ProgramName, chars); exit (1); } if (filename) { fp = fopen (filename, "r"); if (!fp) { fprintf (stderr, "%s: unable to open file \"%s\".\n", ProgramName, filename); exit (1); } } else { fp = stdin; } if (!name) name = filename ? cify_name (StripName (filename)) : ""; doit (fp, filename, chars, xhot, yhot, name); if (filename) (void) fclose (fp); exit (0); } struct _scan_list { int allocated; int used; unsigned char *scanlines; struct _scan_list *next; }; #define NTOALLOC 16 static inline struct _scan_list * _new_scan_list(int bytes_per_scanline) { struct _scan_list *slist = (struct _scan_list *) calloc (1, sizeof(*slist)); if (!slist) { return NULL; } slist->allocated = NTOALLOC * bytes_per_scanline; slist->scanlines = (unsigned char *) calloc(slist->allocated, 1); if (!slist->scanlines) { free(slist); return NULL; } slist->used = 0; slist->next = NULL; return slist; } static void doit (FILE *fp, const char *filename, const char *chars, int xhot, int yhot, const char *name) { int i, j; int last_character; char buf[BUFSIZ]; char *cp, *newline; int width = 0, height = 0; int len; int removespace = (((isascii(chars[0]) && isspace(chars[0])) || (isascii(chars[1]) && isspace(chars[1]))) ? 0 : 1); int lineno = 0; int bytes_per_scanline = 0; struct _scan_list *head = NULL, *slist = NULL; static unsigned char masktable[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; int padded = 0; while (1) { buf[0] = '\0'; lineno++; if (fgets (buf, sizeof buf, fp) == NULL) break; cp = buf; if (removespace) { for (cp = buf; *cp && isascii(*cp) && isspace(*cp); cp++) ; } if (*cp == '\n' || !*cp) continue; /* empty line */ newline = strchr(cp, '\n'); if (!newline) { fprintf (stderr, "%s: line %d too long.\n", ProgramName, lineno); return; } if (removespace) { for (; --newline > cp && isascii(*newline) && isspace(*newline); ); newline++; } if (newline == cp + 1) continue; *newline = '\0'; len = strlen (cp); if (width == 0) { width = len; padded = ((width & 7) != 0); bytes_per_scanline = (len + 7) / 8; head = slist = _new_scan_list(bytes_per_scanline); if (!slist) { fprintf (stderr, "%s: unable to allocate scan list\n", ProgramName); return; } } else if (width != len) { fprintf (stderr, "%s: line %d is %d characters wide instead of %d\n", ProgramName, lineno, len, width); return; } if (slist->used + 1 >= slist->allocated) { struct _scan_list *old = slist; old->next = slist = _new_scan_list(bytes_per_scanline); if (!slist) { fprintf (stderr, "%s: unable to allocate scan list\n", ProgramName); free(old); return; } } /* okay, parse the line and stick values into the scanline array */ for (i = 0; i < width; i++) { int ind = (i & 7); int on = 0; if (cp[i] == chars[1]) { on = 1; } else if (cp[i] != chars[0]) { fprintf (stderr, "%s: bad character '%c' on line %d\n", ProgramName, cp[i], lineno); } if (on) slist->scanlines[slist->used] |= masktable[ind]; if (ind == 7) slist->used++; } if (padded) slist->used++; height++; } printf ("#define %s_width %d\n", name, width); printf ("#define %s_height %d\n", name, height); if (xhot >= 0) printf ("#define %s_x_hot %d\n", name, xhot); if (yhot >= 0) printf ("#define %s_y_hot %d\n", name, yhot); printf ("\n"); printf ("static unsigned char %s_bits[] = {\n", name); j = 0; last_character = height * bytes_per_scanline - 1; for (slist = head; slist; slist = slist->next) { for (i = 0; i < slist->used; i++) { printf (" 0x%02x", slist->scanlines[i]); if (j != last_character) putchar (','); if ((j % 12) == 11) putchar ('\n'); j++; } } printf (" };\n"); return; } x11-apps-7.7+5+nmu1ubuntu1/bitmap/FlipVert0000664000000000000000000000150412456374665015145 0ustar #define FlipVert_width 30 #define FlipVert_height 30 static char FlipVert_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0xc0, 0x75, 0x00, 0x00, 0xe0, 0xea, 0x00, 0x00, 0x70, 0xd5, 0x01, 0x00, 0xb8, 0xaa, 0x03, 0x00, 0xdc, 0x75, 0x07, 0x00, 0xee, 0xfb, 0x0e, 0x00, 0xf7, 0xf5, 0x1d, 0x00, 0xbb, 0xbb, 0x1b, 0x00, 0x9f, 0x35, 0x1f, 0x00, 0x8f, 0x3b, 0x1e, 0x00, 0x80, 0x35, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0x80, 0x35, 0x20, 0x08, 0x80, 0x3b, 0x60, 0x0c, 0x80, 0x35, 0xe0, 0x0e, 0x80, 0x3b, 0xe0, 0x0f, 0x80, 0x35, 0x60, 0x0d, 0x80, 0x3b, 0xe0, 0x0e, 0x80, 0xf5, 0x7f, 0x0d, 0x00, 0xfb, 0xff, 0x06, 0x00, 0xb6, 0x6a, 0x03, 0x00, 0x7c, 0xf5, 0x01, 0x00, 0xb8, 0xea, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/bitmap/Dialog.h0000664000000000000000000000331412456374665015040 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Davor Matic, MIT X Consortium */ /*#define None 0*/ #define Yes 1<<1 #define No 1<<2 #define Maybe 1<<3 /* :-) */ #define Okay 1<<4 #define Abort 1<<5 #define Cancel 1<<6 #define Retry 1<<7 typedef struct { Widget top_widget, shell_widget, dialog_widget; unsigned long options; } _Dialog, *Dialog; typedef struct { String name; unsigned long flag; } DialogButton; extern Dialog CreateDialog(Widget, String, unsigned long); extern unsigned long PopupDialog(Dialog, String, String, String *, XtGrabKind); extern void PopdownDialog(Dialog, String *); x11-apps-7.7+5+nmu1ubuntu1/bitmap/Makefile.am0000664000000000000000000000443312456374665015527 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS=man bin_PROGRAMS = bitmap bmtoa atobm bitmap_CFLAGS = $(CWARNFLAGS) $(BITMAP_CFLAGS) bitmap_LDADD = $(BITMAP_LIBS) $(MATH_LIBS) bitmap_SOURCES = \ BitEdit.c \ CutPaste.c \ Graphics.c \ ReqMach.c \ Bitmap.c \ Dialog.c \ Handlers.c \ Bitmap.h \ BitmapP.h \ Dialog.h \ Requests.h bmtoa_CFLAGS = $(CWARNFLAGS) $(BMTOA_CFLAGS) bmtoa_LDADD = $(BMTOA_LIBS) bmtoa_SOURCES = bmtoa.c atobm_CFLAGS = $(CWARNFLAGS) $(ATOBM_CFLAGS) atobm_LDADD = $(ATOBM_LIBS) atobm_SOURCES = atobm.c EXTRA_DIST = autogen.sh bitmapdir = $(includedir)/X11/bitmaps dist_bitmap_DATA = \ Dashes \ Down \ Excl \ FlipHoriz \ FlipVert \ Fold \ Left \ Right \ RotateLeft \ RotateRight \ Stipple \ Term \ Up # App default files (*.ad) DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ dist_appdefault_DATA = \ app-defaults/Bitmap-color \ app-defaults/Bitmap-nocase \ app-defaults/Bitmap MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/bitmap/Dialog.c0000664000000000000000000001275212456374665015041 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Davor Matic, MIT X Consortium */ #include #include #include #include #include #include #include "Dialog.h" #define min(x, y) (((x) < (y)) ? (x) : (y)) #define max(x, y) (((x) > (y)) ? (x) : (y)) static void SetDialogButton(Widget w, XEvent *event, String *argv, Cardinal *argc); static XtActionsRec actions_table[] = { {"set-dialog-button", SetDialogButton}, }; static DialogButton dialog_buttons[] = { {"yes", Yes}, {"no", No}, {"maybe", Maybe}, {"okay", Okay}, {"abort", Abort}, {"cancel", Cancel}, {"retry", Retry}, }; static unsigned long selected; /* ARGSUSED */ static void SetSelected(Widget w, XtPointer clientData, XtPointer callData) /* ARGSUSED */ { String name = (String)clientData; int i; for (i = 0; i < XtNumber(dialog_buttons); i++) if (!strcmp(dialog_buttons[i].name, name)) selected |= dialog_buttons[i].flag; } /* ARGSUSED */ static void SetDialogButton(Widget w, /* not used */ XEvent *event, /* not used */ String *argv, Cardinal *argc) { char button_name[80]; XtPointer dummy = NULL; int i; for (i = 0; i < *argc; i++) { XmuCopyISOLatin1Lowered (button_name, argv[i]); SetSelected(w, button_name, dummy); } } static Boolean firstTime = True; Dialog CreateDialog(Widget top_widget, String name, unsigned long options) { int i; Dialog popup; popup = (Dialog) XtMalloc(sizeof(_Dialog)); if (popup) { if (firstTime) { XtAddActions(actions_table, XtNumber(actions_table)); firstTime = False; } popup->top_widget = top_widget; popup->shell_widget = XtCreatePopupShell(name, transientShellWidgetClass, top_widget, NULL, 0); popup->dialog_widget = XtCreateManagedWidget("dialog", dialogWidgetClass, popup->shell_widget, NULL, 0); for (i = 0; i < XtNumber(dialog_buttons); i++) if (options & dialog_buttons[i].flag) XawDialogAddButton(popup->dialog_widget, dialog_buttons[i].name, SetSelected, dialog_buttons[i].name); popup->options = options; return popup; } else return NULL; } void PopdownDialog(Dialog popup, String *answer) { if (answer) *answer = XawDialogGetValueString(popup->dialog_widget); XtPopdown(popup->shell_widget); } unsigned long PopupDialog(Dialog popup, String message, String suggestion, String *answer, XtGrabKind grab) { Position popup_x, popup_y, top_x, top_y; Dimension popup_width, popup_height, top_width, top_height, border_width; int n; Arg wargs[4]; n = 0; XtSetArg(wargs[n], XtNlabel, message); n++; XtSetArg(wargs[n], XtNvalue, suggestion); n++; XtSetValues(popup->dialog_widget, wargs, n); XtRealizeWidget(popup->shell_widget); n = 0; XtSetArg(wargs[n], XtNx, &top_x); n++; XtSetArg(wargs[n], XtNy, &top_y); n++; XtSetArg(wargs[n], XtNwidth, &top_width); n++; XtSetArg(wargs[n], XtNheight, &top_height); n++; XtGetValues(popup->top_widget, wargs, n); n = 0; XtSetArg(wargs[n], XtNwidth, &popup_width); n++; XtSetArg(wargs[n], XtNheight, &popup_height); n++; XtSetArg(wargs[n], XtNborderWidth, &border_width); n++; XtGetValues(popup->shell_widget, wargs, n); popup_x = max(0, min(top_x + ((Position)top_width - (Position)popup_width) / 2, (Position)DisplayWidth(XtDisplay(popup->shell_widget), DefaultScreen(XtDisplay(popup->shell_widget))) - (Position)popup_width - 2 * (Position)border_width)); popup_y = max(0, min(top_y + ((Position)top_height - (Position)popup_height) / 2, (Position)DisplayHeight(XtDisplay(popup->shell_widget), DefaultScreen(XtDisplay(popup->shell_widget))) - (Position)popup_height - 2 * (Position)border_width)); n = 0; XtSetArg(wargs[n], XtNx, popup_x); n++; XtSetArg(wargs[n], XtNy, popup_y); n++; XtSetValues(popup->shell_widget, wargs, n); selected = None; XtPopup(popup->shell_widget, grab); XWarpPointer(XtDisplay(popup->shell_widget), XtWindow(popup->top_widget), XtWindow(popup->shell_widget), 0, 0, top_width, top_height, popup_width / 2, popup_height / 2); while ((selected & popup->options) == None) { XEvent event; XtNextEvent(&event); XtDispatchEvent(&event); } PopdownDialog(popup, answer); return (selected & popup->options); } x11-apps-7.7+5+nmu1ubuntu1/bitmap/Down0000664000000000000000000000147012456374665014323 0ustar #define Down_width 30 #define Down_height 30 static char Down_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x18, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0xf0, 0xb8, 0xe3, 0x01, 0xf0, 0x59, 0xf3, 0x01, 0xb0, 0xbb, 0xbb, 0x01, 0x70, 0x5f, 0xdf, 0x01, 0xe0, 0xbe, 0xef, 0x00, 0xc0, 0x5d, 0x77, 0x00, 0x80, 0xab, 0x3a, 0x00, 0x00, 0x57, 0x1d, 0x00, 0x00, 0xae, 0x0e, 0x00, 0x00, 0x5c, 0x07, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/bitmap/missing0000755000000000000000000001533012656634574015066 0ustar #! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/bitmap/BitEdit.c0000664000000000000000000006472312456374665015173 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Davor Matic, MIT X Consortium */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "Bitmap.h" #include static const char *usage = "[-options ...] filename\n\ \n\ where options include all standard toolkit options plus:\n\ -size WIDTHxHEIGHT\n\ -sw dimension\n\ -sh dimension\n\ -gt dimension\n\ -grid, +grid\n\ -axes, +axes\n\ -dashed, +dashed\n\ -stippled, +stippled\n\ -proportional, +proportional\n\ -basename basename\n\ -dashes filename\n\ -stipple filename\n\ -hl color\n\ -fr color\n\ \n\ The default WIDTHxHEIGHT is 16x16.\n"; static XrmOptionDescRec options[] = { { "-axes", "*bitmap.axes", XrmoptionNoArg, "True"}, { "+axes", "*bitmap.axes", XrmoptionNoArg, "False"}, { "-basename", "*bitmap.basename", XrmoptionSepArg, NULL}, { "-dashed", "*bitmap.dashed", XrmoptionNoArg, "True"}, { "+dashed", "*bitmap.dashed", XrmoptionNoArg, "False"}, { "-dashes", "*bitmap.dashes", XrmoptionSepArg, NULL}, { "-fr", "*bitmap.frame", XrmoptionSepArg, NULL}, { "-gt", "*bitmap.gridTolerance",XrmoptionSepArg, NULL}, { "-grid", "*bitmap.grid", XrmoptionNoArg, "True"}, { "+grid", "*bitmap.grid", XrmoptionNoArg, "False"}, { "-hl", "*bitmap.highlight", XrmoptionSepArg, NULL}, { "-proportional","*bitmap.proportional", XrmoptionNoArg, "True"}, { "+proportional","*bitmap.proportional", XrmoptionNoArg, "False"}, { "-size", "*bitmap.size", XrmoptionSepArg, NULL}, { "-sh", "*bitmap.squareHeight", XrmoptionSepArg, NULL}, { "-sw", "*bitmap.squareWidth", XrmoptionSepArg, NULL}, { "-stipple", "*bitmap.stipple", XrmoptionSepArg, NULL}, { "-stippled", "*bitmap.stippled", XrmoptionNoArg, "True"}, { "+stippled", "*bitmap.stippled", XrmoptionNoArg, "False"}, }; typedef struct { int id; String name; Boolean trap; Widget widget; } ButtonRec; static ButtonRec file_menu[] = { #define New 101 {New, "new", True}, #define Load 102 {Load, "load", True}, #define Insert 103 {Insert, "insert", True}, #define Save 104 {Save, "save", True}, #define SaveAs 105 {SaveAs, "saveAs", True}, #define Resize 106 {Resize, "resize", True}, #define Rescale 107 {Rescale, "rescale", True}, #define Filename 108 {Filename, "filename", True}, #define Basename 109 {Basename, "basename", True}, #define Dummy -1 {Dummy, "line", False}, #define Quit 110 {Quit, "quit", True}, }; static ButtonRec edit_menu[] = { #define Image 201 {Image, "image", True}, #define Grid 203 {Grid, "grid", True}, #define Dashed 204 {Dashed, "dashed", True}, #define Axes 205 {Axes, "axes", True}, #define Stippled 206 {Stippled, "stippled", True}, #define Proportional 207 {Proportional, "proportional", True}, #define Zoom 208 {Zoom, "zoom", True}, /* Dummy */ {Dummy, "line", False}, #define Cut 209 {Cut, "cut", True}, #define Copy 210 {Copy, "copy", True}, #define Paste 211 {Paste, "paste", True}, }; static ButtonRec buttons[] = { /*#define Clear 1*/ {Clear, "clear", False}, /*#define Set 2*/ {Set, "set", False}, /*#define Invert 3*/ {Invert, "invert", False}, #define Mark 26 {Mark, "mark", True}, #define Unmark 27 {Unmark, "unmark", False}, #define CopyImm 4 {CopyImm, "copy", True}, #define MoveImm 5 {MoveImm, "move", True}, #define FlipHoriz 6 {FlipHoriz, "flipHoriz", False}, #define Up 7 {Up, "up", False}, #define FlipVert 8 {FlipVert, "flipVert", False}, #define Left 9 {Left, "left", False}, #define Fold 10 {Fold, "fold", False}, #define Right 11 {Right, "right", False}, #define RotateLeft 12 {RotateLeft, "rotateLeft", False}, #define Down 13 {Down, "down", False}, #define RotateRight 14 {RotateRight, "rotateRight", False}, #define Point 15 {Point, "point", True}, #define Curve 16 {Curve, "curve", True}, #define Line 17 {Line, "line", True}, #define Rectangle 18 {Rectangle, "rectangle", True}, #define FilledRectangle 19 {FilledRectangle, "filledRectangle", True}, #define Circle 20 {Circle, "circle", True}, #define FilledCircle 21 {FilledCircle, "filledCircle", True}, #define FloodFill 22 {FloodFill, "floodFill", True}, #define SetHotSpot 23 {SetHotSpot, "setHotSpot", True}, #define ClearHotSpot 24 {ClearHotSpot, "clearHotSpot", False}, #define Undo 25 {Undo, "undo", False}, }; #include "Dialog.h" static Widget top_widget, parent_widget, formy_widget, fileMenu_widget, editMenu_widget, status_widget, pane_widget, form_widget, bitmap_widget, image_shell, box_widget, normal_image_widget, inverted_image_widget; static Boolean image_visible = False; static Pixmap check_mark; static Dialog input_dialog, error_dialog, qsave_dialog; static Time btime; static String filename = NULL, base_name = NULL, format; static char message[80]; void FixMenu ( Widget w, XEvent *event, String *params, Cardinal *num_params ); void SwitchImage ( void ); void SwitchGrid( void ); void SwitchDashed( void ); void SwitchAxes( void ); void SwitchStippled( void ); void SwitchProportional( void ); void SwitchZoom( void ); void DoCut( void ); void DoCopy( void ); void DoPaste( void ); void DoNew( void ); void DoLoad( void ); void DoInsert( void ); void DoSave( void ); void DoSaveAs( void ); void DoResize( void ); void DoRescale( void ); void DoFilename( void ); void DoBasename( void ); void DoQuit ( Widget w, XEvent *event, String *params, Cardinal *num_params ); static XtActionsRec actions_table[] = { {"fix-menu", FixMenu}, {"switch-image", (XtActionProc)SwitchImage}, {"switch-grid", (XtActionProc)SwitchGrid}, {"switch-dashed", (XtActionProc)SwitchDashed}, {"switch-axes", (XtActionProc)SwitchAxes}, {"switch-stippled", (XtActionProc)SwitchStippled}, {"switch-proportional", (XtActionProc)SwitchProportional}, {"switch-zoom", (XtActionProc)SwitchZoom}, {"do-cut", (XtActionProc)DoCut}, {"do-copy", (XtActionProc)DoCopy}, {"do-paste", (XtActionProc)DoPaste}, {"do-new", (XtActionProc)DoNew}, {"do-load", (XtActionProc)DoLoad}, {"do-insert", (XtActionProc)DoInsert}, {"do-save", (XtActionProc)DoSave}, {"do-save-as", (XtActionProc)DoSaveAs}, {"do-resize", (XtActionProc)DoResize}, {"do-rescale", (XtActionProc)DoRescale}, {"do-filename", (XtActionProc)DoFilename}, {"do-basename", (XtActionProc)DoBasename}, {"do-quit", DoQuit} }; static Atom wm_delete_window; static void FixImage(void) { Pixmap old_image, image; int n; Arg wargs[2]; if (!image_visible) return; n=0; XtSetArg(wargs[n], XtNbitmap, &old_image); n++; XtGetValues(normal_image_widget, wargs, n); image = BWGetUnzoomedPixmap(bitmap_widget); n=0; XtSetArg(wargs[n], XtNbitmap, image); n++; XtSetValues(normal_image_widget, wargs, n); XtSetValues(inverted_image_widget, wargs, n); if (old_image != XtUnspecifiedPixmap) XFreePixmap(XtDisplay(bitmap_widget), old_image); } static void FixStatus(void) { int n; Arg wargs[2]; String str, label; str = BWUnparseStatus(bitmap_widget); n=0; XtSetArg(wargs[n], XtNlabel, &label); n++; XtGetValues(status_widget, wargs, n); if (strcmp(str, label)) { n = 0; XtSetArg(wargs[n], XtNlabel, str); n++; XtSetValues(status_widget, wargs, n); } /*XtFree(str); */ } static void FixUp(void) { FixImage(); FixStatus(); } static void FixEntry(Widget w, int *id) { int n; Arg wargs[2]; Time dummy = 0; n = 0; switch (*id) { case Image: XtSetArg(wargs[n], XtNleftBitmap, image_visible ? check_mark : None); n++; break; case Grid: XtSetArg(wargs[n], XtNleftBitmap, BWQueryGrid(bitmap_widget) ? check_mark : None); n++; break; case Dashed: XtSetArg(wargs[n], XtNleftBitmap, BWQueryDashed(bitmap_widget) ? check_mark : None); n++; break; case Axes: XtSetArg(wargs[n], XtNleftBitmap, BWQueryAxes(bitmap_widget) ? check_mark : None); n++; break; case Stippled: XtSetArg(wargs[n], XtNleftBitmap, BWQueryStippled(bitmap_widget) ? check_mark : None); n++; break; case Proportional: XtSetArg(wargs[n], XtNleftBitmap, BWQueryProportional(bitmap_widget) ? check_mark : None); n++; break; case Zoom: XtSetArg(wargs[n], XtNleftBitmap, BWQueryZooming(bitmap_widget) ? check_mark : None); n++; break; case Copy: case Cut: XtSetArg(wargs[n], XtNsensitive, BWQueryMarked(bitmap_widget)); n++; break; case Paste: XtSetArg(wargs[n], XtNsensitive, BWQuerySelection(bitmap_widget, dummy)); n++; break; default: return; } XtSetValues(w, wargs, n); } /* ARGSUSED */ void FixMenu(Widget w, XEvent *event, String *params, Cardinal *num_params) { int i; btime = event->xbutton.time; for (i = 0; i < XtNumber(edit_menu); i++) FixEntry(edit_menu[i].widget, &edit_menu[i].id); } static int zero = 0; #define Plain (char *)&zero,sizeof(int) /* ARGSUSED */ static void TheCallback(Widget w, /* not used */ XtPointer clientData, XtPointer callData) { int *id = (int *)clientData; switch (*id) { case New: DoNew(); break; case Load: DoLoad(); break; case Insert: DoInsert(); break; case Save: DoSave(); break; case SaveAs: DoSaveAs(); break; case Resize: DoResize(); break; case Rescale: DoRescale(); break; case Filename: DoFilename(); break; case Basename: DoBasename(); break; case Image: SwitchImage(); break; case Grid: SwitchGrid(); break; case Dashed: SwitchDashed(); break; case Axes: SwitchAxes(); break; case Stippled: SwitchStippled(); break; case Proportional: SwitchProportional(); break; case Zoom: SwitchZoom(); break; case Cut: DoCut(); break; case Copy: DoCopy(); break; case Paste: DoPaste(); break; case Clear: BWStoreToBuffer(bitmap_widget); BWClear(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Set: BWStoreToBuffer(bitmap_widget); BWSet(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Invert: BWStoreToBuffer(bitmap_widget); BWInvert(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Mark: BWRemoveAllRequests(bitmap_widget); BWEngageRequest(bitmap_widget, MarkRequest, True, Plain); break; case Unmark: BWUnmark(bitmap_widget); break; case CopyImm: BWRemoveAllRequests(bitmap_widget); if (BWQueryMarked(bitmap_widget)) { BWAddRequest(bitmap_widget, MarkRequest, False, Plain); BWEngageRequest(bitmap_widget, CopyRequest, True, Plain); } else { BWEngageRequest(bitmap_widget, MarkRequest, False, Plain); BWAddRequest(bitmap_widget, CopyRequest, True, Plain); } break; case MoveImm: BWRemoveAllRequests(bitmap_widget); if (BWQueryMarked(bitmap_widget)) { BWAddRequest(bitmap_widget, MarkRequest, False, Plain); BWEngageRequest(bitmap_widget, MoveRequest, True, Plain); } else { BWEngageRequest(bitmap_widget, MarkRequest, False, Plain); BWAddRequest(bitmap_widget, MoveRequest, True, Plain); } break; case Up: BWStoreToBuffer(bitmap_widget); BWUp(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Down: BWStoreToBuffer(bitmap_widget); BWDown(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Left: BWStoreToBuffer(bitmap_widget); BWLeft(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Right: BWStoreToBuffer(bitmap_widget); BWRight(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Fold: BWStoreToBuffer(bitmap_widget); BWFold(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case FlipHoriz: BWStoreToBuffer(bitmap_widget); BWFlipHoriz(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case FlipVert: BWStoreToBuffer(bitmap_widget); BWFlipVert(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case RotateRight: BWStoreToBuffer(bitmap_widget); BWRotateRight(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case RotateLeft: BWStoreToBuffer(bitmap_widget); BWRotateLeft(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Point: BWRemoveAllRequests(bitmap_widget); BWEngageRequest(bitmap_widget, PointRequest, True, Plain); break; case Curve: BWRemoveAllRequests(bitmap_widget); BWEngageRequest(bitmap_widget, CurveRequest, True, Plain); break; case Line: BWRemoveAllRequests(bitmap_widget); BWEngageRequest(bitmap_widget, LineRequest, True, Plain); break; case Rectangle: BWRemoveAllRequests(bitmap_widget); BWEngageRequest(bitmap_widget, RectangleRequest, True, Plain); break; case FilledRectangle: BWRemoveAllRequests(bitmap_widget); BWEngageRequest(bitmap_widget, FilledRectangleRequest, True, Plain); break; case Circle: BWRemoveAllRequests(bitmap_widget); BWEngageRequest(bitmap_widget, CircleRequest, True, Plain); break; case FilledCircle: BWRemoveAllRequests(bitmap_widget); BWEngageRequest(bitmap_widget, FilledCircleRequest, True, Plain); break; case FloodFill: BWRemoveAllRequests(bitmap_widget); BWEngageRequest(bitmap_widget, FloodFillRequest, True, Plain); break; case SetHotSpot: BWRemoveAllRequests(bitmap_widget); BWEngageRequest(bitmap_widget, HotSpotRequest, True, Plain); break; case ClearHotSpot: BWStoreToBuffer(bitmap_widget); BWClearHotSpot(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Undo: BWUndo(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Quit: DoQuit(bitmap_widget, NULL, NULL, NULL); break; } /* don't add anything below this line */ } /* ARGSUSED */ void SwitchImage(void) { if (image_visible) { XtPopdown(image_shell); image_visible = False; } else { Position image_x, image_y; int n; Arg wargs[3]; XtTranslateCoords(bitmap_widget, 10, 10, &image_x, &image_y); n = 0; XtSetArg(wargs[n], XtNx, image_x); n++; XtSetArg(wargs[n], XtNy, image_y); n++; XtSetValues(image_shell, wargs, n); image_visible = True; FixImage(); XtPopup(image_shell, XtGrabNone); FixImage(); } } void SwitchGrid(void) { BWSwitchGrid(bitmap_widget); } void SwitchDashed(void) { BWSwitchDashed(bitmap_widget); } void SwitchAxes(void) { BWSwitchAxes(bitmap_widget); } void SwitchStippled(void) { BWSwitchStippled(bitmap_widget); } void SwitchProportional(void) { BWSwitchProportional(bitmap_widget); } void SwitchZoom(void) { if (BWQueryZooming(bitmap_widget)) { BWZoomOut(bitmap_widget); BWChangeNotify(bitmap_widget); } else { if (BWQueryMarked(bitmap_widget)) { BWStoreToBuffer(bitmap_widget); BWZoomMarked(bitmap_widget); BWChangeNotify(bitmap_widget); } else { BWEngageRequest(bitmap_widget, ZoomInRequest, False, Plain); } } } void DoCut(void) { BWStore(bitmap_widget); BWStoreToBuffer(bitmap_widget); BWClearMarked(bitmap_widget); BWUnmark(bitmap_widget); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); } void DoCopy(void) { BWStore(bitmap_widget); BWUnmark(bitmap_widget); } void DoPaste(void) { BWRequestSelection(bitmap_widget, btime, TRUE); BWEngageRequest(bitmap_widget, RestoreRequest, False, Plain); } void DoNew(void) { BWGetFilename(bitmap_widget, &filename); if (PopupDialog(input_dialog, "New file:", filename, &filename, XtGrabExclusive) == Okay) { BWChangeFilename(bitmap_widget, filename); BWChangeBasename(bitmap_widget, filename); BWStoreToBuffer(bitmap_widget); BWClear(bitmap_widget); BWClearHotSpot(bitmap_widget); BWChangeNotify(bitmap_widget); BWClearChanged(bitmap_widget); BWUnmark(bitmap_widget); FixStatus(); } } void DoLoad(void) { if (BWQueryChanged(bitmap_widget)) { BWGetFilename(bitmap_widget, &filename); RetryLoadSave: switch (PopupDialog(qsave_dialog, "Save file before loading?", filename, &filename, XtGrabExclusive)) { case Yes: if (BWWriteFile(bitmap_widget, filename, NULL) != BitmapSuccess) { snprintf(message, sizeof(message), "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryLoadSave; } break; case Cancel: return; } } BWGetFilepath(bitmap_widget, &filename); RetryLoad: if (PopupDialog(input_dialog, "Load file:", filename, &filename, XtGrabExclusive) == Okay) { if (BWReadFile(bitmap_widget, filename, NULL) != BitmapSuccess) { snprintf(message, sizeof(message), "Can't read file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryLoad; } else { BWChangeNotify(bitmap_widget); BWClearChanged(bitmap_widget); FixStatus(); } } } void DoInsert(void) { BWGetFilepath(bitmap_widget, &filename); RetryInsert: if (PopupDialog(input_dialog, "Insert file:", filename, &filename, XtGrabExclusive) == Okay) { if (BWStoreFile(bitmap_widget, filename, NULL) != BitmapSuccess) { snprintf(message, sizeof(message), "Can't read file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryInsert; } else { BWEngageRequest(bitmap_widget, RestoreRequest, False, Plain); } } } void DoSave(void) { BWGetFilename(bitmap_widget, &filename); if (!strcmp(filename, "")) DoSaveAs(); else if (BWWriteFile(bitmap_widget, NULL, NULL) != BitmapSuccess) { snprintf(message, sizeof(message), "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) DoSaveAs(); } else { BWClearChanged(bitmap_widget); } } void DoSaveAs(void) { BWGetFilename(bitmap_widget, &filename); RetrySave: if (PopupDialog(input_dialog, "Save file:", filename, &filename, XtGrabExclusive) == Okay) { if (BWWriteFile(bitmap_widget, filename, NULL) != BitmapSuccess) { snprintf(message, sizeof(message), "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetrySave; } else { BWClearChanged(bitmap_widget); FixStatus(); } } } void DoResize(void) { Dimension width, height; format = ""; RetryResize: if (PopupDialog(input_dialog, "Resize to WIDTHxHEIGHT:", format, &format, XtGrabExclusive) == Okay) { if (BWParseSize(format, &width, &height)) { BWResize(bitmap_widget, width, height); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); FixStatus(); } else { snprintf(message, sizeof(message), "Wrong format: %s", format); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryResize; } } } void DoRescale(void) { Dimension width, height; format = ""; RetryRescale: if (PopupDialog(input_dialog, "Rescale to WIDTHxHEIGHT:", format, &format, XtGrabExclusive) == Okay) { if (BWParseSize(format, &width, &height)) { BWRescale(bitmap_widget, width, height); BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); FixStatus(); } else { snprintf(message, sizeof(message), "Wrong format: %s", format); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryRescale; } } } void DoFilename(void) { BWGetFilename(bitmap_widget, &filename); if (PopupDialog(input_dialog, "Change filename:", filename, &filename, XtGrabExclusive) == Okay) { BWChangeFilename(bitmap_widget, filename); FixStatus(); } } void DoBasename(void) { BWGetBasename(bitmap_widget, &base_name); if (PopupDialog(input_dialog, "Change basename:", base_name, &base_name, XtGrabExclusive) == Okay) { BWChangeBasename(bitmap_widget, base_name); FixStatus(); } } void DoQuit(Widget w, XEvent *event, String *params, Cardinal *num_params) { if (BWQueryChanged(bitmap_widget)) { BWGetFilename(bitmap_widget, &filename); RetryQuit: switch (PopupDialog(qsave_dialog, "Save file before quitting?", filename, &filename, XtGrabExclusive)) { case Yes: if (BWWriteFile(bitmap_widget, filename, NULL) != BitmapSuccess) { snprintf(message, sizeof(message), "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryQuit; else return; } break; case Cancel: return; } } exit(0); } int main(int argc, char *argv[]) { int i, n; Arg wargs[2]; Widget w; Widget radio_group = NULL; XtPointer radio_data = NULL; top_widget = XtInitialize(NULL, "Bitmap", options, XtNumber(options), &argc, argv); if (argc > 2) { fputs(usage, stderr); exit (0); } check_mark = XCreateBitmapFromData(XtDisplay(top_widget), RootWindowOfScreen(XtScreen(top_widget)), (char *) xlogo16_bits, xlogo16_width, xlogo16_height); XtAddActions(actions_table, XtNumber(actions_table)); XtOverrideTranslations (top_widget, XtParseTranslationTable("WM_PROTOCOLS: do-quit()")); parent_widget = XtCreateManagedWidget("parent", panedWidgetClass, top_widget, NULL, 0); formy_widget = XtCreateManagedWidget("formy", formWidgetClass, parent_widget, NULL, 0); fileMenu_widget = XtCreatePopupShell("fileMenu", simpleMenuWidgetClass, formy_widget, NULL, 0); (void) XtCreateManagedWidget("fileButton", menuButtonWidgetClass, formy_widget, NULL, 0); for (i = 0; i < XtNumber(file_menu); i++) { w = XtCreateManagedWidget(file_menu[i].name, (file_menu[i].trap ? smeBSBObjectClass : smeLineObjectClass), fileMenu_widget, NULL, 0), XtAddCallback(w, XtNcallback, TheCallback, (XtPointer)&file_menu[i].id); file_menu[i].widget = w; } editMenu_widget = XtCreatePopupShell("editMenu", simpleMenuWidgetClass, formy_widget, NULL, 0); (void) XtCreateManagedWidget("editButton", menuButtonWidgetClass, formy_widget, NULL, 0); for (i = 0; i < XtNumber(edit_menu); i++) { w = XtCreateManagedWidget(edit_menu[i].name, (edit_menu[i].trap ? smeBSBObjectClass : smeLineObjectClass), editMenu_widget, NULL, 0), XtAddCallback(w, XtNcallback, TheCallback, (XtPointer)&edit_menu[i].id); edit_menu[i].widget = w; } status_widget = XtCreateManagedWidget("status", labelWidgetClass, formy_widget, NULL, 0); pane_widget = XtCreateManagedWidget("pane", panedWidgetClass, parent_widget, NULL, 0); form_widget = XtCreateManagedWidget("form", formWidgetClass, pane_widget, NULL, 0); for (i = 0; i < XtNumber(buttons); i++) { w = XtCreateManagedWidget(buttons[i].name, (buttons[i].trap ? toggleWidgetClass : commandWidgetClass), form_widget, NULL, 0); XtAddCallback(w, XtNcallback, TheCallback, (XtPointer)&buttons[i].id); buttons[i].widget = w; if (buttons[i].id == Point) { radio_group = buttons[i].widget; radio_data = buttons[i].name; } } bitmap_widget = XtCreateManagedWidget("bitmap", bitmapWidgetClass, pane_widget, NULL, 0); XtRealizeWidget(top_widget); if (argc > 1) if (BWReadFile(bitmap_widget, argv[1], NULL)) wm_delete_window = XInternAtom(XtDisplay(top_widget), "WM_DELETE_WINDOW", False); (void) XSetWMProtocols (XtDisplay(top_widget), XtWindow(top_widget), &wm_delete_window, 1); image_shell = XtCreatePopupShell("image", transientShellWidgetClass, top_widget, NULL, 0); box_widget = XtCreateManagedWidget("box", boxWidgetClass, image_shell, NULL, 0); normal_image_widget = XtCreateManagedWidget("normalImage", labelWidgetClass, box_widget, NULL, 0); inverted_image_widget = XtCreateManagedWidget("invertedImage", labelWidgetClass, box_widget, NULL, 0); n=0; XtSetArg(wargs[n], XtNbitmap, BWGetUnzoomedPixmap(bitmap_widget)); n++; XtSetValues(normal_image_widget, wargs, n); XtSetValues(inverted_image_widget, wargs, n); XtRealizeWidget(image_shell); BWNotify(bitmap_widget, (XtActionProc)FixUp); FixStatus(); input_dialog = CreateDialog(top_widget, "input", Okay | Cancel); error_dialog = CreateDialog(top_widget, "error", Abort | Retry); qsave_dialog = CreateDialog(top_widget, "qsave", Yes | No | Cancel); XawToggleSetCurrent(radio_group, radio_data); BWEngageRequest(bitmap_widget, PointRequest, True, Plain); XtMainLoop(); exit(0); } x11-apps-7.7+5+nmu1ubuntu1/bitmap/configure.ac0000664000000000000000000000532312456374665015760 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([bitmap], [1.0.8], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [bitmap]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS AM_PROG_CC_C_O AC_CHECK_FUNCS([mkstemp]) # Math libraries & functions # - some compilers use builtin inlines for floor when optimizing # - lrint() is a C99 addition not found on some older systems # - must do the libm check first so that the lrint check will have it in $LIBS save_LIBS="$LIBS" AC_SEARCH_LIBS([floor], [m]) AC_SEARCH_LIBS([lrint], [m]) AC_CHECK_FUNCS([lrint]) MATH_LIBS="$LIBS" LIBS="$save_LIBS" AC_SUBST([MATH_LIBS]) # Obtain compiler/linker options from dependencies PKG_CHECK_MODULES(BMTOA, [x11 xmu xproto >= 7.0.17]) PKG_CHECK_MODULES(ATOBM, [xproto >= 7.0.25]) PKG_CHECK_MODULES(BITMAP, xbitmaps xaw7 xmu) PKG_CHECK_MODULES(APPDEFS, xt) xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` AC_ARG_WITH(appdefaultdir, AS_HELP_STRING([--with-appdefaultdir=], [specify directory for app-defaults files (default is autodetected)]), [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) AC_CONFIG_FILES([Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/bitmap/README0000664000000000000000000000127212456374665014351 0ustar bitmap, bmtoa, atobm - X bitmap (XBM) editor and converter utilities All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/bitmap http://cgit.freedesktop.org/xorg/app/bitmap For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/bitmap/Right0000664000000000000000000000147312456374665014474 0ustar #define Right_width 30 #define Right_height 30 static char Right_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x80, 0x1d, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0xdc, 0x01, 0xff, 0xff, 0xbf, 0x03, 0xfe, 0xff, 0x5f, 0x07, 0xac, 0xaa, 0xaa, 0x0e, 0x58, 0x55, 0x55, 0x1d, 0xac, 0xaa, 0xaa, 0x0e, 0xfe, 0xff, 0x5f, 0x07, 0xff, 0xff, 0xbf, 0x03, 0x00, 0x00, 0xdc, 0x01, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0x80, 0x1d, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/bitmap/COPYING0000664000000000000000000000216512456374665014526 0ustar Copyright 1988, 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. x11-apps-7.7+5+nmu1ubuntu1/bitmap/INSTALL0000664000000000000000000003660012456374754014524 0ustar Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xlogo/0000775000000000000000000000000012656635743013342 5ustar x11-apps-7.7+5+nmu1ubuntu1/xlogo/LogoP.h0000664000000000000000000000365712167023104014521 0ustar /* Copyright 1988, 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _XawLogoP_h #define _XawLogoP_h #include "Logo.h" #include #ifdef XRENDER #include #include #endif typedef struct { Pixel fgpixel; GC foreGC; GC backGC; Boolean shape_window; Boolean need_shaping; #ifdef XRENDER Boolean render; Boolean sharp; XftDraw *draw; XRenderPictFormat *mask_format; XftColor fg; XftColor bg; #endif } LogoPart; typedef struct _LogoRec { CorePart core; SimplePart simple; LogoPart logo; } LogoRec; typedef struct {int dummy;} LogoClassPart; typedef struct _LogoClassRec { CoreClassPart core_class; SimpleClassPart simple_class; LogoClassPart logo_class; } LogoClassRec; extern LogoClassRec logoClassRec; #endif /* _XawLogoP_h */ x11-apps-7.7+5+nmu1ubuntu1/xlogo/xlogo.c0000664000000000000000000001221212167023104014607 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "xlogo.h" #include "Logo.h" #include #ifdef XKB #include #endif #include #include /* Global vars*/ const char *ProgramName; /* program name (from argv[0]) */ static void quit(Widget w, XEvent *event, String *params, Cardinal *num_params); static XrmOptionDescRec options[] = { { "-shape", "*shapeWindow", XrmoptionNoArg, (XPointer) "on" }, #ifdef XRENDER {"-render", "*render",XrmoptionNoArg, "TRUE"}, {"-sharp", "*sharp", XrmoptionNoArg, "TRUE"}, #endif {"-v", "Verbose", XrmoptionNoArg, "TRUE"}, {"-q", "Quiet", XrmoptionNoArg, "TRUE"}, }; static XtActionsRec actions[] = { {"quit", quit }, }; static Atom wm_delete_window; /* See xlogo.h */ XLogoResourceData userOptions; #define Offset(field) XtOffsetOf(XLogoResourceData, field) static XtResource resources[] = { {"verbose", "Verbose", XtRBoolean, sizeof(Boolean), Offset(verbose), XtRImmediate, (XtPointer)False}, {"quiet", "Quiet", XtRBoolean, sizeof(Boolean), Offset(quiet), XtRImmediate, (XtPointer)False}, }; static String fallback_resources[] = { "*iconPixmap: xlogo32", "*iconMask: xlogo32", "*baseTranslations: #override \\" "\tq: quit()", NULL, }; static void die(Widget w, XtPointer client_data, XtPointer call_data) { XtAppSetExitFlag(XtWidgetToApplicationContext(w)); } static void save(Widget w, XtPointer client_data, XtPointer call_data) { return; } /* * Report the syntax for calling xlogo. */ static void Syntax(Widget toplevel) { Arg arg; SmcConn connection; String reasons[10]; int i, n = 0; reasons[n++] = "Usage: "; reasons[n++] = (String)ProgramName; reasons[n++] = " [-fg ] [-bg ] [-rv] [-bw ] [-bd ]\n"; reasons[n++] = " [-v] [-q]\n"; reasons[n++] = " [-d []:[]]\n"; reasons[n++] = " [-g [][x][<+->[<+->]]]\n"; #ifdef XRENDER reasons[n++] = " [-render] [-sharp]\n"; #endif /* XRENDER */ reasons[n++] = " [-shape]\n\n"; XtSetArg(arg, XtNconnection, &connection); XtGetValues(toplevel, &arg, (Cardinal)1); if (connection) SmcCloseConnection(connection, n, reasons); else { for (i=0; i < n; i++) printf("%s", reasons[i]); } exit(EXIT_FAILURE); } int main(int argc, char *argv[]) { Widget toplevel; XtAppContext app_con; ProgramName = argv[0]; toplevel = XtOpenApplication(&app_con, "XLogo", options, XtNumber(options), &argc, argv, fallback_resources, sessionShellWidgetClass, NULL, ZERO); if (argc != 1) Syntax(toplevel); XtGetApplicationResources(toplevel, (XtPointer)&userOptions, resources, XtNumber(resources), NULL, 0); XtAppAddActions(app_con, actions, XtNumber(actions)); XtAddCallback(toplevel, XtNsaveCallback, save, NULL); XtAddCallback(toplevel, XtNdieCallback, die, NULL); XtOverrideTranslations (toplevel, XtParseTranslationTable ("WM_PROTOCOLS: quit()")); XtCreateManagedWidget("xlogo", logoWidgetClass, toplevel, NULL, ZERO); XtRealizeWidget(toplevel); wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", False); (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel), &wm_delete_window, 1); XtAppMainLoop(app_con); return EXIT_SUCCESS; } /*ARGSUSED*/ static void quit(Widget w, XEvent *event, String *params, Cardinal *num_params) { Arg arg; if (event->type == ClientMessage && (Atom)event->xclient.data.l[0] != wm_delete_window) { #ifdef XKB XkbStdBell(XtDisplay(w), XtWindow(w), 0, XkbBI_BadValue); #else XBell(XtDisplay(w), 0); #endif } else { /* resign from the session */ XtSetArg(arg, XtNjoinSession, False); XtSetValues(w, &arg, ONE); die(w, NULL, NULL); } } x11-apps-7.7+5+nmu1ubuntu1/xlogo/app-defaults/0000775000000000000000000000000012167023104015702 5ustar x11-apps-7.7+5+nmu1ubuntu1/xlogo/app-defaults/XLogo-color0000664000000000000000000000032712167023104017773 0ustar ! $Xorg: XLogo-co.ad,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ #include "XLogo" ! MIT colors are Cardinal Red (Pantone 201c) and Silver Grey (Pantone 421c) XLogo*background: rgb:d2/22/32 XLogo*foreground: rgb:d7/d7/d7 x11-apps-7.7+5+nmu1ubuntu1/xlogo/app-defaults/XLogo0000664000000000000000000000017112167023104016654 0ustar XLogo*iconPixmap: xlogo32 XLogo*iconMask: xlogo32 XLogo*baseTranslations: #override \ q,Escape: quit() x11-apps-7.7+5+nmu1ubuntu1/xlogo/xlogo.h0000664000000000000000000000347112167023104014623 0ustar /* Copyright 2004 Roland Mainz Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef XLOGO_XLOGO_H #define XLOGO_XLOGO_H 1 #include /* Turn a NULL pointer string into an empty string */ #define NULLSTR(x) (((x)!=NULL)?(x):("")) #define Error(x) { printf x ; exit(EXIT_FAILURE); } #define Log(x) { if(userOptions.verbose) printf x; } #define Msg(x) { if((!userOptions.quiet) || userOptions.verbose) printf x; } typedef struct { Boolean verbose; Boolean quiet; Boolean printAndExit; String printername; String printfile; } XLogoResourceData, *XLogoResourceDataPtr; /* Global vars */ extern const char *ProgramName; /* program name (from argv[0]) */ extern XLogoResourceData userOptions; #endif /* !XLOGO_XLOGO_H */ x11-apps-7.7+5+nmu1ubuntu1/xlogo/ChangeLog0000664000000000000000000006173012167023104015076 0ustar commit 81f58b56464520fde4e64c0764bc58d5d197b849 Author: Alan Coopersmith Date: Thu Mar 22 22:49:50 2012 -0700 xlogo 1.0.4 Signed-off-by: Alan Coopersmith commit 18e61546798d20b7b1c15a2ff5d554bee7ec6bdf Author: Jeremy Huddleston Date: Sun Sep 25 00:53:50 2011 -0700 Require xt >= 1.0 for appdefaultdir https://bugs.freedesktop.org/show_bug.cgi?id=7237 Signed-off-by: Jeremy Huddleston commit 0e96450836cc876d213e02491394da3f6fa7575d Author: Gaetan Nadon Date: Wed Jan 19 10:06:56 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 7c7b2beb9b94790f9f08049163b85a37d253f0f6 Author: Gaetan Nadon Date: Thu Jan 13 17:15:36 2011 -0500 man: replace hard coded man page section with substitution strings Signed-off-by: Gaetan Nadon commit 7a21422aa690f4734da047ee03ea49723acda342 Author: Gaetan Nadon Date: Wed Jan 12 16:28:02 2011 -0500 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS This silences an Autoconf warning commit d1fe51c3209702740a2b073fa690aa2ce138bc7e Author: Gaetan Nadon Date: Wed Jan 12 15:29:50 2011 -0500 config: replace deprecated AC_HELP_STRING with AS_HELP_STRING This silences an Automake warning. Signed-off-by: Gaetan Nadon commit 73941fa2f5e5a71fb36a3b9a9dec8a833898907e Author: Alan Coopersmith Date: Fri Nov 19 22:45:57 2010 -0800 Bug 31645 - xlogo: Doesn't build with libXrender and without libXft https://bugs.freedesktop.org/show_bug.cgi?id=31645 Add AM_CONDITIONAL to skip building RenderLogo.c without Render support Signed-off-by: Alan Coopersmith commit 6d8da24e45c124162b06529290366d465f1df499 Author: Alan Coopersmith Date: Sat Oct 30 16:58:57 2010 -0700 xlogo 1.0.3 Signed-off-by: Alan Coopersmith commit b7d9388a51cc90d4ed72aa6fc28c3673c15d3a18 Author: Alan Coopersmith Date: Fri Sep 24 08:12:50 2010 -0700 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now Signed-off-by: Alan Coopersmith commit 81aec653b14836ca0588166fb826171fb118adca Author: Gaetan Nadon Date: Tue Jul 20 18:45:18 2010 -0400 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon commit f407f555d4ac750199be8c460e2c30228e8588ac Author: Alan Coopersmith Date: Fri Aug 6 11:22:34 2010 -0700 Fill in COPYING file with copyright notices from source code Signed-off-by: Alan Coopersmith commit 0f9f099172329dfcb254d2ce1394eae064ad88f9 Author: Alan Coopersmith Date: Thu Jul 1 18:26:43 2010 -0700 Combine dependencies into a single call to PKG_CHECK_MODULES Signed-off-by: Alan Coopersmith commit da7d99707d0ee12c583fe2b083f6ec7abaaab8fb Author: Alan Coopersmith Date: Thu Jul 1 18:20:01 2010 -0700 Xmu functions are called directly, so include it in PKG_CHECK_MODULES Signed-off-by: Alan Coopersmith commit 9e0e31869b90f031605ca77f5645014c6de3705b Author: Alan Coopersmith Date: Wed Jun 30 23:25:03 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS The existing statement can now be removed from the configuration file. Use XORG_DEFAULT_OPTIONS provided $(SED) Use platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit f7f0ba3c8fff55c8a38b0786828a372c1dc72715 Author: Alan Coopersmith Date: Fri Apr 16 15:59:54 2010 -0700 Add dependency on libSM since xlogo calls SmcCloseConnection Signed-off-by: Alan Coopersmith commit 5a6a92096883c1618ffb0bfc8c44509e42003044 Author: Gaetan Nadon Date: Thu Feb 11 10:08:07 2010 -0500 config: move CWARNFLAGS from configure.ac to Makefile.am Compiler warning flags should be explicitly set in the makefile rather than being merged with other packages compiler flags. Signed-off-by: Gaetan Nadon commit 1ba50ffb7746f902a678865584eb1fd0c946bda5 Author: Gaetan Nadon Date: Sat Dec 19 20:48:48 2009 -0500 configure.ac: use backticks rather than $() for cmd subs Use "$PKG_CONFIG" rather than hard coded "pkg-config" Signed-off-by: Gaetan Nadon commit f826c5af5514da12ee146c61698d4545af391434 Author: Alan Coopersmith Date: Thu Dec 10 22:33:05 2009 -0800 xlogo 1.0.2 Signed-off-by: Alan Coopersmith commit 3166b7e2e3013ca0d0c5b1679cdcb88f21384398 Author: Alan Coopersmith Date: Thu Dec 10 22:32:35 2009 -0800 Add direct dependency on libXt, since xlogo calls Xt functions Signed-off-by: Alan Coopersmith commit 02220d224d457aa070daf7603461b5d359780de4 Author: Alan Coopersmith Date: Thu Dec 10 22:25:24 2009 -0800 Remove more leftover Xprint bits Signed-off-by: Alan Coopersmith commit fed17089fc586b6e762d121a34f2dbf95dd6433b Author: Alan Coopersmith Date: Thu Dec 10 22:23:18 2009 -0800 Strip old CVS id tags and trailing whitespaces Signed-off-by: Alan Coopersmith commit a3223e295cf840b7854a91c7e5577812edb11e62 Author: Alan Coopersmith Date: Thu Dec 10 22:10:27 2009 -0800 Use AM_V_GEN to silence man page generation output Signed-off-by: Alan Coopersmith commit 39313841d56ebe935d55190cc239ac66d072bb32 Author: Gaetan Nadon Date: Thu Nov 26 09:19:54 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit 0f388329378b5e5fb4cbce3e76e0f7661ac326eb Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit cc1220ace1ce5ff89e089603d912d9dd456066bf Author: Gaetan Nadon Date: Tue Oct 27 15:07:25 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit 7e3e8c7f74d9ca2286001d53510668b02e75e25f Author: Gaetan Nadon Date: Mon Oct 26 22:08:39 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit e5230ea7372b2d9672579f65752a1d2c7e65dab5 Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit 8e40f73c2a36680aec587b4be5971cea5141e13a Author: Jeremy Huddleston Date: Wed Oct 21 12:47:21 2009 -0700 This is not a GNU project, so declare it foreign. On Wed, 2009-10-21 at 13:36 +1000, Peter Hutterer wrote: > On Tue, Oct 20, 2009 at 08:23:55PM -0700, Jeremy Huddleston wrote: > > I noticed an INSTALL file in xlsclients and libXvMC today, and it > > was quite annoying to work around since 'autoreconf -fvi' replaces > > it and git wants to commit it. Should these files even be in git? > > Can I nuke them for the betterment of humanity and since they get > > created by autoreconf anyways? > > See https://bugs.freedesktop.org/show_bug.cgi?id=24206 As an interim measure, replace AM_INIT_AUTOMAKE([dist-bzip2]) with AM_INIT_AUTOMAKE([foreign dist-bzip2]). This will prevent the generation of the INSTALL file. It is also part of the 24206 solution. Signed-off-by: Jeremy Huddleston commit 8510be4defc2a6d291ac87439abfffcdd4214f7b Author: Alan Coopersmith Date: Thu Oct 1 14:54:26 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit 982d3b53606238b4602bbdbc4f0f1f9c1bd0563b Author: Jeremy Huddleston Date: Thu Oct 1 14:10:15 2009 -0700 Require macros 1.3 for XORG_DEFAULT_OPTIONS Signed-off-by: Jeremy Huddleston > commit 12f6dde9f5cd64773ccd907deb8600533e7b958f Author: Jeremy Huddleston Date: Thu Oct 1 14:06:44 2009 -0700 Fixed compiler warning xlogo.c:153: warning: format not a string literal and no format arguments commit 9bb8ad30520e9e9d688e844e18590b371a2ac1a9 Author: Paulo Cesar Pereira de Andrade Date: Thu Jan 22 15:40:27 2009 -0200 Correct make distcheck and sparse warnings. commit 15a8c8d5c3db1945a3ba6876241d04f0027e9dcd Author: Julien Cristau Date: Thu Aug 21 00:30:29 2008 +0200 Build fix, XAW_USE_XPRINT is no more commit 44ca3b95b355af966044132fab8b5e1616aa7303 Author: James Cloos Date: Wed Aug 20 10:32:52 2008 -0400 xaw8 is gone, use xaw7 commit f426787beaad60cee9c116613ddde540c310038a Author: Julien Cristau Date: Fri May 16 14:25:24 2008 +0200 $(builddir) is the current directory Apparently automake doesn't always export the builddir variable. This fixes my previous commit. commit 7c427dcbce96d6cb445ed73e08805524b593e1ea Author: Julien Cristau Date: Sun Apr 20 19:51:43 2008 +0200 Use AM_CFLAGS instead of xlogo_CFLAGS and remove AM_PROG_CC_C_O commit 79c7a3d87978c253105603b8ac6b5d48a0b2b476 Author: Julien Cristau Date: Sun Apr 20 19:49:24 2008 +0200 Fix build with builddir != srcdir commit 1b7e7cf9ec4723afa3e9bed0825fbc8adca6408f Author: Jeremy Huddleston Date: Thu Mar 27 20:30:08 2008 -0700 Added missing AM_PROG_CC_C_O commit 2ddbb1bf87af90f0fcf1d78992b3783374831614 Author: Jeremy Huddleston Date: Thu Mar 27 20:07:50 2008 -0700 Build fix for file systems that are not case sensitive commit 7c07c38b263902fef9e2962c1946ad493718c2e6 Author: James Cloos Date: Thu Dec 6 16:37:21 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit 2875b41b3e619315821b603ef56b1d29657469c2 Author: James Cloos Date: Mon Sep 3 05:51:31 2007 -0400 Add *~ to .gitignore to skip patch/emacs droppings commit dc7d96bec5665c64da74da75e0710a7b57b9173a Author: James Cloos Date: Thu Aug 23 19:24:58 2007 -0400 Rename .cvsignore to .gitignore commit a88e031e6c81857edc404f7b5d52c0c39cdd3146 Author: Kevin E Martin Date: Wed Dec 21 02:29:51 2005 +0000 Update package version for X11R7 release. commit d8f94db09d68dc59dfe8d183cd0c1f3b9eff3004 Author: Adam Jackson Date: Mon Dec 19 16:22:45 2005 +0000 Stub COPYING files commit ae1b1194d57cb1a1089cffe61137e67c9e8b6b20 Author: Kevin E Martin Date: Thu Dec 15 00:24:08 2005 +0000 Update package version number for final X11R7 release candidate. commit be590c64bc8df224154347ab5f6c32fe60bf0e67 Author: Kevin E Martin Date: Wed Dec 7 16:18:00 2005 +0000 Change to use the app-defaults default dir configured in libXt. commit 2ad19d20118c07d369ef67dd9ff8bd094d8e5864 Author: Kevin E Martin Date: Tue Dec 6 22:48:23 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit 6ea22dc485341e30ac906e3559b104326ab90178 Author: Kevin E Martin Date: Sat Dec 3 05:49:25 2005 +0000 Update package version number for X11R7 RC3 release. commit 7f3821c5e6815bbb59a9298d2671b150cf89615f Author: Alan Coopersmith Date: Mon Nov 28 22:01:44 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit 601ec0670c548caed335352295bbcb058968aa50 Author: Eric Anholt Date: Mon Nov 21 10:35:02 2005 +0000 Another pass at .cvsignores for apps. commit 09d3bc9867032ee89503914bc7e731c48a470dfb Author: Eric Anholt Date: Sun Nov 20 22:08:53 2005 +0000 Add/improve .cvsignore files for apps. commit a5ed76fbde1c8195951b41a0372a0b5caeeaebfa Author: Alan Coopersmith Date: Sun Nov 20 04:13:45 2005 +0000 Add dependency on xp module when building with Xprint support. commit ddcaa857470b13840b8a3c3e1748c0154f76b9c2 Author: Kevin E Martin Date: Sat Nov 19 07:15:37 2005 +0000 Update pkgconfig files to separate library build-time dependencies from application build-time dependencies, and update package deps to work with separate build roots. commit f3e7ab0f031b9ff8968596667616e79ec05f9b62 Author: Kevin E Martin Date: Wed Oct 19 02:47:55 2005 +0000 Update package version number for RC1 release. commit 1b4c1658fc24b851a7f83e9190ecc6aacbc9f23b Author: Alan Coopersmith Date: Tue Oct 18 00:32:54 2005 +0000 Change default install dir for app-default files from $(sysconfdir)/X11/app-defaults to $(libdir)/X11/app-defaults to match the monolith & allow localization commit 0b90073689ab1745bb2277485687521f564a1939 Author: Alan Coopersmith Date: Mon Oct 17 23:56:23 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 0813f5229d48b9a0ed3dec5438db338dae71dfd9 Author: Alan Coopersmith Date: Sat Oct 15 01:04:15 2005 +0000 Add #include for modularization. commit fd78790af2a87e999b0f01d1c8f8ecce849a2384 Author: Alan Coopersmith Date: Fri Oct 14 00:25:46 2005 +0000 Use sed to fill in variables in man page commit 70298627f76aaf18ab4e63e297a0f42a8809d9bb Author: Alan Coopersmith Date: Thu Oct 13 20:11:00 2005 +0000 Fix app-default files to install under the same names as in the monolith instead of their short names used only for 14-character filename length limited ancient filesystems commit 42f1737418b0c1d7e2ceaaaf3ddbcb2db7ab614b Author: Alan Coopersmith Date: Tue Aug 16 15:52:25 2005 +0000 Fix render checks to check for both Xrender & Xft2, and to define XRENDER commit 2eae29c6f837bd6f8ab383f0d4e61742c063291a Author: Alan Coopersmith Date: Mon Aug 1 20:25:30 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit 345a950cebdb8717e08fb878de0307a2611ba846 Author: Kevin E Martin Date: Fri Jul 29 21:22:35 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit 28cbacfd0b809ce1614d177b10dd11ff1ab4b9d0 Author: Alan Coopersmith Date: Tue Jul 26 15:44:02 2005 +0000 Replace more GNU make-ism's with more portable macros commit e3721beb3d51bd53527639afb4185f8fda24101e Author: Matthieu Herrb Date: Sat Jul 23 16:41:40 2005 +0000 Fix remaining DEP_{CFLAGS,LIB} references commit 19cf02998290cc99fcbc94feb03647386ef595f9 Author: Matthieu Herrb Date: Sat Jul 23 16:40:58 2005 +0000 fix GNU-make only app-default rule commit b7533f8eb9cea84603a80e5207b4a589d3dfd444 Author: Adam Jackson Date: Wed Jul 20 19:31:58 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit 6fc943cfccd96e6ad0fec6a2e1b836fa0d0d7d3a Author: Søren Sandmann Pedersen Date: Tue Jul 5 22:51:09 2005 +0000 Add build systems for xlogo, xlsatoms, xlsclients, xmag, xman, xmessage, xmh, xmore. lib/Xaw/xaw.m4: Add an AM_CONDITIONAL and a shell variable xaw_use_xprint symlink.sh: add some extra files for xgc, xinit, xkbcomp, xlogo, xmb, and xmodmap xc/programs/xmore/xmore.c: Conditionalize use of xprint commit 4d8b36adf2024e6c28ecd266fb3585fdbc2c66f2 Author: Roland Mainz Date: Mon Apr 11 01:06:15 2005 +0000 xc/programs/Xserver/Xprint/attributes.c xc/programs/glxgears/glxgears.c xc/programs/xdbedizzy/xdbedizzy.c xc/programs/xedit/Imakefile xc/programs/xedit/Xedit-xprint.ad xc/programs/xedit/util.c xc/programs/xedit/xedit.h xc/programs/xlogo/print.c xc/programs/xlogo/xlogo.c xc/programs/xlogo/xlogo.h xc/programs/xman/Imakefile xc/programs/xman/print.h xc/programs/xmore/Imakefile xc/programs/xmore/print.c xc/programs/xmore/print.h xc/programs/xmore/printdialog.c xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c xc/programs/xphelloworld/xphelloworld/xphelloworld.c xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c //bugs.freedesktop.org/show_bug.cgi?id=790) attachment #2379 (https://bugs.freedesktop.org/attachment.cgi?id=2379) Implement support client+Xserver support for passing output (stdout+stderr) of the spooler command started by the Xprint server back to the application using the "xp-spooler-command-results" XPJobAttr attribute (applications can fetch the attribute value after the XPEndJobNotify event was received; more details can be found in http://xprint.mozdev.org/docs/dtprint_fspec.ps). commit c4d739517989871ad786fd0f5e0ae6a683f7e92f Author: Roland Mainz Date: Mon Jan 3 01:06:35 2005 +0000 xc/lib/XprintAppUtil/xpapputil.c xc/lib/XprintAppUtil/xpapputil.h xc/lib/XprintUtil/xprintutil.c xc/lib/XprintUtil/xprintutil.h xc/programs/glxgears/glxgears.c xc/programs/xdbedizzy/xdbedizzy.c xc/programs/xedit/Xedit-xprint.ad xc/programs/xedit/commands.c xc/programs/xlogo/print.c xc/programs/xlsfonts/xlsfonts.c xc/programs/xlsfonts/xlsfonts.man xc/programs/xlsfonts/xlsfonts.sgml xc/programs/xman/Xman-xprint.ad xc/programs/xman/handler.c xc/programs/xman/print.c xc/programs/xman/print.h xc/programs/xmore/XMore.ad xc/programs/xmore/print.c xc/programs/xmore/print.h xc/programs/xmore/printdialog.c xc/programs/xmore/printdialog.h xc/programs/xmore/printdialogprivates.h xc/programs/xmore/xmore.c xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c xc/programs/xphelloworld/xphelloworld/xphelloworld.c xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c xc/programs/xphelloworld/xpxthelloworld/xpxthelloworld.c xc/programs/xplsprinters/xplsprinters.c //bugs.freedesktop.org/show_bug.cgi?id=1706) attachment #1615 (https://bugs.freedesktop.org/attachment.cgi?id=1615): XprintUtils 2004/Q3 update. This adds various new features to the XprintUtils library including support for page resolutions where X_resolution!=Y_resolution, listfonts-mode control and initial framework for the COLORSPACE extension. Patch by Roland Mainz and Julien Lafon . commit f4149e9970ced64f8eb2e92a115ea87174de2747 Author: Kevin E Martin Date: Thu Sep 2 05:50:38 2004 +0000 Clean up defines for Xprint support and fix BuildServersOnly build for libXaw. commit ac167b94611ccb2b990ff70db5957fae0bde0969 Author: Kevin E Martin Date: Thu Sep 2 01:10:30 2004 +0000 Bump major version number of libXaw (Bug #1273). commit 18ae14262f9859a2e1f2dd769a0c4dcf4e1bb344 Author: Kristian Høgsberg Date: Mon Aug 16 16:36:16 2004 +0000 As discussed and agreed on on the release-wranglers meeting of August 16, I'm committing the patch from bug #1060 to back out unconditional Xprint functionality. Back out Xprint changes. Revert xman to CVS of June 5, revert xlogo to CVS of May 8, revert xedit to CVS of April 25, to back out unconditional Xprint support. Fix up Xprint config logic to be like the rest of the extensions: BuildXprint is a one-stop option for disabling everything Xprint related. XprtServer controls building Xprt, BuildXprintLib controls building Xprint libs and BuildXprintClients controls building clients related to Xprint. BuiltXprint defaults to YES and the other options respects relevant settings, i.e. BuildServer and BuildServersOnly. Build Xaw regardless of BuildXprintLib setting. Only build xphelloworld, xplsprinters and xprehashprinterlist when BuildXprintClients it YES. Disable building xmore, it has always supported XawPrintShell. Make Xprint support depend on BuildXprintLib. commit 28ffd14fbae70a5e01cdcbe2cb9342d3c8816b76 Author: Roland Mainz Date: Sun May 9 00:36:41 2004 +0000 Fix for http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=581 - Print support for XLogo. commit 8eb746981d01e0db330e8e6139300ede823037f3 Author: Egbert Eich Date: Fri Apr 23 19:54:57 2004 +0000 Merging XORG-CURRENT into trunk commit 2a3e8d4963b3a8ed53e226965ec80f749ad8d5a4 Author: Egbert Eich Date: Sun Mar 14 08:35:37 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit effebf964672168e99b59fdf89be48dab2f88ecd Author: Egbert Eich Date: Wed Mar 3 12:13:14 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit 8cc0b397fa0c771a60f58e362a69bc04e8f1510f Author: Egbert Eich Date: Thu Feb 26 13:36:26 2004 +0000 readding XFree86's cvs IDs commit 142da2b715826c9fe7dad89ee344ead2f798cf82 Author: Egbert Eich Date: Thu Feb 26 09:24:14 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit 59a2fa66d61369dd415f1cb7c8c5d6e7640e4870 Author: Kaleb Keithley Date: Fri Dec 19 20:56:01 2003 +0000 XFree86 4.3.99.902 (RC 2) commit 54d675d206d1dbb9901e33ccc14988daf98f97b8 Author: Kaleb Keithley Date: Tue Nov 25 19:29:15 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit 05b7c570b155f167e5a7f1b804e10b870bbc762c Author: Kaleb Keithley Date: Fri Nov 14 16:49:23 2003 +0000 XFree86 4.3.0.1 commit cc25207f02f9b4d630f5d6646a1815431e532ea0 Author: Kaleb Keithley Date: Fri Nov 14 16:49:23 2003 +0000 Initial revision commit 6fc51a3195bf01d2f69b33524d27ec3bb5e17181 Author: Kaleb Keithley Date: Fri Nov 14 15:54:54 2003 +0000 R6.6 is the Xorg base-line x11-apps-7.7+5+nmu1ubuntu1/xlogo/RenderLogo.h0000664000000000000000000000254212167023104015531 0ustar /* Copyright 1988, 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _RenderLogo_h #define _RenderLogo_h void RenderLogo(Display *dpy, int op, Picture src, Picture dst, XRenderPictFormat *maskFormat, int x, int y, unsigned int width, unsigned int height); #endif /* _RenderLogo_h */ x11-apps-7.7+5+nmu1ubuntu1/xlogo/config.guess0000664000000000000000000012776412167023104015653 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. timestamp='2010-08-21' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' HUP INT TERM # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-tilera-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xlogo/Logo.c0000664000000000000000000003253612167023104014372 0ustar /* Copyright 1988, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "LogoP.h" #include #include #ifdef XRENDER #include "RenderLogo.h" #endif static XtResource resources[] = { {XtNshapeWindow, XtCShapeWindow, XtRBoolean, sizeof (Boolean), XtOffsetOf(LogoRec,logo.shape_window), XtRImmediate, (XtPointer) FALSE}, #ifdef XRENDER {XtNrender, XtCBoolean, XtRBoolean, sizeof(Boolean), XtOffsetOf(LogoRec,logo.render), XtRImmediate, (XtPointer) FALSE }, {XtNsharp, XtCBoolean, XtRBoolean, sizeof(Boolean), XtOffsetOf(LogoRec,logo.sharp), XtRImmediate, (XtPointer) FALSE }, {XtNforeground, XtCForeground, XtRXftColor, sizeof(XftColor), XtOffsetOf(LogoRec, logo.fg), XtRString, (XtPointer) XtDefaultForeground}, {XtNbackground, XtCForeground, XtRXftColor, sizeof(XftColor), XtOffsetOf(LogoRec, logo.bg), XtRString, (XtPointer) XtDefaultBackground}, #else {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), XtOffsetOf(LogoRec,logo.fgpixel), XtRString, (XtPointer) XtDefaultForeground}, #endif }; static void ClassInitialize ( void ); static void Initialize ( Widget request, Widget new, ArgList args, Cardinal *num_args ); static void Destroy ( Widget gw ); static void Realize ( Widget gw, XtValueMask *valuemaskp, XSetWindowAttributes *attr ); static void Resize ( Widget gw ); static void Redisplay ( Widget gw, XEvent *event, Region region ); static Boolean SetValues ( Widget gcurrent, Widget grequest, Widget gnew, ArgList args, Cardinal *num_args ); LogoClassRec logoClassRec = { { /* core fields */ /* superclass */ (WidgetClass) &simpleClassRec, /* class_name */ "Logo", /* widget_size */ sizeof(LogoRec), /* class_initialize */ ClassInitialize, /* class_part_initialize */ NULL, /* class_inited */ FALSE, /* initialize */ Initialize, /* initialize_hook */ NULL, /* realize */ Realize, /* actions */ NULL, /* num_actions */ 0, /* resources */ resources, /* resource_count */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, /* compress_exposure */ TRUE, /* compress_enterleave */ TRUE, /* visible_interest */ FALSE, /* destroy */ Destroy, /* resize */ Resize, /* expose */ Redisplay, /* set_values */ SetValues, /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ NULL, /* query_geometry */ XtInheritQueryGeometry, /* display_accelerator */ XtInheritDisplayAccelerator, /* extension */ NULL }, { /* simple fields */ /* change_sensitive */ XtInheritChangeSensitive }, { /* logo fields */ /* ignore */ 0 } }; WidgetClass logoWidgetClass = (WidgetClass) &logoClassRec; /***************************************************************************** * * * private utility routines * * * *****************************************************************************/ static void create_gcs(LogoWidget w) { XGCValues v; #ifdef XRENDER w->logo.fgpixel = w->logo.fg.pixel; #endif v.foreground = w->logo.fgpixel; w->logo.foreGC = XtGetGC ((Widget) w, GCForeground, &v); v.foreground = w->core.background_pixel; w->logo.backGC = XtGetGC ((Widget) w, GCForeground, &v); } static void check_shape(LogoWidget w) { if (w->logo.shape_window) { int event_base, error_base; if (!XShapeQueryExtension (XtDisplay (w), &event_base, &error_base)) w->logo.shape_window = FALSE; } } /* ARGSUSED */ static void unset_shape(LogoWidget w) { XSetWindowAttributes attr; unsigned long mask; Display *dpy = XtDisplay ((Widget) w); Window win = XtWindow ((Widget) w); if (w->core.background_pixmap != None && w->core.background_pixmap != XtUnspecifiedPixmap) { attr.background_pixmap = w->core.background_pixmap; mask = CWBackPixmap; } else { attr.background_pixel = w->core.background_pixel; mask = CWBackPixel; } XChangeWindowAttributes (dpy, win, mask, &attr); XShapeCombineMask (dpy, win, ShapeBounding, 0, 0, None, ShapeSet); if (!w->logo.foreGC) create_gcs (w); w->logo.need_shaping = w->logo.shape_window; } static void set_shape(LogoWidget w) { GC ones, zeros; Display *dpy = XtDisplay ((Widget) w); Window win = XtWindow ((Widget) w); unsigned int width = (unsigned int) w->core.width; unsigned int height = (unsigned int) w->core.height; Pixmap pm = XCreatePixmap (dpy, win, width, height, (unsigned int) 1); XGCValues v; v.foreground = (Pixel) 1; v.background = (Pixel) 0; ones = XCreateGC (dpy, pm, (GCForeground | GCBackground), &v); v.foreground = (Pixel) 0; v.background = (Pixel) 1; zeros = XCreateGC (dpy, pm, (GCForeground | GCBackground), &v); if (pm && ones && zeros) { int x = 0, y = 0; Widget parent; XmuDrawLogo (dpy, pm, ones, zeros, 0, 0, width, height); for (parent = (Widget) w; XtParent(parent); parent = XtParent(parent)) { x += parent->core.x + parent->core.border_width; y += parent->core.y + parent->core.border_width; } XShapeCombineMask (dpy, XtWindow (parent), ShapeBounding, x, y, pm, ShapeSet); w->logo.need_shaping = FALSE; } else { unset_shape (w); } if (ones) XFreeGC (dpy, ones); if (zeros) XFreeGC (dpy, zeros); if (pm) XFreePixmap (dpy, pm); } /***************************************************************************** * * * class methods * * * *****************************************************************************/ #ifdef XRENDER static void RenderPrepare (LogoWidget w) { if (!w->logo.draw) { w->logo.draw = XftDrawCreate (XtDisplay (w), XtWindow (w), DefaultVisual (XtDisplay (w), DefaultScreen(XtDisplay (w))), w->core.colormap); } } static XtConvertArgRec xftColorConvertArgs[] = { {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen), sizeof(Screen *)}, {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.colormap), sizeof(Colormap)} }; #define donestr(type, value, tstr) \ { \ if (toVal->addr != NULL) { \ if (toVal->size < sizeof(type)) { \ toVal->size = sizeof(type); \ XtDisplayStringConversionWarning(dpy, \ (char*) fromVal->addr, tstr); \ return False; \ } \ *(type*)(toVal->addr) = (value); \ } \ else { \ static type static_val; \ static_val = (value); \ toVal->addr = (XPointer)&static_val; \ } \ toVal->size = sizeof(type); \ return True; \ } static void XmuFreeXftColor (XtAppContext app, XrmValuePtr toVal, XtPointer closure, XrmValuePtr args, Cardinal *num_args) { Screen *screen; Colormap colormap; XftColor *color; if (*num_args != 2) { XtAppErrorMsg (app, "freeXftColor", "wrongParameters", "XtToolkitError", "Freeing an XftColor requires screen and colormap arguments", (String *) NULL, (Cardinal *)NULL); return; } screen = *((Screen **) args[0].addr); colormap = *((Colormap *) args[1].addr); color = (XftColor *) toVal->addr; XftColorFree (DisplayOfScreen (screen), DefaultVisual (DisplayOfScreen (screen), XScreenNumberOfScreen (screen)), colormap, color); } static Boolean XmuCvtStringToXftColor(Display *dpy, XrmValue *args, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, XtPointer *converter_data) { char *spec; XRenderColor renderColor; XftColor xftColor; Screen *screen; Colormap colormap; if (*num_args != 2) { XtAppErrorMsg (XtDisplayToApplicationContext (dpy), "cvtStringToXftColor", "wrongParameters", "XtToolkitError", "String to render color conversion needs screen and colormap arguments", (String *) NULL, (Cardinal *)NULL); return False; } screen = *((Screen **) args[0].addr); colormap = *((Colormap *) args[1].addr); spec = (char *) fromVal->addr; if (strcasecmp (spec, XtDefaultForeground) == 0) { renderColor.red = 0; renderColor.green = 0; renderColor.blue = 0; renderColor.alpha = 0xffff; } else if (strcasecmp (spec, XtDefaultBackground) == 0) { renderColor.red = 0xffff; renderColor.green = 0xffff; renderColor.blue = 0xffff; renderColor.alpha = 0xffff; } else if (!XRenderParseColor (dpy, spec, &renderColor)) return False; if (!XftColorAllocValue (dpy, DefaultVisual (dpy, XScreenNumberOfScreen (screen)), colormap, &renderColor, &xftColor)) return False; donestr (XftColor, xftColor, XtRXftColor); } #endif static void ClassInitialize(void) { #ifdef XRENDER XtSetTypeConverter (XtRString, XtRXftColor, XmuCvtStringToXftColor, xftColorConvertArgs, XtNumber(xftColorConvertArgs), XtCacheByDisplay, XmuFreeXftColor); #endif } /* ARGSUSED */ static void Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args) { LogoWidget w = (LogoWidget)new; #ifdef XRENDER w->logo.draw = NULL; w->logo.fgpixel = w->logo.fg.pixel; #endif if (w->core.width < 1) w->core.width = 100; if (w->core.height < 1) w->core.height = 100; w->logo.foreGC = (GC) NULL; w->logo.backGC = (GC) NULL; check_shape (w); w->logo.need_shaping = w->logo.shape_window; } static void Destroy(Widget gw) { LogoWidget w = (LogoWidget) gw; if (w->logo.foreGC) { XtReleaseGC (gw, w->logo.foreGC); w->logo.foreGC = (GC) NULL; } if (w->logo.backGC) { XtReleaseGC (gw, w->logo.backGC); w->logo.backGC = (GC) NULL; } } static void Realize(Widget gw, XtValueMask *valuemaskp, XSetWindowAttributes *attr) { LogoWidget w = (LogoWidget) gw; if (w->logo.shape_window) { attr->background_pixel = w->logo.fgpixel; /* going to shape */ *valuemaskp |= CWBackPixel; } else create_gcs (w); (*logoWidgetClass->core_class.superclass->core_class.realize) (gw, valuemaskp, attr); } static void Resize(Widget gw) { LogoWidget w = (LogoWidget) gw; if (w->logo.shape_window && XtIsRealized(gw)) set_shape (w); } /* ARGSUSED */ static void Redisplay(Widget gw, XEvent *event, Region region) { LogoWidget w = (LogoWidget) gw; if (w->logo.shape_window) { if (w->logo.need_shaping) set_shape (w); /* may change shape flag */ } if (!w->logo.shape_window) { #ifdef XRENDER if (w->logo.render) { RenderPrepare (w); XClearWindow (XtDisplay(w), XtWindow(w)); RenderLogo (XtDisplay(w), PictOpOver, XftDrawSrcPicture (w->logo.draw, &w->logo.fg), XftDrawPicture (w->logo.draw), XRenderFindStandardFormat (XtDisplay (w), w->logo.sharp ? PictStandardA1: PictStandardA8), 0, 0, (unsigned int) w->core.width, (unsigned int) w->core.height); } else #endif { XmuDrawLogo (XtDisplay(w), XtWindow(w), w->logo.foreGC, w->logo.backGC, 0, 0, (unsigned int) w->core.width, (unsigned int) w->core.height); } } } /* ARGSUSED */ static Boolean SetValues (Widget gcurrent, Widget grequest, Widget gnew, ArgList args, Cardinal *num_args) { LogoWidget current = (LogoWidget) gcurrent; LogoWidget new = (LogoWidget) gnew; Boolean redisplay = FALSE; if (new->logo.shape_window && new->logo.shape_window != current->logo.shape_window) check_shape (new); /* validate shape_window */ if ((new->logo.fgpixel != current->logo.fgpixel) || (new->core.background_pixel != current->core.background_pixel)) { Destroy (gnew); if (!new->logo.shape_window) create_gcs (new); redisplay = TRUE; } if (new->logo.shape_window != current->logo.shape_window) { if (new->logo.shape_window) { Destroy (gnew); if (XtIsRealized(gnew)) set_shape (new); else new->logo.need_shaping = True; redisplay = FALSE; } else { if (XtIsRealized(gnew)) unset_shape (new); /* creates new GCs */ redisplay = TRUE; } } return (redisplay); } x11-apps-7.7+5+nmu1ubuntu1/xlogo/RenderLogo.c0000664000000000000000000001152212167023104015522 0ustar /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #ifdef XRENDER #include #include #include #include "RenderLogo.h" typedef struct _XLineDouble { XPointDouble p1, p2; } XLineDouble; static void intersect(XLineDouble *l1, XLineDouble *l2, XPointDouble *intersection); /* * Draw the "official" X Window System Logo, designed by Danny Chong * * Written by Ollie Jones, Apollo Computer * * Does some fancy stuff to make the logo look acceptable even * if it is tiny. Also makes the various linear elements of * the logo line up as well as possible considering rasterization. * * Munged to draw anti-aliased logo using Render extension. * Carl Worth, 2002-05-16 */ void RenderLogo(Display *dpy, int op, Picture src, Picture dst, XRenderPictFormat *maskFormat, int x, int y, unsigned int width, unsigned int height) { unsigned int size; double thin, thick, gap, d31; XPointDouble poly[6]; XLineDouble thick_left, thick_right, thin_left, thin_right, gap_left, gap_right; /* for now, do a centered even-sized square, at least for now */ size = width; if (height < width) size = height; size &= ~1; x += (width - size) >> 1; y += (height - size) >> 1; thin = (size / 11.0); thick = (size / 4.0); gap = thin / 4.0; d31 = thin + thin + gap; thick_left.p1.x = x; thick_left.p1.y = y; thick_left.p2.x = x + size - thick; thick_left.p2.y = y + size; thick_right.p1.x = x + thick; thick_right.p1.y = y; thick_right.p2.x = x + size; thick_right.p2.y = y + size; thin_left.p1.x = x + size-d31; thin_left.p1.y = y; thin_left.p2.x = x + 0; thin_left.p2.y = y + size; thin_right.p1.x = x + size; thin_right.p1.y = y; thin_right.p2.x = x + d31; thin_right.p2.y = y + size; gap_left.p1.x = x + size-( thin+gap); gap_left.p1.y = y; gap_left.p2.x = x + thin; gap_left.p2.y = y + size; gap_right.p1.x = x + size- thin; gap_right.p1.y = y; gap_right.p2.x = x + thin + gap; gap_right.p2.y = y + size; poly[0] = thick_left.p1; poly[1] = thick_right.p1; intersect(&thick_right, &gap_left, &poly[2]); poly[3] = gap_left.p2; poly[4] = thin_left.p2; intersect(&thick_left, &thin_left, &poly[5]); XRenderCompositeDoublePoly(dpy, op, src, dst, maskFormat, 0, 0, 0, 0, poly, 6, 0); poly[0] = thin_right.p1; poly[1] = gap_right.p1; intersect(&thick_left, &gap_right, &poly[2]); poly[3] = thick_left.p2; poly[4] = thick_right.p2; intersect(&thick_right, &thin_right, &poly[5]); XRenderCompositeDoublePoly(dpy, op, src, dst, maskFormat, 0, 0, 0, 0, poly, 6, 0); } static double compute_inverse_slope (XLineDouble *l) { return ((l->p2.x - l->p1.x) / (l->p2.y - l->p1.y)); } static double compute_x_intercept(XLineDouble *l, double inverse_slope) { return (l->p1.x) - inverse_slope * l->p1.y; } static void intersect(XLineDouble *l1, XLineDouble *l2, XPointDouble *intersection) { double check; /* * x = m1y + b1 * x = m2y + b2 * m1y + b1 = m2y + b2 * y * (m1 - m2) = b2 - b1 * y = (b2 - b1) / (m1 - m2) */ double m1 = compute_inverse_slope (l1); double b1 = compute_x_intercept (l1, m1); double m2 = compute_inverse_slope (l2); double b2 = compute_x_intercept (l2, m2); intersection->y = (b2 - b1) / (m1 - m2); intersection->x = m1 * intersection->y + b1; check = m2 * intersection->y + b2; if (check >= intersection->x) check -= intersection->x; else check = intersection->x - check; if (check > (1/(double)(1<<16))) { fprintf(stderr, "intersect: intersection is off by %f\n", check); } } #endif /* XRENDER */ x11-apps-7.7+5+nmu1ubuntu1/xlogo/config.h.in0000664000000000000000000000325512656634677015377 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to 1 to use Xrender & Xft2 to draw logo */ #undef XRENDER x11-apps-7.7+5+nmu1ubuntu1/xlogo/man/0000775000000000000000000000000012656635743014115 5ustar x11-apps-7.7+5+nmu1ubuntu1/xlogo/man/xlogo.man0000664000000000000000000000643212167023104015722 0ustar .\" Copyright 1988, 1994, 1998 The Open Group .\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" .TH XLOGO 1 __xorgversion__ .SH NAME xlogo - X Window System logo .SH SYNOPSIS .B xlogo [-\fItoolkitoption\fP ...] .SH DESCRIPTION The \fIxlogo\fP program displays the X Window System logo. .SH OPTIONS .I Xlogo accepts all of the standard X Toolkit command line options, as well as the following: .TP 8 .B \-render This option indicates that the logo should be drawn with anti-aliased edges using the RENDER extension. .TP 8 .B \-sharp If -render is also specified, this forces the edges to be rendered in sharp mode, (ie. 1-bit alpha channel). .TP 8 .B \-shape This option indicates that the logo window should be shaped rather than rectangular. .SH RESOURCES The default width and the default height are each 100 pixels. This program uses the \fILogo\fP widget in the Athena widget set. It understands all of the Simple widget resource names and classes as well as: .TP 8 .B foreground (\fPclass\fB Foreground) Specifies the color for the logo. The default is depends on whether \fIreverseVideo\fP is specified. If \fIreverseVideo\fP is specified the default is \fIXtDefaultForeground\fP, otherwise the default is \fIXtDefaultBackground\fP. .TP 8 .B shapeWindow (\fPclass\fB ShapeWindow) Specifies that the window is shaped to the X logo. The default is False. .SH WIDGETS In order to specify resources, it is useful to know the hierarchy of the widgets which compose \fIxlogo\fR. In the notation below, indentation indicates hierarchical structure. The widget class name is given first, followed by the widget instance name. .sp .nf .TA .5i .ta .5i XLogo xlogo Logo xlogo .fi .sp .SH ENVIRONMENT .TP 8 .B DISPLAY to get the default host and display number. .TP 8 .B XENVIRONMENT to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH FILES .TP .I __apploaddir__/XLogo specifies required resources .SH SEE ALSO X(__miscmansuffix__), xrdb(__appmansuffix__) .SH AUTHORS Ollie Jones of Apollo Computer and Jim Fulton of the MIT X Consortium wrote the logo graphics routine, based on a graphic design by Danny Chong and Ross Chapman of Apollo Computer. x11-apps-7.7+5+nmu1ubuntu1/xlogo/man/Makefile.am0000664000000000000000000000052312167023104016124 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = xlogo.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/xlogo/config.sub0000664000000000000000000010437612167023104015310 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. timestamp='2010-09-11' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile-* | tilegx-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; # This must be matched before tile*. tilegx*) basic_machine=tilegx-unknown os=-linux-gnu ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xlogo/Logo.h0000664000000000000000000000412512167023104014370 0ustar /* Copyright 1988, 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _XawLogo_h #define _XawLogo_h /* Parameters: Name Class RepType Default Value ---- ----- ------- ------------- background Background Pixel XtDefaultBackground border BorderColor Pixel XtDefaultForeground borderWidth BorderWidth Dimension 1 destroyCallback Callback Pointer NULL foreground Foreground Pixel XtDefaultForeground height Height Dimension 100 mappedWhenManaged MappedWhenManaged Boolean True shapeWindow ShapeWindow Boolean False width Width Dimension 100 x Position Position 0 y Position Position 0 */ #define XtNshapeWindow "shapeWindow" #define XtCShapeWindow "ShapeWindow" #define XtNrender "render" #define XtCRender "Render" #define XtRXftColor "XftColor" #define XtNsharp "sharp" #define XtCSharp "Sharp" typedef struct _LogoRec *LogoWidget; typedef struct _LogoClassRec *LogoWidgetClass; extern WidgetClass logoWidgetClass; #endif /* _XawLogo_h */ x11-apps-7.7+5+nmu1ubuntu1/xlogo/Makefile.am0000664000000000000000000000340512167023104015353 0ustar # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = xlogo AM_CFLAGS = $(XLOGO_CFLAGS) $(CWARNFLAGS) xlogo_LDADD = $(XLOGO_LIBS) xlogo_SOURCES = \ Logo.c \ Logo.h \ LogoP.h \ xlogo.c \ xlogo.h if USE_RENDER xlogo_SOURCES += \ RenderLogo.c \ RenderLogo.h endif # App default files DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ dist_appdefault_DATA = \ app-defaults/XLogo \ app-defaults/XLogo-color MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xlogo/configure.ac0000664000000000000000000000522112167023104015603 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. AC_PREREQ([2.60]) AC_INIT([xlogo], [1.0.4], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xlogo]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS AC_CONFIG_HEADERS([config.h]) # Base set of required pkg-config packages XLOGO_DEPS="sm xaw7 xmu xt >= 1.0 xext x11" # Use render & xft2 to draw logo? AC_ARG_WITH(render, AS_HELP_STRING([--with-xrender], [Use Xrender & Xft2 to draw logo]), USE_RENDER="$withval", USE_RENDER="try") if test "x$USE_RENDER" = "xtry" ; then PKG_CHECK_EXISTS([xrender xft], USE_RENDER="yes", USE_RENDER="no") fi if test "x$USE_RENDER" = "xyes" ; then XLOGO_DEPS="xft xrender $XLOGO_DEPS" AC_DEFINE(XRENDER, 1, [Define to 1 to use Xrender & Xft2 to draw logo]) fi AM_CONDITIONAL([USE_RENDER], [test "x$USE_RENDER" = "xyes"]) PKG_CHECK_MODULES(XLOGO, $XLOGO_DEPS) PKG_CHECK_MODULES(APPDEFS, xt) xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` AC_ARG_WITH(appdefaultdir, AS_HELP_STRING([--with-appdefaultdir=], [specify directory for app-defaults files (default is autodetected)]), [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xlogo/README0000664000000000000000000000125712167023104014202 0ustar The xlogo program simply displays the X Window System logo. All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xlogo http://cgit.freedesktop.org/xorg/app/xlogo For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xlogo/COPYING0000664000000000000000000000226712167023104014357 0ustar Copyright 1988, 1990, 1993 1994, 1998 The Open Group Copyright 2004 Roland Mainz Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. x11-apps-7.7+5+nmu1ubuntu1/xlogo/INSTALL0000664000000000000000000002622212167023104014352 0ustar Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 6. Often, you can also type `make uninstall' to remove the installed files again. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *Note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xditview/0000775000000000000000000000000012656635743014055 5ustar x11-apps-7.7+5+nmu1ubuntu1/xditview/DviP.h0000664000000000000000000001402512514121441015044 0ustar /* * DviP.h - Private definitions for Dvi widget */ #ifndef _XtDviP_h #define _XtDviP_h #ifdef USE_XFT #include #endif #include "Dvi.h" #include #include "DviChar.h" /*********************************************************************** * * Dvi Widget Private Data * ***********************************************************************/ /************************************ * * Class structure * ***********************************/ /* * New fields for the Dvi widget class record */ typedef struct _DviClass { int makes_compiler_happy; /* not used */ } DviClassPart; /* * Full class record declaration */ typedef struct _DviClassRec { CoreClassPart core_class; SimpleClassPart simple_class; DviClassPart command_class; } DviClassRec; extern DviClassRec dviClassRec; /*************************************** * * Instance (widget) structure * **************************************/ /* * a list of fonts we've used for this widget */ typedef struct _dviFontSizeList { struct _dviFontSizeList *next; int size; char *x_name; #ifdef USE_XFT XftFont *font; Bool core; #else XFontStruct *font; #endif int doesnt_exist; } DviFontSizeList; typedef struct _dviFontList { struct _dviFontList *next; char *dvi_name; char *x_name; int dvi_number; Boolean initialized; Boolean scalable; DviFontSizeList *sizes; DviCharNameMap *char_map; } DviFontList; typedef struct _dviFontMap { struct _dviFontMap *next; char *dvi_name; char *x_name; } DviFontMap; #define DVI_TEXT_CACHE_SIZE 256 #define DVI_CHAR_CACHE_SIZE 1024 #ifdef USE_XFT typedef struct _dviTextItem { char *chars; int nchars; int x; XftFont *font; } DviTextItem; #endif typedef struct _dviCharCache { #ifdef USE_XFT DviTextItem cache[DVI_TEXT_CACHE_SIZE]; #else XTextItem cache[DVI_TEXT_CACHE_SIZE]; #endif char char_cache[DVI_CHAR_CACHE_SIZE]; int index; int max; int char_index; int font_size; int font_number; #ifdef USE_XFT XftFont *font; #else XFontStruct *font; #endif int start_x, start_y; int x, y; } DviCharCache; typedef struct _dviState { struct _dviState *next; int font_size; int font_bound; int font_number; int line_style; int line_width; int x; int y; } DviState; typedef struct _dviFileMap { struct _dviFileMap *next; long position; int page_number; } DviFileMap; /* * New fields for the Dvi widget record */ typedef struct { /* * resource specifiable items */ char *font_map_string; unsigned long foreground; int requested_page; int last_page; FILE *file; Boolean seek; /* file is "seekable" */ #ifdef USE_XFT XftFont *default_font; #else XFontStruct *default_font; #endif int backing_store; Boolean noPolyText; int screen_resolution; float page_width; float page_height; int size_scale_set; /* * private state */ FILE *tmpFile; /* used when reading stdin */ char readingTmp; /* reading now from tmp */ char ungot; /* have ungetc'd a char */ GC normal_GC; #ifdef USE_XFT XftDraw *draw; XftColor black; #endif DviFileMap *file_map; DviFontList *fonts; DviFontMap *font_map; int current_page; int font_size; int font_number; int device_resolution; int line_width; int line_style; int desired_width; int desired_height; int size_scale; /* font size scale */ #ifdef USE_XFT XftFont *font; #else XFontStruct *font; #endif int display_enable; double scale; /* device coordinates to pixels */ struct ExposedExtents { int x1, y1, x2, y2; } extents; DviState *state; DviCharCache cache; } DviPart; extern int DviGetAndPut(DviWidget, int *); #define DviGetIn(dw,cp)\ (dw->dvi.tmpFile ? (\ DviGetAndPut (dw, cp) \ ) :\ (*cp = getc (dw->dvi.file))\ ) #define DviGetC(dw, cp)\ (dw->dvi.readingTmp ? (\ ((*cp = getc (dw->dvi.tmpFile)) == EOF) ? (\ fseek (dw->dvi.tmpFile, 0l, SEEK_END),\ (dw->dvi.readingTmp = 0),\ DviGetIn (dw,cp)\ ) : (\ *cp\ )\ ) : (\ DviGetIn(dw,cp)\ )\ ) #define DviUngetC(dw, c)\ (dw->dvi.readingTmp ? (\ ungetc (c, dw->dvi.tmpFile)\ ) : ( \ (dw->dvi.ungot = 1),\ ungetc (c, dw->dvi.file))) #define ToX(dw,device) ((int) ((device) * (dw)->dvi.scale + 0.5)) #define ToDevice(dw,x) ((int) ((x) / (dw)->dvi.scale + 0.5)) #define SizeScale(dw) ((dw)->dvi.size_scale ? (dw)->dvi.size_scale : 4) #define FontSizeInPixels(dw,size) ((int) ((size) * (dw)->dvi.screen_resolution / (SizeScale(dw) * 72))) #define FontSizeInDevice(dw,size) ((int) ((size) * (dw)->dvi.device_resolution / (SizeScale(dw) * 72))) /* * Full widget declaration */ typedef struct _DviRec { CorePart core; SimplePart simple; DviPart dvi; } DviRec; /* draw.c */ extern void HorizontalMove(DviWidget, int); extern void HorizontalGoto(DviWidget, int); extern void VerticalMove(DviWidget, int); extern void VerticalGoto(DviWidget, int); extern void FlushCharCache(DviWidget); extern void SetGCForDraw(DviWidget); extern void DrawLine(DviWidget, int, int); extern void DrawCircle(DviWidget, int); extern void DrawEllipse(DviWidget, int, int); extern void DrawArc(DviWidget, int, int, int, int); extern void DrawSpline(DviWidget, const char *, int); /* font.c */ extern void ParseFontMap(DviWidget); extern void DestroyFontMap(DviFontMap *); extern void SetFontPosition(DviWidget, int, const char *, const char *); #ifdef USE_XFT extern XftFont * QueryFont(DviWidget, int, int); #else extern XFontStruct * QueryFont(DviWidget, int, int); #endif extern DviCharNameMap * QueryFontMap(DviWidget, int); /* lex.c */ extern char * GetLine(DviWidget, char *, int); extern char * GetWord(DviWidget, char *, int); extern int GetNumber(DviWidget); /* page.c */ extern void DestroyFileMap(DviFileMap *); extern void ForgetPagePositions(DviWidget); extern void RememberPagePosition(DviWidget, int); extern long SearchPagePosition(DviWidget, int); extern void FileSeek(DviWidget, long); /* parse.c */ extern int ParseInput(DviWidget); /* Dvi.c */ extern void SetDeviceResolution(DviWidget, int); #endif /* _XtDviP_h */ x11-apps-7.7+5+nmu1ubuntu1/xditview/Menu.h0000664000000000000000000000230012514121441015077 0ustar #ifndef _XtMenu_h #define _XtMenu_h /*********************************************************************** * * Menu Widget * ***********************************************************************/ /* Parameters: Name Class RepType Default Value ---- ----- ------- ------------- background Background pixel White border BorderColor pixel Black borderWidth BorderWidth int 1 height Height int 120 mappedWhenManaged MappedWhenManaged Boolean True reverseVideo ReverseVideo Boolean False width Width int 120 x Position int 0 y Position int 0 */ #define XtNmenuEntries "menuEntries" #define XtNhorizontalPadding "horizontalPadding" #define XtNverticalPadding "verticalPadding" #define XtNselection "Selection" #define XtCMenuEntries "MenuEntries" #define XtCPadding "Padding" #define XtCSelection "Selection" typedef struct _MenuRec *MenuWidget; /* completely defined in MenuPrivate.h */ typedef struct _MenuClassRec *MenuWidgetClass; /* completely defined in MenuPrivate.h */ extern WidgetClass menuWidgetClass; extern Widget XawMenuCreate (); #endif /* _XtMenu_h */ /* DON'T ADD STUFF AFTER THIS #endif */ x11-apps-7.7+5+nmu1ubuntu1/xditview/lex.c0000664000000000000000000000243012514121441014762 0ustar #include #include #include #include #include #include "DviP.h" int DviGetAndPut(DviWidget dw, int *cp) { if (dw->dvi.ungot) { dw->dvi.ungot = 0; *cp = getc (dw->dvi.file); } else { *cp = getc (dw->dvi.file); putc (*cp, dw->dvi.tmpFile); } return *cp; } char * GetLine(DviWidget dw, char *Buffer, int Length) { int i = 0, c; char *p = Buffer; Length--; /* Save room for final NULL */ while ((!p || i < Length) && DviGetC (dw, &c) != EOF && c != '\n') if (p) *p++ = c; if (c == '\n') DviUngetC(dw, c); if (p) *p = '\0'; return (Buffer); } char * GetWord(DviWidget dw, char *Buffer, int Length) { int i = 0, c; char *p = Buffer; Length--; /* Save room for final NULL */ while (DviGetC(dw, &c) != EOF && isspace(c)) ; if (c != EOF) DviUngetC(dw, c); while (i < Length && DviGetC(dw, &c) != EOF && !isspace(c)) if (p) *p++ = c; if (c != EOF) DviUngetC(dw, c); if (p) *p = '\0'; return (Buffer); } int GetNumber(DviWidget dw) { int i = 0, c; while (DviGetC(dw, &c) != EOF && isspace(c)) ; if (c != EOF) DviUngetC(dw, c); while (DviGetC(dw, &c) != EOF && isdigit(c)) i = i*10 + c - '0'; if (c != EOF) DviUngetC(dw, c); return (i); } x11-apps-7.7+5+nmu1ubuntu1/xditview/rdblarrow0000664000000000000000000000032412514121441015747 0ustar #define next_width 11 #define next_height 11 static char next_bits[] = { 0x21, 0x00, 0x42, 0x00, 0x84, 0x00, 0x08, 0x01, 0x10, 0x02, 0x20, 0x04, 0x10, 0x02, 0x08, 0x01, 0x84, 0x00, 0x42, 0x00, 0x21, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/xditview/compile0000755000000000000000000001624512656634653015440 0ustar #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xditview/app-defaults/0000775000000000000000000000000012520516676016433 5ustar x11-apps-7.7+5+nmu1ubuntu1/xditview/app-defaults/Xditview0000664000000000000000000000607012514121441020145 0ustar Xditview.geometry: 600x800 *MenuButton*Font: -*-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-1 *SimpleMenu*Font: -*-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-1 *Text*Font: -*-courier-medium-r-normal--*-120-*-*-*-*-iso8859-1 *paned.allowResize: true *paned.?.showGrip: false *paned.?.skipAdjust: false *paned.form.porthole.width: 600 *paned.form.porthole.height: 800 *paned.label.skipAdjust: true *MenuButton.shapeStyle: oval *Command.shapeStyle: oval *fileMenuButton.label: File *fileMenuButton.leftBitmap: menu12 *fileMenuButton.menuName: fileMenu *fileMenu.openFile.label: Open File *fileMenu.revisitFile.label: Reopen File *fileMenu.setResolution.label: Set Screen Resolution *fileMenu.quit.label: Quit *prevButton.bitmap: ldblarrow *prevButton.internalHeight: 0 *prevButton.Translations: #override : PreviousPage() unset() *pageNumber.translations: #override\ CtrlJ: SetPageNumber()\n\ CtrlM: SetPageNumber()\n\ Linefeed: SetPageNumber()\n\ Return: SetPageNumber()\n\ CtrlO: Noop()\n\ MetaI: Noop()\n\ CtrlN: Noop()\n\ CtrlP: Noop()\n\ CtrlZ: Noop()\n\ MetaZ: Noop()\n\ space: NextPage()\n\ Ctrlv: NextPage()\n\ Metav: PreviousPage()\n\ Next: NextPage()\n\ Prior: PreviousPage()\n\ Find: OpenFile() *pageNumber*editType: edit *nextButton.bitmap: rdblarrow *nextButton.internalHeight: 0 *nextButton.translations: #override : NextPage() unset() *viewport.allowResize: false *viewport.forceBars: true *viewport.allowHoriz: true *viewport.allowVert: true *dvi.translations: #augment \ : XawPositionSimpleMenu(popupMenu) MenuPopup(popupMenu)\n\ Ctrlv: NextPage()\n\ Metav: PreviousPage()\n\ space: NextPage()\n\ Next: NextPage()\n\ Prior: PreviousPage()\n\ Find: OpenFile() *dvi.baseTranslations: #augment \ : XawPositionSimpleMenu(popupMenu) MenuPopup(popupMenu)\n\ space: NextPage()\n\ Ctrlv: NextPage()\n\ Metav: PreviousPage()\n\ Next: NextPage()\n\ Prior: PreviousPage()\n\ Find: OpenFile() *popupMenu.nextPage.label: Next Page *popupMenu.previousPage.label: Previous Page *popupMenu.setResolution.label: Set Screen Resolution *popupMenu.openFile.label: Open File *popupMenu.revisitFile.label: Reopen File *popupMenu.quit.label: Quit *promptShell.allowShellResize: true *promptShell.promptDialog.value.translations: #override\ Return: Accept() *promptShell.promptDialog.value.baseTranslations: #override\ Return: Accept() *promptShell.promptDialog.accept.label: Accept *promptShell.promptDialog.accept.translations: #override\ : Accept() unset() *promptShell.promptDialog.accept.baseTranslations: #override \ : Accept() unset() *promptShell.promptDialog.cancel.label: Cancel *promptShell.promptDialog.cancel.translations: #override \ : Cancel() unset() *promptShell.promptDialog.cancel.baseTranslations: #override \ : Cancel() unset() x11-apps-7.7+5+nmu1ubuntu1/xditview/app-defaults/Xditview-chrtr0000664000000000000000000000253712514121441021271 0ustar #include "Xditview" *Dvi.fontMap:\ R -*-charter-medium-r-normal--*-*-*-*-*-*-iso8859-1\n\ I -*-charter-medium-i-normal--*-*-*-*-*-*-iso8859-1\n\ B -*-charter-bold-r-normal--*-*-*-*-*-*-iso8859-1\n\ F -*-charter-bold-i-normal--*-*-*-*-*-*-iso8859-1\n\ BI -*-charter-bold-i-normal--*-*-*-*-*-*-iso8859-1\n\ C -*-courier-medium-r-normal--*-*-*-*-*-*-iso8859-1\n\ CO -*-courier-medium-o-normal--*-*-*-*-*-*-iso8859-1\n\ CB -*-courier-bold-r-normal--*-*-*-*-*-*-iso8859-1\n\ CF -*-courier-bold-o-normal--*-*-*-*-*-*-iso8859-1\n\ H -*-helvetica-medium-r-normal--*-*-*-*-*-*-iso8859-1\n\ HO -*-helvetica-medium-o-normal--*-*-*-*-*-*-iso8859-1\n\ HB -*-helvetica-bold-r-normal--*-*-*-*-*-*-iso8859-1\n\ HF -*-helvetica-bold-o-normal--*-*-*-*-*-*-iso8859-1\n\ N -*-new century schoolbook-medium-r-normal--*-*-*-*-*-*-iso8859-1\n\ NI -*-new century schoolbook-medium-i-normal--*-*-*-*-*-*-iso8859-1\n\ NB -*-new century schoolbook-bold-r-normal--*-*-*-*-*-*-iso8859-1\n\ NF -*-new century schoolbook-bold-i-normal--*-*-*-*-*-*-iso8859-1\n\ A -*-charter-medium-r-normal--*-*-*-*-*-*-iso8859-1\n\ AI -*-charter-medium-i-normal--*-*-*-*-*-*-iso8859-1\n\ AB -*-charter-bold-r-normal--*-*-*-*-*-*-iso8859-1\n\ AF -*-charter-bold-i-normal--*-*-*-*-*-*-iso8859-1\n\ S -*-symbol-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific\n\ S2 -*-symbol-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific\n x11-apps-7.7+5+nmu1ubuntu1/xditview/ChangeLog0000664000000000000000000004350612514121525015614 0ustar commit d8b43b22c6432e7c927236b6e729a53f737cedfb Author: Alan Coopersmith Date: Thu Apr 16 23:07:15 2015 -0700 xditview 1.0.4 Signed-off-by: Alan Coopersmith commit b35fd1fb11d26dbe2be060a77a8a275b98d28251 Author: Alan Coopersmith Date: Sat Nov 8 09:29:58 2014 -0800 Use SEEK_* names instead of raw numbers for fseek whence argument Signed-off-by: Alan Coopersmith commit 67506ce7948065ae81f370bb821645de4c7daf9b Author: Alan Coopersmith Date: Sat Oct 25 13:39:48 2014 -0700 Remove CVS/RCS $Id tags Signed-off-by: Alan Coopersmith commit c14b35a3b958663056a887471a1280842efbb981 Author: Alan Coopersmith Date: Sat Oct 25 13:27:06 2014 -0700 Combine usage message strings Signed-off-by: Alan Coopersmith commit cb2b3214a0593b0970cd8738d34d0ac3e1268b38 Author: Alan Coopersmith Date: Sat Oct 25 13:15:46 2014 -0700 Remove #if 0 code Signed-off-by: Alan Coopersmith commit 5134d3eaaeb25a49622d827af7c783b980a10919 Author: Alan Coopersmith Date: Sat Oct 25 13:12:31 2014 -0700 unifdef -UNOTDEF -UNOTUSED commit f7f6ce39ca5f1988f04696581f261bf59c23dc4c Author: Alan Coopersmith Date: Sat Oct 25 12:56:45 2014 -0700 Const cleanup Signed-off-by: Alan Coopersmith commit da45a0a835bf2d2abb2810ca7bdb9cbc450f7135 Author: Alan Coopersmith Date: Mon Jun 2 22:24:37 2014 -0700 autogen.sh: Honor NOCONFIGURE=1 See http://people.gnome.org/~walters/docs/build-api.txt Signed-off-by: Alan Coopersmith commit bc59f4d3543192e8ccd29f70db9f3dcb4e23fd5a Author: Alan Coopersmith Date: Mon Jun 2 22:24:37 2014 -0700 configure: Drop AM_MAINTAINER_MODE Signed-off-by: Alan Coopersmith commit fc869719ccf944905316692c94c236f249aeb8c2 Author: Alan Coopersmith Date: Mon Jun 2 22:24:25 2014 -0700 config: Add missing AC_CONFIG_SRCDIR Regroup AC statements under the Autoconf initialization section. Regroup AM statements under the Automake initialization section. Signed-off-by: Alan Coopersmith commit 4768101b52f5e5324208c5c014bac87e0eb28b39 Author: Alan Coopersmith Date: Tue Feb 18 18:13:43 2014 -0800 Convert sprintf calls to snprintf Signed-off-by: Alan Coopersmith commit 93986e62c7793ef7bb3123748249302e974b72e6 Author: Alan Coopersmith Date: Sun Apr 21 15:18:28 2013 -0700 Close file leak when fdopen() fails in OpenFile() Found by parfait 1.1 bug checking tool: Error: File Leak File Descriptor Leak: Leaked File Descriptor fd at line 457 of app/xditview/Dvi.c in function 'OpenFile'. fd initialized at line 449 with mkstemp Also reorganize & clean up the code a bit while we're here Signed-off-by: Alan Coopersmith commit 23371e39e595056b3db2e361fad8a21ed4a0d9e7 Author: Alan Coopersmith Date: Sat Jan 12 16:36:26 2013 -0800 xditview 1.0.3 Signed-off-by: Alan Coopersmith commit 257b2cdcaeb19a75b3e61e11a038244af89d3179 Author: Gaetan Nadon Date: Wed Jan 19 10:06:56 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit a81efa4ac87783a42ffb5f8099b05016903fb1a4 Author: Gaetan Nadon Date: Thu Jan 13 17:15:36 2011 -0500 man: replace hard coded man page section with substitution strings Signed-off-by: Gaetan Nadon commit a274cf7cbf58d9e3b40c7146c191a63a995e9f2d Author: Gaetan Nadon Date: Thu Jan 13 11:15:47 2011 -0500 man: remove trailing spaces and tabs Using s/[ \t]*$// Signed-off-by: Gaetan Nadon commit e65ffae36608a8c7d4cf24d6c1c1a686b70abc00 Author: Gaetan Nadon Date: Wed Jan 12 16:28:02 2011 -0500 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS This silences an Autoconf warning commit 78fe41b9f00cd8ad5ee8532ae70771b0e0fe6756 Author: Gaetan Nadon Date: Wed Jan 12 15:29:50 2011 -0500 config: replace deprecated AC_HELP_STRING with AS_HELP_STRING This silences an Automake warning. Signed-off-by: Gaetan Nadon commit 1616e2d2e5c632c7a175dee2b0ae4e2b737bb648 Author: Gaetan Nadon Date: Wed Jan 12 11:54:40 2011 -0500 config: use AC_PROG_INSTALL now supplied by XORG_DEFAULT_OPTIONS It depends on util-macros 1.8 or later The existing statement can now be removed from the configuration file. Signed-off-by: Gaetan Nadon commit b05d3efcd5ecceb73edc9e64cc07a5c7fcfaa321 Author: Alan Coopersmith Date: Fri Aug 6 16:08:20 2010 -0700 xditview 1.0.2 Signed-off-by: Alan Coopersmith commit cc0f7c0855e22a50d2ffca3f3be104d44854ae2c Author: Alan Coopersmith Date: Fri Aug 6 16:05:21 2010 -0700 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all X.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Alan Coopersmith commit 71b679ff4a6680368f3da23b184e081fdf4bedfd Author: Alan Coopersmith Date: Fri Aug 6 08:54:56 2010 -0700 Use AM_CFLAGS instead of requiring AM_PROG_CC_C_O Since we don't build different targets with different CFLAGS, simplify configuration and build. Also remove AC_PROG_CC since XORG_DEFAULT_OPTIONS handles that now. Signed-off-by: Alan Coopersmith commit 8d5842d32d880fab4e076776b669b6cd3d07a8ca Author: Alan Coopersmith Date: Fri Aug 6 08:50:47 2010 -0700 Fill in COPYING file with copyright notices from source code Signed-off-by: Alan Coopersmith commit c61d64144df11490353c436d103976dd6949c2e2 Author: Alan Coopersmith Date: Thu Jul 1 17:46:28 2010 -0700 Xmu functions are called directly, so include it in PKG_CHECK_MODULES Signed-off-by: Alan Coopersmith commit 8861f35c5199902638458d16267e455ac482eb1f Author: Alan Coopersmith Date: Wed Jun 30 23:25:03 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS The existing statement can now be removed from the configuration file. Use automake provided $(AM_V_GEN) and XORG_DEFAULT_OPTIONS provided $(SED) Enables silent rule and use platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit a2453f7648632483c5e229a9c55f232b5ceee6d4 Author: Gaetan Nadon Date: Sat Dec 19 20:48:47 2009 -0500 configure.ac: use backticks rather than $() for cmd subs Use "$PKG_CONFIG" rather than hard coded "pkg-config" Signed-off-by: Gaetan Nadon commit 1c1473782948289aa5747b157853939c0005c86d Author: Gaetan Nadon Date: Thu Nov 26 09:19:53 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit c8f4d8fec8d9d267d514069f22bb97d78d9bf02e Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit b20e0836477153bd42955d152c87c0b3652bbd40 Author: Gaetan Nadon Date: Tue Oct 27 15:07:24 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit 1d80ad4cc2d12060aa2d263b7775fa1095facf4d Author: Gaetan Nadon Date: Mon Oct 26 22:08:38 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit 1393c45552fc14e8210470f4e9e5f0ff61c23728 Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit c02e64f7a2cc1a59fb24b6c3bf125dd177d20ed9 Author: Alan Coopersmith Date: Thu Oct 1 14:54:22 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit 9eed454db87e3d1956298558b8595d4fddd85d05 Author: Paulo Cesar Pereira de Andrade Date: Tue Jan 13 17:18:26 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings. commit a73267ed9bca410a83fd2a9ff3bcc0b659804295 Author: James Cloos Date: Wed Aug 20 10:32:50 2008 -0400 xaw8 is gone, use xaw7 commit 698cffe8f81447969cf5bab75fff41c0e24d0939 Author: Jeremy Huddleston Date: Thu Mar 27 20:32:09 2008 -0700 Added missing AM_PROG_CC_C_O commit 4ce9072751ab49742a5c1e56846540edd20ade9a Author: Jeremy Huddleston Date: Thu Mar 27 20:07:57 2008 -0700 Build fix for file systems that are not case sensitive commit 0d6dfa2a57288c749ca84d105644c12ddc3019ec Author: James Cloos Date: Thu Dec 6 16:37:11 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit 96ac95a860acd786cf592057ff1dbf3aff54e12d Author: James Cloos Date: Mon Sep 3 05:51:18 2007 -0400 Add *~ to .gitignore to skip patch/emacs droppings commit ab06b0738229e92404e4ebce74fcc49e8ea9baff Author: James Cloos Date: Thu Aug 23 19:24:42 2007 -0400 Rename .cvsignore to .gitignore commit fa5bac56eaa4d1b220be9482758f44d658df8657 Author: Kevin E Martin Date: Wed Dec 21 02:29:49 2005 +0000 Update package version for X11R7 release. commit 50b53649ad329f1a5c038deeeafe681924b6eddd Author: Adam Jackson Date: Mon Dec 19 16:22:43 2005 +0000 Stub COPYING files commit d0ecfe6cdfe672b1340ecb1d14b97922a375f91a Author: Kevin E Martin Date: Thu Dec 15 00:24:05 2005 +0000 Update package version number for final X11R7 release candidate. commit 7dfe2ee4c0312d7ca924d77c09098ca5b4948b3b Author: Kevin E Martin Date: Wed Dec 7 16:17:59 2005 +0000 Change to use the app-defaults default dir configured in libXt. commit 66a5572e4d49de7366d9cb6586cfdb4a41e6aa6a Author: Kevin E Martin Date: Tue Dec 6 22:48:20 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit e069c91ac9d5919779dabaaf238a73997cb39411 Author: Kevin E Martin Date: Sat Dec 3 05:49:19 2005 +0000 Update package version number for X11R7 RC3 release. commit 837f6e226dfcc1f08669c2a9353706f51c06948e Author: Alan Coopersmith Date: Mon Nov 28 22:01:40 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit 86c3aed84692ba2e8abba4e71e095be1c74a1472 Author: Eric Anholt Date: Mon Nov 21 10:34:59 2005 +0000 Another pass at .cvsignores for apps. commit a2aaf98c495e0898320085deca662a5352fc6df4 Author: Eric Anholt Date: Sun Nov 20 22:08:51 2005 +0000 Add/improve .cvsignore files for apps. commit 98a90f8714b490e32e5a5c9ab95028e0bb877e05 Author: Kevin E Martin Date: Wed Oct 19 02:47:53 2005 +0000 Update package version number for RC1 release. commit 6dbb0ac2ad3435721cdbd9e556010926e04379f9 Author: Alan Coopersmith Date: Tue Oct 18 00:32:54 2005 +0000 Change default install dir for app-default files from $(sysconfdir)/X11/app-defaults to $(libdir)/X11/app-defaults to match the monolith & allow localization commit da0f86782a9172bf23efe514adf2025b936c626e Author: Alan Coopersmith Date: Mon Oct 17 23:56:21 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 59535c605a073db09aa1c08a93d056b1b9bd90a9 Author: Alan Coopersmith Date: Fri Oct 14 00:25:44 2005 +0000 Use sed to fill in variables in man page commit 7cc94256cfb6146ea03f37bcc710f9177032d979 Author: Alan Coopersmith Date: Sun Oct 2 19:35:49 2005 +0000 Add ldblarrow & rdblarrow bitmaps to xditview commit 2e789b84345923e0718985ed91de1ffe715a0d72 Author: Alan Coopersmith Date: Mon Aug 1 20:25:29 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit 8ad58e473b58679bf73128e1396bbd40b4116d93 Author: Kevin E Martin Date: Fri Jul 29 21:22:31 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit f962df222c7d88dae609679a3fd7dc8bb892c869 Author: Alan Coopersmith Date: Tue Jul 26 15:44:02 2005 +0000 Replace more GNU make-ism's with more portable macros commit f9a1705a1ff8b5a585bbc04925519992b4c09523 Author: Adam Jackson Date: Wed Jul 20 19:31:52 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit 8f71071ec06b471378321afe3980cb80de111621 Author: Alan Coopersmith Date: Sat Jul 16 22:07:13 2005 +0000 Add #ifdef HAVE_CONFIG_H/#include "config.h" to files that need it to get HAS_MKSTEMP defined in modular builds. commit d2835ed1c92ed5504455831e861a33b9ebedee7e Author: Alan Coopersmith Date: Sat Jul 16 22:00:11 2005 +0000 Convert more app-defaults rules to work with non-GNU make commit 783f6b29ef8cfa45394847eea56362073f552b30 Author: Alan Coopersmith Date: Sat Jul 16 21:59:14 2005 +0000 Define HAS_MKSTEMP if mkstemp() is present (needed for improved protection against tempfile race conditions in many places) commit a72338b2f0fef721d6388d292ece4b21f19e9def Author: Søren Sandmann Pedersen Date: Wed Jul 6 19:53:30 2005 +0000 Build system for xditview commit f6f89b92dce48d65da1e89debbf15b1ff8b727de Author: Egbert Eich Date: Fri Apr 23 19:54:42 2004 +0000 Merging XORG-CURRENT into trunk commit b932978399dfc078e0216ec6073f237a60ed32fe Author: Egbert Eich Date: Sun Mar 14 08:35:11 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit 7d1befb96b2874812e59335b3a560ed1f3c063c3 Author: Egbert Eich Date: Wed Mar 3 12:13:00 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit 436d9f6ea33a815a21d7066354a3a6e317901057 Author: Egbert Eich Date: Thu Feb 26 13:36:17 2004 +0000 readding XFree86's cvs IDs commit 24d49e45544894cd22fd5fd11145805ccfe88ccc Author: Egbert Eich Date: Thu Feb 26 09:24:00 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit c355698ae0f02fcc49a528d57a2070d9b0c64fba Author: Kaleb Keithley Date: Tue Nov 25 19:29:11 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit de89577b3dd6b405e2fd274afb20eea8dcc651c9 Author: Kaleb Keithley Date: Fri Nov 14 16:49:21 2003 +0000 XFree86 4.3.0.1 commit 84735728ed5f6a07d87254860e2776775c54b85b Author: Kaleb Keithley Date: Fri Nov 14 16:49:21 2003 +0000 Initial revision x11-apps-7.7+5+nmu1ubuntu1/xditview/DviChar.h0000664000000000000000000000226412514121441015524 0ustar /* * DviChar.h * * descriptions for mapping dvi names to * font indexes and back. Dvi fonts are all * 256 elements (actually only 256-32 are usable). * * The encoding names are taken from X - * case insensitive, a dash seperating the * CharSetRegistry from the CharSetEncoding */ #ifndef _DVICHAR_H_ #define _DVICHAR_H_ #include "Dvi.h" # define DVI_MAX_SYNONYMS 10 # define DVI_MAP_SIZE 256 # define DVI_HASH_SIZE 256 # define DVI_MAX_LIGATURES 16 typedef struct _dviCharNameHash { struct _dviCharNameHash *next; const char *name; int position; } DviCharNameHash; typedef struct _dviCharNameMap { const char * encoding; int special; const char * const dvi_names[DVI_MAP_SIZE][DVI_MAX_SYNONYMS]; const char * const ligatures[DVI_MAX_LIGATURES][2]; DviCharNameHash *buckets[DVI_HASH_SIZE]; } DviCharNameMap; extern DviCharNameMap *DviFindMap (const char *); extern void DviRegisterMap (DviCharNameMap *); #define DviCharName(map,index,synonym) ((map)->dvi_names[index][synonym]) extern int DviCharIndex (DviCharNameMap *, const char *); extern unsigned char *DviCharIsLigature (DviCharNameMap *, const char *); extern void ResetFonts (DviWidget); #endif x11-apps-7.7+5+nmu1ubuntu1/xditview/depcomp0000755000000000000000000005601612656634653015437 0ustar #! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xditview/config.guess0000775000000000000000000012367212514123564016372 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-11-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xditview/ldblarrow0000664000000000000000000000034012514121441015737 0ustar #define previous_width 11 #define previous_height 11 static char previous_bits[] = { 0x20, 0x04, 0x10, 0x02, 0x08, 0x01, 0x84, 0x00, 0x42, 0x00, 0x21, 0x00, 0x42, 0x00, 0x84, 0x00, 0x08, 0x01, 0x10, 0x02, 0x20, 0x04}; x11-apps-7.7+5+nmu1ubuntu1/xditview/DviChar.c0000664000000000000000000003165112514121441015521 0ustar /* * DviChar.c * * Map DVI (ditrof output) character names to * font indexes and back */ # include # include "DviChar.h" # define allocHash() ((DviCharNameHash *) XtMalloc (sizeof (DviCharNameHash))) struct map_list { struct map_list *next; DviCharNameMap *map; }; static struct map_list *world; static int standard_maps_loaded = 0; static void load_standard_maps (void); static int hash_name (const char *name); static void dispose_hash(DviCharNameMap *map); static void compute_hash(DviCharNameMap *map); DviCharNameMap * DviFindMap (const char *encoding) { struct map_list *m; if (!standard_maps_loaded) load_standard_maps (); for (m = world; m; m=m->next) if (!strcmp (m->map->encoding, encoding)) return m->map; return NULL; } void DviRegisterMap (DviCharNameMap *map) { struct map_list *m; if (!standard_maps_loaded) load_standard_maps (); for (m = world; m; m = m->next) if (!strcmp (m->map->encoding, map->encoding)) break; if (!m) { m = (struct map_list *) XtMalloc (sizeof *m); m->next = world; world = m; } dispose_hash (map); m->map = map; compute_hash (map); } static void dispose_hash (DviCharNameMap *map) { DviCharNameHash **buckets; DviCharNameHash *h, *next; int i; buckets = map->buckets; for (i = 0; i < DVI_HASH_SIZE; i++) { for (h = buckets[i]; h; h=next) { next = h->next; XtFree ((char *) h); } } } static int hash_name (const char *name) { int i = 0; while (*name) i = (i << 1) ^ *name++; if (i < 0) i = -i; return i; } static void compute_hash (DviCharNameMap *map) { DviCharNameHash **buckets; int c, s, i; DviCharNameHash *h; buckets = map->buckets; for (i = 0; i < DVI_HASH_SIZE; i++) buckets[i] = NULL; for (c = 0; c < DVI_MAP_SIZE; c++) for (s = 0; s < DVI_MAX_SYNONYMS; s++) { if (!map->dvi_names[c][s]) break; i = hash_name (map->dvi_names[c][s]) % DVI_HASH_SIZE; h = allocHash (); h->next = buckets[i]; buckets[i] = h; h->name = map->dvi_names[c][s]; h->position = c; } } int DviCharIndex (DviCharNameMap *map, const char *name) { int i; DviCharNameHash *h; i = hash_name (name) % DVI_HASH_SIZE; for (h = map->buckets[i]; h; h=h->next) if (!strcmp (h->name, name)) return h->position; return -1; } static DviCharNameMap ISO8859_1_map = { "iso8859-1", 0, { { NULL, /* 0 */}, { NULL, /* 1 */}, { NULL, /* 2 */}, { NULL, /* 3 */}, { NULL, /* 4 */}, { NULL, /* 5 */}, { NULL, /* 6 */}, { NULL, /* 7 */}, { NULL, /* 8 */}, { NULL, /* 9 */}, { NULL, /* 10 */}, { NULL, /* 11 */}, { NULL, /* 12 */}, { NULL, /* 13 */}, { NULL, /* 14 */}, { NULL, /* 15 */}, { NULL, /* 16 */}, { NULL, /* 17 */}, { NULL, /* 18 */}, { NULL, /* 19 */}, { NULL, /* 20 */}, { NULL, /* 21 */}, { NULL, /* 22 */}, { NULL, /* 23 */}, { NULL, /* 24 */}, { NULL, /* 25 */}, { NULL, /* 26 */}, { NULL, /* 27 */}, { NULL, /* 28 */}, { NULL, /* 29 */}, { NULL, /* 30 */}, { NULL, /* 31 */}, { NULL, /* 32 */}, { "!", /* 33 */}, { "\"", /* 34 */}, { "#", /* 35 */}, { "$", /* 36 */}, { "%", /* 37 */}, { "&", /* 38 */}, { "'", /* 39 */}, { "(", /* 40 */}, { ")", /* 41 */}, { "*", /* 42 */}, { "+", /* 43 */}, { ",", /* 44 */}, { "-","\\-", /* 45 */}, { ".", /* 46 */}, { "/","sl", /* 47 */}, { "0", /* 48 */}, { "1", /* 49 */}, { "2", /* 50 */}, { "3", /* 51 */}, { "4", /* 52 */}, { "5", /* 53 */}, { "6", /* 54 */}, { "7", /* 55 */}, { "8", /* 56 */}, { "9", /* 57 */}, { ":", /* 58 */}, { ";", /* 59 */}, { "<", /* 60 */}, { "=","eq", /* 61 */}, { ">", /* 62 */}, { "?", /* 63 */}, { "@", /* 64 */}, { "A", /* 65 */}, { "B", /* 66 */}, { "C", /* 67 */}, { "D", /* 68 */}, { "E", /* 69 */}, { "F", /* 70 */}, { "G", /* 71 */}, { "H", /* 72 */}, { "I", /* 73 */}, { "J", /* 74 */}, { "K", /* 75 */}, { "L", /* 76 */}, { "M", /* 77 */}, { "N", /* 78 */}, { "O", /* 79 */}, { "P", /* 80 */}, { "Q", /* 81 */}, { "R", /* 82 */}, { "S", /* 83 */}, { "T", /* 84 */}, { "U", /* 85 */}, { "V", /* 86 */}, { "W", /* 87 */}, { "X", /* 88 */}, { "Y", /* 89 */}, { "Z", /* 90 */}, { "[", /* 91 */}, { "\\", /* 92 */}, { "]", /* 93 */}, { "a^", /* 94 */}, { "_","ru","ul", /* 95 */}, { "`", /* 96 */}, { "a", /* 97 */}, { "b", /* 98 */}, { "c", /* 99 */}, { "d", /* 100 */}, { "e", /* 101 */}, { "f", /* 102 */}, { "g", /* 103 */}, { "h", /* 104 */}, { "i", /* 105 */}, { "j", /* 106 */}, { "k", /* 107 */}, { "l", /* 108 */}, { "m", /* 109 */}, { "n", /* 110 */}, { "o", /* 111 */}, { "p", /* 112 */}, { "q", /* 113 */}, { "r", /* 114 */}, { "s", /* 115 */}, { "t", /* 116 */}, { "u", /* 117 */}, { "v", /* 118 */}, { "w", /* 119 */}, { "x", /* 120 */}, { "y", /* 121 */}, { "z", /* 122 */}, { "{", /* 123 */}, { "|","or" /* 124 */}, { "}", /* 125 */}, { "a~","ap" /* 126 */}, { NULL, /* 127 */}, { NULL, /* 128 */}, { NULL, /* 129 */}, { NULL, /* 130 */}, { NULL, /* 131 */}, { NULL, /* 132 */}, { NULL, /* 133 */}, { NULL, /* 134 */}, { NULL, /* 135 */}, { NULL, /* 136 */}, { NULL, /* 137 */}, { NULL, /* 138 */}, { NULL, /* 139 */}, { NULL, /* 140 */}, { NULL, /* 141 */}, { NULL, /* 142 */}, { NULL, /* 143 */}, { NULL, /* 144 */}, { NULL, /* 145 */}, { NULL, /* 146 */}, { NULL, /* 147 */}, { NULL, /* 148 */}, { NULL, /* 149 */}, { NULL, /* 150 */}, { NULL, /* 151 */}, { NULL, /* 152 */}, { NULL, /* 153 */}, { NULL, /* 154 */}, { NULL, /* 155 */}, { NULL, /* 156 */}, { NULL, /* 157 */}, { NULL, /* 158 */}, { NULL, /* 159 */}, { NULL, /* 160 */}, { "I!", /* 161 */}, { "ct", /* 162 */}, { "po", /* 163 */}, { "cu", /* 164 */}, { "$J", /* 165 */}, { NULL, /* 166 */}, { "sc", /* 167 */}, { NULL, /* 168 */}, { "co", /* 169 */}, { NULL, /* 170 */}, { "d<", /* 171 */}, { "no", /* 172 */}, { "hy", /* 173 */}, { "rg", /* 174 */}, { "ma", /* 175 */}, { "de", /* 176 */}, { "+-", /* 177 */}, { NULL, /* 178 */}, { NULL, /* 179 */}, { "aa", /* 180 */}, { "*m", /* 181 */}, { "pp", /* 182 */}, { NULL, /* 183 */}, { "cd", /* 184 */}, { NULL, /* 185 */}, { NULL, /* 186 */}, { "d>", /* 187 */}, { "14", /* 188 */}, { "12", /* 189 */}, { "34", /* 190 */}, { "I?", /* 191 */}, { NULL, /* 192 */}, { NULL, /* 193 */}, { NULL, /* 194 */}, { NULL, /* 195 */}, { NULL, /* 196 */}, { NULL, /* 197 */}, { "AE", /* 198 */}, { NULL, /* 199 */}, { NULL, /* 200 */}, { NULL, /* 201 */}, { NULL, /* 202 */}, { NULL, /* 203 */}, { NULL, /* 204 */}, { NULL, /* 205 */}, { NULL, /* 206 */}, { NULL, /* 207 */}, { NULL, /* 208 */}, { NULL, /* 209 */}, { NULL, /* 210 */}, { NULL, /* 211 */}, { NULL, /* 212 */}, { NULL, /* 213 */}, { NULL, /* 214 */}, { "mu", /* 215 */}, { "O/", /* 216 */}, { NULL, /* 217 */}, { NULL, /* 218 */}, { NULL, /* 219 */}, { NULL, /* 220 */}, { NULL, /* 221 */}, { NULL, /* 222 */}, { "ss", /* 223 */}, { NULL, /* 224 */}, { NULL, /* 225 */}, { NULL, /* 226 */}, { NULL, /* 227 */}, { NULL, /* 228 */}, { NULL, /* 229 */}, { "ae", /* 230 */}, { NULL, /* 231 */}, { NULL, /* 232 */}, { NULL, /* 233 */}, { NULL, /* 234 */}, { NULL, /* 235 */}, { NULL, /* 236 */}, { NULL, /* 237 */}, { NULL, /* 238 */}, { NULL, /* 239 */}, { NULL, /* 240 */}, { NULL, /* 241 */}, { NULL, /* 242 */}, { NULL, /* 243 */}, { NULL, /* 244 */}, { NULL, /* 245 */}, { NULL, /* 246 */}, { NULL, /* 247 */}, { NULL, /* 248 */}, { NULL, /* 249 */}, { NULL, /* 250 */}, { NULL, /* 251 */}, { NULL, /* 252 */}, { NULL, /* 253 */}, { NULL, /* 254 */}, { NULL, /* 255 */}, }, { { "fi", "fi", }, { "fl", "fl", }, { "ff", "ff", }, { "Fi", "ffi", }, { "Fl", "ffl", }, { NULL, NULL, }, } }; static DviCharNameMap Adobe_Symbol_map = { "adobe-fontspecific", 1, { { NULL, /* 0 */}, { NULL, /* 1 */}, { NULL, /* 2 */}, { NULL, /* 3 */}, { NULL, /* 4 */}, { NULL, /* 5 */}, { NULL, /* 6 */}, { NULL, /* 7 */}, { NULL, /* 8 */}, { NULL, /* 9 */}, { NULL, /* 10 */}, { NULL, /* 11 */}, { NULL, /* 12 */}, { NULL, /* 13 */}, { NULL, /* 14 */}, { NULL, /* 15 */}, { NULL, /* 16 */}, { NULL, /* 17 */}, { NULL, /* 18 */}, { NULL, /* 19 */}, { NULL, /* 20 */}, { NULL, /* 21 */}, { NULL, /* 22 */}, { NULL, /* 23 */}, { NULL, /* 24 */}, { NULL, /* 25 */}, { NULL, /* 26 */}, { NULL, /* 27 */}, { NULL, /* 28 */}, { NULL, /* 29 */}, { NULL, /* 30 */}, { NULL, /* 31 */}, { NULL, /* 32 */}, { "!", /* 33 */}, { "fa", /* 34 */}, { "#", /* 35 */}, { "te", /* 36 */}, { "%", /* 37 */}, { "&", /* 38 */}, { "cm", /* 39 */}, { "(", /* 40 */}, { ")", /* 41 */}, { "**", /* 42 */}, { "+","pl", /* 43 */}, { ",", /* 44 */}, { "-","mi","\\-", /* 45 */}, { ".", /* 46 */}, { "/","sl", /* 47 */}, { "0", /* 48 */}, { "1", /* 49 */}, { "2", /* 50 */}, { "3", /* 51 */}, { "4", /* 52 */}, { "5", /* 53 */}, { "6", /* 54 */}, { "7", /* 55 */}, { "8", /* 56 */}, { "9", /* 57 */}, { ":", /* 58 */}, { ";", /* 59 */}, { "<", /* 60 */}, { "=","eq", /* 61 */}, { ">", /* 62 */}, { "?", /* 63 */}, { "=~", /* 64 */}, { "*A", /* 65 */}, { "*B", /* 66 */}, { "*C", /* 67 */}, { "*D", /* 68 */}, { "*E", /* 69 */}, { "*F", /* 70 */}, { "*G", /* 71 */}, { "*Y", /* 72 */}, { "*I", /* 73 */}, { NULL, /* 74 */}, { "*K", /* 75 */}, { "*L", /* 76 */}, { "*M", /* 77 */}, { "*N", /* 78 */}, { "*O", /* 79 */}, { "*P", /* 80 */}, { "*H", /* 81 */}, { "*R", /* 82 */}, { "*S", /* 83 */}, { "*T", /* 84 */}, { "*U", /* 85 */}, { "ts", /* 86 */}, { "*W", /* 87 */}, { "*C", /* 88 */}, { "*Q", /* 89 */}, { "*Z", /* 90 */}, { "[", /* 91 */}, { "tf", /* 92 */}, { "]", /* 93 */}, { "bt", /* 94 */}, { "ul", /* 95 */}, { "rn", /* 96 */}, { "*a", /* 97 */}, { "*b", /* 98 */}, { "*x", /* 99 */}, { "*d", /* 100 */}, { "*e", /* 101 */}, { "*f", /* 102 */}, { "*g", /* 103 */}, { "*y", /* 104 */}, { "*i", /* 105 */}, { NULL, /* 106 */}, { "*k", /* 107 */}, { "*l", /* 108 */}, { "*m", /* 109 */}, { "*n", /* 110 */}, { "*o", /* 111 */}, { "*p", /* 112 */}, { "*h", /* 113 */}, { "*r", /* 114 */}, { "*s", /* 115 */}, { "*t", /* 116 */}, { "*u", /* 117 */}, { NULL, /* 118 */}, { "*w", /* 119 */}, { "*c", /* 120 */}, { "*q", /* 121 */}, { "*z", /* 122 */}, { "{", /* 123 */}, { "|", /* 124 */}, { "}", /* 125 */}, { "a~","ap", /* 126 */}, { NULL, /* 127 */}, { NULL, /* 128 */}, { NULL, /* 129 */}, { NULL, /* 130 */}, { NULL, /* 131 */}, { NULL, /* 132 */}, { NULL, /* 133 */}, { NULL, /* 134 */}, { NULL, /* 135 */}, { NULL, /* 136 */}, { NULL, /* 137 */}, { NULL, /* 138 */}, { NULL, /* 139 */}, { NULL, /* 140 */}, { NULL, /* 141 */}, { NULL, /* 142 */}, { NULL, /* 143 */}, { NULL, /* 144 */}, { NULL, /* 145 */}, { NULL, /* 146 */}, { NULL, /* 147 */}, { NULL, /* 148 */}, { NULL, /* 149 */}, { NULL, /* 150 */}, { NULL, /* 151 */}, { NULL, /* 152 */}, { NULL, /* 153 */}, { NULL, /* 154 */}, { NULL, /* 155 */}, { NULL, /* 156 */}, { NULL, /* 157 */}, { NULL, /* 158 */}, { NULL, /* 159 */}, { NULL, /* 160 */}, { NULL, /* 161 */}, { "fm","mt", /* 162 */}, { "<=", /* 163 */}, { "/","sl" /* 164 */}, { "if", /* 165 */}, { NULL, /* 166 */}, { "Cc", /* 167 */}, { "Cd", /* 168 */}, { "Ch", /* 169 */}, { "Cs", /* 170 */}, { "<>", /* 171 */}, { "<-", /* 172 */}, { "ua", /* 173 */}, { "->", /* 174 */}, { "da", /* 175 */}, { "de", /* 176 */}, { "+-", /* 177 */}, { "sd", /* 178 */}, { ">=", /* 179 */}, { "mu", /* 180 */}, { "pt", /* 181 */}, { "pd", /* 182 */}, { "bu", /* 183 */}, { "di", /* 184 */}, { "!=", /* 185 */}, { "==", /* 186 */}, { "~=", /* 187 */}, { "..", /* 188 */}, { "br", /* 189 */}, { "em", /* 190 */}, { "cr", /* 191 */}, { "al", /* 192 */}, { NULL, /* 193 */}, { NULL, /* 194 */}, { NULL, /* 195 */}, { "ax", /* 196 */}, { "a+", /* 197 */}, { "es", /* 198 */}, { "ca", /* 199 */}, { "cu", /* 200 */}, { "sp", /* 201 */}, { "ip", /* 202 */}, { "!s", /* 203 */}, { "sb", /* 204 */}, { "ib", /* 205 */}, { "mo", /* 206 */}, { "!m", /* 207 */}, { "ag", /* 208 */}, { "gr", /* 209 */}, { NULL, /* 210 */}, { NULL, /* 211 */}, { NULL, /* 212 */}, { NULL, /* 213 */}, { "sr", /* 214 */}, { "m.", /* 215 */}, { "no", /* 216 */}, { "an", /* 217 */}, { "lo", /* 218 */}, { "io", /* 219 */}, { "<:", /* 220 */}, { "u=", /* 221 */}, { ":>", /* 222 */}, { "d=", /* 223 */}, { "dm", /* 224 */}, { "L<", /* 225 */}, { "rg", /* 226 */}, { "co", /* 227 */}, { "tm", /* 228 */}, { NULL, /* 229 */}, { NULL, /* 230 */}, { NULL, /* 231 */}, { NULL, /* 232 */}, { "lc", /* 233 */}, { NULL, /* 234 */}, { "lf", /* 235 */}, { "lt", /* 236 */}, { "lk", /* 237 */}, { "lb", /* 238 */}, { "bv", /* 239 */}, { "AL", /* 240 */}, { "R>", /* 241 */}, { "is", /* 242 */}, { NULL, /* 243 */}, { NULL, /* 244 */}, { NULL, /* 245 */}, { NULL, /* 246 */}, { NULL, /* 247 */}, { NULL, /* 248 */}, { "rc", /* 249 */}, { NULL, /* 250 */}, { "rf", /* 251 */}, { "rt", /* 252 */}, { "rk", /* 253 */}, { "rb", /* 254 */}, { NULL, /* 255 */}, }, { { NULL, NULL }, } }; static void load_standard_maps (void) { standard_maps_loaded = 1; DviRegisterMap (&ISO8859_1_map); DviRegisterMap (&Adobe_Symbol_map); } x11-apps-7.7+5+nmu1ubuntu1/xditview/xdit.bm0000664000000000000000000000157212514121441015324 0ustar #define xdit_width 32 #define xdit_height 32 static unsigned const char xdit_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x02, 0x00, 0x00, 0x02, 0x8a, 0xa2, 0xfc, 0x03, 0x52, 0x14, 0x03, 0x04, 0x02, 0x80, 0x00, 0x08, 0x52, 0x54, 0x00, 0x10, 0x8a, 0x22, 0x8f, 0x23, 0x02, 0x20, 0x06, 0x21, 0x8a, 0x12, 0x8c, 0x40, 0x52, 0x14, 0x8c, 0x40, 0x02, 0x10, 0x58, 0x40, 0x52, 0x14, 0x30, 0x40, 0x8a, 0x12, 0x30, 0x40, 0x02, 0x10, 0x70, 0x40, 0x8a, 0x12, 0xc8, 0x40, 0x52, 0x24, 0xc4, 0xe0, 0x02, 0x20, 0x84, 0xe1, 0x52, 0x54, 0xce, 0xf3, 0x8a, 0xa2, 0x00, 0xf8, 0x02, 0x00, 0x03, 0xfc, 0x8a, 0x22, 0xfc, 0xf3, 0x52, 0x14, 0x00, 0xc2, 0x02, 0x00, 0x00, 0x02, 0x52, 0x14, 0x45, 0x02, 0x8a, 0xa2, 0x28, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x02, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/xditview/draw.c0000664000000000000000000002627112514121441015140 0ustar /* * Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * */ /* * draw.c * * accept dvi function calls and translate to X */ /* Support for ditroff drawing commands added: lines, circles, ellipses, arcs and splines. Splines are approximated as short lines by iterating a simple approximation algorithm. This seems good enough for previewing. David Evans , 14th March, 1990 */ #include #include #include #include #include #include #include "DviP.h" #include #ifndef M_PI #define M_PI 3.14159265358979323846264338327950 #endif /* the following are for use in the spline approximation algorithm */ typedef struct Point { double x; double y; struct Point *next; } Point; #define ITERATIONS 10 /* iterations to approximate spline */ #define midx(p,q) ((p->x + q->x) / 2) /* mid x point on pq */ #define midy(p,q) ((p->y + q->y) / 2) /* mid y point on pq */ #define length(p,q) sqrt(((q->x - p->x)*(q->x - p->x)) \ + ((q->y - p->y)*(q->y - p->y))) /* length of pq */ static Point *spline = (Point *)NULL; /* head of spline linked list */ static void ApproxSpline(int n); static void DeletePoint(Point *p); static void DrawSplineSegments(DviWidget dw); static int GetSpline(const char *s); static void InsertPoint(Point *p, Point *q); static void LineApprox(Point *p1, Point *p2, Point *p3); static Point * MakePoint(double x, double y); void HorizontalMove(DviWidget dw, int delta) { dw->dvi.state->x += delta; } void HorizontalGoto(DviWidget dw, int NewPosition) { dw->dvi.state->x = NewPosition; } void VerticalMove(DviWidget dw, int delta) { dw->dvi.state->y += delta; } void VerticalGoto(DviWidget dw, int NewPosition) { dw->dvi.state->y = NewPosition; } #ifdef USE_XFT static void DrawText (DviWidget dw) { int i; XftFont *font; font = dw->dvi.cache.font; for (i = 0; i <= dw->dvi.cache.index; i++) { if (dw->dvi.cache.cache[i].font) font = dw->dvi.cache.cache[i].font; XftDrawString8 (dw->dvi.draw, &dw->dvi.black, font, dw->dvi.cache.cache[i].x, dw->dvi.cache.start_y, (unsigned char *) dw->dvi.cache.cache[i].chars, dw->dvi.cache.cache[i].nchars); } } #endif void FlushCharCache (DviWidget dw) { int xx, yx; xx = ToX(dw, dw->dvi.state->x); yx = ToX(dw, dw->dvi.state->y); if (dw->dvi.cache.char_index != 0) { #ifdef USE_XFT DrawText (dw); #else XDrawText (XtDisplay (dw), XtWindow (dw), dw->dvi.normal_GC, dw->dvi.cache.start_x, dw->dvi.cache.start_y, dw->dvi.cache.cache, dw->dvi.cache.index + 1); #endif } dw->dvi.cache.index = 0; dw->dvi.cache.max = DVI_TEXT_CACHE_SIZE; if (dw->dvi.noPolyText) dw->dvi.cache.max = 1; dw->dvi.cache.char_index = 0; dw->dvi.cache.cache[0].nchars = 0; dw->dvi.cache.start_x = dw->dvi.cache.x = xx; dw->dvi.cache.start_y = dw->dvi.cache.y = yx; } void SetGCForDraw (DviWidget dw) { int lw; if (dw->dvi.state->line_style != dw->dvi.line_style || dw->dvi.state->line_width != dw->dvi.line_width) { lw = ToX(dw, dw->dvi.state->line_width); if (lw <= 1) lw = 0; XSetLineAttributes (XtDisplay (dw), dw->dvi.normal_GC, lw, LineSolid, CapButt, JoinMiter); dw->dvi.line_style = dw->dvi.state->line_style; dw->dvi.line_width = dw->dvi.state->line_width; } } void DrawLine (DviWidget dw, int x, int y) { if (dw->dvi.display_enable) XDrawLine (XtDisplay (dw), XtWindow (dw), dw->dvi.normal_GC, ToX(dw, dw->dvi.state->x), ToX(dw, dw->dvi.state->y), ToX(dw, dw->dvi.state->x + x), ToX(dw,dw->dvi.state->y + y)); dw->dvi.state->x += x; dw->dvi.state->y += y; } void DrawCircle (DviWidget dw, int diameter) { if (dw->dvi.display_enable) XDrawArc (XtDisplay (dw), XtWindow (dw), dw->dvi.normal_GC, ToX(dw, dw->dvi.state->x), ToX(dw, dw->dvi.state->y - (diameter / 2)), ToX(dw, diameter), ToX(dw, diameter), 0, 360 * 64); dw->dvi.state->x += diameter; } void DrawEllipse (DviWidget dw, int a, int b) { if (dw->dvi.display_enable) XDrawArc (XtDisplay (dw), XtWindow (dw), dw->dvi.normal_GC, ToX(dw, dw->dvi.state->x), ToX(dw, dw->dvi.state->y - (b / 2)), ToX(dw,a), ToX(dw,b), 0, 360 * 64); dw->dvi.state->x += a; } /* Convert angle in degrees to 64ths of a degree */ static int ConvertAngle(int theta) { return(theta * 64); } void DrawArc (DviWidget dw, int x0, int y0, int x1, int y1) { int xc, yc, x2, y2, r; int angle1, angle2; /* centre */ xc = dw->dvi.state->x + x0; yc = dw->dvi.state->y + y0; /* to */ x2 = xc + x1; y2 = yc + y1; dw->dvi.state->x = x2; dw->dvi.state->y = y2; if (dw->dvi.display_enable) { /* radius */ r = (int)sqrt((float) x1 * x1 + (float) y1 * y1); /* start and finish angles */ if (x0 == 0) { if (y0 >= 0) angle1 = 90; else angle1 = 270; } else { angle1 = (int) (atan((double)(y0) / (double)(x0)) * 180 / M_PI); if (x0 > 0) angle1 = 180 - angle1; else angle1 = -angle1; } if (x1 == 0) { if (y1 <= 0) angle2 = 90; else angle2 = 270; } else { angle2 = (int) (atan((double)(y1) / (double)(x1)) * 180 / M_PI); if (x1 < 0) angle2 = 180 - angle2; else angle2 = -angle2; } if (angle1 < 0) angle1 += 360; if (angle2 < 0) angle2 += 360; if (angle2 < angle1) angle1 -= 360; angle2 = angle2 - angle1; angle1 = ConvertAngle(angle1); angle2 = ConvertAngle(angle2); XDrawArc (XtDisplay (dw), XtWindow (dw), dw->dvi.normal_GC, ToX(dw, xc - r), ToX(dw, yc - r), ToX(dw, 2 * r), ToX(dw, 2 * r), angle1, angle2); } } /* copy next non-blank string from p to temp, update p */ static const char * getstr(const char *p, char *temp) { while (*p == ' ' || *p == '\t' || *p == '\n') p++; if (*p == '\0') { temp[0] = 0; return((char *)NULL); } while (*p != ' ' && *p != '\t' && *p != '\n' && *p != '\0') *temp++ = *p++; *temp = '\0'; return(p); } /* Draw a spline by approximating with short lines. */ /*ARGSUSED*/ void DrawSpline (DviWidget dw, const char *s, int len) { int n; /* get coordinate pairs into spline linked list */ if ((n = GetSpline(s)) <= 0) return; ApproxSpline(n); DrawSplineSegments(dw); } /* Parse string s to create a linked list of Point's with spline */ /* as its head. Return the number of coordinate pairs found. */ static int GetSpline(const char *s) { double x, y, x1, y1; int n = 0; Point *pt; const char *p = s; char d[10]; if (!*p) return(n); pt = spline = MakePoint(0.0, 0.0); n = 1; x = y = 0.0; p = s; while (p && *p) { if ((p = getstr(p, d)) == (const char *)NULL) break; x1 = x + atof(d); if ((p = getstr(p, d)) == (const char *)NULL) break; y1 = y + atof(d); pt->next = MakePoint(x1, y1); pt = pt->next; x = pt->x; y = pt->y; n++; } /* number of pairs of points */ return(n); } /* Approximate a spline by lines generated by iterations of the */ /* approximation algorithm from the original n points in the spline. */ static void ApproxSpline(int n) { int mid, j; Point *p1, *p2, *p3, *p; if (n < 3) return; /* number of mid-points to calculate */ mid = n - 3; /* remember original points are stored as an array of n points */ /* so I can index it directly to calculate mid-points only. */ if (mid > 0) { p = spline->next; j = 1; while (j < n-2) { p1 = p; p = p->next; p2 = p; InsertPoint(p1, MakePoint(midx(p1, p2), midy(p1, p2))); j++; } } /* Now approximate curve by line segments. */ /* There *should* be the correct number of points now! */ p = spline; while (p != (Point *)NULL) { p1 = p; if ((p = p->next) == (Point *)NULL) break; p2 = p; if ((p = p->next) == (Point *)NULL) break; p3 = p; /* This point becomes first point of next curve */ LineApprox(p1, p2, p3); } } /* p1, p2, and p3 are initially 3 *consecutive* points on the curve. */ /* For each adjacent pair of points find the mid-point, insert this */ /* in the linked list, delete the first of the two used (unless it */ /* is the first for this curve). Repeat this ITERATIONS times. */ /*ARGSUSED*/ static void LineApprox(Point *p1, Point *p2, Point *p3) { Point *p4, *p; int reps = ITERATIONS; while (reps) { for (p = p1; p != (Point *)NULL && p != p3; ) { InsertPoint(p, p4 = MakePoint( midx(p,p->next), midy(p,p->next) )); if (p != p1) DeletePoint(p); p = p4->next; /* skip inserted point! */ } reps--; } } /* Traverse the linked list, calling DrawLine to approximate the */ /* spline curve. Rounding errors are taken into account so that */ /* the "curve" is continuous, and ends up where expected. */ static void DrawSplineSegments(DviWidget dw) { Point *p, *q; double x1, y1; int dx, dy; double xpos, ypos; p = spline; dx = dy = 0; /* save the start position */ xpos = dw->dvi.state->x; ypos = dw->dvi.state->y; x1 = y1 = 0.0; while (p != (Point *)NULL) { dx = p->x - x1 + 0.5; dy = p->y - y1 + 0.5; DrawLine (dw, dx, dy); x1 = p->x; y1 = p->y; dw->dvi.state->x = xpos + x1; dw->dvi.state->y = ypos + y1; q = p; p = p->next; XtFree((char *)q); } spline = (Point *)NULL; } /* Malloc memory for a Point, and initialise the elements to x, y, NULL */ /* Return a pointer to the new Point. */ static Point * MakePoint(double x, double y) { Point *p; p = (Point *) XtMalloc (sizeof (Point)); p->x = x; p->y = y; p->next = (Point *)NULL; return(p); } /* Insert point q in linked list after point p. */ static void InsertPoint(Point *p, Point *q) { /* point q to the next point */ q->next = p->next; /* point p to new inserted one */ p->next = q; } /* Delete point p from the linked list. */ static void DeletePoint(Point *p) { Point *tmp; tmp = p->next; p->x = p->next->x; p->y = p->next->y; p->next = p->next->next; XtFree((char *)tmp); } x11-apps-7.7+5+nmu1ubuntu1/xditview/Dvi.h0000664000000000000000000000252112514121441014722 0ustar #ifndef _XtDvi_h #define _XtDvi_h /*********************************************************************** * * Dvi Widget * ***********************************************************************/ /* Parameters: Name Class RepType Default Value ---- ----- ------- ------------- background Background pixel White foreground Foreground Pixel Black fontMap FontMap char * ... pageNumber PageNumber int 1 */ #define XtNfontMap "fontMap" #define XtNpageNumber "pageNumber" #define XtNlastPageNumber "lastPageNumber" #define XtNnoPolyText "noPolyText" #define XtNseek "seek" #define XtNscreenResolution "screenResolution" #define XtNpageWidth "pageWidth" #define XtNpageHeight "pageHeight" #define XtNsizeScale "sizeScale" #define XtCFontMap "FontMap" #define XtCPageNumber "PageNumber" #define XtCLastPageNumber "LastPageNumber" #define XtCNoPolyText "NoPolyText" #define XtCSeek "Seek" #define XtCScreenResolution "ScreenResolution" #define XtCPageWidth "PageWidth" #define XtCPageHeight "PageHeight" #define XtCSizeScale "SizeScale" typedef struct _DviRec *DviWidget; /* completely defined in DviPrivate.h */ typedef struct _DviClassRec *DviWidgetClass; /* completely defined in DviPrivate.h */ extern WidgetClass dviWidgetClass; #endif /* _XtDvi_h */ /* DON'T ADD STUFF AFTER THIS #endif */ x11-apps-7.7+5+nmu1ubuntu1/xditview/XFontName.h0000664000000000000000000000257612514121441016051 0ustar #ifndef _XFONTNAME_H_ #define _XFONTNAME_H_ typedef struct _xFontName { char Registry[256]; char Foundry[256]; char FamilyName[256]; char WeightName[256]; char Slant[3]; char SetwidthName[256]; char AddStyleName[256]; unsigned int PixelSize; unsigned int PointSize; unsigned int ResolutionX; unsigned int ResolutionY; char Spacing[2]; unsigned int AverageWidth; char CharSetRegistry[256]; char CharSetEncoding[256]; } XFontName; #define FontNameRegistry (1<<0) #define FontNameFoundry (1<<1) #define FontNameFamilyName (1<<2) #define FontNameWeightName (1<<3) #define FontNameSlant (1<<4) #define FontNameSetwidthName (1<<5) #define FontNameAddStyleName (1<<6) #define FontNamePixelSize (1<<7) #define FontNamePointSize (1<<8) #define FontNameResolutionX (1<<9) #define FontNameResolutionY (1<<10) #define FontNameSpacing (1<<11) #define FontNameAverageWidth (1<<12) #define FontNameCharSetRegistry (1<<13) #define FontNameCharSetEncoding (1<<14) #define SlantRoman "R" #define SlantItalic "I" #define SlantOblique "O" #define SlantReverseItalic "RI" #define SlantReverseOblique "RO" #define SpacingMonoSpaced "M" #define SpacingProportional "P" #define SpacingCharacterCell "C" typedef char XFontNameString[256]; extern Bool XParseFontName(XFontNameString, XFontName *, unsigned int *); extern Bool XFormatFontName(XFontName *, unsigned int, XFontNameString); #endif x11-apps-7.7+5+nmu1ubuntu1/xditview/font.c0000664000000000000000000002217112514121441015144 0ustar /* * font.c * * map dvi fonts to X fonts */ #include #include #include #include #include #include #include "DviP.h" #include "XFontName.h" static char * savestr (const char *s) { char *n; if (!s) return NULL; n = XtMalloc (strlen (s) + 1); if (n) strcpy (n, s); return n; } static DviFontList * LookupFontByPosition (DviWidget dw, int position) { DviFontList *f; for (f = dw->dvi.fonts; f; f=f->next) if (f->dvi_number == position) break; return f; } static DviFontSizeList * LookupFontSizeBySize (DviWidget dw, DviFontList *f, int size) { DviFontSizeList *fs, *best = NULL; int bestdist; char fontNameString[2048]; XFontName fontName; unsigned int fontNameAttributes; int dist; if (f->scalable) { for (best = f->sizes; best; best = best->next) if (best->size == size) return best; best = (DviFontSizeList *) XtMalloc (sizeof *best); best->next = f->sizes; best->size = size; XParseFontName (f->x_name, &fontName, &fontNameAttributes); fontNameAttributes &= ~(FontNamePixelSize|FontNameAverageWidth); fontNameAttributes |= FontNameResolutionX; fontNameAttributes |= FontNameResolutionY; fontNameAttributes |= FontNamePointSize; fontName.ResolutionX = dw->dvi.screen_resolution; fontName.ResolutionY = dw->dvi.screen_resolution; fontName.PointSize = size * 10 / dw->dvi.size_scale; XFormatFontName (&fontName, fontNameAttributes, fontNameString); best->x_name = savestr (fontNameString); #ifdef USE_XFT /* * Force a match of a core font for adobe-fontspecific * encodings; we dont have a scalable font in * the right encoding */ best->core = False; if (!strcmp (fontName.CharSetRegistry, "adobe") && !strcmp (fontName.CharSetEncoding, "fontspecific")) { best->core = True; } #endif best->doesnt_exist = 0; best->font = NULL; f->sizes = best; } else { bestdist = 65536; for (fs = f->sizes; fs; fs=fs->next) { dist = size - fs->size; if (dist < 0) dist = -dist * 16; if (dist < bestdist) { best = fs; bestdist = dist; } } } return best; } static char * SkipFontNameElement (char *n) { while (*n != '-') if (!*++n) return NULL; return n+1; } # define SizePosition 8 # define EncodingPosition 13 #ifndef USE_XFT static int ConvertFontNameToSize (char *n) { int i, size; for (i = 0; i < SizePosition; i++) { n = SkipFontNameElement (n); if (!n) return -1; } size = atoi (n); return size/10; } #endif static char * ConvertFontNameToEncoding (char *n) { int i; for (i = 0; i < EncodingPosition; i++) { n = SkipFontNameElement (n); if (!n) return NULL; } return n; } static void DisposeFontSizes (DviWidget dw, DviFontSizeList *fs) { DviFontSizeList *next; for (; fs; fs=next) { next = fs->next; if (fs->x_name) XtFree (fs->x_name); if (fs->font) { #ifdef USE_XFT XftFontClose (XtDisplay (dw), fs->font); #else XUnloadFont (XtDisplay (dw), fs->font->fid); XFree ((char *)fs->font); #endif } XtFree ((char *) fs); } } void ResetFonts (DviWidget dw) { DviFontList *f; for (f = dw->dvi.fonts; f; f = f->next) { if (f->initialized) { DisposeFontSizes (dw, f->sizes); f->sizes = NULL; f->initialized = FALSE; f->scalable = FALSE; } } /* * force requery of fonts */ dw->dvi.font = NULL; dw->dvi.font_number = -1; dw->dvi.cache.font = NULL; dw->dvi.cache.font_number = -1; } static DviFontSizeList * InstallFontSizes (DviWidget dw, char *x_name, Boolean *scalablep) { #ifndef USE_XFT char fontNameString[2048]; char **fonts; int i, count; int size; DviFontSizeList *new; XFontName fontName; unsigned int fontNameAttributes; #endif DviFontSizeList *sizes; sizes = NULL; #ifdef USE_XFT *scalablep = TRUE; #else *scalablep = FALSE; if (!XParseFontName (x_name, &fontName, &fontNameAttributes)) return NULL; fontNameAttributes &= ~(FontNamePixelSize|FontNamePointSize); fontNameAttributes |= FontNameResolutionX; fontNameAttributes |= FontNameResolutionY; fontName.ResolutionX = dw->dvi.screen_resolution; fontName.ResolutionY = dw->dvi.screen_resolution; XFormatFontName (&fontName, fontNameAttributes, fontNameString); fonts = XListFonts (XtDisplay (dw), fontNameString, 10000000, &count); for (i = 0; i < count; i++) { size = ConvertFontNameToSize (fonts[i]); if (size == 0) { DisposeFontSizes (dw, sizes); *scalablep = TRUE; sizes = NULL; break; } if (size != -1) { new = (DviFontSizeList *) XtMalloc (sizeof *new); new->next = sizes; new->size = size; new->x_name = savestr (fonts[i]); new->doesnt_exist = 0; new->font = NULL; sizes = new; } } XFreeFontNames (fonts); #endif return sizes; } static DviFontList * InstallFont (DviWidget dw, int position, const char *dvi_name, const char *x_name) { DviFontList *f; const char *encoding; f = LookupFontByPosition (dw, position); if (f) { /* * ignore gratuitous font loading */ if (!strcmp (f->dvi_name, dvi_name) && !strcmp (f->x_name, x_name)) return f; DisposeFontSizes (dw, f->sizes); if (f->dvi_name) XtFree (f->dvi_name); if (f->x_name) XtFree (f->x_name); } else { f = (DviFontList *) XtMalloc (sizeof (*f)); f->next = dw->dvi.fonts; dw->dvi.fonts = f; } f->initialized = FALSE; f->dvi_name = savestr (dvi_name); f->x_name = savestr (x_name); f->dvi_number = position; f->sizes = NULL; f->scalable = FALSE; if (f->x_name) { encoding = ConvertFontNameToEncoding (f->x_name); f->char_map = DviFindMap (encoding); } else f->char_map = NULL; /* * force requery of fonts */ dw->dvi.font = NULL; dw->dvi.font_number = -1; dw->dvi.cache.font = NULL; dw->dvi.cache.font_number = -1; return f; } static const char * MapDviNameToXName (DviWidget dw, const char *dvi_name) { DviFontMap *fm; for (fm = dw->dvi.font_map; fm; fm=fm->next) if (!strcmp (fm->dvi_name, dvi_name)) return fm->x_name; ++dvi_name; for (fm = dw->dvi.font_map; fm; fm=fm->next) if (!strcmp (fm->dvi_name, "R")) return fm->x_name; if (dw->dvi.font_map->x_name) return dw->dvi.font_map->x_name; return "-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1"; } void ParseFontMap (DviWidget dw) { char dvi_name[1024]; char x_name[2048]; char *m, *s; DviFontMap *fm, *new; if (dw->dvi.font_map) DestroyFontMap (dw->dvi.font_map); fm = NULL; m = dw->dvi.font_map_string; while (*m) { s = m; while (*m && !isspace (*m)) ++m; strncpy (dvi_name, s, m-s); dvi_name[m-s] = '\0'; while (isspace (*m)) ++m; s = m; while (*m && *m != '\n') ++m; strncpy (x_name, s, m-s); x_name[m-s] = '\0'; new = (DviFontMap *) XtMalloc (sizeof *new); new->x_name = savestr (x_name); new->dvi_name = savestr (dvi_name); new->next = fm; fm = new; ++m; } dw->dvi.font_map = fm; } void DestroyFontMap (DviFontMap *font_map) { DviFontMap *next; for (; font_map; font_map = next) { next = font_map->next; if (font_map->x_name) XtFree (font_map->x_name); if (font_map->dvi_name) XtFree (font_map->dvi_name); XtFree ((char *) font_map); } } /*ARGSUSED*/ void SetFontPosition (DviWidget dw, int position, const char *dvi_name, const char *extra) { const char *x_name; x_name = MapDviNameToXName (dw, dvi_name); (void) InstallFont (dw, position, dvi_name, x_name); } #ifdef USE_XFT XftFont * #else XFontStruct * #endif QueryFont (DviWidget dw, int position, int size) { DviFontList *f; DviFontSizeList *fs; f = LookupFontByPosition (dw, position); if (!f) return dw->dvi.default_font; if (!f->initialized) { f->sizes = InstallFontSizes (dw, f->x_name, &f->scalable); f->initialized = TRUE; } fs = LookupFontSizeBySize (dw, f, size); if (!fs) return dw->dvi.default_font; if (!fs->font) { if (fs->x_name) { #ifdef USE_XFT XftPattern *pat; XftPattern *match; XftResult result; pat = XftXlfdParse (fs->x_name, False, False); XftPatternAddBool (pat, XFT_CORE, fs->core); match = XftFontMatch (XtDisplay (dw), XScreenNumberOfScreen(dw->core.screen), pat, &result); XftPatternDestroy (pat); if (match) { fs->font = XftFontOpenPattern (XtDisplay (dw), match); if (!fs->font) XftPatternDestroy (match); } else fs->font = 0; #else fs->font = XLoadQueryFont (XtDisplay (dw), fs->x_name); #endif } if (!fs->font) fs->font = dw->dvi.default_font; } return fs->font; } DviCharNameMap * QueryFontMap (DviWidget dw, int position) { DviFontList *f; f = LookupFontByPosition (dw, position); if (f) return f->char_map; else return NULL; } unsigned char * DviCharIsLigature (DviCharNameMap *map, const char *name) { int i; for (i = 0; i < DVI_MAX_LIGATURES; i++) { if (!map->ligatures[i][0]) break; if (!strcmp (name, map->ligatures[i][0])) return (unsigned char *) map->ligatures[i][1]; } return NULL; } x11-apps-7.7+5+nmu1ubuntu1/xditview/config.h.in0000664000000000000000000000326212656634652016101 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the "mkstemp" function. */ #undef HAS_MKSTEMP /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION x11-apps-7.7+5+nmu1ubuntu1/xditview/parse.c0000664000000000000000000002521412514121441015311 0ustar /* Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * parse.c * * parse dvi input */ #include #include #include #include #include #include "DviP.h" static void ParseDrawFunction(DviWidget dw, char *buf); static void ParseDeviceControl(DviWidget dw); static void PutCharacters(DviWidget dw, unsigned char *src, int len); static void push_env(DviWidget dw); static void pop_env(DviWidget dw); #define HorizontalMove(dw, delta) ((dw)->dvi.state->x += (delta)) #ifdef USE_XFT static int charWidth (DviWidget dw, XftFont *font, char c) { XGlyphInfo extents; XftTextExtents8 (XtDisplay (dw), font, (unsigned char *) &c, 1, &extents); return extents.xOff; } #else #define charWidth(dw,fi,c) (\ (fi)->per_char ?\ (fi)->per_char[(c) - (fi)->min_char_or_byte2].width\ :\ (fi)->max_bounds.width\ ) #endif int ParseInput(DviWidget dw) { int n, k; int c; char Buffer[BUFSIZ]; int NextPage; int prevFont; int otherc; unsigned char tc; /* * make sure some state exists */ if (!dw->dvi.state) push_env (dw); for (;;) { switch (DviGetC(dw, &c)) { case '\n': break; case ' ': /* when input is text */ case 0: /* occasional noise creeps in */ break; case '{': /* push down current environment */ push_env(dw); break; case '}': pop_env(dw); break; /* * two motion digits plus a character */ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': HorizontalMove(dw, (c-'0')*10 + DviGetC(dw,&otherc)-'0'); /* fall through */ case 'c': /* single ascii character */ (void) DviGetC(dw,&c); if (c == ' ') break; tc = c; PutCharacters (dw, &tc, 1); break; case 'C': GetWord(dw, Buffer, BUFSIZ); { DviCharNameMap *map; int i; unsigned char *ligature; c = -1; map = QueryFontMap (dw, dw->dvi.state->font_number); if (map) { c = DviCharIndex (map, Buffer); if (c == -1) { ligature = DviCharIsLigature (map, Buffer); if (ligature) { i = strlen ((char *) ligature); PutCharacters (dw, ligature, i); break; } } } prevFont = -1; if (c == -1) { for (i = 1; (map = QueryFontMap (dw, i)); i++) if (map->special) if ((c = DviCharIndex (map, Buffer)) != -1) { prevFont = dw->dvi.state->font_number; dw->dvi.state->font_number = i; break; } } if (c != -1) { tc = c; PutCharacters (dw, &tc, 1); } if (prevFont != -1) dw->dvi.state->font_number = prevFont; } break; case 'D': /* draw function */ GetLine(dw, Buffer, BUFSIZ); ParseDrawFunction(dw, Buffer); break; case 's': /* ignore fractional sizes */ n = GetNumber(dw); if (!dw->dvi.size_scale) { static int guesses[] = { 1, 4, 100, 1000, 1 }; int i; for (i = 0; i < 4; i++) if (8 <= n/guesses[i] && n/guesses[i] <= 24) { break; } dw->dvi.size_scale = guesses[i]; } dw->dvi.state->font_size = n; dw->dvi.state->line_width = n * (dw->dvi.device_resolution / (720 * dw->dvi.size_scale)); break; case 'f': n = GetNumber(dw); dw->dvi.state->font_number = n; break; case 'H': /* absolute horizontal motion */ k = GetNumber(dw); HorizontalGoto(dw, k); break; case 'h': /* relative horizontal motion */ k = GetNumber(dw); HorizontalMove(dw, k); break; case 'w': /* word space */ break; case 'V': n = GetNumber(dw); VerticalGoto(dw, n); break; case 'v': n = GetNumber(dw); VerticalMove(dw, n); break; case 'P': /* new spread */ break; case 'p': /* new page */ (void) GetNumber(dw); NextPage = dw->dvi.current_page + 1; RememberPagePosition(dw, NextPage); FlushCharCache (dw); return(NextPage); case 'n': /* end of line */ GetNumber(dw); GetNumber(dw); HorizontalGoto(dw, 0); break; case '#': /* comment */ case 'F': /* file info */ GetLine(dw, NULL, 0); break; case 't': /* text */ GetLine(dw, Buffer, BUFSIZ); PutCharacters (dw, (unsigned char *)Buffer, strlen (Buffer)); dw->dvi.state->x = ToDevice (dw, dw->dvi.cache.x); break; case 'x': /* device control */ ParseDeviceControl(dw); break; case EOF: dw->dvi.last_page = dw->dvi.current_page; FlushCharCache (dw); return dw->dvi.current_page; default: GetLine (dw, Buffer, BUFSIZ); fprintf (stderr, "Unknown command %s\n", Buffer); break; } } } static void push_env(DviWidget dw) { DviState *new; new = (DviState *) XtMalloc (sizeof (*new)); if (dw->dvi.state) *new = *(dw->dvi.state); else { new->font_size = 10 * dw->dvi.size_scale; new->font_number = 1; new->line_style = 0; new->line_width = 10; new->x = 0; new->y = 0; } new->next = dw->dvi.state; dw->dvi.state = new; } static void pop_env(DviWidget dw) { DviState *old; old = dw->dvi.state; dw->dvi.state = old->next; XtFree ((char *) old); } static void InitTypesetter (DviWidget dw) { while (dw->dvi.state) pop_env (dw); dw->dvi.size_scale = dw->dvi.size_scale_set; push_env (dw); FlushCharCache (dw); } static void SetFont (DviWidget dw) { dw->dvi.cache.font_size = dw->dvi.state->font_size; dw->dvi.cache.font_number = dw->dvi.state->font_number; dw->dvi.cache.font = QueryFont (dw, dw->dvi.cache.font_number, dw->dvi.cache.font_size); } static void PutCharacters (DviWidget dw, unsigned char *src, int len) { int xx, yx; int fx, fy; char *dst; int c; xx = ToX(dw, dw->dvi.state->x); yx = ToX(dw, dw->dvi.state->y); fy = FontSizeInPixels (dw, dw->dvi.state->font_size); fx = fy * len; /* * quick and dirty extents calculation: */ if (yx + fy >= dw->dvi.extents.y1 && yx - fy <= dw->dvi.extents.y2 && xx + fx >= dw->dvi.extents.x1 && xx - fx <= dw->dvi.extents.x2) { #ifdef USE_XFT XftFont *font; DviTextItem *text; #else register XFontStruct *font; register XTextItem *text; #endif if (!dw->dvi.display_enable) return; if (yx != dw->dvi.cache.y || dw->dvi.cache.char_index + len > DVI_CHAR_CACHE_SIZE) FlushCharCache (dw); /* * load a new font, if the current block is not empty, * step to the next. */ if (dw->dvi.cache.font_size != dw->dvi.state->font_size || dw->dvi.cache.font_number != dw->dvi.state->font_number) { SetFont (dw); if (dw->dvi.cache.cache[dw->dvi.cache.index].nchars != 0) { ++dw->dvi.cache.index; if (dw->dvi.cache.index >= dw->dvi.cache.max) FlushCharCache (dw); dw->dvi.cache.cache[dw->dvi.cache.index].nchars = 0; } } if (xx != dw->dvi.cache.x) { if (dw->dvi.cache.cache[dw->dvi.cache.index].nchars != 0) { ++dw->dvi.cache.index; if (dw->dvi.cache.index >= dw->dvi.cache.max) FlushCharCache (dw); dw->dvi.cache.cache[dw->dvi.cache.index].nchars = 0; } } if (!dw->dvi.cache.font) SetFont (dw); text = &dw->dvi.cache.cache[dw->dvi.cache.index]; font = dw->dvi.cache.font; dst = &dw->dvi.cache.char_cache[dw->dvi.cache.char_index]; if (text->nchars == 0) { text->chars = dst; #ifdef USE_XFT text->x = xx; #else text->delta = xx - dw->dvi.cache.x; #endif #ifdef USE_XFT text->font = font; #endif if (font != dw->dvi.font) { #ifndef USE_XFT text->font = font->fid; #endif dw->dvi.font = font; } #ifndef USE_XFT else text->font = None; #endif dw->dvi.cache.x = xx; } dw->dvi.cache.char_index += len; text->nchars += len; while (len--) { c = *src++; *dst++ = c; if (font) dw->dvi.cache.x += charWidth(dw,font,c); } } } static void ParseDrawFunction(DviWidget dw, char *buf) { int n, m, n1, m1; SetGCForDraw (dw); switch (buf[0]) { case 'l': /* draw a line */ sscanf(buf+1, "%d %d", &n, &m); DrawLine(dw, n, m); break; case 'c': /* circle */ sscanf(buf+1, "%d", &n); DrawCircle(dw, n); break; case 'e': /* ellipse */ sscanf(buf+1, "%d %d", &m, &n); DrawEllipse(dw, m, n); break; case 'a': /* arc */ sscanf(buf+1, "%d %d %d %d", &n, &m, &n1, &m1); DrawArc(dw, n, m, n1, m1); break; case '~': /* wiggly line */ DrawSpline(dw, buf+1,1); break; case 't': /* line width */ sscanf(buf+1, "%d", &n); dw->dvi.state->line_width = n; break; case 's': /* line style */ sscanf(buf+1, "%d", &n); /* XXX */ break; default: /* warning("unknown drawing function %s", buf); */ break; } } extern int LastPage, CurrentPage; static void ParseDeviceControl(DviWidget dw) /* Parse the x commands */ { char str[20], str1[50]; int c, n; GetWord (dw, str, 20); switch (str[0]) { /* crude for now */ case 'T': /* output device */ GetWord(dw, str, 20); break; case 'i': /* initialize */ InitTypesetter (dw); break; case 't': /* trailer */ break; case 'p': /* pause -- can restart */ break; case 's': /* stop */ return; case 'r': /* resolution when prepared */ SetDeviceResolution (dw, GetNumber (dw)); break; case 'f': /* font used */ n = GetNumber(dw); GetWord(dw, str, 20); GetLine(dw, str1, 50); SetFontPosition(dw, n, str, str1); break; case 'H': /* char height */ break; case 'S': /* slant */ break; } while (DviGetC(dw,&c) != '\n') /* skip rest of input line */ if (c == EOF) return; } x11-apps-7.7+5+nmu1ubuntu1/xditview/man/0000775000000000000000000000000012656635743014630 5ustar x11-apps-7.7+5+nmu1ubuntu1/xditview/man/xditview.man0000664000000000000000000001422712514121441017150 0ustar .\" .TH XDITVIEW 1 __xorgversion__ .SH NAME xditview \- display ditroff output .SH SYNOPSIS .B xditview [ \-\fItoolkitoption\fP .\|.\|. ] [ \-\fIoption\fP .\|.\|. ] [ \fIfilename\fP ] .SH DESCRIPTION The .I xditview program displays .I ditroff output on an X display. It uses no special metrics and automatically converts the printer coordinates into screen coordinates; using the user-specified screen resolution, rather than the actual resolution so that the appropriate fonts can be found. If ``\fB\-\fP'' is given as the .I filename, .I xditview reads from standard input. If ``\fB|\fP'' is the first character of .I filename, .I xditview forks .I sh to run the rest of the ``file name'' and uses the standard output of that command. .SH OPTIONS .I Xditview accepts all of the standard X Toolkit command line options along with the additional options listed below: .TP 8 .B \-page \fIpage-number\fP This option specifies the page number of the document to be displayed at start up time. .TP 8 .B \-resolution \fIscreen-resolution\fP This specifies the desired screen resolution to use; fonts will be opened by requesting this resolution field in the XLFD names. .TP 8 .B \-noPolyText Some X servers incorrectly implement PolyText with multiple strings per request. This option suppresses the use of this feature in .I xditview. .TP 8 .B \-backingStore \fIbacking-store-type\fP Redisplay can take up to a second or so; this option causes the server to save the window contents so that when it is scrolled around the viewport, the window is painted from contents saved in backing store. \fIbacking-store-type\fP can be one of \fBAlways\fP, \fPWhenMapped\fP or \fPNotUseful\fP. .PP The following standard X Toolkit command line arguments are commonly used with .I xditview: .TP 8 .B \-bg \fIcolor\fP This option specifies the color to use for the background of the window. The default is \fIwhite\fP. .TP 8 .B \-bd \fIcolor\fP This option specifies the color to use for the border of the window. The default is \fIblack\fP. .TP 8 .B \-bw \fInumber\fP This option specifies the width in pixels of the border surrounding the window. .TP 8 .B \-fg \fIcolor\fP This option specifies the color to use for displaying text. The default is \fIblack\fP. .TP 8 .B \-fn \fIfont\fP This option specifies the font to be used for displaying widget text. The default is \fIfixed\fP. .TP 8 .B \-rv This option indicates that reverse video should be simulated by swapping the foreground and background colors. .TP 8 .B \-geometry \fIgeometry\fP This option specifies the preferred size and position of the window. .TP 8 .B \-display \fIhost\fP:\fIdisplay\fP This option specifies the X server to contact. .TP 8 .B \-xrm \fIresourcestring\fP This option specifies a resource string to be used. .SH X DEFAULTS This program uses a .I Dvi widget. It understands all of the core resource names and classes as well as: .PP .TP 8 .B width (\fPclass\fB Width) Specifies the width of the window. .TP 8 .B height (\fPclass\fB Height) Specifies the height of the window. .TP 8 .B foreground (\fPclass\fB Foreground) Specifies the default foreground color. .TP 8 .B font (\fPclass\fB Font) Specifies the font to be used for error messages. .TP 8 .B FontMap (\fBclass\fB FontMap) To associate the .I ditroff fonts with appropriate X fonts, this string resource contains a set of new-line separated specifications, each of which consists of a ditroff name, some white space and an XLFD pattern with * characters in appropriate places to allow all sizes to be listed. The default fontMap is: .nf .sp R \-*\-times\-medium\-r\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e I \-*\-times\-medium\-i\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e B \-*\-times\-bold\-r\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e F \-*\-times\-bold\-i\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e BI \-*\-times\-bold\-i\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e C \-*\-courier\-medium\-r\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e CO \-*\-courier\-medium\-o\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e CB \-*\-courier\-bold\-r\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e CF \-*\-courier\-bold\-o\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e H \-*\-helvetica\-medium\-r\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e HO \-*\-helvetica\-medium\-o\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e HB \-*\-helvetica\-bold\-r\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e HF \-*\-helvetica\-bold\-o\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e N \-*\-new century schoolbook\-medium\-r\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e NI \-*\-new century schoolbook\-medium\-i\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e NB \-*\-new century schoolbook\-bold\-r\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e NF \-*\-new century schoolbook\-bold\-i\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e A \-*\-charter\-medium\-r\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e AI \-*\-charter\-medium\-i\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e AB \-*\-charter\-bold\-r\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e AF \-*\-charter\-bold\-i\-normal\-\^\-*\-*\-*\-*\-*\-*\-iso8859\-1\en\e S \-*\-symbol\-medium\-r\-normal\-\^\-*\-*\-*\-*\-*\-*\-adobe\-fontspecific\en\e S2 \-*\-symbol\-medium\-r\-normal\-\^\-*\-*\-*\-*\-*\-*\-adobe\-fontspecific\en .sp .fi .SH "USING XDITVIEW WITH DITROFF" .PP You can use any ditroff output file with .I xditview, although files which use the fonts appropriate to the fontMap will look more accurate on the screen. On servers which support scaled fonts, all requested font sizes will be accurately reflected on the screen; for servers which do not support scaled .I xditview will use the closest font from the same family. .SH "SEE ALSO" .IR X (__miscmansuffix__), .IR xrdb (__appmansuffix__), .IR ditroff (__appmansuffix__), .I "X Logical Font Description Conventions" .SH ORIGIN Portions of this program originated in .I xtroff which was derived from .I suntroff. .SH COPYRIGHT Copyright 1994 X Consortium .br See \fIX\fP(__miscmansuffix__) for a full statement of rights and permissions. .SH AUTHORS Keith Packard (MIT X Consortium) .br Richard L. Hyde (Purdue) .br David Slattengren (Berkeley) .br Malcom Slaney (Schlumberger Palo Alto Research) .br Mark Moraes (University of Toronto) x11-apps-7.7+5+nmu1ubuntu1/xditview/man/Makefile.am0000664000000000000000000000052612514121441016641 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = xditview.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/xditview/XFontName.c0000664000000000000000000001007112514121441016031 0ustar /* * XFontName.c * * build/parse X Font name strings */ # include # include # include "XFontName.h" #include static char * extractStringField ( char *name, char *buffer, int size, unsigned int *attrp, unsigned int bit) { char *buf = buffer; if (!*name) return NULL; while (*name && *name != '-' && size > 0) { *buf++ = *name++; --size; } if (size <= 0) return NULL; *buf = '\0'; if (buffer[0] != '*' || buffer[1] != '\0') *attrp |= bit; if (*name == '-') return name+1; return name; } static char * extractUnsignedField ( char *name, unsigned int *result, unsigned int *attrp, unsigned int bit) { char buf[256]; char *c; unsigned int i; name = extractStringField (name, buf, sizeof (buf), attrp, bit); if (!name) return NULL; if (!(*attrp & bit)) return name; i = 0; for (c = buf; *c; c++) { if (!isdigit (*c)) return NULL; i = i * 10 + (*c - '0'); } *result = i; return name; } Bool XParseFontName (XFontNameString fontNameString, XFontName *fontName, unsigned int *fontNameAttributes) { char *name = fontNameString; XFontName temp; unsigned int attributes = 0; #define GetString(field,bit)\ if (!(name = extractStringField \ (name, temp.field, sizeof (temp.field),\ &attributes, bit))) \ return False; #define GetUnsigned(field,bit)\ if (!(name = extractUnsignedField \ (name, &temp.field, \ &attributes, bit))) \ return False; GetString (Registry, FontNameRegistry) GetString (Foundry, FontNameFoundry) GetString (FamilyName, FontNameFamilyName) GetString (WeightName, FontNameWeightName) GetString (Slant, FontNameSlant) GetString (SetwidthName, FontNameSetwidthName) GetString (AddStyleName, FontNameAddStyleName) GetUnsigned (PixelSize, FontNamePixelSize) GetUnsigned (PointSize, FontNamePointSize) GetUnsigned (ResolutionX, FontNameResolutionX) GetUnsigned (ResolutionY, FontNameResolutionY) GetString (Spacing, FontNameSpacing) GetUnsigned (AverageWidth, FontNameAverageWidth) GetString (CharSetRegistry, FontNameCharSetRegistry) if (!*name) { temp.CharSetEncoding[0] = '\0'; attributes |= FontNameCharSetEncoding; } else { GetString (CharSetEncoding, FontNameCharSetEncoding) } *fontName = temp; *fontNameAttributes = attributes; return True; } static char * utoa ( unsigned int u, char *s, int size) { char *t; t = s + size; *--t = '\0'; do *--t = (u % 10) + '0'; while (u /= 10); return t; } Bool XFormatFontName (XFontName *fontName, unsigned int fontNameAttributes, XFontNameString fontNameString) { XFontNameString tmp; char *name = tmp; const char *f; int left = sizeof (tmp) - 1; char number[32]; #define PutString(field, bit)\ f = (fontNameAttributes & bit) ? \ fontName->field \ : "*"; \ if ((left -= strlen (f)) < 0) \ return False; \ while (*f) \ if ((*name++ = *f++) == '-') \ return False; #define PutHyphen()\ if (--left < 0) \ return False; \ *name++ = '-'; #define PutUnsigned(field, bit) \ f = (fontNameAttributes & bit) ? \ utoa (fontName->field, number, sizeof (number)) \ : "*"; \ if ((left -= strlen (f)) < 0) \ return False; \ while (*f) \ *name++ = *f++; PutString (Registry, FontNameRegistry) PutHyphen (); PutString (Foundry, FontNameFoundry) PutHyphen (); PutString (FamilyName, FontNameFamilyName) PutHyphen (); PutString (WeightName, FontNameWeightName) PutHyphen (); PutString (Slant, FontNameSlant) PutHyphen (); PutString (SetwidthName, FontNameSetwidthName) PutHyphen (); PutString (AddStyleName, FontNameAddStyleName) PutHyphen (); PutUnsigned (PixelSize, FontNamePixelSize) PutHyphen (); PutUnsigned (PointSize, FontNamePointSize) PutHyphen (); PutUnsigned (ResolutionX, FontNameResolutionX) PutHyphen (); PutUnsigned (ResolutionY, FontNameResolutionY) PutHyphen (); PutString (Spacing, FontNameSpacing) PutHyphen (); PutUnsigned (AverageWidth, FontNameAverageWidth) PutHyphen (); PutString (CharSetRegistry, FontNameCharSetRegistry) PutHyphen (); PutString (CharSetEncoding, FontNameCharSetEncoding) *name = '\0'; strcpy (fontNameString, tmp); return True; } x11-apps-7.7+5+nmu1ubuntu1/xditview/config.sub0000775000000000000000000010622312514123564016026 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-12-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xditview/xdit_mask.bm0000664000000000000000000000161112514121441016331 0ustar #define xdit_mask_width 32 #define xdit_mask_height 32 static unsigned const char xdit_mask_bits[] = { 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xc7, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/xditview/Makefile.am0000664000000000000000000000377312514121441016075 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = xditview AM_CFLAGS = $(XDITVIEW_CFLAGS) xditview_LDADD = $(XDITVIEW_LIBS) -lm xditview_SOURCES = \ draw.c \ Dvi.c \ DviChar.c \ DviChar.h \ Dvi.h \ DviP.h \ font.c \ lex.c \ Menu.h \ page.c \ parse.c \ xditview.c \ XFontName.c \ XFontName.h # App default files DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ dist_appdefault_DATA = \ app-defaults/Xditview \ app-defaults/Xditview-chrtr # Bitmaps referenced at runtime bitmapdir = $(includedir)/X11/bitmaps dist_bitmap_DATA = ldblarrow rdblarrow EXTRA_DIST = xdit.bm xdit_mask.bm MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xditview/missing0000755000000000000000000001533012656634653015453 0ustar #! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xditview/configure.ac0000664000000000000000000000446512514121441016326 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xditview], [1.0.4], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xditview]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS # Checks for library functions. AC_CHECK_FUNC([mkstemp], AC_DEFINE(HAS_MKSTEMP,1,[Define to 1 if you have the "mkstemp" function.])) # Checks for pkg-config packages PKG_CHECK_MODULES(XDITVIEW, xaw7 xmu xt x11) PKG_CHECK_MODULES(APPDEFS, xt) xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` AC_ARG_WITH(appdefaultdir, AS_HELP_STRING([--with-appdefaultdir=], [specify directory for app-defaults files (default is autodetected)]), [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xditview/README0000664000000000000000000000125312514121441014710 0ustar xditview displays ditroff output on an X display. All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xditview http://cgit.freedesktop.org/xorg/app/xditview For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xditview/xditview.c0000664000000000000000000004006712514121441016045 0ustar /* Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * xditview -- * * Display ditroff output in an X window */ #include #include #include #include #include /* rindex declaration */ #include #include #include #include #include #include #include #include #include #include #include #include #include "Dvi.h" #include "xdit.bm" #include "xdit_mask.bm" #include #include /* Command line options table. Only resources are entered here...there is a pass over the remaining options after XtParseCommand is let loose. */ static XrmOptionDescRec options[] = { {"-page", "*dvi.pageNumber", XrmoptionSepArg, NULL}, {"-backingStore", "*dvi.backingStore", XrmoptionSepArg, NULL}, {"-noPolyText", "*dvi.noPolyText", XrmoptionNoArg, "TRUE"}, {"-resolution", "*dvi.screenResolution",XrmoptionSepArg, NULL}, }; static char current_file_name[1024]; static FILE *current_file; static void MakePrompt(Widget, const char *, void (*)(char *), char *); /* * Report the syntax for calling xditview. */ static void Syntax(const char *call) { (void) printf ("Usage: %s [-fg ] [-bg ]\n%s\n", call, " [-bd ] [-bw ] [-help]\n" " [-display displayname] [-geometry geom]\n" " [-page ] [-backing ]\n" " [-resolution ]\n"); exit(1); } static void NewResolution (char *resString); static void NewFile (char *name); static void DisplayPageNumber (void); static void VisitFile (char *name, Boolean resetPage); static Widget toplevel, paned, porthole, dvi; static Widget popupMenu; static Widget menuBar; static Widget fileMenuButton, fileMenu; static Widget pageNumber; static void NextPage(Widget entry, XtPointer name, XtPointer data); static void PreviousPage(Widget entry, XtPointer name, XtPointer data); static void SetResolution(Widget entry, XtPointer name, XtPointer data); static void OpenFile(Widget entry, XtPointer name, XtPointer data); static void RevisitFile(Widget entry, XtPointer name, XtPointer data); static void Quit(Widget entry, XtPointer closure, XtPointer data); struct menuEntry { char *name; void (*function)(Widget entry, XtPointer name, XtPointer data); }; static struct menuEntry popupMenuEntries[] = { { "nextPage", NextPage }, { "previousPage", PreviousPage }, { "setResolution", SetResolution }, { "openFile", OpenFile }, { "revisitFile", RevisitFile }, { "quit", Quit } }; static struct menuEntry fileMenuEntries[] = { { "openFile", OpenFile }, { "revisitFile", RevisitFile }, { "setResolution", SetResolution }, { "quit", Quit } }; static void NextPageAction(Widget, XEvent *, String *, Cardinal *); static void PreviousPageAction(Widget, XEvent *, String *, Cardinal *); static void SetResolutionAction(Widget, XEvent *, String *, Cardinal *); static void OpenFileAction(Widget, XEvent *, String *, Cardinal *); static void RevisitFileAction(Widget, XEvent *, String *, Cardinal *); static void QuitAction(Widget, XEvent *, String *, Cardinal *); static void AcceptAction(Widget, XEvent *, String *, Cardinal *); static void CancelAction(Widget, XEvent *, String *, Cardinal *); static void UpdatePageNumber(Widget, XEvent *, String *, Cardinal *); static void Noop(Widget, XEvent *, String *, Cardinal *); static XtActionsRec xditview_actions[] = { { "NextPage", NextPageAction }, { "PreviousPage", PreviousPageAction }, { "SetResolution", SetResolutionAction }, { "OpenFile", OpenFileAction }, { "Quit", QuitAction }, { "Accept", AcceptAction }, { "Cancel", CancelAction }, { "SetPageNumber", UpdatePageNumber }, { "Noop", Noop } }; static Atom wm_delete_window; int main(int argc, char **argv) { char *file_name = NULL; int i; XtAppContext xtcontext; Arg topLevelArgs[2]; Widget entry; XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); toplevel = XtAppInitialize(&xtcontext, "Xditview", options, XtNumber (options), &argc, argv, NULL, NULL, 0); if (argc > 2) Syntax(argv[0]); XtAppAddActions(xtcontext, xditview_actions, XtNumber (xditview_actions)); XtOverrideTranslations (toplevel, XtParseTranslationTable ("WM_PROTOCOLS: Quit()")); XtSetArg (topLevelArgs[0], XtNiconPixmap, XCreateBitmapFromData (XtDisplay (toplevel), XtScreen(toplevel)->root, (char *) xdit_bits, xdit_width, xdit_height)); XtSetArg (topLevelArgs[1], XtNiconMask, XCreateBitmapFromData (XtDisplay (toplevel), XtScreen(toplevel)->root, (char *) xdit_mask_bits, xdit_mask_width, xdit_mask_height)); XtSetValues (toplevel, topLevelArgs, 2); if (argc > 1) file_name = argv[1]; /* * create the popup menu and insert the entries */ popupMenu = XtCreatePopupShell ("popupMenu", simpleMenuWidgetClass, toplevel, NULL, 0); for (i = 0; i < XtNumber (popupMenuEntries); i++) { entry = XtCreateManagedWidget(popupMenuEntries[i].name, smeBSBObjectClass, popupMenu, NULL, (Cardinal) 0); XtAddCallback(entry, XtNcallback, popupMenuEntries[i].function, NULL); } paned = XtCreateManagedWidget("paned", panedWidgetClass, toplevel, NULL, (Cardinal) 0); menuBar = XtCreateManagedWidget ("menuBar", boxWidgetClass, paned, NULL, 0); fileMenuButton = XtCreateManagedWidget ("fileMenuButton", menuButtonWidgetClass, menuBar, NULL, (Cardinal) 0); fileMenu = XtCreatePopupShell ("fileMenu", simpleMenuWidgetClass, fileMenuButton, NULL, (Cardinal) 0); for (i = 0; i < XtNumber (fileMenuEntries); i++) { entry = XtCreateManagedWidget(fileMenuEntries[i].name, smeBSBObjectClass, fileMenu, NULL, (Cardinal) 0); XtAddCallback (entry, XtNcallback, fileMenuEntries[i].function, NULL); } (void) XtCreateManagedWidget ("prevButton", commandWidgetClass, menuBar, NULL, (Cardinal) 0); pageNumber = XtCreateManagedWidget("pageNumber", asciiTextWidgetClass, menuBar, NULL, (Cardinal) 0); (void) XtCreateManagedWidget ("nextButton", commandWidgetClass, menuBar, NULL, (Cardinal) 0); porthole = XtCreateManagedWidget ("viewport", viewportWidgetClass, paned, NULL, 0); dvi = XtCreateManagedWidget ("dvi", dviWidgetClass, porthole, NULL, 0); if (file_name) VisitFile (file_name, FALSE); XtRealizeWidget (toplevel); wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", False); (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel), &wm_delete_window, 1); XtAppMainLoop(xtcontext); return 0; } static void DisplayPageNumber (void) { Arg arg[2]; int actual_number, last_page; XawTextBlock text; int length; char value[128]; char *cur; XtSetArg (arg[0], XtNpageNumber, &actual_number); XtSetArg (arg[1], XtNlastPageNumber, &last_page); XtGetValues (dvi, arg, 2); if (actual_number == 0) snprintf (value, sizeof(value), ""); else if (last_page > 0) snprintf (value, sizeof(value), "%d of %d", actual_number, last_page); else snprintf (value, sizeof(value), "%d", actual_number); text.firstPos = 0; text.length = strlen (value); text.ptr = value; text.format = FMT8BIT; XtSetArg (arg[0], XtNstring, &cur); XtGetValues (XawTextGetSource (pageNumber), arg, 1); length = strlen (cur); XawTextReplace (pageNumber, 0, length, &text); } static void SetPageNumber (int number) { Arg arg[1]; XtSetArg (arg[0], XtNpageNumber, number); XtSetValues (dvi, arg, 1); DisplayPageNumber (); } static void UpdatePageNumber (Widget w, XEvent *xev, String *s, Cardinal *c) { char *string; Arg arg[1]; XtSetArg (arg[0], XtNstring, &string); XtGetValues (XawTextGetSource(pageNumber), arg, 1); SetPageNumber (atoi(string)); } static void NewResolution(char *resString) { int res; Arg arg[1]; res = atoi (resString); if (res <= 0) return; XtSetArg (arg[0], XtNscreenResolution, res); XtSetValues (dvi, arg, 1); } static void VisitFile (char *name, Boolean resetPage) { Arg arg[3]; char *n; FILE *new_file; Boolean seek = 0; int i; if (current_file) { if (!strcmp (current_file_name, "-")) ; else if (current_file_name[0] == '|') pclose (current_file); else fclose (current_file); } if (!strcmp (name, "-")) new_file = stdin; else if (name[0] == '|') new_file = popen (name+1, "r"); else { new_file = fopen (name, "r"); seek = 1; } if (!new_file) { /* XXX display error message */ return; } i = 0; XtSetArg (arg[i], XtNfile, new_file); i++; XtSetArg (arg[i], XtNseek, seek); i++; if (resetPage) { XtSetArg (arg[i], XtNpageNumber, 1); i++; } XtSetValues (dvi, arg, i); XtSetArg (arg[0], XtNtitle, name); if (name[0] != '/' && (n = rindex (name, '/'))) n = n + 1; else n = name; XtSetArg (arg[1], XtNiconName, n); XtSetValues (toplevel, arg, 2); strcpy (current_file_name, name); current_file = new_file; DisplayPageNumber (); } static void NewFile (char *name) { VisitFile (name, TRUE); } static char fileBuf[1024]; static char resolutionBuf[1024]; static void ResetMenuEntry (Widget entry) { Arg arg[1]; XtSetArg (arg[0], XtNpopupOnEntry, entry); XtSetValues (XtParent(entry) , arg, (Cardinal) 1); } /*ARGSUSED*/ static void NextPage (Widget entry, XtPointer name, XtPointer data) { NextPageAction(entry, NULL, NULL, NULL); ResetMenuEntry (entry); } static void NextPageAction (Widget w, XEvent *xev, String *s, Cardinal *c) { Arg args[1]; int number; XtSetArg (args[0], XtNpageNumber, &number); XtGetValues (dvi, args, 1); SetPageNumber (number+1); } /*ARGSUSED*/ static void PreviousPage (Widget entry, XtPointer name, XtPointer data) { PreviousPageAction (entry, NULL, NULL, NULL); ResetMenuEntry (entry); } static void PreviousPageAction (Widget w, XEvent *xev, String *s, Cardinal *c) { Arg args[1]; int number; XtSetArg (args[0], XtNpageNumber, &number); XtGetValues (dvi, args, 1); SetPageNumber (number-1); } /*ARGSUSED*/ static void SetResolution (Widget entry, XtPointer name, XtPointer data) { SetResolutionAction (entry, NULL, NULL, NULL); ResetMenuEntry (entry); } static void SetResolutionAction (Widget w, XEvent *xev, String *s, Cardinal *c) { Arg args[1]; int cur; XtSetArg (args[0], XtNscreenResolution, &cur); XtGetValues (dvi, args, 1); snprintf (resolutionBuf, sizeof(resolutionBuf), "%d", cur); MakePrompt (toplevel, "Screen resolution:", NewResolution, resolutionBuf); } /*ARGSUSED*/ static void OpenFile (Widget entry, XtPointer name, XtPointer data) { OpenFileAction (entry, NULL, NULL, NULL); ResetMenuEntry (entry); } static void OpenFileAction (Widget w, XEvent *xev, String *s, Cardinal *c) { if (current_file_name[0]) strcpy (fileBuf, current_file_name); else fileBuf[0] = '\0'; MakePrompt (toplevel, "File to open:", NewFile, fileBuf); } /*ARGSUSED*/ static void RevisitFile (Widget entry, XtPointer name, XtPointer data) { RevisitFileAction (entry, NULL, NULL, NULL); ResetMenuEntry (entry); } static void RevisitFileAction (Widget w, XEvent *xev, String *s, Cardinal *c) { if (current_file_name[0]) VisitFile (current_file_name, FALSE); } /*ARGSUSED*/ static void Quit (Widget entry, XtPointer closure, XtPointer data) { QuitAction (entry, NULL, NULL, NULL); } static void QuitAction (Widget w, XEvent *xev, String *s, Cardinal *c) { exit (0); } static Widget promptShell, promptDialog; static void (*promptfunction)(char *); /* ARGSUSED */ static void CancelAction (Widget widget, XEvent *event, String *params, Cardinal *num_params) { if (promptShell) { XtSetKeyboardFocus(toplevel, (Widget) None); XtDestroyWidget(promptShell); promptShell = (Widget) 0; } } /* ARGSUSED */ static void AcceptAction (Widget widget, XEvent *event, String *params, Cardinal *num_params) { (*promptfunction)(XawDialogGetValueString(promptDialog)); CancelAction (widget, event, params, num_params); } static void Noop (Widget w, XEvent *xev, String *s, Cardinal *c) { } static void MakePrompt(Widget centerw, const char *prompt, void (*func)(char *), char *def) { static Arg dialogArgs[] = { {XtNlabel, (XtArgVal) 0}, {XtNvalue, (XtArgVal) 0}, }; Arg valueArgs[1]; Arg centerArgs[2]; Position source_x, source_y; Position dest_x, dest_y; Dimension center_width, center_height; Dimension prompt_width, prompt_height; Widget valueWidget; CancelAction ((Widget)NULL, (XEvent *) 0, (String *) 0, (Cardinal *) 0); promptShell = XtCreatePopupShell ("promptShell", transientShellWidgetClass, toplevel, NULL, (Cardinal) 0); dialogArgs[0].value = (XtArgVal)prompt; dialogArgs[1].value = (XtArgVal)def; promptDialog = XtCreateManagedWidget( "promptDialog", dialogWidgetClass, promptShell, dialogArgs, XtNumber (dialogArgs)); XawDialogAddButton(promptDialog, "accept", NULL, NULL); XawDialogAddButton(promptDialog, "cancel", NULL, NULL); valueWidget = XtNameToWidget (promptDialog, "value"); if (valueWidget) { XtSetArg (valueArgs[0], XtNresizable, TRUE); XtSetValues (valueWidget, valueArgs, 1); /* * as resizable isn't set until just above, the * default value will be displayed incorrectly. * rectify the situation by resetting the values */ XtSetValues (promptDialog, dialogArgs, XtNumber (dialogArgs)); } XtSetKeyboardFocus (promptDialog, valueWidget); XtSetKeyboardFocus (toplevel, valueWidget); XtRealizeWidget (promptShell); /* * place the widget in the center of the "parent" */ XtSetArg (centerArgs[0], XtNwidth, ¢er_width); XtSetArg (centerArgs[1], XtNheight, ¢er_height); XtGetValues (centerw, centerArgs, 2); XtSetArg (centerArgs[0], XtNwidth, &prompt_width); XtSetArg (centerArgs[1], XtNheight, &prompt_height); XtGetValues (promptShell, centerArgs, 2); source_x = (int)(center_width - prompt_width) / 2; source_y = (int)(center_height - prompt_height) / 3; XtTranslateCoords (centerw, source_x, source_y, &dest_x, &dest_y); XtSetArg (centerArgs[0], XtNx, dest_x); XtSetArg (centerArgs[1], XtNy, dest_y); XtSetValues (promptShell, centerArgs, 2); XtMapWidget(promptShell); promptfunction = func; } x11-apps-7.7+5+nmu1ubuntu1/xditview/page.c0000664000000000000000000000245612514121441015116 0ustar /* * page.c * * map page numbers to file position */ #include #include #include #include #include #include "DviP.h" static DviFileMap * MapPageNumberToFileMap (DviWidget dw, int number) { DviFileMap *m; for (m = dw->dvi.file_map; m; m=m->next) if (m->page_number == number) break; return m; } void DestroyFileMap (DviFileMap *m) { DviFileMap *next; for (; m; m = next) { next = m->next; XtFree ((char *) m); } } void ForgetPagePositions (DviWidget dw) { DestroyFileMap (dw->dvi.file_map); dw->dvi.file_map = NULL; } void RememberPagePosition(DviWidget dw, int number) { DviFileMap *m; if (!(m = MapPageNumberToFileMap (dw, number))) { m = (DviFileMap *) XtMalloc (sizeof *m); m->page_number = number; m->next = dw->dvi.file_map; dw->dvi.file_map = m; } if (dw->dvi.tmpFile) m->position = ftell (dw->dvi.tmpFile); else m->position = ftell (dw->dvi.file); } long SearchPagePosition (DviWidget dw, int number) { DviFileMap *m; if (!(m = MapPageNumberToFileMap (dw, number))) return -1; return m->position; } void FileSeek(DviWidget dw, long position) { if (dw->dvi.tmpFile) { dw->dvi.readingTmp = 1; fseek (dw->dvi.tmpFile, position, SEEK_SET); } else fseek (dw->dvi.file, position, SEEK_SET); } x11-apps-7.7+5+nmu1ubuntu1/xditview/COPYING0000664000000000000000000000237512514121441015071 0ustar Copyright (c) 1991, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. x11-apps-7.7+5+nmu1ubuntu1/xditview/Dvi.c0000664000000000000000000003717512514121441014732 0ustar /* Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * Dvi.c - Dvi display widget */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #define XtStrlen(s) ((s) ? strlen(s) : 0) /* The following are defined for the reader's convenience. Any Xt..Field macro in this code just refers to some field in one of the substructures of the WidgetRec. */ #include #include #include #include #include #include #include #include "DviP.h" /**************************************************************** * * Full class record constant * ****************************************************************/ /* Private Data */ /* Note: default_font_map was too long a token for some machines... * therefor it has been split in to and assigned to resources * in the ClassInitialize routine. */ static const char *default_font_map_1 = "\ R -*-times-medium-r-normal--*-*-*-*-*-*-iso8859-1\n\ I -*-times-medium-i-normal--*-*-*-*-*-*-iso8859-1\n\ B -*-times-bold-r-normal--*-*-*-*-*-*-iso8859-1\n\ F -*-times-bold-i-normal--*-*-*-*-*-*-iso8859-1\n\ TR -*-times-medium-r-normal--*-*-*-*-*-*-iso8859-1\n\ TI -*-times-medium-i-normal--*-*-*-*-*-*-iso8859-1\n\ TB -*-times-bold-r-normal--*-*-*-*-*-*-iso8859-1\n\ TF -*-times-bold-i-normal--*-*-*-*-*-*-iso8859-1\n\ BI -*-times-bold-i-normal--*-*-*-*-*-*-iso8859-1\n\ C -*-courier-medium-r-normal--*-*-*-*-*-*-iso8859-1\n\ CO -*-courier-medium-o-normal--*-*-*-*-*-*-iso8859-1\n\ CB -*-courier-bold-r-normal--*-*-*-*-*-*-iso8859-1\n\ CF -*-courier-bold-o-normal--*-*-*-*-*-*-iso8859-1\n\ H -*-helvetica-medium-r-normal--*-*-*-*-*-*-iso8859-1\n\ HO -*-helvetica-medium-o-normal--*-*-*-*-*-*-iso8859-1\n\ HB -*-helvetica-bold-r-normal--*-*-*-*-*-*-iso8859-1\n\ HF -*-helvetica-bold-o-normal--*-*-*-*-*-*-iso8859-1\n\ "; static const char *default_font_map_2 = "\ N -*-new century schoolbook-medium-r-normal--*-*-*-*-*-*-iso8859-1\n\ NI -*-new century schoolbook-medium-i-normal--*-*-*-*-*-*-iso8859-1\n\ NB -*-new century schoolbook-bold-r-normal--*-*-*-*-*-*-iso8859-1\n\ NF -*-new century schoolbook-bold-i-normal--*-*-*-*-*-*-iso8859-1\n\ A -*-charter-medium-r-normal--*-*-*-*-*-*-iso8859-1\n\ AI -*-charter-medium-i-normal--*-*-*-*-*-*-iso8859-1\n\ AB -*-charter-bold-r-normal--*-*-*-*-*-*-iso8859-1\n\ AF -*-charter-bold-i-normal--*-*-*-*-*-*-iso8859-1\n\ S -*-symbol-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific\n\ S2 -*-symbol-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific\n\ "; #define offset(field) XtOffsetOf(DviRec, field) static XtResource resources[] = { {XtNfontMap, XtCFontMap, XtRString, sizeof (char *), offset(dvi.font_map_string), XtRString, NULL /* set in code */}, {XtNforeground, XtCForeground, XtRPixel, sizeof (unsigned long), offset(dvi.foreground), XtRString, XtDefaultForeground}, {XtNpageNumber, XtCPageNumber, XtRInt, sizeof (int), offset(dvi.requested_page), XtRImmediate, (XtPointer) 1}, {XtNlastPageNumber, XtCLastPageNumber, XtRInt, sizeof (int), offset (dvi.last_page), XtRImmediate, (XtPointer) 0}, {XtNfile, XtCFile, XtRFile, sizeof (FILE *), offset (dvi.file), XtRFile, (char *) 0}, {XtNseek, XtCSeek, XtRBoolean, sizeof (Boolean), offset(dvi.seek), XtRImmediate, (XtPointer) False}, {XtNfont, XtCFont, XtRFontStruct, sizeof (XFontStruct *), offset(dvi.default_font), XtRString, XtDefaultFont}, {XtNbackingStore, XtCBackingStore, XtRBackingStore, sizeof (int), offset(dvi.backing_store), XtRString, "default"}, {XtNnoPolyText, XtCNoPolyText, XtRBoolean, sizeof (Boolean), offset(dvi.noPolyText), XtRImmediate, (XtPointer) False}, {XtNscreenResolution, XtCScreenResolution, XtRInt, sizeof (int), offset(dvi.screen_resolution), XtRImmediate, (XtPointer) 75}, {XtNpageWidth, XtCPageWidth, XtRFloat, sizeof (float), offset(dvi.page_width), XtRString, "8.5"}, {XtNpageHeight, XtCPageHeight, XtRFloat, sizeof (float), offset(dvi.page_height), XtRString, "11"}, {XtNsizeScale, XtCSizeScale, XtRInt, sizeof (int), offset(dvi.size_scale_set), XtRImmediate, (XtPointer) 0}, }; #undef offset static void ClassInitialize(void); static void Initialize(Widget, Widget, ArgList, Cardinal *); static void Realize(Widget, XtValueMask *, XSetWindowAttributes *); static void Destroy(Widget); static void Redisplay(Widget, XEvent *, Region); static Boolean SetValues(Widget, Widget, Widget, ArgList , Cardinal *); static Boolean SetValuesHook(Widget, ArgList, Cardinal *); static XtGeometryResult QueryGeometry(Widget, XtWidgetGeometry *, XtWidgetGeometry *); static void RequestDesiredSize(DviWidget); static void ShowDvi(DviWidget); static void CloseFile(DviWidget); static void OpenFile(DviWidget); #define SuperClass ((SimpleWidgetClass)&simpleClassRec) DviClassRec dviClassRec = { { (WidgetClass) SuperClass, /* superclass */ "Dvi", /* class_name */ sizeof(DviRec), /* size */ ClassInitialize, /* class_initialize */ NULL, /* class_part_initialize */ FALSE, /* class_inited */ Initialize, /* initialize */ NULL, /* initialize_hook */ Realize, /* realize */ NULL, /* actions */ 0, /* num_actions */ resources, /* resources */ XtNumber(resources), /* resource_count */ NULLQUARK, /* xrm_class */ FALSE, /* compress_motion */ XtExposeCompressMaximal, /* compress_exposure */ TRUE, /* compress_enterleave */ FALSE, /* visible_interest */ Destroy, /* destroy */ NULL, /* resize */ Redisplay, /* expose */ SetValues, /* set_values */ SetValuesHook, /* set_values_hook */ XtInheritSetValuesAlmost, /* set_values_almost */ NULL, /* get_values_hook */ NULL, /* accept_focus */ XtVersion, /* version */ NULL, /* callback_private */ NULL, /* tm_table */ QueryGeometry, /* query_geometry */ XtInheritDisplayAccelerator, /* display_accelerator */ NULL, /* extension */ }, /* CoreClass fields initialization */ { XtInheritChangeSensitive /* change_sensitive */ }, /* SimpleClass fields initialization */ { 0, /* field not used */ }, /* DviClass fields initialization */ }; WidgetClass dviWidgetClass = (WidgetClass) &dviClassRec; static void ClassInitialize (void) { int len1 = strlen(default_font_map_1); int len2 = strlen(default_font_map_2); char *dfm = XtMalloc(len1 + len2 + 1); char *ptr = dfm; strcpy(ptr, default_font_map_1); ptr += len1; strcpy(ptr, default_font_map_2); resources[0].default_addr = dfm; XtAddConverter( XtRString, XtRBackingStore, XmuCvtStringToBackingStore, NULL, 0 ); } /**************************************************************** * * Private Procedures * ****************************************************************/ /* ARGSUSED */ static void Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args) { DviWidget dw = (DviWidget) new; dw->dvi.tmpFile = NULL; dw->dvi.readingTmp = 0; dw->dvi.ungot = 0; dw->dvi.normal_GC = NULL; dw->dvi.file_map = NULL; dw->dvi.fonts = NULL; dw->dvi.font_map = NULL; dw->dvi.current_page = 0; dw->dvi.font_size = 0; dw->dvi.font_number = 0; dw->dvi.device_resolution = 0; dw->dvi.line_width = 0; dw->dvi.line_style = 0; dw->dvi.font = NULL; dw->dvi.display_enable = 0; dw->dvi.scale = 0.0; dw->dvi.state = NULL; dw->dvi.cache.index = 0; dw->dvi.cache.font = NULL; dw->dvi.size_scale = 0; dw->dvi.size_scale_set = 0; RequestDesiredSize (dw); } static void Realize(Widget w, XtValueMask *valueMask, XSetWindowAttributes *attrs) { DviWidget dw = (DviWidget) w; XGCValues values; if (dw->dvi.backing_store != Always + WhenMapped + NotUseful) { attrs->backing_store = dw->dvi.backing_store; *valueMask |= CWBackingStore; } XtCreateWindow (w, (unsigned)InputOutput, (Visual *) CopyFromParent, *valueMask, attrs); values.foreground = dw->dvi.foreground; dw->dvi.normal_GC = XCreateGC (XtDisplay (w), XtWindow (w), GCForeground, &values); #ifdef USE_XFT { int scr; Visual *visual; Colormap cmap; XRenderColor black; scr = XScreenNumberOfScreen (dw->core.screen); visual = DefaultVisual (XtDisplay (w), scr); cmap = DefaultColormap (XtDisplay (w), scr); dw->dvi.draw = XftDrawCreate (XtDisplay (w), XtWindow (w), visual, cmap); black.red = black.green = black.blue = 0; black.alpha = 0xffff; XftColorAllocValue (XtDisplay (w), visual, cmap, &black, &dw->dvi.black); dw->dvi.default_font = XftFontOpenName (XtDisplay (w), scr, "serif-12"); } #endif if (dw->dvi.file) OpenFile (dw); ParseFontMap (dw); } static void Destroy(Widget w) { DviWidget dw = (DviWidget) w; XFreeGC (XtDisplay (w), dw->dvi.normal_GC); DestroyFontMap (dw->dvi.font_map); DestroyFileMap (dw->dvi.file_map); } /* * Repaint the widget window */ /* ARGSUSED */ static void Redisplay(Widget w, XEvent *event, Region region) { DviWidget dw = (DviWidget) w; #ifndef USE_XFT XRectangle extents; #endif #ifdef USE_XFT XClearArea (XtDisplay (dw), XtWindow (dw), 0, 0, 0, 0, False); dw->dvi.extents.x1 = 0; dw->dvi.extents.y1 = 0; dw->dvi.extents.x2 = dw->core.width; dw->dvi.extents.y2 = dw->core.height; #else XClipBox (region, &extents); dw->dvi.extents.x1 = extents.x; dw->dvi.extents.y1 = extents.y; dw->dvi.extents.x2 = extents.x + extents.width; dw->dvi.extents.y2 = extents.y + extents.height; #endif ShowDvi (dw); } static void RequestDesiredSize (DviWidget dw) { XtWidgetGeometry req, rep; dw->dvi.desired_width = dw->dvi.page_width * dw->dvi.screen_resolution; dw->dvi.desired_height = dw->dvi.page_height * dw->dvi.screen_resolution; req.request_mode = CWWidth|CWHeight; req.width = dw->dvi.desired_width; req.height = dw->dvi.desired_height; XtMakeGeometryRequest ((Widget) dw, &req, &rep); } /* * Set specified arguments into widget */ /* ARGSUSED */ static Boolean SetValues (Widget wcurrent, Widget wrequest, Widget wnew, ArgList args, Cardinal *num_args) { DviWidget current = (DviWidget) wcurrent; DviWidget request = (DviWidget) wrequest; DviWidget new = (DviWidget) wnew; Boolean redisplay = FALSE; char *new_map; int cur, req; req = request->dvi.requested_page; cur = current->dvi.requested_page; if (cur != req) { if (req < 1) req = 1; if (request->dvi.file) { if (current->dvi.last_page != 0 && req > current->dvi.last_page) req = current->dvi.last_page; } if (cur != req) redisplay = TRUE; new->dvi.requested_page = req; } if (current->dvi.font_map_string != request->dvi.font_map_string) { new_map = XtMalloc (strlen (request->dvi.font_map_string) + 1); if (new_map) { redisplay = TRUE; strcpy (new_map, request->dvi.font_map_string); new->dvi.font_map_string = new_map; if (current->dvi.font_map_string) XtFree (current->dvi.font_map_string); current->dvi.font_map_string = NULL; ParseFontMap (new); } } if (current->dvi.screen_resolution != request->dvi.screen_resolution) { ResetFonts (new); new->dvi.line_width = -1; } if (request->dvi.device_resolution) new->dvi.scale = ((double) request->dvi.screen_resolution) / ((double) request->dvi.device_resolution); if (current->dvi.page_width != request->dvi.page_width || current->dvi.page_height != request->dvi.page_height || current->dvi.screen_resolution != request->dvi.screen_resolution) { RequestDesiredSize (new); redisplay = TRUE; } return redisplay; } /* * use the set_values_hook entry to check when * the file is set */ static Boolean SetValuesHook (Widget widget, ArgList args, Cardinal *num_argsp) { DviWidget dw = (DviWidget) widget; Cardinal i; for (i = 0; i < *num_argsp; i++) { if (!strcmp (args[i].name, XtNfile)) { CloseFile (dw); OpenFile (dw); return TRUE; } } return FALSE; } static void CloseFile (DviWidget dw) { if (dw->dvi.tmpFile) fclose (dw->dvi.tmpFile); ForgetPagePositions (dw); } static void OpenFile (DviWidget dw) { dw->dvi.tmpFile = NULL; if (!dw->dvi.seek) { char tmpName[] = "/tmp/dviXXXXXX"; #ifndef HAS_MKSTEMP mktemp (tmpName); dw->dvi.tmpFile = fopen (tmpName, "w+"); #else int fd = mkstemp(tmpName); if (fd != -1) { dw->dvi.tmpFile = fdopen(fd, "w+"); if (dw->dvi.tmpFile == NULL) close(fd); } #endif remove (tmpName); } if (dw->dvi.requested_page < 1) dw->dvi.requested_page = 1; dw->dvi.last_page = 0; } static XtGeometryResult QueryGeometry (Widget w, XtWidgetGeometry *request, XtWidgetGeometry *geometry_return) { XtGeometryResult ret; DviWidget dw = (DviWidget) w; ret = XtGeometryYes; if ((int)request->width < dw->dvi.desired_width || (int)request->height < dw->dvi.desired_height) ret = XtGeometryAlmost; geometry_return->width = dw->dvi.desired_width; geometry_return->height = dw->dvi.desired_height; geometry_return->request_mode = CWWidth|CWHeight; return ret; } void SetDeviceResolution (DviWidget dw, int resolution) { if (resolution != dw->dvi.device_resolution) { dw->dvi.device_resolution = resolution; dw->dvi.scale = ((double) dw->dvi.screen_resolution) / ((double) resolution); } } static void ShowDvi (DviWidget dw) { int i; long file_position; if (!dw->dvi.file) return; if (dw->dvi.requested_page < 1) dw->dvi.requested_page = 1; if (dw->dvi.last_page != 0 && dw->dvi.requested_page > dw->dvi.last_page) dw->dvi.requested_page = dw->dvi.last_page; file_position = SearchPagePosition (dw, dw->dvi.requested_page); if (file_position != -1) { FileSeek(dw, file_position); dw->dvi.current_page = dw->dvi.requested_page; } else { for (i=dw->dvi.requested_page; i > 0; i--) { file_position = SearchPagePosition (dw, i); if (file_position != -1) break; } if (file_position == -1) file_position = 0; FileSeek (dw, file_position); dw->dvi.current_page = i; dw->dvi.display_enable = 0; while (dw->dvi.current_page != dw->dvi.requested_page) { dw->dvi.current_page = ParseInput (dw); /* * at EOF, seek back to the begining of this page. */ if (feof (dw->dvi.file)) { file_position = SearchPagePosition (dw, dw->dvi.current_page); if (file_position != -1) FileSeek (dw, file_position); break; } } } dw->dvi.display_enable = 1; ParseInput (dw); if (dw->dvi.last_page && dw->dvi.requested_page > dw->dvi.last_page) dw->dvi.requested_page = dw->dvi.last_page; } x11-apps-7.7+5+nmu1ubuntu1/xditview/INSTALL0000664000000000000000000003660012514121525015070 0ustar Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xwd/0000775000000000000000000000000012656635743013014 5ustar x11-apps-7.7+5+nmu1ubuntu1/xwd/ChangeLog0000664000000000000000000004772712201066414014562 0ustar commit b71cda30549b7259e337bd05d499c5921ed34f19 Author: Alan Coopersmith Date: Thu Aug 8 21:12:15 2013 -0700 xwd 1.0.6 Signed-off-by: Alan Coopersmith commit 02d3b987ad0007b2b6627d97056d0d77fb607039 Author: Alan Coopersmith Date: Sat Jul 20 00:08:51 2013 -0700 Strip trailing whitespace Signed-off-by: Alan Coopersmith commit cc51f7fce1cefb7a2318c624a2e1ebc124775ec8 Author: Alan Coopersmith Date: Sat Jul 20 00:07:30 2013 -0700 Fix some clang warnings about integer size/sign conversions Signed-off-by: Alan Coopersmith commit e89c0797e8b21b543a228fb56957ba3a1e91c38e Author: Alan Coopersmith Date: Fri Jul 19 23:45:05 2013 -0700 Quiet gcc warnings about potentially uninitialized variables It should have been impossible for these to be used without being initialized, but following the logic to prove that was trickier than the compiler was willing to unravel. Signed-off-by: Alan Coopersmith commit 2bc7b34f2868f7d340c36c20a715d9c36495f236 Author: Alan Coopersmith Date: Fri Jul 19 23:41:56 2013 -0700 Remove unused bitmap_unit variable from ReadRegionsInList() multiVis.c: In function ‘ReadRegionsInList’: multiVis.c:389:25: warning: variable ‘bitmap_unit’ set but not used [-Wunused-but-set-variable] Signed-off-by: Alan Coopersmith commit ad99aa119875151b182c6e3d463d3c297ae3d56b Author: Alan Coopersmith Date: Fri Jul 19 23:40:37 2013 -0700 Rename new_list variable to not shadow new_list function Silences gcc warning: list.c: In function ‘dup_list_head’: list.c:104:14: warning: declaration of ‘new_list’ shadows a global declaration [-Wshadow] list.c:80:10: warning: shadowed declaration is here [-Wshadow] Signed-off-by: Alan Coopersmith commit 94731abadcd06995c28f140aaffde456a7750807 Author: Alan Coopersmith Date: Fri Jul 19 23:38:46 2013 -0700 Add printf attributes as suggested by gcc -Wmissing-format-attribute Signed-off-by: Alan Coopersmith commit 9c9ae7363d216933394e6ccd2ba6e0196845a6c6 Author: Alan Coopersmith Date: Fri Jul 19 23:33:19 2013 -0700 Fix gcc warnings about discarding const qualifiers Signed-off-by: Alan Coopersmith commit c22c121262efcaca5f58774072ac84e1006e43aa Author: Alan Coopersmith Date: Mon Mar 19 13:16:20 2012 -0700 Optionally enable existing code to call XkbStdBell from libxkbfile Copied from similar check in oclock/configure.ac Signed-off-by: Alan Coopersmith Reviewed-by: Jeremy Huddleston commit 091e5f0fc73d7cdda2dcb72fbe198a0103476d77 Author: Alan Coopersmith Date: Mon Mar 19 13:09:52 2012 -0700 Move Pixel typedef from xwd.c to wsutils.h Removes need for including in multiVis.c just to get the Pixel typedef, which resolves https://bugs.freedesktop.org/show_bug.cgi?id=47462 without adding a dependency on libXt. Signed-off-by: Alan Coopersmith Reviewed-by: Jeremy Huddleston commit 431918bd9644dd5db2216e8ab61959e9a4b74bc0 Author: Alan Coopersmith Date: Wed Feb 22 20:19:03 2012 -0800 xwd 1.0.5 Signed-off-by: Alan Coopersmith commit 61fcdc321919a362bd46853537c136140421d746 Author: Jeremy Huddleston Date: Tue Dec 13 15:56:47 2011 -0800 Silence -Wshadow warnings Signed-off-by: Jeremy Huddleston commit 48ef3b5604dbe05d67c0f6e01d38cb718085b9b6 Author: Jeremy Huddleston Date: Tue Dec 13 15:54:13 2011 -0800 Mark usage as _X_NORETURN Signed-off-by: Jeremy Huddleston commit 8376c9c6098b69a47fc37817ecf9f57302d992fc Author: Jeremy Huddleston Date: Tue Dec 13 15:53:02 2011 -0800 Dead code removal Signed-off-by: Jeremy Huddleston commit 7d88d8ab44b17247753f7225a1d8133d55d8423e Author: Pär Lidberg Date: Mon Oct 3 00:24:06 2011 -0700 Fix LP64 bug https://bugs.freedesktop.org/show_bug.cgi?id=14321 Signed-off-by: Jeremy Huddleston commit 95315108d25d0a17aef488e2bd4df8e98415d5d7 Author: Alan Coopersmith Date: Thu Jun 9 20:27:46 2011 -0700 Replace local checks for gcc with _X_NORETURN from xproto 7.0.17 Signed-off-by: Alan Coopersmith commit 6d83294bae9ba7394716f62abb08cfb8b89ed373 Author: Jeremy Huddleston Date: Sun May 8 10:02:16 2011 -0700 Rewrite parse_long to not fail -Wformat-nonliteral Signed-off-by: Jeremy Huddleston commit 97085ba43fcd752271a9356c435d28b95211644d Author: Jeremy Huddleston Date: Sun May 8 09:52:49 2011 -0700 Dead code removal xwd.c:298:5: warning: Value stored to 'bw' is never read bw = 0; ^ ~ Found-by: clang static analyzer Signed-off-by: Jeremy Huddleston commit 4a148f172d83d5e7f0ace6f28d4b8894b5e10442 Author: Gaetan Nadon Date: Wed Jan 19 10:06:57 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 00bdfc48c8249d989282aeb4d14edac49df63a3a Author: Gaetan Nadon Date: Thu Jan 13 17:15:37 2011 -0500 man: replace hard coded man page section with substitution strings Signed-off-by: Gaetan Nadon commit 1560946f78332c86e51f5298500bad94d9130181 Author: Gaetan Nadon Date: Thu Jan 13 11:15:48 2011 -0500 man: remove trailing spaces and tabs Using s/[ \t]*$// Signed-off-by: Gaetan Nadon commit d58fa4c8f990abbb12df3cca34ed413683604470 Author: Alan Coopersmith Date: Sun Nov 7 10:17:48 2010 -0800 xwd 1.0.4 Signed-off-by: Alan Coopersmith commit 5f10318237d4327d429db6d94527278466452de2 Author: Alan Coopersmith Date: Sun Nov 7 10:16:29 2010 -0800 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS Regroup AC statements under the Autoconf initialization section. Regroup AM sttaements under the Automake initialization section. Add missing AC_CONFIG_SRCDIR Signed-off-by: Alan Coopersmith commit ee07a99593b89559e3f77c301fce245da3bcd21f Author: Alan Coopersmith Date: Sun Nov 7 10:13:24 2010 -0800 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now PKG_CONFIG_MODULES handles AC_SUBST of the CFLAGS & LIBS variables Signed-off-by: Alan Coopersmith commit 78ff57bae1a7cfa3f650ed1bd25e48e1b690a30b Author: Alan Coopersmith Date: Sun Nov 7 10:11:24 2010 -0800 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS Enables use of platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit a9371f05f4c63a7c68ff97a1ef06c82c8fc78b6d Author: Gaetan Nadon Date: Sun Nov 7 10:10:39 2010 -0800 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon Signed-off-by: Alan Coopersmith commit e5edfc867b49b785e7859823047f19e4af9c465d Author: Jesse Adkins Date: Tue Sep 28 13:29:50 2010 -0700 Purge cvs tags. Signed-off-by: Jesse Adkins Signed-off-by: Alan Coopersmith commit 6bb4b240be83cb0074d10602b2532de062ac7966 Author: Gaetan Nadon Date: Thu Nov 26 09:19:55 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit a8fbe89bbcccf29964e108f5c113c4b1ce094670 Author: Gaetan Nadon Date: Wed Oct 28 14:09:09 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit 4ecee142fb9641b0a165816bf7a26e9bb32b3639 Author: Gaetan Nadon Date: Mon Oct 26 22:08:39 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit 0f7c35e98702dbe2249eb0beeb3419c2b8905fdb Author: Gaetan Nadon Date: Thu Oct 22 12:34:16 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit d42b2891295ef8d58dee73d9c37ca3a22a81dc3a Author: Jeremy Huddleston Date: Wed Oct 21 12:47:22 2009 -0700 This is not a GNU project, so declare it foreign. On Wed, 2009-10-21 at 13:36 +1000, Peter Hutterer wrote: > On Tue, Oct 20, 2009 at 08:23:55PM -0700, Jeremy Huddleston wrote: > > I noticed an INSTALL file in xlsclients and libXvMC today, and it > > was quite annoying to work around since 'autoreconf -fvi' replaces > > it and git wants to commit it. Should these files even be in git? > > Can I nuke them for the betterment of humanity and since they get > > created by autoreconf anyways? > > See https://bugs.freedesktop.org/show_bug.cgi?id=24206 As an interim measure, replace AM_INIT_AUTOMAKE([dist-bzip2]) with AM_INIT_AUTOMAKE([foreign dist-bzip2]). This will prevent the generation of the INSTALL file. It is also part of the 24206 solution. Signed-off-by: Jeremy Huddleston commit 5ba93bf07a4ffb84d86f6d4fad419e81a57358c6 Author: Alan Coopersmith Date: Fri Oct 16 19:59:20 2009 -0700 xwd 1.0.3 Signed-off-by: Alan Coopersmith commit 06525a61829053f5aed23efb61046b1a1efb5b79 Author: Alan Coopersmith Date: Fri Oct 16 19:58:59 2009 -0700 Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS Signed-off-by: Alan Coopersmith commit ff06ff5f6eadfa1a6b4c25198b8965e38a260e63 Author: Alan Coopersmith Date: Fri Oct 16 19:58:08 2009 -0700 Fill in COPYING file with copyright/license notices from code & docs Signed-off-by: Alan Coopersmith commit b744604c550dadb04fd773e207626db4fbe6a460 Author: Alan Coopersmith Date: Thu Oct 1 14:54:32 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit 5d82f32cac19af013c48d01b66aa9f14add30f42 Author: Paulo Cesar Pereira de Andrade Date: Thu Jan 15 15:43:08 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and most gcc 4.3 and sparse warnings. commit a27df6ee496a1b2df678242cf514490924f44027 Author: Branden Robinson Date: Fri Feb 11 02:14:27 2005 -0500 Do not spew usage on connection error General philosophy: The user should only be shown a usage message when: * it is asked for with a --help option or the like. * the command line is syntactically invalid. commit 37401df6799722d16bc02c52b241cf2ef5070b7d Author: James Cloos Date: Sun Jun 29 10:47:22 2008 -0400 xwd 1.0.2 commit f9725928e875035bd2a96621aa8f861160e85dd7 Author: Kim Woelders Date: Sun Jun 22 01:17:12 2008 -0400 Remove unused code, ANSIfy, add const. Signed-off-by: James Cloos commit 3dcc66bbbc74c41c2b4509a785c3688fd75387a1 Author: Kim Woelders Date: Sun Jun 22 01:16:31 2008 -0400 Fix window selection by pointer. This should fix things in WM’s using virtual roots as well as in tabbing WM’s. Signed-off-by: James Cloos commit 23b60f871f76878572b2acec59dd6c47e3acd0e0 Author: Jeremy Huddleston Date: Sun Apr 13 22:30:44 2008 -0700 Added missing AM_PROG_CC_C_O commit f686dfebf0816630664d5fe024fae3710ac8c103 Author: Niveditha Rau Date: Fri Feb 15 16:41:33 2008 -0800 Add -silent to options in man page synopsis commit 2e522aa858ded39209036ebb956c9ea3257d3668 Author: James Cloos Date: Thu Dec 6 16:37:34 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit e5d381ba7a3d06090c5352bd5c39601ec1abcfbe Author: James Cloos Date: Mon Sep 3 05:51:57 2007 -0400 Add *~ to .gitignore to skip patch/emacs droppings commit a905f2d72bc3b09a4a2eb3046771dc4331b920c9 Author: James Cloos Date: Thu Aug 23 19:25:16 2007 -0400 Rename .cvsignore to .gitignore commit 1a6550aebfd3c675c0d75c8a23aaa94baca6761a Author: Kevin E Martin Date: Wed Dec 21 02:29:54 2005 +0000 Update package version for X11R7 release. commit b840d879c0e514728da5f6aad94723c87e17f294 Author: Adam Jackson Date: Mon Dec 19 16:22:47 2005 +0000 Stub COPYING files commit 9023b24530ccaf71c2375dc1031baf743f1610c2 Author: Kevin E Martin Date: Thu Dec 15 00:24:12 2005 +0000 Update package version number for final X11R7 release candidate. commit 7e0ff968e8dab09792ff802b1433c68d4e3f6d2d Author: Kevin E Martin Date: Tue Dec 6 22:48:27 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit e63fca21475fc1a99937388883868f3d61edfc9d Author: Kevin E Martin Date: Sat Dec 3 05:49:29 2005 +0000 Update package version number for X11R7 RC3 release. commit 750b3f6469c060a3c2826530714183667992d61f Author: Alan Coopersmith Date: Mon Nov 28 22:01:48 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit 31f96dce7b65f6879f9cac3302352b45f8b17b56 Author: Eric Anholt Date: Mon Nov 21 10:35:09 2005 +0000 Another pass at .cvsignores for apps. commit e1ce2fee75109d460db19ea9bc259c993306ffba Author: Alan Coopersmith Date: Mon Nov 21 03:14:17 2005 +0000 Change dependency from xmu to xmuu since the full xmu (with all its baggage like Xt) is not needed here. commit f2872124b38058973d90a9e00490a16ab855eb74 Author: Eric Anholt Date: Sun Nov 20 22:08:56 2005 +0000 Add/improve .cvsignore files for apps. commit 70f962e49566a2f5187ce94150ced0dcadcee517 Author: Kevin E Martin Date: Wed Oct 19 02:47:58 2005 +0000 Update package version number for RC1 release. commit a1be690262901ca063d1bbfbdedfd15e8a434b85 Author: Alan Coopersmith Date: Mon Oct 17 23:56:25 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit ca2bc3fb574ad4ac5a3de6d591b5046a2548d257 Author: Alan Coopersmith Date: Fri Oct 14 00:25:48 2005 +0000 Use sed to fill in variables in man page commit 9f14a8229938ddb5d78adb84f1c73eaa2d399e61 Author: Alan Coopersmith Date: Mon Aug 1 20:25:33 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit 1ddc8445cc15cd5202de51bdf89b6f9072b44a5c Author: Kevin E Martin Date: Fri Jul 29 21:22:38 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit 754d3311ce2773c4eda374fd97f8f326d845a3ca Author: Adam Jackson Date: Wed Jul 20 19:32:05 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit 504daf4567c93ac5ec425ab122cd88f29089ea7d Author: Søren Sandmann Pedersen Date: Fri Jul 8 20:59:16 2005 +0000 Add build system for xwd commit a26e8f8a7974255f834535976f45de85050845ba Author: Roland Mainz Date: Wed Oct 6 19:29:59 2004 +0000 Fix for https://freedesktop.org/bugzilla/show_bug.cgi?id=1518 - Add filter support to "xlsfonts" that it can filter builtin-, glyph- and/or other kinds of printer fonts (controlled by the xp-listfonts-modes attribute as described in the CDE DtPrint and Xprint specifications). commit 9d55223b5ae27e8745bec57385a72126ecb8f8f2 Author: Egbert Eich Date: Fri Apr 23 19:55:09 2004 +0000 Merging XORG-CURRENT into trunk commit 965e88073aa8c5c4affc0ba934d70f75866aafd8 Author: Egbert Eich Date: Sun Mar 14 08:35:54 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit 04bed4e3e41764a41016fa7a3d1dd6189e4ebd4d Author: Egbert Eich Date: Wed Mar 3 12:13:20 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit 7fb18f8136d988a305b3a55a584701b8a5d2d620 Author: Egbert Eich Date: Thu Feb 26 13:36:32 2004 +0000 readding XFree86's cvs IDs commit f6983fb7f571b827ad5ea1e3e81ee24c65547e1b Author: Egbert Eich Date: Thu Feb 26 09:24:18 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit f8547075b021b392855041018de02fdbf84b252c Author: Kaleb Keithley Date: Tue Nov 25 19:29:23 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit 5c3c7501aceec68da15fda13ab4efb0c5f82ef99 Author: Kaleb Keithley Date: Fri Nov 14 16:49:24 2003 +0000 XFree86 4.3.0.1 commit f7cb26f3488672da827d30962b940f3e11e49b4a Author: Kaleb Keithley Date: Fri Nov 14 15:54:55 2003 +0000 R6.6 is the Xorg base-line x11-apps-7.7+5+nmu1ubuntu1/xwd/clientwin.h0000664000000000000000000000247012201066050015133 0ustar /* * Copyright 2007 Kim woelders * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _CLIENTWIN_H_ #define _CLIENTWIN_H_ #include extern Window Find_Client(Display * dpy, Window root, Window target_win); #endif x11-apps-7.7+5+nmu1ubuntu1/xwd/list.c0000664000000000000000000001632212201066050014106 0ustar /** ------------------------------------------------------------------------ This file contains routines for manipulating generic lists. Lists are implemented with a "harness". In other words, each node in the list consists of two pointers, one to the data item and one to the next node in the list. The head of the list is the same struct as each node, but the "item" ptr is used to point to the current member of the list (used by the first_in_list and next_in_list functions). Copyright 1994 Hewlett-Packard Co. Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ----------------------------------------------------------------------- **/ #include #include #include "list.h" /** ------------------------------------------------------------------------ Sets the pointers of the specified list to NULL. --------------------------------------------------------------------- **/ void zero_list(list_ptr lp) { lp->next = NULL; lp->ptr.item = NULL; } /** ------------------------------------------------------------------------ Adds item to the list pointed to by lp. Finds the end of the list, then mallocs a new list node onto the end of the list. The item pointer in the new node is set to "item" passed in, and the next pointer in the new node is set to NULL. Returns 1 if successful, 0 if the malloc failed. -------------------------------------------------------------------- **/ int add_to_list(list_ptr lp, void *item) { while (lp->next) { lp = lp->next; } if ((lp->next = (list_ptr) malloc( sizeof( list_item))) == NULL) { return 0; } lp->next->ptr.item = item; lp->next->next = NULL; return 1; } /** ------------------------------------------------------------------------ Creates a new list and sets its pointers to NULL. Returns a pointer to the new list. -------------------------------------------------------------------- **/ list_ptr new_list (void) { list_ptr lp; if ((lp = (list_ptr) malloc( sizeof( list_item)))) { lp->next = NULL; lp->ptr.item = NULL; } return lp; } /** ------------------------------------------------------------------------ Creates a new list head, pointing to the same list as the one passed in. If start_at_curr is TRUE, the new list's first item is the "current" item (as set by calls to first/next_in_list()). If start_at_curr is FALSE, the first item in the new list is the same as the first item in the old list. In either case, the curr pointer in the new list is the same as in the old list. Returns a pointer to the new list head. -------------------------------------------------------------------- **/ list_ptr dup_list_head(list_ptr lp, int start_at_curr) { list_ptr new_listp; if ((new_listp = (list_ptr) malloc( sizeof( list_item))) == NULL) { return (list_ptr)NULL; } new_listp->next = start_at_curr ? lp->ptr.curr : lp->next; new_listp->ptr.curr = lp->ptr.curr; return new_listp; } /** ------------------------------------------------------------------------ Returns the number of items in the list. -------------------------------------------------------------------- **/ unsigned int list_length(list_ptr lp) { unsigned int count = 0; while (lp->next) { count++; lp = lp->next; } return count; } /** ------------------------------------------------------------------------ Scans thru list, looking for a node whose ptr.item is equal to the "item" passed in. "Equal" here means the same address - no attempt is made to match equivalent values stored in different locations. If a match is found, that node is deleted from the list. Storage for the node is freed, but not for the item itself. Returns a pointer to the item, so the caller can free it if it so desires. If a match is not found, returns NULL. -------------------------------------------------------------------- **/ void *delete_from_list(list_ptr lp, void *item) { list_ptr new_next; while (lp->next) { if (lp->next->ptr.item == item) { new_next = lp->next->next; free (lp->next); lp->next = new_next; return item; } lp = lp->next; } return NULL; } /** ------------------------------------------------------------------------ Deletes each node in the list *except the head*. This allows the deletion of lists where the head is not malloced or created with new_list(). If free_items is true, each item pointed to from the node is freed, in addition to the node itself. -------------------------------------------------------------------- **/ void delete_list(list_ptr lp, int free_items) { list_ptr del_node; void *item; while (lp->next) { del_node = lp->next; item = del_node->ptr.item; lp->next = del_node->next; free (del_node); if (free_items) { free( item); } } } void delete_list_destroying(list_ptr lp, void destructor(void *item)) { list_ptr del_node; void *item; while (lp->next) { del_node = lp->next; item = del_node->ptr.item; lp->next = del_node->next; free( del_node); if (destructor) { destructor( item); } } } /** ------------------------------------------------------------------------ Returns a ptr to the first *item* (not list node) in the list. Sets the list head node's curr ptr to the first node in the list. Returns NULL if the list is empty. -------------------------------------------------------------------- **/ void * first_in_list(list_ptr lp) { if (! lp) { return NULL; } lp->ptr.curr = lp->next; return lp->ptr.curr ? lp->ptr.curr->ptr.item : NULL; } /** ------------------------------------------------------------------------ Returns a ptr to the next *item* (not list node) in the list. Sets the list head node's curr ptr to the next node in the list. first_in_list must have been called prior. Returns NULL if no next item. -------------------------------------------------------------------- **/ void * next_in_list(list_ptr lp) { if (! lp) { return NULL; } if (lp->ptr.curr) { lp->ptr.curr = lp->ptr.curr->next; } return lp->ptr.curr ? lp->ptr.curr->ptr.item : NULL; } int list_is_empty(list_ptr lp) { return (lp == NULL || lp->next == NULL); } x11-apps-7.7+5+nmu1ubuntu1/xwd/config.guess0000775000000000000000000013036112342463275015327 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-06-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xwd/clientwin.c0000664000000000000000000001371512201066050015132 0ustar /* * Copyright 2007 Kim woelders * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include "clientwin.h" static Atom atom_wm_state = None; /* * Check if window has given property */ static Bool Window_Has_Property(Display * dpy, Window win, Atom atom) { Atom type_ret; int format_ret; unsigned char *prop_ret; unsigned long bytes_after, num_ret; type_ret = None; prop_ret = NULL; XGetWindowProperty(dpy, win, atom, 0, 0, False, AnyPropertyType, &type_ret, &format_ret, &num_ret, &bytes_after, &prop_ret); if (prop_ret) XFree(prop_ret); return (type_ret != None) ? True : False; } /* * Check if window is viewable */ static Bool Window_Is_Viewable(Display * dpy, Window win) { Bool ok; XWindowAttributes xwa; XGetWindowAttributes(dpy, win, &xwa); ok = (xwa.class == InputOutput) && (xwa.map_state == IsViewable); return ok; } /* * Find a window that has WM_STATE set in the window tree below win. * Unmapped/unviewable windows are not considered valid matches. * Children are searched in top-down stacking order. * The first matching window is returned, None if no match is found. */ static Window Find_Client_In_Children(Display * dpy, Window win) { Window root, parent; Window *children; unsigned int n_children; int i; if (!XQueryTree(dpy, win, &root, &parent, &children, &n_children)) return None; if (!children) return None; /* Check each child for WM_STATE and other validity */ win = None; for (i = (int) n_children - 1; i >= 0; i--) { if (!Window_Is_Viewable(dpy, children[i])) { children[i] = None; /* Don't bother descending into this one */ continue; } if (!Window_Has_Property(dpy, children[i], atom_wm_state)) continue; /* Got one */ win = children[i]; goto done; } /* No children matched, now descend into each child */ for (i = (int) n_children - 1; i >= 0; i--) { if (children[i] == None) continue; win = Find_Client_In_Children(dpy, children[i]); if (win != None) break; } done: XFree(children); return win; } /* * Find virtual roots (_NET_VIRTUAL_ROOTS) */ static unsigned long * Find_Roots(Display * dpy, Window root, unsigned long *num) { Atom type_ret; int format_ret; unsigned char *prop_ret; unsigned long bytes_after, num_ret; Atom atom; *num = 0; atom = XInternAtom(dpy, "_NET_VIRTUAL_ROOTS", False); if (!atom) return NULL; type_ret = None; prop_ret = NULL; if (XGetWindowProperty(dpy, root, atom, 0, 0x7fffffff, False, XA_WINDOW, &type_ret, &format_ret, &num_ret, &bytes_after, &prop_ret) != Success) return NULL; if (prop_ret && type_ret == XA_WINDOW && format_ret == 32) { *num = num_ret; return ((unsigned long *) prop_ret); } if (prop_ret) XFree(prop_ret); return NULL; } /* * Find child window at pointer location */ static Window Find_Child_At_Pointer(Display * dpy, Window win) { Window root_return, child_return; int dummyi; unsigned int dummyu; XQueryPointer(dpy, win, &root_return, &child_return, &dummyi, &dummyi, &dummyi, &dummyi, &dummyu); return child_return; } /* * Find client window at pointer location * * root is the root window. * subwin is the subwindow reported by a ButtonPress event on root. * * If the WM uses virtual roots subwin may be a virtual root. * If so, we descend the window stack at the pointer location and assume the * child is the client or one of its WM frame windows. * This will of course work only if the virtual roots are children of the real * root. */ Window Find_Client(Display * dpy, Window root, Window subwin) { unsigned long *roots; unsigned long i, n_roots; Window win; /* Check if subwin is a virtual root */ roots = Find_Roots(dpy, root, &n_roots); for (i = 0; i < n_roots; i++) { if (subwin != roots[i]) continue; win = Find_Child_At_Pointer(dpy, subwin); if (win == None) return subwin; /* No child - Return virtual root. */ subwin = win; break; } if (roots) XFree(roots); if (atom_wm_state == None) { atom_wm_state = XInternAtom(dpy, "WM_STATE", False); if (!atom_wm_state) return subwin; } /* Check if subwin has WM_STATE */ if (Window_Has_Property(dpy, subwin, atom_wm_state)) return subwin; /* Attempt to find a client window in subwin's children */ win = Find_Client_In_Children(dpy, subwin); if (win != None) return win; /* Found a client */ /* Did not find a client */ return subwin; } x11-apps-7.7+5+nmu1ubuntu1/xwd/list.h0000664000000000000000000000531612201066050014114 0ustar /** ------------------------------------------------------------------------ This file contains routines for manipulating generic lists. Lists are implemented with a "harness". In other words, each node in the list consists of two pointers, one to the data item and one to the next node in the list. The head of the list is the same struct as each node, but the "item" ptr is used to point to the current member of the list (used by the first_in_list and next_in_list functions). Copyright 1994 Hewlett-Packard Co. Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. -------------------------------------------------------------------- **/ #ifndef LIST_DEF #define LIST_DEF #include #define LESS -1 #define EQUAL 0 #define GREATER 1 #define DUP_WHOLE_LIST 0 #define START_AT_CURR 1 typedef struct _list_item { struct _list_item *next; union { void *item; /* in normal list node, pts to data */ struct _list_item *curr; /* in list head, pts to curr for 1st, next */ } ptr; } list, list_item, *list_ptr; typedef void (*DESTRUCT_FUNC_PTR)( void * ); void zero_list( list_ptr ); int add_to_list ( list_ptr , void * ); list_ptr new_list ( void ); list_ptr dup_list_head ( list_ptr , int ); unsigned int list_length( list_ptr ); void *delete_from_list ( list_ptr , void * ); void delete_list( list_ptr , int ); void delete_list_destroying ( list_ptr , DESTRUCT_FUNC_PTR ); void *first_in_list ( list_ptr ); void *next_in_list ( list_ptr ); int list_is_empty ( list_ptr ); #endif x11-apps-7.7+5+nmu1ubuntu1/xwd/dsimple.h0000664000000000000000000000550612201066050014577 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Just_display.h: This file contains the definitions needed to use the * functions in just_display.c. It also declares the global * variables dpy, screen, and program_name which are needed to * use just_display.c. * * Written by Mark Lillibridge. Last updated 7/1/87 * * Send bugs, etc. to chariot@athena.mit.edu. */ /* Simple helper macros */ #ifndef MAX #define MAX(a,b) (((a)>(b))?(a):(b)) #endif /* MAX */ #ifndef MIN #define MIN(a,b) (((a)<(b))?(a):(b)) #endif /* MIN */ /* Global variables used by routines in just_display.c */ extern const char *program_name; /* Name of this program */ extern Display *dpy; /* The current display */ extern int screen; /* The current screen */ #define INIT_NAME program_name=argv[0] /* use this in main to setup program_name */ /* Declaritions for functions in just_display.c */ char *Get_Display_Name(int *, char **); Display *Open_Display(const char *); void Setup_Display_And_Screen(int *, char **); void Close_Display(void); Window Select_Window_Args(int *, char **); void usage(void) _X_NORETURN; #define X_USAGE "[host:display]" /* X arguments handled by Get_Display_Name */ /* * Other_stuff.h: Definitions of routines in other_stuff. * * Written by Mark Lillibridge. Last updated 7/1/87 * * Send bugs, etc. to chariot@athena.mit.edu. */ Window Select_Window(Display *, int); Window Window_With_Name(Display *, Window, const char *); void Fatal_Error(const char *, ...) _X_NORETURN _X_ATTRIBUTE_PRINTF(1, 2); void outl(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2); x11-apps-7.7+5+nmu1ubuntu1/xwd/wsutils.h0000664000000000000000000003326412201066050014656 0ustar /** ------------------------------------------------------------------------ This file contains routines for manipulating generic lists. Lists are implemented with a "harness". In other words, each node in the list consists of two pointers, one to the data item and one to the next node in the list. The head of the list is the same struct as each node, but the "item" ptr is used to point to the current member of the list (used by the first_in_list and next_in_list functions). Copyright 1994 Hewlett-Packard Co. Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ------------------------------------------------------------------------ **/ /****************************************************************************** * * This file contains various typedef's, macros and procedure declarations for * a set of example utility procedures contained in the file "wsutils.c". * ******************************************************************************/ typedef unsigned long Pixel; /* This is the actual structure returned by the X server describing the * SERVER_OVERLAY_VISUAL property. */ typedef struct { VisualID visualID; /* The VisualID of the overlay visual */ int transparentType; /* Can be None, TransparentPixel or * TransparentMask */ Pixel value; /* Pixel value */ int layer; /* Overlay planes will always be in * layer 1 */ } OverlayVisualPropertyRec; /* This is structure also describes the SERVER_OVERLAY_VISUAL property, but * should be more useful than the one actually returned by the X server * because it actually points to the visual's XVisualInfo struct rather than * refering to the visual's ID. */ typedef struct { XVisualInfo *pOverlayVisualInfo; /* Pointer to the XVisualInfo struct */ int transparentType; /* Can be None, TransparentPixel or * TransparentMask */ Pixel value; /* Pixel value */ int layer; /* Overlay planes will always be in * layer 1 */ } OverlayInfo; /* These macros are the values of the "transparentType" above: */ #ifndef None #define None 0 #endif #ifndef TransparentPixel #define TransparentPixel 1 #endif /* These macros define how flexible a program is when it requests a window's * creation with either the CreateImagePlanesWindow() or * CreateOverlayPlanesWindow(): */ #ifndef NOT_FLEXIBLE #define NOT_FLEXIBLE 0 #define FLEXIBLE 1 #endif /* These macros define the values of the "sbCmapHint" parameter of the * CreateImagePlanesWindow(): */ #ifndef SB_CMAP_TYPE_NORMAL #define SB_CMAP_TYPE_NORMAL 1 #endif #ifndef SB_CMAP_TYPE_MONOTONIC #define SB_CMAP_TYPE_MONOTONIC 2 #endif #ifndef SB_CMAP_TYPE_FULL #define SB_CMAP_TYPE_FULL 4 #endif /****************************************************************************** * * GetXVisualInfo() * * This routine takes an X11 Display, screen number, and returns whether the * screen supports transparent overlays and three arrays: * * 1) All of the XVisualInfo struct's for the screen. * 2) All of the OverlayInfo struct's for the screen. * 3) An array of pointers to the screen's image plane XVisualInfo * structs. * * The code below obtains the array of all the screen's visuals, and obtains * the array of all the screen's overlay visual information. It then processes * the array of the screen's visuals, determining whether the visual is an * overlay or image visual. * * If the routine sucessfully obtained the visual information, it returns zero. * If the routine didn't obtain the visual information, it returns non-zero. * ******************************************************************************/ extern int GetXVisualInfo( Display *display, /* Which X server (aka "display"). */ int screen, /* Which screen of the "display". */ int *transparentOverlays, /* Non-zero if there's at least one * overlay visual and if at least one * of those supports a transparent * pixel. */ int *numVisuals, /* Number of XVisualInfo struct's * pointed to to by pVisuals. */ XVisualInfo **pVisuals, /* All of the device's visuals. */ int *numOverlayVisuals, /* Number of OverlayInfo's pointed * to by pOverlayVisuals. If this * number is zero, the device does * not have overlay planes. */ OverlayInfo **pOverlayVisuals, /* The device's overlay plane visual * information. */ int *numImageVisuals, /* Number of XVisualInfo's pointed * to by pImageVisuals. */ XVisualInfo ***pImageVisuals /* The device's image visuals. */ ); /****************************************************************************** * * FreeXVisualInfo() * * This routine frees the data that was allocated by GetXVisualInfo(). * ******************************************************************************/ extern void FreeXVisualInfo( XVisualInfo *pVisuals, OverlayInfo *pOverlayVisuals, XVisualInfo **pImageVisuals ); /****************************************************************************** * * FindImagePlanesVisual() * * This routine attempts to find a visual to use to create an image planes * window based upon the information passed in. * * The "Hint" values give guides to the routine as to what the program wants. * The "depthFlexibility" value tells the routine how much the program wants * the actual "depthHint" specified. If the program can't live with the * screen's image planes visuals, the routine returns non-zero, and the * "depthObtained" and "pImageVisualToUse" return parameters are NOT valid. * Otherwise, the "depthObtained" and "pImageVisualToUse" return parameters * are valid and the routine returns zero. * * NOTE: This is just an example of what can be done. It may or may not be * useful for any specific application. * ******************************************************************************/ extern int FindImagePlanesVisual( Display *display, /* Which X server (aka "display"). */ int screen, /* Which screen of the "display". */ int numImageVisuals, /* Number of XVisualInfo's pointed * to by pImageVisuals. */ XVisualInfo **pImageVisuals, /* The device's image visuals. */ int sbCmapHint, /* What Starbase cmap modes will be * used with the visual. NOTE: This * is a mask of the possible values. */ int depthHint, /* Desired depth. */ int depthFlexibility, /* How much the actual value in * "depthHint" is desired. */ Visual **pImageVisualToUse, /* The screen's image visual to use. */ int *depthObtained /* Actual depth of the visual. */ ); /****************************************************************************** * * FindOverlayPlanesVisual() * * This routine attempts to find a visual to use to create an overlay planes * window based upon the information passed in. * * While the CreateImagePlanesWindow() routine took a sbCmapHint, this * routine doesn't. Starbase's CMAP_FULL shouldn't be used in overlay planes * windows. This is partially because this functionality is better suited in * the image planes where there are generally more planes, and partially * because the overlay planes generally have PseudoColor visuals with one * color being transparent (the transparent normally being the "white" color * for CMAP_FULL). * * The "depthHint" values give guides to the routine as to what depth the * program wants the window to be. The "depthFlexibility" value tells the * routine how much the program wants the actual "depthHint" specified. If * the program can't live with the screen's overlay planes visuals, the * routine returns non-zero, and the "depthObtained" and "pOverlayVisualToUse" * return parameters are NOT valid. Otherwise, the "depthObtained" and * "pOverlayVisualToUse" return parameters are valid and the routine returns * zero. * * NOTE: This is just an example of what can be done. It may or may not be * useful for any specific application. * ******************************************************************************/ extern int FindOverlayPlanesVisual( Display *display, /* Which X server (aka "display"). */ int screen, /* Which screen of the "display". */ int numOverlayVisuals, /* Number of OverlayInfo's pointed * to by pOverlayVisuals. */ OverlayInfo *pOverlayVisuals, /* The device's overlay plane visual * information. */ int depthHint, /* Desired depth. */ int depthFlexibility, /* How much the actual value in * "depthHint" is desired. */ int transparentBackground, /* Non-zero if the visual must have * a transparent color. */ Visual **pOverlayVisualToUse, /* The screen's overlay visual to * use. */ int *depthObtained, /* Actual depth of the visual. */ int *transparentColor /* The transparent color the program * can use with the visual. */ ); /****************************************************************************** * * CreateImagePlanesWindow() * * This routine creates an image planes window, potentially creates a colormap * for the window to use, and sets the window's standard properties, based * upon the information passed in to the routine. While "created," the window * has not been mapped. * * If the routine suceeds, it returns zero and the return parameters * "imageWindow", "imageColormap" and "mustFreeImageColormap" are valid. * Otherwise, the routine returns non-zero and the return parameters are * NOT valid. * * NOTE: This is just an example of what can be done. It may or may not be * useful for any specific application. * ******************************************************************************/ extern int CreateImagePlanesWindow( Display *display, /* Which X server (aka "display"). */ int screen, /* Which screen of the "display". */ Window parentWindow, /* Window ID of the parent window for * the created window. */ int windowX, /* Desired X coord. of the window. */ int windowY, /* Desired Y coord of the window. */ int windowWidth, /* Desired width of the window. */ int windowHeight, /* Desired height of the window. */ int windowDepth, /* Desired depth of the window. */ Visual *pImageVisualToUse, /* The window's image planes visual. */ int argc, /* Program's argc parameter. */ char *argv[], /* Program's argv parameter. */ char *windowName, /* Name to put on window's border. */ char *iconName, /* Name to put on window's icon. */ Window *imageWindow, /* Window ID of the created window. */ Colormap *imageColormap, /* The window's colormap. */ int *mustFreeImageColormap /* Non-zero if the program must call * XFreeColormap() for imageColormap. */ ); /****************************************************************************** * * CreateOverlayPlanesWindow() * * This routine creates an overlay planes window, potentially creates a colormap * for the window to use, and sets the window's standard properties, based * upon the information passed in to the routine. While "created," the window * has not been mapped. * * If the routine suceeds, it returns zero and the return parameters * "overlayWindow", "overlayColormap" and "mustFreeOverlayColormap" are valid. * Otherwise, the routine returns non-zero and the return parameters are * NOT valid. * * NOTE: This is just an example of what can be done. It may or may not be * useful for any specific application. * ******************************************************************************/ int CreateOverlayPlanesWindow( Display *display, /* Which X server (aka "display"). */ int screen, /* Which screen of the "display". */ Window parentWindow, /* Window ID of the parent window for * the created window. */ int windowX, /* Desired X coord. of the window. */ int windowY, /* Desired Y coord of the window. */ int windowWidth, /* Desired width of the window. */ int windowHeight, /* Desired height of the window. */ int windowDepth, /* Desired depth of the window. */ Visual *pOverlayVisualToUse, /* The window's overlay planes visual.*/ int argc, /* Program's argc parameter. */ char *argv[], /* Program's argv parameter. */ char *windowName, /* Name to put on window's border. */ char *iconName, /* Name to put on window's icon. */ int transparentBackground, /* Non-zero if the window's background * should be a transparent color. */ int *transparentColor, /* The transparent color to use as the * window's background. */ Window *overlayWindow, /* Window ID of the created window. */ Colormap *overlayColormap, /* The window's colormap. */ int *mustFreeOverlayColormap/* Non-zero if the program must call * XFreeColormap() for * overlayColormap. */ ); x11-apps-7.7+5+nmu1ubuntu1/xwd/config.h.in0000664000000000000000000000322312656634717015037 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to use XkbStdBell */ #undef XKB x11-apps-7.7+5+nmu1ubuntu1/xwd/multiVis.h0000664000000000000000000000423212201066050014751 0ustar /** ------------------------------------------------------------------------ This file contains routines for manipulating generic lists. Lists are implemented with a "harness". In other words, each node in the list consists of two pointers, one to the data item and one to the next node in the list. The head of the list is the same struct as each node, but the "item" ptr is used to point to the current member of the list (used by the first_in_list and next_in_list functions). Copyright 1994 Hewlett-Packard Co. Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ------------------------------------------------------------------------ **/ extern int GetMultiVisualRegions( Display *, Window, int, int, unsigned int, unsigned int, int *, int *, XVisualInfo **, int *, OverlayInfo **, int *, XVisualInfo ***, list_ptr *, list_ptr *, int * ); extern XImage *ReadAreaToImage( Display *, Window, int, int, unsigned int, unsigned int, int, XVisualInfo *, int, OverlayInfo *, int, XVisualInfo **, list_ptr, list_ptr, int, int ); extern void initFakeVisual( Visual * ); x11-apps-7.7+5+nmu1ubuntu1/xwd/man/0000775000000000000000000000000012656635743013567 5ustar x11-apps-7.7+5+nmu1ubuntu1/xwd/man/xwd.man0000664000000000000000000001067212201066050015043 0ustar .\" Copyright 1988, 1994, 1998 The Open Group .\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" .TH XWD 1 __xorgversion__ .SH NAME xwd - dump an image of an X window .SH SYNOPSIS .B "xwd" [-debug] [-help] [-nobdrs] [-out \fIfile\fP] [-xy] [-frame] [-add \fIvalue\fP] [-root | -id \fIid\fP | -name \fIname\fP ] [-icmap] [-screen] [-silent] [-display \fIdisplay\fP] .SH DESCRIPTION .PP .I Xwd is an X Window System window dumping utility. .I Xwd allows X users to store window images in a specially formatted dump file. This file can then be read by various other X utilities for redisplay, printing, editing, formatting, archiving, image processing, etc. The target window is selected by clicking the pointer in the desired window. The keyboard bell is rung once at the beginning of the dump and twice when the dump is completed. .SH OPTIONS .PP .TP 8 .B "-display \fIdisplay\fP" This argument allows you to specify the server to connect to; see \fIX(__miscmansuffix__)\fP. .PP .TP 8 .B "-help" Print out the `Usage:' command syntax summary. .PP .TP 8 .B "-nobdrs" This argument specifies that the window dump should not include the pixels that compose the X window border. This is useful in situations where you may wish to include the window contents in a document as an illustration. .PP .TP 8 .B "-out \fIfile\fP" This argument allows the user to explicitly specify the output file on the command line. The default is to output to standard out. .PP .TP 8 .B "-xy" This option applies to color displays only. It selects `XY' format dumping instead of the default `Z' format. .PP .TP 8 .B "-add \fIvalue\fP" This option specifies an signed value to be added to every pixel. .PP .TP 8 .B "-frame" This option indicates that the window manager frame should be included when manually selecting a window. .PP .TP 8 .B "-root" This option indicates that the root window should be selected for the window dump, without requiring the user to select a window with the pointer. .PP .TP 8 .B "-id \fIid\fP" This option indicates that the window with the specified resource id should be selected for the window dump, without requiring the user to select a window with the pointer. .PP .TP 8 .B "-name \fIname\fP" This option indicates that the window with the specified WM_NAME property should be selected for the window dump, without requiring the user to select a window with the pointer. .PP .TP 8 .B "-icmap" Normally the colormap of the chosen window is used to obtain RGB values. This option forces the first installed colormap of the screen to be used instead. .PP .TP 8 .B "-screen" This option indicates that the GetImage request used to obtain the image should be done on the root window, rather than directly on the specified window. In this way, you can obtain pieces of other windows that overlap the specified window, and more importantly, you can capture menus or other popups that are independent windows but appear over the specified window. .PP .TP 8 .B "-silent" Operate silently, i.e. don't ring any bells before and after dumping the window. .SH ENVIRONMENT .PP .TP 8 .B DISPLAY To get default host and display number. .SH FILES .PP .TP 8 .B XWDFile.h X Window Dump File format definition file. .SH SEE ALSO xwud(__appmansuffix__), X(__miscmansuffix__) .SH AUTHORS Tony Della Fera, Digital Equipment Corp., MIT Project Athena .br William F. Wyatt, Smithsonian Astrophysical Observatory x11-apps-7.7+5+nmu1ubuntu1/xwd/man/Makefile.am0000664000000000000000000000052112201066050015570 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = xwd.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/xwd/config.sub0000775000000000000000000010530112167023104014752 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-04-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xwd/Makefile.am0000664000000000000000000000307012201066050015017 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = xwd AM_CFLAGS = $(CWARNFLAGS) $(XWD_CFLAGS) xwd_LDADD = $(XWD_LIBS) xwd_SOURCES = \ clientwin.c \ clientwin.h \ dsimple.c \ dsimple.h \ list.c \ list.h \ multiVis.c \ multiVis.h \ wsutils.h \ xwd.c MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xwd/dsimple.c0000664000000000000000000002236712201066050014576 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #include #include #include #include #include #include #include /* * Other_stuff.h: Definitions of routines in other_stuff. * * Written by Mark Lillibridge. Last updated 7/1/87 */ #include "clientwin.h" #include "dsimple.h" /* * Just_display: A group of routines designed to make the writting of simple * X11 applications which open a display but do not open * any windows much faster and easier. Unless a routine says * otherwise, it may be assumed to require program_name, dpy, * and screen already defined on entry. * * Written by Mark Lillibridge. Last updated 7/1/87 */ /* This stuff is defined in the calling program by just_display.h */ const char *program_name = "unknown_program"; Display *dpy = NULL; int screen = 0; /* * Get_Display_Name (argc, argv) Look for -display, -d, or host:dpy (obselete) * If found, remove it from command line. Don't go past a lone -. */ char *Get_Display_Name( int *pargc, /* MODIFIED */ char **argv) /* MODIFIED */ { int argc = *pargc; char **pargv = argv+1; char *displayname = NULL; int i; for (i = 1; i < argc; i++) { char *arg = argv[i]; if (!strcmp (arg, "-display") || !strcmp (arg, "-d")) { if (++i >= argc) usage (); displayname = argv[i]; *pargc -= 2; continue; } if (!strcmp(arg,"-")) { while (i Selects window with id . may * be either in decimal or hex. * -name Selects the window with name . * * Call as Select_Window_Args(&argc, argv) in main before * parsing any of your program's command line arguments. * Select_Window_Args will remove its arguments so that * your program does not have to worry about them. * The window returned is the window selected or 0 if * none of the above arguments was present. If 0 is * returned, Select_Window should probably be called after * all command line arguments, and other setup is done. * For examples of usage, see xwininfo, xwd, or xprop. */ Window Select_Window_Args( int *rargc, char **argv) #define ARGC (*rargc) { int nargc=1; int argc; char **nargv; Window w=0; nargv = argv+1; argc = ARGC; #define OPTION argv[0] #define NXTOPTP ++argv, --argc>0 #define NXTOPT if (++argv, --argc==0) usage() #define COPYOPT nargv++[0]=OPTION, nargc++ while (NXTOPTP) { if (!strcmp(OPTION, "-")) { COPYOPT; while (NXTOPTP) COPYOPT; break; } if (!strcmp(OPTION, "-root")) { w=RootWindow(dpy, screen); continue; } if (!strcmp(OPTION, "-name")) { NXTOPT; w = Window_With_Name(dpy, RootWindow(dpy, screen), OPTION); if (!w) Fatal_Error("No window with name %s exists!",OPTION); continue; } if (!strcmp(OPTION, "-id")) { NXTOPT; w=0; sscanf(OPTION, "0x%lx", &w); if (!w) sscanf(OPTION, "%lu", &w); if (!w) Fatal_Error("Invalid window id format: %s.", OPTION); continue; } COPYOPT; } ARGC = nargc; return(w); } /* * Other_stuff: A group of routines which do common X11 tasks. * * Written by Mark Lillibridge. Last updated 7/1/87 */ /* * Routine to let user select a window using the mouse */ Window Select_Window(Display *disp, int descend) { int status; Cursor cursor; XEvent event; Window target_win = None, root = RootWindow(disp,screen); int buttons = 0; /* Make the target cursor */ cursor = XCreateFontCursor(disp, XC_crosshair); /* Grab the pointer using target cursor, letting it room all over */ status = XGrabPointer(disp, root, False, ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, root, cursor, CurrentTime); if (status != GrabSuccess) Fatal_Error("Can't grab the mouse."); /* Let the user select a window... */ while ((target_win == None) || (buttons != 0)) { /* allow one more event */ XAllowEvents(disp, SyncPointer, CurrentTime); XWindowEvent(disp, root, ButtonPressMask|ButtonReleaseMask, &event); switch (event.type) { case ButtonPress: if (target_win == None) { target_win = event.xbutton.subwindow; /* window selected */ if (target_win == None) target_win = root; } buttons++; break; case ButtonRelease: if (buttons > 0) /* there may have been some down before we started */ buttons--; break; } } XUngrabPointer(disp, CurrentTime); /* Done with pointer */ if (!descend || (target_win == root)) return(target_win); target_win = Find_Client(disp, root, target_win); return(target_win); } /* * Window_With_Name: routine to locate a window with a given name on a display. * If no window with the given name is found, 0 is returned. * If more than one window has the given name, the first * one found will be returned. Only top and its subwindows * are looked at. Normally, top should be the RootWindow. */ Window Window_With_Name( Display *disp, Window top, const char *name) { Window *children, dummy; unsigned int nchildren; unsigned int i; Window w=0; char *window_name; if (XFetchName(disp, top, &window_name) && !strcmp(window_name, name)) return(top); if (!XQueryTree(disp, top, &dummy, &dummy, &children, &nchildren)) return(0); for (i=0; i= 7.0.17 ${XKBMODULE}]) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xwd/README0000664000000000000000000000122212201066050013640 0ustar xwd - dump an image of an X window All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xwd http://cgit.freedesktop.org/xorg/app/xwd For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xwd/xwd.c0000664000000000000000000004037012201066050013735 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * xwd.c MIT Project Athena, X Window system window raster image dumper. * * This program will dump a raster image of the contents of a window into a * file for output on graphics printers or for other uses. * * Author: Tony Della Fera, DEC * 17-Jun-85 * * Modification history: * * 11/14/86 Bill Wyatt, Smithsonian Astrophysical Observatory * - Removed Z format option, changing it to an XY option. Monochrome * windows will always dump in XY format. Color windows will dump * in Z format by default, but can be dumped in XY format with the * -xy option. * * 11/18/86 Bill Wyatt * - VERSION 6 is same as version 5 for monchrome. For colors, the * appropriate number of Color structs are dumped after the header, * which has the number of colors (=0 for monochrome) in place of the * V5 padding at the end. Up to 16-bit displays are supported. I * don't yet know how 24- to 32-bit displays will be handled under * the Version 11 protocol. * * 6/15/87 David Krikorian, MIT Project Athena * - VERSION 7 runs under the X Version 11 servers, while the previous * versions of xwd were are for X Version 10. This version is based * on xwd version 6, and should eventually have the same color * abilities. (Xwd V7 has yet to be tested on a color machine, so * all color-related code is commented out until color support * becomes practical.) */ /*% *% This is the format for commenting out color-related code until *% color can be supported. %*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include "X11/XWDFile.h" #define FEEP_VOLUME 0 /* Include routines to do parsing */ #include "dsimple.h" #include "list.h" #include "wsutils.h" #include "multiVis.h" #ifdef XKB #include #endif /* Setable Options */ static int format = ZPixmap; static Bool nobdrs = False; static Bool on_root = False; static Bool standard_out = True; static Bool debug = False; static Bool silent = False; static Bool use_installed = False; static long add_pixel_value = 0; extern int main(int, char **); extern void Window_Dump(Window, FILE *); extern int Image_Size(XImage *); extern int Get_XColors(XWindowAttributes *, XColor **); extern void _swapshort(register char *, register unsigned); extern void _swaplong(register char *, register unsigned); static long parse_long(char *); static int Get24bitDirectColors(XColor **); static int ReadColors(Visual *, Colormap, XColor **); static long parse_long (char *s) { long retval = 0L; int thesign = 1; if (s && s[0]) { switch(s[0]) { case '-': (void) sscanf (s + 1, "%lu", &retval); thesign = -1; break; case '0': (void) sscanf (s + 1, "%lo", &retval); break; case 'x': case 'X': (void) sscanf (s + 1, "%lx", &retval); break; default: (void) sscanf (s, "%lu", &retval); break; } } return (thesign * retval); } int main(int argc, char **argv) { register int i; Window target_win; FILE *out_file = stdout; Bool frame_only = False; INIT_NAME; Setup_Display_And_Screen(&argc, argv); /* Get window select on command line, if any */ target_win = Select_Window_Args(&argc, argv); for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-nobdrs")) { nobdrs = True; continue; } if (!strcmp(argv[i], "-debug")) { debug = True; continue; } if (!strcmp(argv[i], "-help")) usage(); if (!strcmp(argv[i], "-out")) { if (++i >= argc) usage(); if (!(out_file = fopen(argv[i], "wb"))) Fatal_Error("Can't open output file as specified."); standard_out = False; continue; } if (!strcmp(argv[i], "-xy")) { format = XYPixmap; continue; } if (!strcmp(argv[i], "-screen")) { on_root = True; continue; } if (!strcmp(argv[i], "-icmap")) { use_installed = True; continue; } if (!strcmp(argv[i], "-add")) { if (++i >= argc) usage(); add_pixel_value = parse_long (argv[i]); continue; } if (!strcmp(argv[i], "-frame")) { frame_only = True; continue; } if (!strcmp(argv[i], "-silent")) { silent = True; continue; } usage(); } #ifdef WIN32 if (standard_out) _setmode(fileno(out_file), _O_BINARY); #endif /* * Let the user select the target window. */ if (target_win == None) target_win = Select_Window(dpy, !frame_only); /* * Dump it! */ Window_Dump(target_win, out_file); XCloseDisplay(dpy); if (fclose(out_file)) { perror("xwd"); exit(1); } exit(0); } static int Get24bitDirectColors(XColor **colors) { int i , ncolors = 256 ; XColor *tcol ; *colors = tcol = (XColor *)malloc(sizeof(XColor) * ncolors) ; for(i=0 ; i < ncolors ; i++) { tcol[i].pixel = i << 16 | i << 8 | i ; tcol[i].red = tcol[i].green = tcol[i].blue = i << 8 | i ; } return ncolors ; } /* * Window_Dump: dump a window to a file which must already be open for * writting. */ void Window_Dump(Window window, FILE *out) { unsigned long swaptest = 1; XColor *colors; unsigned buffer_size; size_t win_name_size; CARD32 header_size; int ncolors, i; char *win_name; char default_win_name[] = "xwdump"; Bool got_win_name; XWindowAttributes win_info; XImage *image; int absx, absy, x, y; unsigned width, height; int dwidth, dheight; Window dummywin; XWDFileHeader header; XWDColor xwdcolor; int transparentOverlays , multiVis; int numVisuals; XVisualInfo *pVisuals; int numOverlayVisuals; OverlayInfo *pOverlayVisuals; int numImageVisuals; XVisualInfo **pImageVisuals; list_ptr vis_regions; /* list of regions to read from */ list_ptr vis_image_regions ; Visual vis_h,*vis ; int allImage = 0 ; /* * Inform the user not to alter the screen. */ if (!silent) { #ifdef XKB XkbStdBell(dpy,None,50,XkbBI_Wait); #else XBell(dpy,FEEP_VOLUME); #endif XFlush(dpy); } /* * Get the parameters of the window being dumped. */ if (debug) outl("xwd: Getting target window information.\n"); if(!XGetWindowAttributes(dpy, window, &win_info)) Fatal_Error("Can't get target window attributes."); /* handle any frame window */ if (!XTranslateCoordinates (dpy, window, RootWindow (dpy, screen), 0, 0, &absx, &absy, &dummywin)) { fprintf (stderr, "%s: unable to translate window coordinates (%d,%d)\n", program_name, absx, absy); exit (1); } win_info.x = absx; win_info.y = absy; width = win_info.width; height = win_info.height; if (!nobdrs) { absx -= win_info.border_width; absy -= win_info.border_width; width += (2 * win_info.border_width); height += (2 * win_info.border_width); } dwidth = DisplayWidth (dpy, screen); dheight = DisplayHeight (dpy, screen); /* clip to window */ if (absx < 0) width += absx, absx = 0; if (absy < 0) height += absy, absy = 0; if (absx + width > dwidth) width = dwidth - absx; if (absy + height > dheight) height = dheight - absy; XFetchName(dpy, window, &win_name); if (!win_name || !win_name[0]) { win_name = default_win_name; got_win_name = False; } else { got_win_name = True; } /* sizeof(char) is included for the null string terminator. */ win_name_size = strlen(win_name) + sizeof(char); /* * Snarf the pixmap with XGetImage. */ x = absx - win_info.x; y = absy - win_info.y; multiVis = GetMultiVisualRegions(dpy,RootWindow(dpy, screen), absx, absy, width, height,&transparentOverlays,&numVisuals, &pVisuals, &numOverlayVisuals,&pOverlayVisuals,&numImageVisuals, &pImageVisuals,&vis_regions,&vis_image_regions,&allImage) ; if (on_root || multiVis) { if(!multiVis) image = XGetImage (dpy, RootWindow(dpy, screen), absx, absy, width, height, AllPlanes, format); else image = ReadAreaToImage(dpy, RootWindow(dpy, screen), absx, absy, width, height, numVisuals,pVisuals,numOverlayVisuals,pOverlayVisuals, numImageVisuals, pImageVisuals,vis_regions, vis_image_regions,format,allImage); } else image = XGetImage (dpy, window, x, y, width, height, AllPlanes, format); if (!image) { fprintf (stderr, "%s: unable to get image at %dx%d+%d+%d\n", program_name, width, height, x, y); exit (1); } if (add_pixel_value != 0) XAddPixel (image, add_pixel_value); /* * Determine the pixmap size. */ buffer_size = Image_Size(image); if (debug) outl("xwd: Getting Colors.\n"); if( !multiVis) { ncolors = Get_XColors(&win_info, &colors); vis = win_info.visual ; } else { ncolors = Get24bitDirectColors(&colors) ; initFakeVisual(&vis_h) ; vis = &vis_h ; } /* * Inform the user that the image has been retrieved. */ if (!silent) { #ifdef XKB XkbStdBell(dpy,window,FEEP_VOLUME,XkbBI_Proceed); XkbStdBell(dpy,window,FEEP_VOLUME,XkbBI_RepeatingLastBell); #else XBell(dpy, FEEP_VOLUME); XBell(dpy, FEEP_VOLUME); #endif XFlush(dpy); } /* * Calculate header size. */ if (debug) outl("xwd: Calculating header size.\n"); header_size = SIZEOF(XWDheader) + (CARD32) win_name_size; /* * Write out header information. */ if (debug) outl("xwd: Constructing and dumping file header.\n"); header.header_size = (CARD32) header_size; header.file_version = (CARD32) XWD_FILE_VERSION; header.pixmap_format = (CARD32) format; header.pixmap_depth = (CARD32) image->depth; header.pixmap_width = (CARD32) image->width; header.pixmap_height = (CARD32) image->height; header.xoffset = (CARD32) image->xoffset; header.byte_order = (CARD32) image->byte_order; header.bitmap_unit = (CARD32) image->bitmap_unit; header.bitmap_bit_order = (CARD32) image->bitmap_bit_order; header.bitmap_pad = (CARD32) image->bitmap_pad; header.bits_per_pixel = (CARD32) image->bits_per_pixel; header.bytes_per_line = (CARD32) image->bytes_per_line; /**** header.visual_class = (CARD32) win_info.visual->class; header.red_mask = (CARD32) win_info.visual->red_mask; header.green_mask = (CARD32) win_info.visual->green_mask; header.blue_mask = (CARD32) win_info.visual->blue_mask; header.bits_per_rgb = (CARD32) win_info.visual->bits_per_rgb; header.colormap_entries = (CARD32) win_info.visual->map_entries; *****/ header.visual_class = (CARD32) vis->class; header.red_mask = (CARD32) vis->red_mask; header.green_mask = (CARD32) vis->green_mask; header.blue_mask = (CARD32) vis->blue_mask; header.bits_per_rgb = (CARD32) vis->bits_per_rgb; header.colormap_entries = (CARD32) vis->map_entries; header.ncolors = ncolors; header.window_width = (CARD32) win_info.width; header.window_height = (CARD32) win_info.height; header.window_x = absx; header.window_y = absy; header.window_bdrwidth = (CARD32) win_info.border_width; if (*(char *) &swaptest) { _swaplong((char *) &header, sizeof(header)); for (i = 0; i < ncolors; i++) { _swaplong((char *) &colors[i].pixel, sizeof(CARD32)); _swapshort((char *) &colors[i].red, 3 * sizeof(short)); } } if (fwrite((char *)&header, SIZEOF(XWDheader), 1, out) != 1 || fwrite(win_name, win_name_size, 1, out) != 1) { perror("xwd"); exit(1); } /* * Write out the color maps, if any */ if (debug) outl("xwd: Dumping %d colors.\n", ncolors); for (i = 0; i < ncolors; i++) { xwdcolor.pixel = colors[i].pixel; xwdcolor.red = colors[i].red; xwdcolor.green = colors[i].green; xwdcolor.blue = colors[i].blue; xwdcolor.flags = colors[i].flags; if (fwrite((char *) &xwdcolor, SIZEOF(XWDColor), 1, out) != 1) { perror("xwd"); exit(1); } } /* * Write out the buffer. */ if (debug) outl("xwd: Dumping pixmap. bufsize=%d\n",buffer_size); /* * This copying of the bit stream (data) to a file is to be replaced * by an Xlib call which hasn't been written yet. It is not clear * what other functions of xwd will be taken over by this (as yet) * non-existant X function. */ if (fwrite(image->data, (int) buffer_size, 1, out) != 1) { perror("xwd"); exit(1); } /* * free the color buffer. */ if(debug && ncolors > 0) outl("xwd: Freeing colors.\n"); if(ncolors > 0) free(colors); /* * Free window name string. */ if (debug) outl("xwd: Freeing window name string.\n"); if (got_win_name) XFree(win_name); /* * Free image */ XDestroyImage(image); } /* * Report the syntax for calling xwd. */ void usage(void) { fprintf (stderr, "usage: %s [-display host:dpy] [-debug] [-help] %s [-nobdrs] [-out ]", program_name, "[{-root|-id |-name }]"); fprintf (stderr, " [-xy] [-add value] [-frame]\n"); exit(1); } /* * Determine the pixmap size. */ int Image_Size(XImage *image) { if (image->format != ZPixmap) return(image->bytes_per_line * image->height * image->depth); return(image->bytes_per_line * image->height); } #define lowbit(x) ((x) & (~(x) + 1)) static int ReadColors(Visual *vis, Colormap cmap, XColor **colors) { int i,ncolors ; ncolors = vis->map_entries; if (!(*colors = (XColor *) malloc (sizeof(XColor) * ncolors))) Fatal_Error("Out of memory!"); if (vis->class == DirectColor || vis->class == TrueColor) { Pixel red, green, blue, red1, green1, blue1; red = green = blue = 0; red1 = lowbit(vis->red_mask); green1 = lowbit(vis->green_mask); blue1 = lowbit(vis->blue_mask); for (i=0; i vis->red_mask) red = 0; green += green1; if (green > vis->green_mask) green = 0; blue += blue1; if (blue > vis->blue_mask) blue = 0; } } else { for (i=0; icolormap; if (use_installed) /* assume the visual will be OK ... */ cmap = XListInstalledColormaps(dpy, win_info->root, &i)[0]; if (!cmap) return(0); ncolors = ReadColors(win_info->visual,cmap,colors) ; return ncolors ; } void _swapshort (register char *bp, register unsigned n) { register char c; register char *ep = bp + n; while (bp < ep) { c = *bp; *bp = *(bp + 1); bp++; *bp++ = c; } } void _swaplong (register char *bp, register unsigned n) { register char c; register char *ep = bp + n; while (bp < ep) { c = bp[3]; bp[3] = bp[0]; bp[0] = c; c = bp[2]; bp[2] = bp[1]; bp[1] = c; bp += 4; } } x11-apps-7.7+5+nmu1ubuntu1/xwd/COPYING0000664000000000000000000000441712201066050014024 0ustar Copyright 1987, 1988, 1993, 1994, 1996, 1998 The Open Group Copyright 1994 Hewlett-Packard Co. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 2007 Kim woelders Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the copyright holders not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The copyright holders make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. x11-apps-7.7+5+nmu1ubuntu1/xwd/INSTALL0000664000000000000000000002622212201066414014024 0ustar Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 6. Often, you can also type `make uninstall' to remove the installed files again. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *Note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xwd/multiVis.c0000664000000000000000000011275512201066050014756 0ustar /** ------------------------------------------------------------------------ This file contains functions to create a list of regions which tile a specified window. Each region contains all visible portions of the window which are drawn with the same visual. If the window consists of subwindows of two different visual types, there will be two regions in the list. The list can be traversed to correctly pull an image of the window using XGetImage or the Image Library. Copyright 1994 Hewlett-Packard Co. Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ------------------------------------------------------------------------ **/ #include #include #include #include #include #include "list.h" #include "wsutils.h" #include "multiVis.h" /* These structures are copied from X11/region.h. For some reason * they're invisible from the outside. */ typedef struct { short x1, x2, y1, y2; } myBox, myBOX, myBoxRec, *myBoxPtr; typedef struct my_XRegion { long size; long numRects; myBOX *rects; myBOX extents; } myREGION; /* Items in long list of windows that have some part in the grabbed area */ typedef struct { Window win; Visual *vis; Colormap cmap; int x_rootrel, y_rootrel; /* root relative location of window */ int x_vis, y_vis; /* rt rel x,y of vis part, not parent clipped */ int width, height; /* width and height of visible part */ int border_width; /* border width of the window */ Window parent; /* id of parent (for debugging) */ } image_win_type; /* Items in short list of regions that tile the grabbed area. May have multiple windows in the region. */ typedef struct { Window win; /* lowest window of this visual */ Visual *vis; Colormap cmap; int x_rootrel, y_rootrel; /* root relative location of bottom window */ int x_vis, y_vis; /* rt rel x,y of vis part, not parent clipped */ int width, height; /* w & h of visible rect of bottom window */ int border; /* border width of the window */ Region visible_region; } image_region_type; /** ------------------------------------------------------------------------ Returns TRUE if the two structs pointed to have the same "vis" & "cmap" fields and s2 lies completely within s1. s1 and s2 can point to structs of image_win_type or image_region_type. ------------------------------------------------------------------------ **/ #define SAME_REGIONS( s1, s2) \ ((s1)->vis == (s2)->vis && (s1)->cmap == (s2)->cmap && \ (s1)->x_vis <= (s2)->x_vis && \ (s1)->y_vis <= (s2)->y_vis && \ (s1)->x_vis + (s1)->width >= (s2)->x_vis + (s2)->width && \ (s1)->y_vis + (s1)->height >= (s2)->y_vis + (s2)->height) #ifndef MIN #define MIN( a, b) ((a) < (b) ? a : b) #define MAX( a, b) ((a) > (b) ? a : b) #endif #define RED_SHIFT 16 #define GREEN_SHIFT 8 #define BLUE_SHIFT 0 /* extern list_ptr new_list(); extern list_ptr dup_list_head(); extern void * first_in_list(); extern void * next_in_list(); extern int add_to_list(); extern void zero_list(); extern void delete_list(); extern void delete_list_destroying(); extern unsigned int list_length(); */ /* Prototype Declarations for Static Functions */ static void QueryColorMap( Display *, Colormap , Visual *, XColor **, int *, int *, int * ); static void TransferImage( Display *, XImage *,int, int , image_region_type*, XImage *,int ,int ); static XImage * ReadRegionsInList( Display *, Visual *, int, int, unsigned int, unsigned int, XRectangle, list_ptr ); static list_ptr make_region_list( Display*, Window, XRectangle*, int*, int, XVisualInfo**, int * ); static void destroy_region_list( list_ptr ) ; static void subtr_rect_from_image_region( image_region_type *, int , int , int , int ); static void add_rect_to_image_region( image_region_type *, int , int , int , int ); static int src_in_region_list( image_win_type *, list_ptr ); static void add_window_to_list( list_ptr, Window, int, int , int , int , int , int, int, Visual*, Colormap, Window ); static int src_in_image( image_win_type *, int , XVisualInfo** ); static int src_in_overlay( image_region_type *, int, OverlayInfo *, int*, int* ); static void make_src_list( Display *, list_ptr, XRectangle *, Window, int, int, XWindowAttributes *, XRectangle * ); static void destroy_image_region( image_region_type * ); /* End of Prototype Declarations */ void initFakeVisual(Visual *Vis) { Vis->ext_data=NULL; Vis->class = DirectColor ; Vis->red_mask = 0x00FF0000; Vis->green_mask = 0x0000FF00 ; Vis->blue_mask = 0x000000FF ; Vis->map_entries = 256 ; Vis->bits_per_rgb = 8 ; } static void QueryColorMap(Display *disp, Colormap src_cmap, Visual *src_vis, XColor **src_colors, int *rShift, int *gShift, int *bShift) { unsigned int ncolors,i ; unsigned long redMask, greenMask, blueMask; int redShift, greenShift, blueShift; XColor *colors ; ncolors = (unsigned) src_vis->map_entries ; *src_colors = colors = (XColor *)malloc(ncolors * sizeof(XColor) ) ; if(src_vis->class != TrueColor && src_vis->class != DirectColor) { for(i=0 ; i < ncolors ; i++) { colors[i].pixel = i ; colors[i].pad = 0; colors[i].flags = DoRed|DoGreen|DoBlue; } } else /** src is decomposed rgb ***/ { /* Get the X colormap */ redMask = src_vis->red_mask; greenMask = src_vis->green_mask; blueMask = src_vis->blue_mask; redShift = 0; while (!(redMask&0x1)) { redShift++; redMask = redMask>>1; } greenShift = 0; while (!(greenMask&0x1)) { greenShift++; greenMask = greenMask>>1; } blueShift = 0; while (!(blueMask&0x1)) { blueShift++; blueMask = blueMask>>1; } *rShift = redShift ; *gShift = greenShift ; *bShift = blueShift ; for (i=0; inext && (*vis_regions)->next->next ) || ( *vis_image_regions && (*vis_image_regions)->next && (*vis_image_regions)->next->next ) ) return 1 ; else return 0 ; } static void TransferImage(Display *disp, XImage *reg_image, int srcw, int srch, image_region_type *reg, XImage *target_image, int dst_x, int dst_y) { int i,j,old_pixel,new_pixel,red_ind,green_ind,blue_ind ; XColor *colors; int rShift = 0, gShift = 0, bShift = 0; QueryColorMap(disp,reg->cmap,reg->vis,&colors, &rShift,&gShift,&bShift) ; switch (reg->vis->class) { case TrueColor : for(i=0 ; i < srch ; i++) { for(j=0 ; j < srcw ; j++) { old_pixel = XGetPixel(reg_image,j,i) ; if( reg->vis->map_entries == 16) { red_ind = (old_pixel & reg->vis->red_mask) >> rShift ; green_ind = (old_pixel & reg->vis->green_mask) >> gShift ; blue_ind = (old_pixel & reg->vis->blue_mask) >> bShift ; new_pixel = ( ((colors[red_ind].red >> 8) << RED_SHIFT) |((colors[green_ind].green >> 8) << GREEN_SHIFT) |((colors[blue_ind].blue >> 8) << BLUE_SHIFT) ); } else new_pixel = old_pixel; XPutPixel(target_image,dst_x+j, dst_y+i,new_pixel); } } break; case DirectColor : for(i=0 ; i < srch ; i++) { for(j=0 ; j < srcw ; j++) { old_pixel = XGetPixel(reg_image,j,i) ; red_ind = (old_pixel & reg->vis->red_mask) >> rShift ; green_ind = (old_pixel & reg->vis->green_mask) >> gShift ; blue_ind = (old_pixel & reg->vis->blue_mask) >> bShift ; new_pixel = ( ((colors[red_ind].red >> 8) << RED_SHIFT) |((colors[green_ind].green >> 8) << GREEN_SHIFT) |((colors[blue_ind].blue >> 8) << BLUE_SHIFT) ); XPutPixel(target_image,dst_x+j, dst_y+i,new_pixel); } } break; default : for(i=0 ; i < srch ; i++) { for(j=0 ; j < srcw ; j++) { old_pixel = XGetPixel(reg_image,j,i) ; new_pixel = ( ((colors[old_pixel].red >> 8) << RED_SHIFT) |((colors[old_pixel].green >> 8) << GREEN_SHIFT) |((colors[old_pixel].blue >> 8) << BLUE_SHIFT) ); XPutPixel(target_image,dst_x+j, dst_y+i,new_pixel); } } break; } } static XImage * ReadRegionsInList(Display *disp, Visual *fakeVis, int depth, int format, unsigned int width, unsigned int height, XRectangle bbox, /* bounding box of grabbed area */ list_ptr regions) /* list of regions to read from */ { image_region_type *reg; int dst_x, dst_y; /* where in pixmap to write (UL) */ int diff; XImage *reg_image,*ximage ; int srcRect_x,srcRect_y,srcRect_width,srcRect_height ; int bytes_per_line; ximage = XCreateImage(disp,fakeVis,depth,format,0,NULL,width,height, 8,0) ; bytes_per_line = ximage->bytes_per_line; if (format == ZPixmap) ximage->data = malloc(height*bytes_per_line); else ximage->data = malloc(height*bytes_per_line*depth); ximage->bits_per_pixel = depth; /** Valid only if format is ZPixmap ***/ for (reg = (image_region_type *) first_in_list( regions); reg; reg = (image_region_type *) next_in_list( regions)) { int rect; struct my_XRegion *vis_reg; vis_reg = (struct my_XRegion *)(reg->visible_region); for (rect = 0; rect < vis_reg->numRects; rect++) { /** ------------------------------------------------------------------------ Intersect bbox with visible part of region giving src rect & output location. Width is the min right side minus the max left side. Similar for height. Offset src rect so x,y are relative to origin of win, not the root-relative visible rect of win. ------------------------------------------------------------------------ **/ srcRect_width = MIN( vis_reg->rects[rect].x2, bbox.width + bbox.x) - MAX( vis_reg->rects[rect].x1, bbox.x); srcRect_height = MIN( vis_reg->rects[rect].y2, bbox.height + bbox.y) - MAX( vis_reg->rects[rect].y1, bbox.y); diff = bbox.x - vis_reg->rects[rect].x1; srcRect_x = MAX( 0, diff) + (vis_reg->rects[rect].x1 - reg->x_rootrel - reg->border); dst_x = MAX( 0, -diff) ; diff = bbox.y - vis_reg->rects[rect].y1; srcRect_y = MAX( 0, diff) + (vis_reg->rects[rect].y1 - reg->y_rootrel - reg->border); dst_y = MAX( 0, -diff) ; reg_image = XGetImage(disp,reg->win,srcRect_x,srcRect_y, srcRect_width,srcRect_height,AllPlanes,format) ; TransferImage(disp,reg_image,srcRect_width, srcRect_height,reg,ximage,dst_x,dst_y) ; } } return ximage ; } /** ------------------------------------------------------------------------ ------------------------------------------------------------------------ **/ XImage *ReadAreaToImage(Display *disp, /* root win on which grab was done */ Window srcRootWinid, /* root rel UL corner of bounding box of grab */ int x, int y, /* size of bounding box of grab */ unsigned int width, unsigned int height, int numVisuals, XVisualInfo *pVisuals, int numOverlayVisuals, OverlayInfo *pOverlayVisuals, int numImageVisuals, XVisualInfo **pImageVisuals, /* list of regions to read from */ list_ptr vis_regions, /* list of regions to read from */ list_ptr vis_image_regions, int format, int allImage) { image_region_type *reg; XRectangle bbox; /* bounding box of grabbed area */ int depth ; XImage *ximage, *ximage_ipm = NULL; Visual fakeVis ; int x1, y1; XImage *image; #if 0 unsigned char *pmData , *ipmData ; #endif int transparentColor, transparentType; int srcRect_x,srcRect_y,srcRect_width,srcRect_height ; int diff ; int dst_x, dst_y; /* where in pixmap to write (UL) */ int pixel; bbox.x = x; /* init X rect for bounding box */ bbox.y = y; bbox.width = width; bbox.height = height; initFakeVisual(&fakeVis) ; depth = 24 ; ximage = ReadRegionsInList(disp,&fakeVis,depth,format,width,height, bbox,vis_regions) ; #if 0 pmData = (unsigned char *)ximage -> data ; #endif /* if transparency possible do it again, but this time for image planes only */ if (vis_image_regions && (vis_image_regions->next) && !allImage) { ximage_ipm = ReadRegionsInList(disp,&fakeVis,depth,format,width,height, bbox,vis_image_regions) ; #if 0 ipmData = (unsigned char *)ximage_ipm -> data ; #endif } /* Now tranverse the overlay visual windows and test for transparency index. */ /* If you find one, subsitute the value from the matching image plane pixmap. */ for (reg = (image_region_type *) first_in_list( vis_regions); reg; reg = (image_region_type *) next_in_list( vis_regions)) { if (src_in_overlay( reg, numOverlayVisuals, pOverlayVisuals, &transparentColor, &transparentType)) { int test = 0 ; srcRect_width = MIN( reg->width + reg->x_vis, bbox.width + bbox.x) - MAX( reg->x_vis, bbox.x); srcRect_height = MIN( reg->height + reg->y_vis, bbox.height + bbox.y) - MAX( reg->y_vis, bbox.y); diff = bbox.x - reg->x_vis; srcRect_x = MAX( 0, diff) + (reg->x_vis - reg->x_rootrel - reg->border); dst_x = MAX( 0, -diff) ; diff = bbox.y - reg->y_vis; srcRect_y = MAX( 0, diff) + (reg->y_vis - reg->y_rootrel - reg->border); dst_y = MAX( 0, -diff) ; /* let's test some pixels for transparency */ image = XGetImage(disp, reg->win, srcRect_x, srcRect_y, srcRect_width, srcRect_height, 0xffffffff, ZPixmap); /* let's assume byte per pixel for overlay image for now */ if ((image->depth == 8) && (transparentType == TransparentPixel)) { unsigned char *pixel_ptr; unsigned char *start_of_line = (unsigned char *) image->data; for (y1 = 0; y1 < srcRect_height; y1++) { pixel_ptr = start_of_line; for (x1 = 0; x1 < srcRect_width; x1++) { if (*pixel_ptr++ == transparentColor) { #if 0 *pmData++ = *ipmData++; *pmData++ = *ipmData++; *pmData++ = *ipmData++; #endif pixel = XGetPixel(ximage_ipm,dst_x+x1,dst_y+y1) ; XPutPixel(ximage,dst_x+x1, dst_y+y1,pixel); if(!test){ test = 1 ; } } #if 0 else { pmData +=3; ipmData +=3; } #endif } start_of_line += image->bytes_per_line; } } else { if (transparentType == TransparentPixel) { for (y1 = 0; y1 < srcRect_height; y1++) { for (x1 = 0; x1 < srcRect_width; x1++) { int pixel_value = XGetPixel(image, x1, y1); if (pixel_value == transparentColor) { #if 0 *pmData++ = *ipmData++; *pmData++ = *ipmData++; *pmData++ = *ipmData++; #endif pixel = XGetPixel(ximage_ipm,dst_x+x1,dst_y+y1) ; XPutPixel(ximage,dst_x+x1, dst_y+y1,pixel); if(!test){ test = 1 ; } } #if 0 else { pmData +=3; ipmData +=3; } #endif } } } else { for (y1 = 0; y1 < srcRect_height; y1++) { for (x1 = 0; x1 < srcRect_width; x1++) { int pixel_value = XGetPixel(image, x1, y1); if (pixel_value & transparentColor) { #if 0 *pmData++ = *ipmData++; *pmData++ = *ipmData++; *pmData++ = *ipmData++; #endif pixel = XGetPixel(ximage_ipm,dst_x+x1,dst_y+y1) ; XPutPixel(ximage,dst_x+x1, dst_y+y1,pixel); if(!test){ test = 1 ; } } #if 0 else { pmData +=3; ipmData +=3; } #endif } } } } XDestroyImage (image); } /* end of src_in_overlay */ } /** end transparency **/ destroy_region_list( vis_regions); if (vis_image_regions) destroy_region_list( vis_image_regions ); FreeXVisualInfo(pVisuals, pOverlayVisuals, pImageVisuals); XSync(disp, 0); return ximage; } /** ------------------------------------------------------------------------ Creates a list of the subwindows of a given window which have a different visual than their parents. The function is recursive. This list is used in make_region_list(), which coalesces the windows with the same visual into a region. image_wins must point to an existing list struct that's already been zeroed (zero_list()). ------------------------------------------------------------------------ **/ static void make_src_list(Display *disp, list_ptr image_wins, /* bnding box of area we want */ XRectangle *bbox, Window curr, /* pos of curr WRT root */ int x_rootrel, int y_rootrel, XWindowAttributes *curr_attrs, /* visible part of curr, not obscurred by ancestors */ XRectangle *pclip) { XWindowAttributes child_attrs; Window root, parent, *child; /* variables for XQueryTree() */ Window *save_child_list; /* variables for XQueryTree() */ unsigned int nchild; /* variables for XQueryTree() */ XRectangle child_clip; /* vis part of child */ int curr_clipX, curr_clipY, curr_clipRt, curr_clipBt; /* check that win is mapped & not outside bounding box */ if (curr_attrs->map_state == IsViewable && curr_attrs->class == InputOutput && !( pclip->x >= (int) (bbox->x + bbox->width) || pclip->y >= (int) (bbox->y + bbox->height) || (int) (pclip->x + pclip->width) <= bbox->x || (int) (pclip->y + pclip->height) <= bbox->y)) { XQueryTree( disp, curr, &root, &parent, &child, &nchild ); save_child_list = child; /* so we can free list when we're done */ add_window_to_list( image_wins, curr, x_rootrel, y_rootrel, pclip->x, pclip->y, pclip->width, pclip->height, curr_attrs->border_width,curr_attrs->visual, curr_attrs->colormap, parent); /** ------------------------------------------------------------------------ set RR coords of right (Rt), left (X), bottom (Bt) and top (Y) of rect we clip all children by. This is our own clip rect (pclip) inflicted on us by our parent plus our own borders. Within the child loop, we figure the clip rect for each child by adding in it's rectangle (not taking into account the child's borders). ------------------------------------------------------------------------ **/ curr_clipX = MAX( pclip->x, x_rootrel + (int) curr_attrs->border_width); curr_clipY = MAX( pclip->y, y_rootrel + (int) curr_attrs->border_width); curr_clipRt = MIN( pclip->x + (int) pclip->width, x_rootrel + (int) curr_attrs->width + 2 * (int) curr_attrs->border_width); curr_clipBt = MIN( pclip->y + (int) pclip->height, y_rootrel + (int) curr_attrs->height + 2 * (int) curr_attrs->border_width); while (nchild--) { int new_width, new_height; int child_xrr, child_yrr; /* root relative x & y of child */ XGetWindowAttributes( disp, *child, &child_attrs); /* intersect parent & child clip rects */ child_xrr = x_rootrel + child_attrs.x + curr_attrs->border_width; child_clip.x = MAX( curr_clipX, child_xrr); new_width = MIN( curr_clipRt, child_xrr + (int) child_attrs.width + 2 * child_attrs.border_width) - child_clip.x; if (new_width >= 0) { child_clip.width = new_width; child_yrr = y_rootrel + child_attrs.y + curr_attrs->border_width; child_clip.y = MAX( curr_clipY, child_yrr); new_height = MIN( curr_clipBt, child_yrr + (int) child_attrs.height + 2 * child_attrs.border_width) - child_clip.y; if (new_height >= 0) { child_clip.height = new_height; make_src_list( disp, image_wins, bbox, *child, child_xrr, child_yrr, &child_attrs, &child_clip); } } child++; } XFree( save_child_list); } } /** ------------------------------------------------------------------------ This function creates a list of regions which tile a specified window. Each region contains all visible portions of the window which are drawn with the same visual. For example, if the window consists of subwindows of two different visual types, there will be two regions in the list. Returns a pointer to the list. ------------------------------------------------------------------------ **/ static list_ptr make_region_list(Display *disp, Window win, XRectangle *bbox, int *hasNonDefault, int numImageVisuals, XVisualInfo **pImageVisuals, int *allImage) { XWindowAttributes win_attrs; list image_wins; list_ptr image_regions; list_ptr srcs_left; image_region_type *new_reg; image_win_type *base_src, *src; Region bbox_region = XCreateRegion(); XRectangle clip; int image_only; int count=0 ; *hasNonDefault = False; XUnionRectWithRegion( bbox, bbox_region, bbox_region); XGetWindowAttributes( disp, win, &win_attrs); zero_list( &image_wins); clip.x = 0; clip.y = 0; clip.width = win_attrs.width; clip.height = win_attrs.height; make_src_list( disp, &image_wins, bbox, win, 0 /* x_rootrel */, 0 /* y_rootrel */, &win_attrs, &clip); image_regions = new_list(); image_only = (*allImage) ? True:False; for (base_src = (image_win_type *) first_in_list( &image_wins); base_src; base_src = (image_win_type *) next_in_list( &image_wins)) { /* test for image visual */ if (!image_only || src_in_image(base_src, numImageVisuals, pImageVisuals)) { /* find a window whose visual hasn't been put in list yet */ if (!src_in_region_list( base_src, image_regions)) { if (! (new_reg = (image_region_type *) malloc( sizeof( image_region_type)))) { return (list_ptr) NULL; } count++; new_reg->visible_region = XCreateRegion(); new_reg->win = base_src->win; new_reg->vis = base_src->vis; new_reg->cmap = base_src->cmap; new_reg->x_rootrel = base_src->x_rootrel; new_reg->y_rootrel = base_src->y_rootrel; new_reg->x_vis = base_src->x_vis; new_reg->y_vis = base_src->y_vis; new_reg->width = base_src->width; new_reg->height = base_src->height; new_reg->border = base_src->border_width; srcs_left = (list_ptr) dup_list_head( &image_wins, START_AT_CURR); for (src = (image_win_type *) first_in_list( srcs_left); src; src = (image_win_type *) next_in_list( srcs_left)) { if (SAME_REGIONS( base_src, src)) { add_rect_to_image_region( new_reg, src->x_vis, src->y_vis, src->width, src->height); } else { if (!image_only || src_in_image(src, numImageVisuals, pImageVisuals)) { subtr_rect_from_image_region( new_reg, src->x_vis, src->y_vis, src->width, src->height); } } } XIntersectRegion( bbox_region, new_reg->visible_region, new_reg->visible_region); if (! XEmptyRegion( new_reg->visible_region)) { add_to_list( image_regions, new_reg); if (new_reg->vis != DefaultVisualOfScreen( win_attrs.screen) || new_reg->cmap != DefaultColormapOfScreen( win_attrs.screen)) { *hasNonDefault = True; } } else { XDestroyRegion( new_reg->visible_region); free( (void *) new_reg); } } } else *allImage = 0; } delete_list( &image_wins, True); XDestroyRegion( bbox_region); return image_regions; } /** ------------------------------------------------------------------------ Destructor called from destroy_region_list(). ------------------------------------------------------------------------ **/ static void destroy_image_region(image_region_type *image_region) { XDestroyRegion( image_region->visible_region); free( (void *) image_region); } /** ------------------------------------------------------------------------ Destroys the region list, destroying all the regions contained in it. ------------------------------------------------------------------------ **/ static void destroy_region_list(list_ptr rlist) { delete_list_destroying( rlist, (DESTRUCT_FUNC_PTR)destroy_image_region); } /** ------------------------------------------------------------------------ Subtracts the specified rectangle from the region in image_region. First converts the rectangle to a region of its own, since X only provides a way to subtract one region from another, not a rectangle from a region. ------------------------------------------------------------------------ **/ static void subtr_rect_from_image_region(image_region_type *image_region, int x, int y, int width, int height) { XRectangle rect; Region rect_region; rect_region = XCreateRegion(); rect.x = x; rect.y = y; rect.width = width; rect.height = height; XUnionRectWithRegion( &rect, rect_region, rect_region); XSubtractRegion( image_region->visible_region, rect_region, image_region->visible_region); XDestroyRegion( rect_region); } /** ------------------------------------------------------------------------ Adds the specified rectangle to the region in image_region. ------------------------------------------------------------------------ **/ static void add_rect_to_image_region(image_region_type *image_region, int x, int y, int width, int height) { XRectangle rect; rect.x = x; rect.y = y; rect.width = width; rect.height = height; XUnionRectWithRegion( &rect, image_region->visible_region, image_region->visible_region); } /** ------------------------------------------------------------------------ Returns TRUE if the given src's visual is already represented in the image_regions list, FALSE otherwise. ------------------------------------------------------------------------ **/ static int src_in_region_list(image_win_type *src, list_ptr image_regions) { image_region_type *ir; for (ir = (image_region_type *) first_in_list( image_regions); ir; ir = (image_region_type *) next_in_list( image_regions)) { if (SAME_REGIONS( ir, src)) { return 1; } } return 0; } /** ------------------------------------------------------------------------ Makes a new entry in image_wins with the given fields filled in. ------------------------------------------------------------------------ **/ static void add_window_to_list(list_ptr image_wins, Window w, int xrr, int yrr, int x_vis, int y_vis, int width, int height, int border_width, Visual *vis, Colormap cmap, Window parent) { image_win_type *new_src; if ((new_src = (image_win_type *) malloc( sizeof( image_win_type))) == NULL) return; new_src->win = w; new_src->x_rootrel = xrr; new_src->y_rootrel = yrr; new_src->x_vis = x_vis; new_src->y_vis = y_vis; new_src->width = width; new_src->height = height; new_src->border_width = border_width; new_src->vis = vis; new_src->cmap = cmap; new_src->parent = parent; add_to_list( image_wins, new_src); } /** ------------------------------------------------------------------------ Returns TRUE if the given src's visual is in the image planes, FALSE otherwise. ------------------------------------------------------------------------ **/ static int src_in_image(image_win_type *src, int numImageVisuals, XVisualInfo **pImageVisuals) { int i; for (i = 0 ; i < numImageVisuals ; i++) { if (pImageVisuals[i]->visual == src->vis) return 1; } return 0; } /** ------------------------------------------------------------------------ Returns TRUE if the given src's visual is in the overlay planes and transparency is possible, FALSE otherwise. ------------------------------------------------------------------------ **/ static int src_in_overlay(image_region_type *src, int numOverlayVisuals, OverlayInfo *pOverlayVisuals, int *transparentColor, int *transparentType) { int i; for (i = 0 ; i < numOverlayVisuals ; i++) { if (((pOverlayVisuals[i].pOverlayVisualInfo)->visual == src->vis) && (pOverlayVisuals[i].transparentType != None)) { *transparentColor = pOverlayVisuals[i].value; *transparentType = pOverlayVisuals[i].transparentType; return 1; } else { } } return 0; } /********************** from wsutils.c ******************************/ /****************************************************************************** * * This file contains a set of example utility procedures; procedures that can * help a "window-smart" Starbase or PHIGS program determine information about * a device, and create image and overlay plane windows. To use these * utilities, #include "wsutils.h" and compile this file and link the results * with your program. * ******************************************************************************/ #define STATIC_GRAY 0x01 #define GRAY_SCALE 0x02 #define PSEUDO_COLOR 0x04 #define TRUE_COLOR 0x10 #define DIRECT_COLOR 0x11 static int weCreateServerOverlayVisualsProperty = False; /****************************************************************************** * * GetXVisualInfo() * * This routine takes an X11 Display, screen number, and returns whether the * screen supports transparent overlays and three arrays: * * 1) All of the XVisualInfo struct's for the screen. * 2) All of the OverlayInfo struct's for the screen. * 3) An array of pointers to the screen's image plane XVisualInfo * structs. * * The code below obtains the array of all the screen's visuals, and obtains * the array of all the screen's overlay visual information. It then processes * the array of the screen's visuals, determining whether the visual is an * overlay or image visual. * * If the routine sucessfully obtained the visual information, it returns zero. * If the routine didn't obtain the visual information, it returns non-zero. * ******************************************************************************/ int GetXVisualInfo(/* Which X server (aka "display"). */ Display *display, /* Which screen of the "display". */ int screen, /* Non-zero if there's at least one overlay visual and * if at least one of those supports a transparent pixel. */ int *transparentOverlays, /* Number of XVisualInfo struct's pointed to by pVisuals. */ int *numVisuals, /* All of the device's visuals. */ XVisualInfo **pVisuals, /* Number of OverlayInfo's pointed to by pOverlayVisuals. * If this number is zero, the device does not have * overlay planes. */ int *numOverlayVisuals, /* The device's overlay plane visual information. */ OverlayInfo **pOverlayVisuals, /* Number of XVisualInfo's pointed to by pImageVisuals. */ int *numImageVisuals, /* The device's image visuals. */ XVisualInfo ***pImageVisuals) { XVisualInfo getVisInfo; /* Paramters of XGetVisualInfo */ int mask; XVisualInfo *pVis, **pIVis; /* Faster, local copies */ OverlayInfo *pOVis; OverlayVisualPropertyRec *pOOldVis; int nVisuals, nOVisuals; Atom overlayVisualsAtom; /* Parameters for XGetWindowProperty */ Atom actualType; unsigned long numLongs, bytesAfter; int actualFormat; int nImageVisualsAlloced; /* Values to process the XVisualInfo */ int imageVisual; /* array */ /* First, get the list of visuals for this screen. */ getVisInfo.screen = screen; mask = VisualScreenMask; *pVisuals = XGetVisualInfo(display, mask, &getVisInfo, numVisuals); if ((nVisuals = *numVisuals) <= 0) { /* Return that the information wasn't sucessfully obtained: */ return(1); } pVis = *pVisuals; /* Now, get the overlay visual information for this screen. To obtain * this information, get the SERVER_OVERLAY_VISUALS property. */ overlayVisualsAtom = XInternAtom(display, "SERVER_OVERLAY_VISUALS", True); if (overlayVisualsAtom != None) { /* Since the Atom exists, we can request the property's contents. The * do-while loop makes sure we get the entire list from the X server. */ bytesAfter = 0; numLongs = sizeof(OverlayVisualPropertyRec) / sizeof(long); do { numLongs += bytesAfter * sizeof(long); XGetWindowProperty(display, RootWindow(display, screen), overlayVisualsAtom, 0, numLongs, False, overlayVisualsAtom, &actualType, &actualFormat, &numLongs, &bytesAfter, (unsigned char**) pOverlayVisuals); } while (bytesAfter > 0); /* Calculate the number of overlay visuals in the list. */ *numOverlayVisuals = numLongs / (sizeof(OverlayVisualPropertyRec) / sizeof(long)); } else { /* This screen doesn't have overlay planes. */ *numOverlayVisuals = 0; *pOverlayVisuals = NULL; *transparentOverlays = 0; } /* Process the pVisuals array. */ *numImageVisuals = 0; nImageVisualsAlloced = 1; pIVis = *pImageVisuals = (XVisualInfo **) malloc(sizeof(XVisualInfo *)); while (--nVisuals >= 0) { nOVisuals = *numOverlayVisuals; pOVis = *pOverlayVisuals; imageVisual = True; while (--nOVisuals >= 0) { pOOldVis = (OverlayVisualPropertyRec *) pOVis; if (pVis->visualid == pOOldVis->visualID) { imageVisual = False; pOVis->pOverlayVisualInfo = pVis; if (pOVis->transparentType == TransparentPixel) *transparentOverlays = 1; } pOVis++; } if (imageVisual) { if ((*numImageVisuals += 1) > nImageVisualsAlloced) { nImageVisualsAlloced++; *pImageVisuals = (XVisualInfo **) realloc(*pImageVisuals, (nImageVisualsAlloced * sizeof(XVisualInfo *))); pIVis = *pImageVisuals + (*numImageVisuals - 1); } *pIVis++ = pVis; } pVis++; } /* Return that the information was sucessfully obtained: */ return(0); } /* GetXVisualInfo() */ /****************************************************************************** * * FreeXVisualInfo() * * This routine frees the data that was allocated by GetXVisualInfo(). * ******************************************************************************/ void FreeXVisualInfo(XVisualInfo *pVisuals, OverlayInfo *pOverlayVisuals, XVisualInfo **pImageVisuals) { XFree(pVisuals); if (weCreateServerOverlayVisualsProperty) free(pOverlayVisuals); else XFree(pOverlayVisuals); free(pImageVisuals); } /* FreeXVisualInfo() */ x11-apps-7.7+5+nmu1ubuntu1/xeyes/0000775000000000000000000000000012656635743013347 5ustar x11-apps-7.7+5+nmu1ubuntu1/xeyes/xeyes.man0000664000000000000000000000336512167023104015163 0ustar .TH XEYES 1 __xorgversion__ .SH NAME xeyes \- a follow the mouse X demo .SH SYNOPSIS .B xeyes [-option ...] .SH DESCRIPTION .I Xeyes watches what you do and reports to the Boss. .SH OPTIONS .TP 8 .B \-fg \fIforeground color\fB choose a different color for the pupil of the eyes. .TP 8 .B \-bg \fIbackground color\fB choose a different color for the background. .TP 8 .B \-outline \fIoutline color\fB choose a different color for the outline of the eyes. .TP 8 .B \-center \fIcenter color\fB choose a different color for the center of the eyes. .TP 8 .B \-backing \fI{ WhenMapped Always NotUseful }\fB selects an appropriate level of backing store. .TP 8 .B \-geometry \fIgeometry\fB define the initial window geometry; see \fIX(__miscmansuffix__)\fP. .TP 8 .B \-display \fIdisplay\fB specify the display to use; see \fIX(__miscmansuffix__)\fP. .TP 8 .B \-bd \fIborder color\fB choose a different color for the window border. .TP 8 .B \-bw \fIborder width\fB choose a different width for the window border. .TP 8 .B \-shape uses the SHAPE extension to shape the window. This is the default. .TP 8 .B \+shape disables use of the SHAPE extension to shape the window. .TP 8 .B \-render uses Xrender to draw anti-aliased eyes. This is the default if \fIxeyes\fP has been compiled with Xrender support. .TP 8 .B \+render disables Xrender and draws traditional eyes. .TP 8 .B \-distance uses an alternative mapping, as if the eyes were set back from the screen, thus following the mouse more precisely. .SH "SEE ALSO" X(__miscmansuffix__), X Toolkit documentation .br See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHOR Keith Packard, MIT X Consortium .br Copied from the NeWS version written (apparently) by Jeremy Huxtable as seen at SIGGRAPH '88 x11-apps-7.7+5+nmu1ubuntu1/xeyes/eyes.bit0000664000000000000000000000245512167023104014775 0ustar #define eyes_width 48 #define eyes_height 32 #define eyes_x_hot 0 #define eyes_y_hot 0 static unsigned char eyes_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x1e, 0x00, 0x00, 0xfe, 0x01, 0x80, 0x7f, 0x00, 0x00, 0x87, 0x03, 0xc0, 0xe1, 0x00, 0x80, 0x01, 0x06, 0x60, 0x80, 0x01, 0xc0, 0x00, 0x0c, 0x30, 0x00, 0x03, 0x60, 0x00, 0x18, 0x18, 0x00, 0x06, 0x30, 0x00, 0x30, 0x0c, 0x00, 0x0c, 0x30, 0x00, 0x30, 0x0c, 0x00, 0x0c, 0x10, 0x00, 0x20, 0x04, 0x00, 0x08, 0x18, 0x00, 0x60, 0x06, 0x00, 0x18, 0x18, 0x00, 0x60, 0x06, 0x00, 0x18, 0x18, 0x00, 0x60, 0x06, 0x00, 0x18, 0x18, 0x00, 0x60, 0x06, 0x00, 0x18, 0x18, 0x00, 0x60, 0x06, 0x00, 0x18, 0x18, 0x00, 0x60, 0x06, 0x00, 0x18, 0x18, 0x80, 0x63, 0x06, 0x00, 0x18, 0x18, 0x80, 0x63, 0x06, 0xe0, 0x18, 0x18, 0x80, 0x63, 0x06, 0xe0, 0x18, 0x18, 0x00, 0x60, 0x06, 0xe0, 0x18, 0x18, 0x00, 0x20, 0x06, 0x00, 0x08, 0x10, 0x00, 0x30, 0x04, 0x00, 0x0c, 0x10, 0x00, 0x10, 0x04, 0x00, 0x04, 0x30, 0x00, 0x18, 0x0c, 0x00, 0x06, 0x60, 0x00, 0x08, 0x18, 0x00, 0x02, 0x40, 0x00, 0x0c, 0x10, 0x00, 0x03, 0xc0, 0x00, 0x06, 0x30, 0x80, 0x01, 0x80, 0x83, 0x03, 0xe0, 0xe0, 0x00, 0x00, 0xff, 0x01, 0xc0, 0x7f, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/xeyes/eyesmask.bit0000664000000000000000000000250112167023104015641 0ustar #define eyesmask_width 48 #define eyesmask_height 32 #define eyesmask_x_hot 0 #define eyesmask_y_hot 0 static unsigned char eyesmask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x1e, 0x00, 0x00, 0xfe, 0x01, 0x80, 0x7f, 0x00, 0x00, 0xff, 0x03, 0xc0, 0xff, 0x00, 0x80, 0xff, 0x07, 0xe0, 0xff, 0x01, 0xc0, 0xff, 0x0f, 0xf0, 0xff, 0x03, 0xe0, 0xff, 0x1f, 0xf8, 0xff, 0x07, 0xf0, 0xff, 0x3f, 0xfc, 0xff, 0x0f, 0xf0, 0xff, 0x3f, 0xfc, 0xff, 0x0f, 0xf0, 0xff, 0x3f, 0xfc, 0xff, 0x0f, 0xf8, 0xff, 0x7f, 0xfe, 0xff, 0x1f, 0xf8, 0xff, 0x7f, 0xfe, 0xff, 0x1f, 0xf8, 0xff, 0x7f, 0xfe, 0xff, 0x1f, 0xf8, 0xff, 0x7f, 0xfe, 0xff, 0x1f, 0xf8, 0xff, 0x7f, 0xfe, 0xff, 0x1f, 0xf8, 0xff, 0x7f, 0xfe, 0xff, 0x1f, 0xf8, 0xff, 0x7f, 0xfe, 0xff, 0x1f, 0xf8, 0xff, 0x7f, 0xfe, 0xff, 0x1f, 0xf8, 0xff, 0x7f, 0xfe, 0xff, 0x1f, 0xf8, 0xff, 0x7f, 0xfe, 0xff, 0x1f, 0xf8, 0xff, 0x3f, 0xfe, 0xff, 0x0f, 0xf0, 0xff, 0x3f, 0xfc, 0xff, 0x0f, 0xf0, 0xff, 0x1f, 0xfc, 0xff, 0x07, 0xf0, 0xff, 0x1f, 0xfc, 0xff, 0x07, 0xe0, 0xff, 0x0f, 0xf8, 0xff, 0x03, 0xc0, 0xff, 0x0f, 0xf0, 0xff, 0x03, 0xc0, 0xff, 0x07, 0xf0, 0xff, 0x01, 0x80, 0xff, 0x03, 0xe0, 0xff, 0x00, 0x00, 0xff, 0x01, 0xc0, 0x7f, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/xeyes/ChangeLog0000664000000000000000000003714312167023104015104 0ustar commit 72e65631bb3d3bb4f65b5d841ca5d409dff07e20 Author: Alan Coopersmith Date: Wed Nov 24 23:28:41 2010 -0800 xeyes 1.1.1 Signed-off-by: Alan Coopersmith commit cf26a29230cd3ccd79fc8c113dab12a47e244f7a Author: Alan Coopersmith Date: Sat Nov 20 17:33:52 2010 -0800 Make usage message fit into 80-column lines Signed-off-by: Alan Coopersmith commit f6a9256db2c463f73982c79378b563d92a6ff180 Author: Alan Coopersmith Date: Sat Nov 20 17:24:20 2010 -0800 Remove trailing whitespace Signed-off-by: Alan Coopersmith commit 906c634e85111deac379f0a8e664c933d31c97d8 Author: Alan Coopersmith Date: Mon Nov 8 23:35:55 2010 -0800 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS Regroup AC statements under the Autoconf initialization section. Regroup AM sttaements under the Automake initialization section. Add missing AC_CONFIG_SRCDIR Signed-off-by: Alan Coopersmith commit b24dce8f95cbed1a91a989a783eb1fdd36335bf1 Author: Alan Coopersmith Date: Mon Nov 8 23:34:03 2010 -0800 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now PKG_CONFIG_MODULES handles AC_SUBST of the CFLAGS & LIBS variables Signed-off-by: Alan Coopersmith commit 34ea83ac16ce3bc55aedd9d8e73e3d4a04bafdcc Author: Alan Coopersmith Date: Mon Nov 8 23:31:22 2010 -0800 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS Enables use of platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit a10b0c4b0445a2b4e12916ee0498db533fde86fd Author: Gaetan Nadon Date: Mon Nov 8 23:30:16 2010 -0800 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon Signed-off-by: Alan Coopersmith commit fcda75a70b29e1532a2a5f33058f3882bcad2642 Author: Jesse Adkins Date: Tue Sep 28 13:29:49 2010 -0700 Purge cvs tags. Signed-off-by: Jesse Adkins commit 2cbe4f83d4b24794679bda517573f907bb3de710 Author: Alan Coopersmith Date: Fri Aug 6 09:04:12 2010 -0700 Fill in COPYING file with copyright notices from source code Signed-off-by: Alan Coopersmith commit 96a593c4a221db4b31041e01053e907bedd60519 Author: Gaetan Nadon Date: Thu Feb 11 10:08:06 2010 -0500 config: move CWARNFLAGS from configure.ac to Makefile.am Compiler warning flags should be explicitly set in the makefile rather than being merged with other packages compiler flags. Signed-off-by: Gaetan Nadon commit a2c8bc28a57474cda77769292aabe1d9f73839a5 Author: James Cloos Date: Fri Dec 18 09:44:56 2009 -0500 xeyes 1.1.0 Signed-off-by: James Cloos commit e134d57ac54b77269252b7f73f0e84d08ded5212 Author: Gaetan Nadon Date: Thu Nov 26 09:19:53 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit 6e387e3329722dc9a09b481dbd15f441f39aa054 Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit 34ddbb1213cc4c061409cf6e3883683f6ed8dc92 Author: Gaetan Nadon Date: Tue Oct 27 15:07:24 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit d1c05b6bb985c00447b3eef598fc6c9b5a95134b Author: Gaetan Nadon Date: Mon Oct 26 22:08:38 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit 3195a5dc486e6daa2ed9754ffd7d2e12da7906a2 Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit 6054c8c98d25752492b57b8ad7fd1d3679d23369 Author: Jeremy Huddleston Date: Wed Oct 21 12:47:20 2009 -0700 This is not a GNU project, so declare it foreign. On Wed, 2009-10-21 at 13:36 +1000, Peter Hutterer wrote: > On Tue, Oct 20, 2009 at 08:23:55PM -0700, Jeremy Huddleston wrote: > > I noticed an INSTALL file in xlsclients and libXvMC today, and it > > was quite annoying to work around since 'autoreconf -fvi' replaces > > it and git wants to commit it. Should these files even be in git? > > Can I nuke them for the betterment of humanity and since they get > > created by autoreconf anyways? > > See https://bugs.freedesktop.org/show_bug.cgi?id=24206 As an interim measure, replace AM_INIT_AUTOMAKE([dist-bzip2]) with AM_INIT_AUTOMAKE([foreign dist-bzip2]). This will prevent the generation of the INSTALL file. It is also part of the 24206 solution. Signed-off-by: Jeremy Huddleston commit 59a5be39cdbddb070cd4e4758848fd08aa5910a4 Author: James Cloos Date: Mon Oct 5 18:08:17 2009 -0400 Bump version for second beta release. 1.0.991 as first beta of 1.1.0. (The first beta was meant to be 1.0.90 rather than 1.0.99. Having gotten that wrong, switch to three-digit release numbers for subsequent betas.) commit 610889785caf41146505458beccc5e3662c233db Author: Dylan Simon Date: Sun Oct 4 17:41:54 2009 -0400 New -distance mapping option Distance mapping makes more efficient use of eye space. Signed-off-by: Dylan Simon Signed-off-by: James Cloos commit dc0f730a4a49f0e436a0a915955997b07bbf56e0 Author: Dylan Simon Date: Sun Oct 4 17:39:07 2009 -0400 Cleanup and simplify calculation and drawing By transforming the eyes’s space when calculating where to place the pupils, the code effectively assumed that EYE_HEIGHT == EYE_WIDTH. Make this assumption explicit and remove calculations which are therefore unnecessary. Clean up related code and, consequently, reduced redraw time and tearing. Signed-off-by: Dylan Simon Signed-off-by: James Cloos commit 7cc3aa8ce30990e12e7b102f61dfcaaf8baa4d16 Author: Dylan Simon Date: Sun Oct 4 17:30:23 2009 -0400 Fix excessive redraw bug introduced by dbb8401026c421d64a2962e6ac6eb900f6dc141e Signed-off-by: Dylan Simon Signed-off-by: James Cloos commit 6d9fdcfb076f4c261b071cc5c454c8b9ce560e68 Author: James Cloos Date: Sat Oct 3 21:33:12 2009 -0400 Bump version for beta release. 1.0.99 as first beta of 1.1.0. Signed-off-by: James Cloos commit 41f604009c3c7b4a3d05311faa649c8152494700 Author: James Cloos Date: Sat Oct 3 21:28:59 2009 -0400 Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS Signed-off-by: James Cloos commit fd754c702c789f15ac1c0241e50dbb23aed354fc Author: Alan Coopersmith Date: Thu Oct 1 14:54:23 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit 5e825a140f4022b88dd7a1a20a9a01b653f1a95c Author: Dylan Simon Date: Sun Sep 27 14:44:35 2009 -0400 Add xrender support Optionally draw all components (except shape) with xrender. Enabled by default. Xlib rendering can be restored by "configure --without-xrender" or "xeyes +render". Signed-off-by: Dylan Simon Signed-off-by: James Cloos commit dbb8401026c421d64a2962e6ac6eb900f6dc141e Author: Peter Hutterer Date: Fri Jul 17 19:21:39 2009 +1000 Split drawing code into multiple functions. commit 85f1441378b47c01aa68dd1479850c4cd1c8eb72 Author: Peter Hutterer Date: Fri Jul 17 18:41:31 2009 +1000 Remove unused NUM_EYES define. Signed-off-by: Peter Hutterer commit e8bd6bcaf2cbe8306cc9a4821e8ea7a54a7e56a2 Author: Paulo Cesar Pereira de Andrade Date: Tue Jan 13 17:42:47 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings. commit 7e3208d263050d0ad4502f7d7d7d64d7ec84a4ad Author: Jeremy Huddleston Date: Thu Nov 27 22:46:49 2008 -0800 AM_CFLAGS instead of xeyes_CFLAGS to shut automake up commit 53488fad7ef10ff8c4835bcd497cd3980be38b7a Author: James Cloos Date: Thu Dec 6 16:37:12 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit ab449267ea2fcae6261e57f42bfb54d2205c470f Author: James Cloos Date: Mon Sep 3 05:51:21 2007 -0400 Add *~ to .gitignore to skip patch/emacs droppings commit 07dfa4cb3ff0c9a94bea85db0e571fbb2cfe9161 Author: James Cloos Date: Thu Aug 23 19:24:45 2007 -0400 Rename .cvsignore to .gitignore commit ecb2095318d7233e8cfa3a58626c31f770be6ee7 Author: Kevin E Martin Date: Wed Dec 21 02:29:49 2005 +0000 Update package version for X11R7 release. commit 3aae44d6b3c9332f73fbeacb39e9c928a2002164 Author: Adam Jackson Date: Mon Dec 19 16:22:43 2005 +0000 Stub COPYING files commit 41b039a4861154d82bdd3e6ea1b6697b16205b93 Author: Kevin E Martin Date: Thu Dec 15 00:24:06 2005 +0000 Update package version number for final X11R7 release candidate. commit bc99738464950416207d43a4a4db970bd0563d56 Author: Kevin E Martin Date: Tue Dec 6 22:48:21 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit 266b7244e16ec2f82bdfb1bd346951761e0d27e2 Author: Kevin E Martin Date: Sat Dec 3 05:49:20 2005 +0000 Update package version number for X11R7 RC3 release. commit 4298a74b61a6aa8ac36b2d820e147e44ab0f5e32 Author: Alan Coopersmith Date: Mon Nov 28 22:01:41 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit 69160791a057704e9a83794420d2349ae8bbbe1c Author: Eric Anholt Date: Mon Nov 21 10:35:00 2005 +0000 Another pass at .cvsignores for apps. commit ba6118981be2d3a058a08cd1621113cc8e4a42f8 Author: Eric Anholt Date: Sun Nov 20 22:08:52 2005 +0000 Add/improve .cvsignore files for apps. commit 6772ce855c078b40635ad62f47da741c037e05c5 Author: Kevin E Martin Date: Wed Oct 19 02:47:53 2005 +0000 Update package version number for RC1 release. commit 8001fd04f2d893e147b3b21fb4702c54e2919b1d Author: Alan Coopersmith Date: Mon Oct 17 23:56:22 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 1f61a27ce249d94b4be20db22cb84642a4d8a480 Author: Alan Coopersmith Date: Fri Oct 14 00:25:45 2005 +0000 Use sed to fill in variables in man page commit 79456c023b864e06b3ab3c6c93106772286b10ae Author: Alan Coopersmith Date: Mon Aug 1 20:25:29 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit 8119360377d17461578cfb26e07c98df6bbe560d Author: Kevin E Martin Date: Fri Jul 29 21:22:32 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit 9da2af8715937921c718733e309471f565614c99 Author: Kevin E Martin Date: Thu Jul 28 15:57:12 2005 +0000 Fix distcheck for remaining apps commit ae49bb18f5feab2b70e6faae046bb26058421d61 Author: Adam Jackson Date: Wed Jul 20 19:31:53 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit c903caebf875d510cbd1f720ccc02bd03250d7c6 Author: Søren Sandmann Pedersen Date: Fri Jul 1 18:07:18 2005 +0000 Xeyes build system commit 160c9f4f69bb2fd273c6223c7e4c6cda1523757f Author: Egbert Eich Date: Fri Apr 23 19:54:47 2004 +0000 Merging XORG-CURRENT into trunk commit 37db892d918e67bb13652d48f76d3da4c67f5d58 Author: Egbert Eich Date: Sun Mar 14 08:35:20 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit e1eda60fd5b4634652d0505a13a2516515d8ff88 Author: Egbert Eich Date: Wed Mar 3 12:13:05 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit f8eb90ffc747cd45db069212031e1e41c797d378 Author: Egbert Eich Date: Thu Feb 26 13:36:24 2004 +0000 readding XFree86's cvs IDs commit cd8a87f77a8ee8b4d29c34cc2066a840964fe3b8 Author: Egbert Eich Date: Thu Feb 26 09:24:07 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit bd6d337e78c95b6cd3d831f6e6ad44afc6595520 Author: Kaleb Keithley Date: Tue Nov 25 19:29:12 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit 2d36e110b8dbfa073bd533d7d0c720a4e51339a4 Author: Kaleb Keithley Date: Fri Nov 14 16:49:22 2003 +0000 XFree86 4.3.0.1 commit dfc0320568e5237fff45b3f7fb6f332d1bf5e9bf Author: Kaleb Keithley Date: Fri Nov 14 16:49:22 2003 +0000 Initial revision x11-apps-7.7+5+nmu1ubuntu1/xeyes/xeyes.c0000664000000000000000000001051412167023104014624 0ustar /* Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include "Eyes.h" #include #include #include "eyes.bit" #include "eyesmask.bit" /* Exit with message describing command line format */ static void usage(void) { fprintf(stderr, "usage: xeyes\n" " [-display [{host}]:[{vs}]]\n" " [-geometry [{width}][x{height}][{+-}{xoff}[{+-}{yoff}]]]\n" " [-fg {color}] [-bg {color}] [-bd {color}] [-bw {pixels}]\n" " [-shape | +shape] [-outline {color}] [-center {color}]\n" " [-backing {backing-store}] [-distance]\n"); #ifdef XRENDER fprintf(stderr, " [-render | +render]\n"); #endif exit(1); } /* Command line options table. Only resources are entered here...there is a pass over the remaining options after XtParseCommand is let loose. */ static XrmOptionDescRec options[] = { {"-outline", "*eyes.outline", XrmoptionSepArg, NULL}, {"-center", "*eyes.center", XrmoptionSepArg, NULL}, {"-backing", "*eyes.backingStore", XrmoptionSepArg, NULL}, {"-shape", "*eyes.shapeWindow", XrmoptionNoArg, "TRUE"}, {"+shape", "*eyes.shapeWindow", XrmoptionNoArg, "FALSE"}, #ifdef XRENDER {"-render", "*eyes.render", XrmoptionNoArg, "TRUE"}, {"+render", "*eyes.render", XrmoptionNoArg, "FALSE"}, #endif {"-distance", "*eyes.distance", XrmoptionNoArg, "TRUE"}, }; static Atom wm_delete_window; /*ARGSUSED*/ static void quit(Widget w, XEvent *event, String *params, Cardinal *num_params) { if (event->type == ClientMessage && event->xclient.data.l[0] != wm_delete_window) { XBell(XtDisplay(w), 0); } else { XtDestroyApplicationContext(XtWidgetToApplicationContext(w)); exit(0); } } static XtActionsRec actions[] = { {"quit", quit} }; int main(int argc, char **argv) { XtAppContext app_context; Widget toplevel; Arg arg[2]; Cardinal i; XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); toplevel = XtAppInitialize(&app_context, "XEyes", options, XtNumber(options), &argc, argv, NULL, arg, (Cardinal) 0); if (argc != 1) usage(); wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", False); XtAppAddActions(app_context, actions, XtNumber(actions)); XtOverrideTranslations (toplevel, XtParseTranslationTable ("WM_PROTOCOLS: quit()")); i = 0; XtSetArg (arg[i], XtNiconPixmap, XCreateBitmapFromData (XtDisplay(toplevel), XtScreen(toplevel)->root, (char *)eyes_bits, eyes_width, eyes_height)); i++; XtSetArg (arg[i], XtNiconMask, XCreateBitmapFromData (XtDisplay(toplevel), XtScreen(toplevel)->root, (char *)eyesmask_bits, eyesmask_width, eyesmask_height)); i++; XtSetValues (toplevel, arg, i); (void) XtCreateManagedWidget ("eyes", eyesWidgetClass, toplevel, NULL, 0); XtRealizeWidget (toplevel); (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel), &wm_delete_window, 1); XtAppMainLoop(app_context); return 0; } x11-apps-7.7+5+nmu1ubuntu1/xeyes/Eyes.h0000664000000000000000000000241612167023104014403 0ustar #ifndef _XtEyes_h #define _XtEyes_h /*********************************************************************** * * Eyes Widget * ***********************************************************************/ /* Parameters: Name Class RepType Default Value ---- ----- ------- ------------- background Background pixel White border BorderColor pixel Black borderWidth BorderWidth int 1 foreground Foreground Pixel Black outline Outline Pixel Black height Height int 120 mappedWhenManaged MappedWhenManaged Boolean True reverseVideo ReverseVideo Boolean False width Width int 120 x Position int 0 y Position int 0 */ #define XtNoutline "outline" #define XtNcenterColor "center" #define XtNshapeWindow "shapeWindow" #define XtCShapeWindow "ShapeWindow" #define XtNrender "render" #define XtNdistance "distance" enum EyesPart { PART_CLEAR = -1, PART_OUTLINE, PART_CENTER, PART_PUPIL, PART_SHAPE, PART_MAX }; typedef struct _EyesRec *EyesWidget; /* completely defined in EyesPrivate.h */ typedef struct _EyesClassRec *EyesWidgetClass; /* completely defined in EyesPrivate.h */ extern WidgetClass eyesWidgetClass; #endif /* _XtEyes_h */ /* DON'T ADD STUFF AFTER THIS #endif */ x11-apps-7.7+5+nmu1ubuntu1/xeyes/config.guess0000664000000000000000000012776412167023104015660 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. timestamp='2010-08-21' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' HUP INT TERM # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-tilera-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xeyes/Eyes.c0000664000000000000000000004175012167023104014402 0ustar /* Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * Eyes.c * * a widget which follows the mouse around */ #ifdef HAVE_CONFIG_H # include "config.h" #endif # include # include # include # include # include # include "EyesP.h" # include # include # include # include #if (defined(SVR4) || defined(SYSV) && defined(i386)) extern double hypot(double, double); #endif #define offset(field) XtOffsetOf(EyesRec, eyes.field) #define goffset(field) XtOffsetOf(WidgetRec, core.field) static XtResource resources[] = { {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), goffset(width), XtRImmediate, (XtPointer) 150}, {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), goffset(height), XtRImmediate, (XtPointer) 100}, {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), offset(pixel[PART_PUPIL]), XtRString, XtDefaultForeground}, {XtNoutline, XtCForeground, XtRPixel, sizeof(Pixel), offset(pixel[PART_OUTLINE]), XtRString, XtDefaultForeground}, {XtNcenterColor, XtCBackground, XtRPixel, sizeof (Pixel), offset(pixel[PART_CENTER]), XtRString, XtDefaultBackground}, {XtNreverseVideo, XtCReverseVideo, XtRBoolean, sizeof (Boolean), offset (reverse_video), XtRImmediate, (XtPointer) FALSE}, {XtNbackingStore, XtCBackingStore, XtRBackingStore, sizeof (int), offset (backing_store), XtRString, "default"}, {XtNshapeWindow, XtCShapeWindow, XtRBoolean, sizeof (Boolean), offset (shape_window), XtRImmediate, (XtPointer) TRUE}, #ifdef XRENDER {XtNrender, XtCBoolean, XtRBoolean, sizeof(Boolean), offset(render), XtRImmediate, (XtPointer) TRUE }, #endif {XtNdistance, XtCBoolean, XtRBoolean, sizeof(Boolean), offset(distance), XtRImmediate, (XtPointer) FALSE }, }; #undef offset #undef goffset # define EYE_X(n) ((n) * 2.0) # define EYE_Y(n) (0.0) # define EYE_OFFSET (0.1) /* padding between eyes */ # define EYE_THICK (0.175) /* thickness of eye rim */ # define BALL_DIAM (0.3) # define BALL_PAD (0.175) # define EYE_DIAM (2.0 - (EYE_THICK + EYE_OFFSET) * 2) # define BALL_DIST ((EYE_DIAM - BALL_DIAM) / 2.0 - BALL_PAD) # define W_MIN_X (-1.0 + EYE_OFFSET) # define W_MAX_X (3.0 - EYE_OFFSET) # define W_MIN_Y (-1.0 + EYE_OFFSET) # define W_MAX_Y (1.0 - EYE_OFFSET) # define TPOINT_NONE (-1000) /* special value meaning "not yet set" */ # define TPointEqual(a, b) ((a).x == (b).x && (a).y == (b).y) # define XPointEqual(a, b) ((a).x == (b).x && (a).y == (b).y) # define AngleBetween(A, A0, A1) (A0 <= A1 ? A0 <= A && A <= A1 : \ A0 <= A || A <= A1) static int delays[] = { 50, 100, 200, 400, 0 }; static void ClassInitialize(void) { XtAddConverter( XtRString, XtRBackingStore, XmuCvtStringToBackingStore, NULL, 0 ); } WidgetClass eyesWidgetClass = (WidgetClass) &eyesClassRec; /* ARGSUSED */ static void Initialize ( Widget greq, Widget gnew, ArgList args, Cardinal *num_args) { EyesWidget w = (EyesWidget)gnew; XtGCMask valuemask; XGCValues myXGCV; int shape_event_base, shape_error_base; #ifdef XRENDER enum EyesPart i; #endif /* * set the colors if reverse video; these are the colors used: * * background - paper white * foreground - text, ticks black * border - border black (foreground) * * This doesn't completely work since the parent has already made up a * border. Sigh. */ if (w->eyes.reverse_video) { Pixel fg = w->eyes.pixel[PART_PUPIL]; Pixel bg = w->core.background_pixel; if (w->core.border_pixel == fg) w->core.border_pixel = bg; if (w->eyes.pixel[PART_OUTLINE] == fg) w->eyes.pixel[PART_OUTLINE] = bg; if (w->eyes.pixel[PART_CENTER] == bg) w->eyes.pixel[PART_CENTER] = fg; w->eyes.pixel[PART_PUPIL] = bg; w->core.background_pixel = fg; } myXGCV.foreground = w->eyes.pixel[PART_PUPIL]; myXGCV.background = w->core.background_pixel; valuemask = GCForeground | GCBackground; w->eyes.gc[PART_PUPIL] = XtGetGC(gnew, valuemask, &myXGCV); myXGCV.foreground = w->eyes.pixel[PART_OUTLINE]; valuemask = GCForeground | GCBackground; w->eyes.gc[PART_OUTLINE] = XtGetGC(gnew, valuemask, &myXGCV); myXGCV.foreground = w->eyes.pixel[PART_CENTER]; myXGCV.background = w->eyes.pixel[PART_PUPIL]; valuemask = GCForeground | GCBackground; w->eyes.gc[PART_CENTER] = XtGetGC(gnew, valuemask, &myXGCV); w->eyes.update = 0; /* wait for Realize to add the timeout */ w->eyes.interval_id = 0; w->eyes.pupil[0].x = w->eyes.pupil[1].x = TPOINT_NONE; w->eyes.pupil[0].y = w->eyes.pupil[1].y = TPOINT_NONE; w->eyes.mouse.x = w->eyes.mouse.y = TPOINT_NONE; if (w->eyes.shape_window && !XShapeQueryExtension (XtDisplay (w), &shape_event_base, &shape_error_base)) w->eyes.shape_window = False; w->eyes.shape_mask = 0; w->eyes.gc[PART_SHAPE] = NULL; #ifdef XRENDER for (i = 0; i < PART_SHAPE; i ++) { XColor c; XRenderColor rc; c.pixel = w->eyes.pixel[i]; XQueryColor(XtDisplay (w), w->core.colormap, &c); rc.red = c.red; rc.green = c.green; rc.blue = c.blue; rc.alpha = -1; w->eyes.fill[i] = XRenderCreateSolidFill(XtDisplay (w), &rc); } #endif } static void drawEllipse(EyesWidget w, enum EyesPart part, double centerx, double centery, double oldx, double oldy, double diam) { const TRectangle tpos = { centerx - diam/2.0, centery - diam/2.0, diam, diam }; TRectangle pos; Trectangle(&w->eyes.t, &tpos, &pos); if (part == PART_CLEAR) { XFillRectangle(XtDisplay(w), XtWindow(w), w->eyes.gc[PART_CENTER], (int)pos.x, (int)pos.y, (int)pos.width+2, (int)pos.height+2); return; } #ifdef XRENDER if (w->eyes.render && part != PART_SHAPE && (!w->eyes.shape_window || part != PART_OUTLINE) && w->eyes.picture) { int n, i; double hd, c, s, sx, sy, x, y, px, py; XPointDouble *p; pos.x = pos.x + pos.width/2.0; pos.y = pos.y + pos.height/2.0; /* determine number of segments to draw */ hd = hypot(pos.width, pos.height)/2; n = (M_PI / acos(hd/(hd+1.0))) + 0.5; if (n < 2) n = 2; c = cos(M_PI/n); s = sin(M_PI/n); sx = -(pos.width*s)/pos.height; sy = (pos.height*s)/pos.width; n *= 2; p = Xmalloc(sizeof(*p)*n); if (!p) return; x = 0; y = pos.height/2.0; for (i = 0; i < n; i ++) { p[i].x = x + pos.x; p[i].y = y + pos.y; px = x; py = y; x = c*px + sx*py; y = c*py + sy*px; } if (oldx != TPOINT_NONE || oldy != TPOINT_NONE) drawEllipse(w, PART_CLEAR, oldx, oldy, TPOINT_NONE, TPOINT_NONE, diam); XRenderCompositeDoublePoly(XtDisplay(w), PictOpOver, w->eyes.fill[part], w->eyes.picture, XRenderFindStandardFormat(XtDisplay(w), PictStandardA8), 0, 0, 0, 0, p, n, 0); Xfree(p); return; } #endif if (oldx != TPOINT_NONE || oldy != TPOINT_NONE) drawEllipse(w, PART_CLEAR, oldx, oldy, TPOINT_NONE, TPOINT_NONE, diam); XFillArc(XtDisplay(w), part == PART_SHAPE ? w->eyes.shape_mask : XtWindow(w), w->eyes.gc[part], (int)(pos.x + 0.5), (int)(pos.y + 0.5), (int)(pos.width + 0.0), (int)(pos.height + 0.0), 90*64, 360*64); } static void eyeLiner(EyesWidget w, Boolean draw, int num) { drawEllipse(w, draw ? PART_OUTLINE : PART_SHAPE, EYE_X(num), EYE_Y(num), TPOINT_NONE, TPOINT_NONE, EYE_DIAM + 2.0*EYE_THICK); if (draw) { drawEllipse(w, PART_CENTER, EYE_X(num), EYE_Y(num), TPOINT_NONE, TPOINT_NONE, EYE_DIAM); } } static TPoint computePupil ( int num, TPoint mouse, const TRectangle *screen) { double cx, cy; double dist; double angle; double dx, dy; double cosa, sina; TPoint ret; cx = EYE_X(num); dx = mouse.x - cx; cy = EYE_Y(num); dy = mouse.y - cy; if (dx == 0 && dy == 0); else { angle = atan2 ((double) dy, (double) dx); cosa = cos (angle); sina = sin (angle); dist = BALL_DIST; if (screen) { /* use distance mapping */ double x0, y0, x1, y1; double a[4]; x0 = screen->x - cx; y0 = screen->y - cy; x1 = x0 + screen->width; y1 = y0 + screen->height; a[0] = atan2(y0, x0); a[1] = atan2(y1, x0); a[2] = atan2(y1, x1); a[3] = atan2(y0, x1); if (AngleBetween(angle, a[0], a[1])) { /* left */ dist *= dx / x0; } else if (AngleBetween(angle, a[1], a[2])) { /* bottom */ dist *= dy / y1; } else if (AngleBetween(angle, a[2], a[3])) { /* right */ dist *= dx / x1; } else if (AngleBetween(angle, a[3], a[0])) { /* top */ dist *= dy / y0; } if (dist > BALL_DIST) dist = BALL_DIST; } if (dist > hypot ((double) dx, (double) dy)) { cx += dx; cy += dy; } else { cx += dist * cosa; cy += dist * sina; } } ret.x = cx; ret.y = cy; return ret; } static void computePupils ( EyesWidget w, TPoint mouse, TPoint pupils[2]) { TRectangle screen, *sp = NULL; if (w->eyes.distance) { Window r, cw; int x, y; r = RootWindowOfScreen(w->core.screen); XTranslateCoordinates(XtDisplay(w), XtWindow(w), r, 0, 0, &x, &y, &cw); screen.x = Tx(-x, -y, &w->eyes.t); screen.y = Ty(-x, -y, &w->eyes.t); screen.width = Twidth (w->core.screen->width, w->core.screen->height, &w->eyes.t); screen.height = Theight(w->core.screen->width, w->core.screen->height, &w->eyes.t); sp = &screen; } pupils[0] = computePupil (0, mouse, sp); pupils[1] = computePupil (1, mouse, sp); } static void eyeBall(EyesWidget w, Boolean draw, TPoint *old, int num) { drawEllipse(w, draw ? PART_PUPIL : PART_CLEAR, w->eyes.pupil[num].x, w->eyes.pupil[num].y, old ? old->x : TPOINT_NONE, old ? old->y : TPOINT_NONE, BALL_DIAM); } static void repaint_window (EyesWidget w) { if (XtIsRealized ((Widget) w)) { eyeLiner (w, TRUE, 0); eyeLiner (w, TRUE, 1); computePupils (w, w->eyes.mouse, w->eyes.pupil); eyeBall (w, TRUE, NULL, 0); eyeBall (w, TRUE, NULL, 1); } } static void drawEye(EyesWidget w, TPoint newpupil, int num) { XPoint xnewpupil, xpupil; xpupil.x = Xx(w->eyes.pupil[num].x, w->eyes.pupil[num].y, &w->eyes.t); xpupil.y = Xy(w->eyes.pupil[num].x, w->eyes.pupil[num].y, &w->eyes.t); xnewpupil.x = Xx(newpupil.x, newpupil.y, &w->eyes.t); xnewpupil.y = Xy(newpupil.x, newpupil.y, &w->eyes.t); if ( #ifdef XRENDER w->eyes.picture ? !TPointEqual(w->eyes.pupil[num], newpupil) : #endif !XPointEqual(xpupil, xnewpupil)) { TPoint oldpupil = w->eyes.pupil[num]; w->eyes.pupil[num] = newpupil; eyeBall (w, TRUE, &oldpupil, num); } } static void drawEyes(EyesWidget w, TPoint mouse) { TPoint newpupil[2]; int num; if (TPointEqual (mouse, w->eyes.mouse)) { if (delays[w->eyes.update + 1] != 0) ++w->eyes.update; return; } computePupils (w, mouse, newpupil); for (num = 0; num < 2; num ++) { drawEye(w, newpupil[num], num); } w->eyes.mouse = mouse; w->eyes.update = 0; } static void draw_it_core(EyesWidget w) { Window rep_root, rep_child; int rep_rootx, rep_rooty; unsigned int rep_mask; int dx, dy; TPoint mouse; Display *dpy = XtDisplay (w); Window win = XtWindow (w); XQueryPointer (dpy, win, &rep_root, &rep_child, &rep_rootx, &rep_rooty, &dx, &dy, &rep_mask); mouse.x = Tx(dx, dy, &w->eyes.t); mouse.y = Ty(dx, dy, &w->eyes.t); drawEyes(w, mouse); } /* ARGSUSED */ static void draw_it ( XtPointer client_data, XtIntervalId *id) /* unused */ { EyesWidget w = (EyesWidget)client_data; if (XtIsRealized((Widget)w)) { draw_it_core(w); } w->eyes.interval_id = XtAppAddTimeOut(XtWidgetToApplicationContext((Widget) w), delays[w->eyes.update], draw_it, (XtPointer)w); } /* draw_it */ static void Resize (Widget gw) { EyesWidget w = (EyesWidget) gw; XGCValues xgcv; Widget parent; Display *dpy = XtDisplay (w); int x, y; if (XtIsRealized (gw)) { XClearWindow (dpy, XtWindow (w)); SetTransform (&w->eyes.t, 0, w->core.width, w->core.height, 0, W_MIN_X, W_MAX_X, W_MIN_Y, W_MAX_Y); #ifdef XRENDER if (w->eyes.picture) { XRenderFreePicture(dpy, w->eyes.picture); w->eyes.picture = 0; } #endif if (w->eyes.shape_window) { w->eyes.shape_mask = XCreatePixmap (dpy, XtWindow (w), w->core.width, w->core.height, 1); if (!w->eyes.gc[PART_SHAPE]) w->eyes.gc[PART_SHAPE] = XCreateGC (dpy, w->eyes.shape_mask, 0, &xgcv); XSetForeground (dpy, w->eyes.gc[PART_SHAPE], 0); XFillRectangle (dpy, w->eyes.shape_mask, w->eyes.gc[PART_SHAPE], 0, 0, w->core.width, w->core.height); XSetForeground (dpy, w->eyes.gc[PART_SHAPE], 1); eyeLiner (w, FALSE, 0); eyeLiner (w, FALSE, 1); x = y = 0; for (parent = (Widget) w; XtParent (parent); parent = XtParent (parent)) { x += parent->core.x + parent->core.border_width; x += parent->core.y + parent->core.border_width; } XShapeCombineMask (XtDisplay (parent), XtWindow (parent), ShapeBounding, x, y, w->eyes.shape_mask, ShapeSet); XFreePixmap (dpy, w->eyes.shape_mask); } #ifdef XRENDER if (w->eyes.render) { XRenderPictureAttributes pa; XRenderPictFormat *pf; pf = XRenderFindVisualFormat(dpy, DefaultVisualOfScreen(w->core.screen)); if (pf) w->eyes.picture = XRenderCreatePicture(dpy, XtWindow (w), pf, 0, &pa); } #endif } } static void Realize ( Widget gw, XtValueMask *valueMask, XSetWindowAttributes *attrs) { EyesWidget w = (EyesWidget)gw; if (w->eyes.backing_store != Always + WhenMapped + NotUseful) { attrs->backing_store = w->eyes.backing_store; *valueMask |= CWBackingStore; } XtCreateWindow( gw, (unsigned)InputOutput, (Visual *)CopyFromParent, *valueMask, attrs ); Resize (gw); w->eyes.interval_id = XtAppAddTimeOut(XtWidgetToApplicationContext(gw), delays[w->eyes.update], draw_it, (XtPointer)gw); } static void Destroy (Widget gw) { EyesWidget w = (EyesWidget)gw; int i; if (w->eyes.interval_id) XtRemoveTimeOut (w->eyes.interval_id); for (i = 0; i < PART_MAX; i ++) XtReleaseGC(gw, w->eyes.gc[i]); #ifdef XRENDER if (w->eyes.picture) XRenderFreePicture (XtDisplay(w), w->eyes.picture); #endif } /* ARGSUSED */ static void Redisplay( Widget gw, XEvent *event, Region region) { EyesWidget w; w = (EyesWidget) gw; w->eyes.pupil[0].x = TPOINT_NONE; w->eyes.pupil[0].y = TPOINT_NONE; w->eyes.pupil[1].x = TPOINT_NONE; w->eyes.pupil[1].y = TPOINT_NONE; (void) repaint_window ((EyesWidget)gw); } /* ARGSUSED */ static Boolean SetValues ( Widget current, Widget request, Widget new, ArgList args, Cardinal *num_args) { return( FALSE ); } EyesClassRec eyesClassRec = { { /* core fields */ /* superclass */ &widgetClassRec, /* class_name */ "Eyes", /* size */ sizeof(EyesRec), /* class_initialize */ ClassInitialize, /* class_part_initialize */ NULL, /* class_inited */ FALSE, /* initialize */ Initialize, /* initialize_hook */ NULL, /* realize */ Realize, /* actions */ NULL, /* num_actions */ 0, /* resources */ resources, /* num_resources */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, /* compress_exposure */ TRUE, /* compress_enterleave */ TRUE, /* visible_interest */ FALSE, /* destroy */ Destroy, /* resize */ Resize, /* expose */ Redisplay, /* set_values */ SetValues, /* set_values_hook */ NULL, /* set_values_almost */ NULL, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ NULL, /* query_geometry */ XtInheritQueryGeometry, } }; x11-apps-7.7+5+nmu1ubuntu1/xeyes/config.h.in0000664000000000000000000000323712656634663015377 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to use X Render Extension */ #undef XRENDER x11-apps-7.7+5+nmu1ubuntu1/xeyes/transform.c0000664000000000000000000000413412167023104015503 0ustar /* * transformed coordinate system objects for X */ # include # include # include # include "transform.h" #if 0 static XPoint * TranslatePoints (TPoint *points, int n_points, Transform *t, int mode) { XPoint *xpoints; int i; double xoff = 0.0, yoff = 0.0; xpoints = (XPoint *) malloc (n_points * sizeof (*xpoints)); if (!xpoints) return NULL; for (i = 0; i < n_points; i++) { xpoints[i].x = Xx(points[i].x + xoff, points[i].y + yoff, t); xpoints[i].y = Xy(points[i].x + xoff, points[i].y + yoff, t); if (mode == CoordModePrevious) { xoff += points[i].x; yoff += points[i].y; } } return xpoints; } static void TFillPolygon ( Display *dpy, Drawable d, GC gc, Transform *t, TPoint *points, int n_points, int shape, int mode) { XPoint *xpoints; xpoints = TranslatePoints (points, n_points, t, mode); if (xpoints) { XFillPolygon (dpy, d, gc, xpoints, n_points, shape, CoordModeOrigin); free (xpoints); } } static void TDrawArc ( Display *dpy, Drawable d, GC gc, Transform *t, double x, double y, double width, double height, int angle1, int angle2) { int xx, xy, xw, xh; xx = Xx(x,y,t); xy = Xy(x,y,t); xw = Xwidth (width, height, t); xh = Xheight (width, height, t); if (xw < 0) { xx += xw; xw = -xw; } if (xh < 0) { xy += xh; xh = -xh; } XDrawArc (dpy, d, gc, xx, xy, xw, xh, angle1, angle2); } #endif void Trectangle(const Transform *t, const TRectangle *i, TRectangle *o) { o->x = t->mx * i->x + t->bx; o->y = t->my * i->y + t->by; o->width = t->mx * i->width; o->height = t->my * i->height; if (o->width < 0) { o->x += o->width; o->width = -o->width; } if (o->height < 0) { o->y += o->height; o->height = -o->height; } } void SetTransform (Transform *t, int xx1, int xx2, int xy1, int xy2, double tx1, double tx2, double ty1, double ty2) { t->mx = ((double) xx2 - xx1) / (tx2 - tx1); t->bx = ((double) xx1) - t->mx * tx1; t->my = ((double) xy2 - xy1) / (ty2 - ty1); t->by = ((double) xy1) - t->my * ty1; } x11-apps-7.7+5+nmu1ubuntu1/xeyes/config.sub0000664000000000000000000010437612167023104015315 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. timestamp='2010-09-11' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile-* | tilegx-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; # This must be matched before tile*. tilegx*) basic_machine=tilegx-unknown os=-linux-gnu ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xeyes/Makefile.am0000664000000000000000000000361412167023104015362 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. bin_PROGRAMS = xeyes AM_CFLAGS = $(XEYES_CFLAGS) $(XRENDER_CFLAGS) $(CWARNFLAGS) xeyes_LDADD = $(XEYES_LIBS) $(XRENDER_LIBS) -lm xeyes_SOURCES = \ Eyes.c \ Eyes.h \ EyesP.h \ transform.c \ transform.h \ xeyes.c appman_PRE = \ xeyes.man EXTRA_DIST = eyes.bit eyesmask.bit appmandir = $(APP_MAN_DIR) appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) EXTRA_DIST += $(appman_PRE) MAINTAINERCLEANFILES = ChangeLog INSTALL CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xeyes/transform.h0000664000000000000000000000177212167023104015515 0ustar /* * header file for transformed coordinate system. No rotations * supported, as elipses cannot be rotated in X. */ typedef struct _transform { double mx, bx; double my, by; } Transform; typedef struct _TPoint { double x, y; } TPoint; typedef struct _TRectangle { double x, y, width, height; } TRectangle; # define Xx(x,y,t) ((int)((t)->mx * (x) + (t)->bx + 0.5)) # define Xy(x,y,t) ((int)((t)->my * (y) + (t)->by + 0.5)) # define Xwidth(w,h,t) ((int)((t)->mx * (w) + 0.5)) # define Xheight(w,h,t) ((int)((t)->my * (h) + 0.5)) # define Tx(x,y,t) ((((double) (x)) - (t)->bx) / (t)->mx) # define Ty(x,y,t) ((((double) (y)) - (t)->by) / (t)->my) # define Twidth(w,h,t) (((double) (w)) / (t)->mx) # define Theight(w,h,t) (((double) (h)) / (t)->my) extern void Trectangle (const Transform *t, const TRectangle *in, TRectangle *out); extern void SetTransform (Transform *t, int xx1, int xx2, int xy1, int xy2, double tx1, double tx2, double ty1, double ty2); x11-apps-7.7+5+nmu1ubuntu1/xeyes/configure.ac0000664000000000000000000000420012167023104015604 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xeyes], [1.1.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xeyes]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS # Checks for pkg-config packages PKG_CHECK_MODULES(XEYES, x11 xt xext xmu) dnl Optional dependencies AC_ARG_WITH(xrender, AC_HELP_STRING([--with-xrender],[Use Xrender for rendering (Default is YES)]),use_xrender="$withval",use_xrender="try") if test x$use_xrender != xno ; then PKG_CHECK_MODULES(XRENDER, [xrender >= 0.4]) AC_DEFINE([XRENDER],1,[Define to use X Render Extension]) fi AC_OUTPUT([Makefile]) x11-apps-7.7+5+nmu1ubuntu1/xeyes/README0000664000000000000000000000126212167023104014203 0ustar xeyes - a follow the mouse X demo, using the X SHAPE extension All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xeyes http://cgit.freedesktop.org/xorg/app/xeyes For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xeyes/COPYING0000664000000000000000000000237012167023104014357 0ustar Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. x11-apps-7.7+5+nmu1ubuntu1/xeyes/EyesP.h0000664000000000000000000000240412167023104014520 0ustar #ifndef _EyesP_h #define _EyesP_h #include "Eyes.h" #include #ifdef XRENDER #include #endif #include "transform.h" #define SEG_BUFF_SIZE 128 /* New fields for the eyes widget instance record */ typedef struct { Pixel pixel[PART_SHAPE]; GC gc[PART_MAX]; /* start of graph stuff */ int backing_store; /* backing store variety */ Boolean reverse_video; /* swap fg and bg pixels */ Boolean shape_window; /* use SetWindowShapeMask */ int update; /* current timeout index */ TPoint mouse; /* old mouse position */ TPoint pupil[2]; /* pupil position */ Transform t; Transform maskt; XtIntervalId interval_id; Pixmap shape_mask; /* window shape */ #ifdef XRENDER Boolean render; Picture picture; Picture fill[PART_SHAPE]; #endif Boolean distance; } EyesPart; /* Full instance record declaration */ typedef struct _EyesRec { CorePart core; EyesPart eyes; } EyesRec; /* New fields for the Eyes widget class record */ typedef struct {int dummy;} EyesClassPart; /* Full class record declaration. */ typedef struct _EyesClassRec { CoreClassPart core_class; EyesClassPart eyes_class; } EyesClassRec; /* Class pointer. */ extern EyesClassRec eyesClassRec; #endif /* _EyesP_h */ x11-apps-7.7+5+nmu1ubuntu1/xeyes/INSTALL0000664000000000000000000002622212167023104014357 0ustar Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 6. Often, you can also type `make uninstall' to remove the installed files again. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *Note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/ico/0000775000000000000000000000000012656635743012764 5ustar x11-apps-7.7+5+nmu1ubuntu1/ico/ico.c0000664000000000000000000011056212167023104013662 0ustar /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /****************************************************************************** * Description * Display a wire-frame rotating icosahedron, with hidden lines removed * * Arguments: * -r display on root window instead of creating a new one * (plus a host of others, try -help) *****************************************************************************/ /* Additions by jimmc@sci: * faces and colors * double buffering on the display * additional polyhedra * sleep switch */ /* * multi-thread version by Stephen Gildea, January 1992 */ /* Additions by Carlos A M dos Santos, XFree86 project, September 1999: * use of "q" to quit threads * support for ICCCM delete window message * better thread support - mutex and condition to control termination */ #ifdef HAVE_CONFIG_H #include "config.h" #include #ifdef XTHREADS # define MULTITHREAD #endif #endif /* HAVE_CONFIG_H / autoconf */ #include #include #include #include #include #include #include #ifdef MULTIBUFFER #include #endif /* MULTIBUFFER */ #ifdef MULTITHREAD #include #endif #include #define MIN_ICO_WIDTH 5 #define MIN_ICO_HEIGHT 5 #define DEFAULT_ICO_WIDTH 150 #define DEFAULT_ICO_HEIGHT 150 #define DEFAULT_DELTAX 13 #define DEFAULT_DELTAY 9 #include "polyinfo.h" /* define format of one polyhedron */ /* Now include all the files which define the actual polyhedra */ static Polyinfo polygons[] = { #include "allobjs.h" }; #define NumberPolygons sizeof(polygons)/sizeof(polygons[0]) #include #include /* for time_t */ #include /* for struct timeval */ typedef double Transform3D[4][4]; typedef struct { int prevX, prevY; unsigned long *plane_masks; /* points into dbpair.plane_masks */ unsigned long enplanemask; /* what we enable for drawing */ XColor *colors; /* size = 2 ** totalplanes */ unsigned long *pixels; /* size = 2 ** planesperbuf */ } DBufInfo; /* variables that need to be per-thread */ struct closure { /* these elements were originally in DBufPair, a struct type */ int planesperbuf; int pixelsperbuf; /* = 1<= 0; --i) { for (j = 3; j >= 0; --j) m[i][j] = 0.0; m[i][i] = 1.0; } } /****************************************************************************** * Description * Concatenate two 4-by-4 transformation matrices. * * Input * l multiplicand (left operand) * r multiplier (right operand) * * Output * *m Result matrix *****************************************************************************/ static void ConcatMat(Transform3D l, Transform3D r, Transform3D m) { int i; int j; for (i = 0; i < 4; ++i) for (j = 0; j < 4; ++j) m[i][j] = l[i][0] * r[0][j] + l[i][1] * r[1][j] + l[i][2] * r[2][j] + l[i][3] * r[3][j]; } /****************************************************************************** * Description * Format a matrix that will perform a rotation transformation * about the specified axis. The rotation angle is measured * counterclockwise about the specified axis when looking * at the origin from the positive axis. * * Input * axis Axis ('x', 'y', 'z') about which to perform rotation * angle Angle (in radians) of rotation * A Pointer to rotation matrix * * Output * *m Formatted rotation matrix *****************************************************************************/ static void FormatRotateMat(char axis, double angle, Transform3D m) { double s, c; IdentMat(m); s = sin(angle); c = cos(angle); switch (axis) { case 'x': m[1][1] = m[2][2] = c; m[1][2] = s; m[2][1] = -s; break; case 'y': m[0][0] = m[2][2] = c; m[2][0] = s; m[0][2] = -s; break; case 'z': m[0][0] = m[1][1] = c; m[0][1] = s; m[1][0] = -s; break; } } /****************************************************************************** * Description * Perform a partial transform on non-homogeneous points. * Given an array of non-homogeneous (3-coordinate) input points, * this routine multiplies them by the 3-by-3 upper left submatrix * of a standard 4-by-4 transform matrix. The resulting non-homogeneous * points are returned. * * Input * n number of points to transform * m 4-by-4 transform matrix * in array of non-homogeneous input points * * Output * *out array of transformed non-homogeneous output points *****************************************************************************/ static void PartialNonHomTransform(int n, Transform3D m, const Point3D *in, Point3D *out) { for (; n > 0; --n, ++in, ++out) { out->x = in->x * m[0][0] + in->y * m[1][0] + in->z * m[2][0]; out->y = in->x * m[0][1] + in->y * m[1][1] + in->z * m[2][1]; out->z = in->x * m[0][2] + in->y * m[1][2] + in->z * m[2][2]; } } /* * Unfortunately we can not use XWindowEvent and XCheckWindowEvent to get * ClientMessage events, because there is no corresponding event mask. We must * use XIfEvent and XCheckIfEvent and this function as a predicate. Better if * Xlib had some kind of XWindowAnyEvent and XCheckWindowEvent. -- Casantos. */ static Bool predicate(_X_UNUSED Display *display, XEvent *event, XPointer args) { Window w = (Window) args; return event->xany.window == w; } /****************************************************************************** * Description * Icosahedron animator. *****************************************************************************/ static void icoClearArea(struct closure *closure, int x, int y, int w, int h) { if (multibufext && dblbuf) return; if (dblbuf || dofaces) { XSetForeground(dpy, closure->gcontext, closure->drawbuf->pixels[0]); /* use background as foreground color for fill */ XFillRectangle(dpy,closure->win,closure->gcontext,x,y,w,h); } else { XClearArea(dpy,closure->win,x,y,w,h,0); } } /* Set up points, transforms, etc. */ static void initPoly(struct closure *closure, Polyinfo *poly, int icoW, int icoH) { Point3D *vertices = poly->v; int NV = poly->numverts; Transform3D r1; Transform3D r2; FormatRotateMat('x', 5 * 3.1416 / 180.0, r1); FormatRotateMat('y', 5 * 3.1416 / 180.0, r2); ConcatMat(r1, r2, closure->xform); memcpy((char *)closure->xv[0], (char *)vertices, NV * sizeof(Point3D)); closure->xv_buffer = 0; closure->wo2 = icoW / 2.0; closure->ho2 = icoH / 2.0; } static void setDrawBuf (struct closure *closure, int n) { XGCValues xgcv; unsigned long mask; #ifdef MULTIBUFFER if (multibufext && dblbuf) { closure->win = closure->multibuffers[n]; n = 0; } #endif /* MULTIBUFFER */ closure->drawbuf = closure->bufs+n; xgcv.foreground = closure->drawbuf->pixels[closure->pixelsperbuf-1]; xgcv.background = closure->drawbuf->pixels[0]; mask = GCForeground | GCBackground; if (dblbuf && !multibufext) { xgcv.plane_mask = closure->drawbuf->enplanemask; mask |= GCPlaneMask; } XChangeGC(dpy, closure->gcontext, mask, &xgcv); } static void setDisplayBuf(struct closure *closure, int n, #ifndef MULTIBUFFER _X_UNUSED #endif int firsttime) { #ifdef MULTIBUFFER if (multibufext && dblbuf) { XmbufDisplayBuffers (dpy, 1, &closure->multibuffers[n], msleepcount, 0); if (!firsttime) return; n = 0; } #endif closure->dpybuf = closure->bufs+n; if (closure->totalpixels > 2) XStoreColors(dpy,closure->cmap,closure->dpybuf->colors,closure->totalpixels); } static void setBufColor(struct closure *closure, int n, XColor *color) { int i,j,cx; DBufInfo *b; unsigned long pix; for (i=0; inplanesets; i++) { b = closure->bufs+i; for (j=0; j<(dblbuf&&!multibufext?closure->pixelsperbuf:1); j++) { cx = n + j*closure->pixelsperbuf; pix = b->colors[cx].pixel; b->colors[cx] = *color; b->colors[cx].pixel = pix; b->colors[cx].flags = DoRed | DoGreen | DoBlue; } } } /****************************************************************************** * Description * Undraw previous polyhedron (by erasing its bounding box). * Rotate and draw the new polyhedron. * * Input * poly the polyhedron to draw * gc X11 graphics context to be used for drawing * icoX, icoY position of upper left of bounding-box * icoW, icoH size of bounding-box * prevX, prevY position of previous bounding-box *****************************************************************************/ static void drawPoly(struct closure *closure, Polyinfo *poly, GC gc, int icoX, int icoY, int icoW, int icoH, int prevX, int prevY) { int *f = poly->f; int NV = poly->numverts; int NF = poly->numfaces; int p0; int p1; XPoint *pv2; XSegment *pe; Point3D *pxv; XPoint v2[MAXNV]; XSegment edges[MAXEDGES]; int i; int j,k; int *pf; int facecolor; int pcount; double pxvz; XPoint ppts[MAXEDGESPERPOLY]; /* Switch double-buffer and rotate vertices */ closure->xv_buffer = !closure->xv_buffer; PartialNonHomTransform(NV, closure->xform, closure->xv[!closure->xv_buffer], closure->xv[closure->xv_buffer]); /* Convert 3D coordinates to 2D window coordinates: */ pxv = closure->xv[closure->xv_buffer]; pv2 = v2; for (i = NV - 1; i >= 0; --i) { pv2->x = (int) ((pxv->x + 1.0) * closure->wo2) + icoX; pv2->y = (int) ((pxv->y + 1.0) * closure->ho2) + icoY; ++pxv; ++pv2; } /* Accumulate edges to be drawn, eliminating duplicates for speed: */ pxv = closure->xv[closure->xv_buffer]; pv2 = v2; pf = f; pe = edges; bzero(closure->drawn, sizeof(closure->drawn)); if (dblbuf) setDrawBuf(closure, closure->dbufnum); /* switch drawing buffers if double buffered */ /* for faces, need to clear before FillPoly */ if (dofaces && !(multibufext && dblbuf)) { /* multibuf uses update background */ if (dblbuf) icoClearArea(closure, closure->drawbuf->prevX - linewidth/2, closure->drawbuf->prevY - linewidth/2, icoW + linewidth + 1, icoH + linewidth + 1); icoClearArea(closure, prevX - linewidth/2, prevY - linewidth/2, icoW + linewidth + 1, icoH + linewidth + 1); } if (dsync) XSync(dpy, 0); for (i = NF - 1; i >= 0; --i, pf += pcount) { pcount = *pf++; /* number of edges for this face */ pxvz = 0.0; for (j=0; jdrawbuf->pixels[facecolor]); for (j=0; jwin, gc, ppts, pcount, Convex, CoordModeOrigin); } if (doedges) { for (j=0; jdrawn[p0][p1]) { closure->drawn[p0][p1] = 1; closure->drawn[p1][p0] = 1; pe->x1 = pv2[p0].x; pe->y1 = pv2[p0].y; pe->x2 = pv2[p1].x; pe->y2 = pv2[p1].y; ++pe; } } } } /* Erase previous, draw current icosahedrons; sync for smoothness. */ if (doedges) { if (dofaces) { XSetForeground(dpy, gc, closure->drawbuf->pixels[0]); /* use background as foreground color */ } else { if (dblbuf && !multibufext) icoClearArea(closure, closure->drawbuf->prevX - linewidth/2, closure->drawbuf->prevY - linewidth/2, icoW + linewidth + 1, icoH + linewidth + 1); if (!(multibufext && dblbuf)) icoClearArea(closure, prevX - linewidth/2, prevY - linewidth/2, icoW + linewidth + 1, icoH + linewidth + 1); if (dblbuf || dofaces) { XSetForeground(dpy, gc, closure->drawbuf->pixels[ closure->pixelsperbuf-1]); } } XDrawSegments(dpy, closure->win, gc, edges, pe - edges); } if (dsync) XSync(dpy, 0); if (dblbuf) { closure->drawbuf->prevX = icoX; closure->drawbuf->prevY = icoY; setDisplayBuf(closure, closure->dbufnum, 0); } if (dblbuf) closure->dbufnum = 1 - closure->dbufnum; if (!(multibufext && dblbuf) && msleepcount > 0) msleep(msleepcount); } static void initDBufs(struct closure *closure, unsigned long fg, unsigned long bg, int planesperbuf) { int i,j,jj,j0,j1,k,m,t; DBufInfo *b; XColor bgcolor, fgcolor; closure->nplanesets = (dblbuf && !multibufext ? 2 : 1); closure->planesperbuf = planesperbuf; closure->pixelsperbuf = 1<totalplanes = closure->nplanesets * planesperbuf; closure->totalpixels = 1<totalplanes; closure->plane_masks = (unsigned long *) xalloc(closure->totalplanes * sizeof(unsigned long)); closure->dbufnum = 0; for (i=0; i < closure->nplanesets; i++) { b = closure->bufs+i; b->plane_masks = closure->plane_masks + (i*planesperbuf); b->colors = (XColor *) xalloc(closure->totalpixels * sizeof(XColor)); b->pixels = (unsigned long *) xalloc(closure->pixelsperbuf * sizeof(unsigned long)); } if (closure->totalplanes == 1) { closure->pixels[0] = bg; closure->plane_masks[0] = fg ^ bg; } else { t = XAllocColorCells(dpy,closure->cmap,0, closure->plane_masks,closure->totalplanes, closure->pixels,1); /* allocate color planes */ if (t==0) { icoFatal("can't allocate enough color planes", NULL); } } fgcolor.pixel = fg; bgcolor.pixel = bg; XQueryColor(dpy,closure->cmap,&fgcolor); XQueryColor(dpy,closure->cmap,&bgcolor); setBufColor(closure, 0,&bgcolor); setBufColor(closure, 1,&fgcolor); for (i=0; inplanesets; i++) { b = closure->bufs+i; for (j0=0; j0<(dblbuf&&!multibufext?closure->pixelsperbuf:1); j0++) { for (j1=0; j1pixelsperbuf; j1++) { j = (j0<planesperbuf)|j1; if (i==0) jj=j; else jj= (j1<planesperbuf)|j0; b->colors[jj].pixel = closure->pixels[0]; for (k=0, m=j; m; k++, m=m>>1) { if (m&1) b->colors[jj].pixel ^= closure->plane_masks[k]; } b->colors[jj].flags = DoRed | DoGreen | DoBlue; } } b->prevX = b->prevY = 0; b->enplanemask = 0; for (j=0; jenplanemask |= b->plane_masks[j]; } for (j=0; jpixelsperbuf; j++) { b->pixels[j] = closure->pixels[0]; for (k=0, m=j; m; k++, m=m>>1) { if (m&1) b->pixels[j] ^= b->plane_masks[k]; } } } if (!(multibufext && dblbuf)) { setDrawBuf(closure, 0); XSetBackground(dpy, closure->gcontext, closure->bufs[0].pixels[0]); XSetWindowBackground(dpy, closure->draw_window, closure->bufs[0].pixels[0]); XSetPlaneMask(dpy, closure->gcontext, AllPlanes); icoClearArea(closure, 0, 0, closure->winW, closure->winH); /* clear entire window */ } } static void setBufColname(struct closure *closure, int n, const char *colname) { int t; XColor dcolor, color; t = XLookupColor(dpy,closure->cmap,colname,&dcolor,&color); if (t==0) { /* no such color */ icoFatal("no such color %s",colname); } setBufColor(closure, n,&color); } /* function to create and run an ico window */ static void * do_ico_window(void *ptr) { unsigned long fg, bg; XSetWindowAttributes xswa; XWindowAttributes xwa; XEvent xev; int icoX, icoY; unsigned long vmask; XGCValues xgcv; int initcolors = 0; int icoDeltaX = DEFAULT_DELTAX, icoDeltaY = DEFAULT_DELTAY; int icodeltax2, icodeltay2; Bool blocking = False; int winX, winY; int icoW = 0, icoH = 0; KeySym ksym; Bool do_it = True; char buf[20]; struct closure *closure = ptr; #ifdef MULTITHREAD int len; #endif #ifdef DEBUG printf("thread %x starting\n", xthread_self()); #endif closure->cmap = XDefaultColormap(dpy,DefaultScreen(dpy)); if (!closure->cmap) { icoFatal("no default colormap!", NULL); } fg = WhitePixel(dpy, DefaultScreen(dpy)); bg = BlackPixel(dpy, DefaultScreen(dpy)); if (background_colorname) { XColor cdef, igndef; if (XAllocNamedColor (dpy, closure->cmap, background_colorname, &cdef, &igndef)) bg = cdef.pixel; else icoFatal("background: no such color \"%s\"",background_colorname); } if (numcolors && (!dofaces || numcolors == 1)) { XColor cdef, igndef; if (XAllocNamedColor (dpy, closure->cmap, colornames[0], &cdef, &igndef)) fg = cdef.pixel; else icoFatal("face: no such color \"%s\"", colornames[0]); } if (invert) { unsigned long tmp = fg; fg = bg; bg = tmp; } /* Set up window parameters, create and map window if necessary */ if (useRoot) { closure->draw_window = DefaultRootWindow(dpy); winX = 0; winY = 0; closure->winW = DisplayWidth(dpy, DefaultScreen(dpy)); closure->winH = DisplayHeight(dpy, DefaultScreen(dpy)); } else { closure->winW = closure->winH = (multibufext&&dblbuf ? 300 : 600); winX = (DisplayWidth(dpy, DefaultScreen(dpy)) - closure->winW) >> 1; winY = (DisplayHeight(dpy, DefaultScreen(dpy)) - closure->winH) >> 1; if (geom) XParseGeometry(geom, &winX, &winY, (unsigned int *)&closure->winW, (unsigned int *)&closure->winH); xswa.event_mask = ExposureMask | StructureNotifyMask | KeyPressMask; xswa.background_pixel = bg; xswa.border_pixel = fg; closure->draw_window = XCreateWindow(dpy, DefaultRootWindow(dpy), winX, winY, closure->winW, closure->winH, 0, DefaultDepth(dpy, DefaultScreen(dpy)), InputOutput, DefaultVisual(dpy, DefaultScreen(dpy)), CWEventMask | CWBackPixel | CWBorderPixel, &xswa); #ifdef MULTITHREAD len = sprintf(buf, "Ico: thread %d", closure->thread_num); XChangeProperty(dpy, closure->draw_window, XA_WM_NAME, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, len); #else XChangeProperty(dpy, closure->draw_window, XA_WM_NAME, XA_STRING, 8, PropModeReplace, (unsigned char *)"Ico", 3); #endif (void) XSetWMProtocols (dpy, closure->draw_window, &wm_delete_window, 1); XMapWindow(dpy, closure->draw_window); #ifdef DEBUG printf("thread %x waiting for Expose\n", xthread_self()); #endif for (;;) { XIfEvent(dpy, &xev, predicate, (XPointer) closure->draw_window); if (xev.type == Expose) break; } #ifdef DEBUG printf("thread %x got Expose\n", xthread_self()); #endif if (XGetWindowAttributes(dpy,closure->draw_window,&xwa)==0) { icoFatal("cannot get window attributes (size)", NULL); } closure->winW = xwa.width; closure->winH = xwa.height; } if (ico_geom) XParseGeometry (ico_geom, &icoX, &icoY, (unsigned int *)&icoW, (unsigned int *)&icoH); if (icoW <= 0) icoW = DEFAULT_ICO_WIDTH; if (icoH <= 0) icoH = DEFAULT_ICO_HEIGHT; if (icoW < MIN_ICO_WIDTH) icoW = MIN_ICO_WIDTH; if (icoH < MIN_ICO_HEIGHT) icoH = MIN_ICO_HEIGHT; if (delta_geom) { unsigned int junk; XParseGeometry (delta_geom, &icoDeltaX, &icoDeltaY, &junk, &junk); if (icoDeltaX == 0 && icoDeltaY == 0) { icoDeltaX = DEFAULT_DELTAX; icoDeltaY = DEFAULT_DELTAY; } } closure->win = None; #ifdef MULTIBUFFER if (multibufext && dblbuf) { if (XmbufCreateBuffers (dpy, closure->draw_window, 2, update_action, MultibufferUpdateHintFrequent, closure->multibuffers) == 2) { XCopyArea (dpy, closure->draw_window, closure->multibuffers[1], DefaultGC(dpy, DefaultScreen(dpy)), 0, 0, closure->winW, closure->winH, 0, 0); closure->win = closure->multibuffers[1]; } else icoFatal ("unable to obtain 2 buffers", NULL); } #endif /* MULTIBUFFER */ if (closure->win == None) closure->win = closure->draw_window; /* Set up a graphics context */ vmask = (GCBackground | GCForeground | GCLineWidth); xgcv.background = bg; xgcv.foreground = fg; xgcv.line_width = linewidth; if (dash) { xgcv.line_style = LineDoubleDash; xgcv.dashes = dash; vmask |= (GCLineStyle | GCDashList); } closure->gcontext = XCreateGC (dpy, closure->draw_window, vmask, &xgcv); if (dofaces && numcolors>1) { int i,t,bits; bits = 0; for (t=numcolors; t; t=t>>1) bits++; initDBufs(closure, fg,bg,bits); /* don't set the background color */ for (i=0; iwinW - icoW) * (rand() & 0xFF)) >> 8; icoY = ((closure->winH - icoH) * (rand() & 0xFF)) >> 8; /* Bounce the box in the window */ icodeltax2 = icoDeltaX * 2; icodeltay2 = icoDeltaY * 2; initPoly(closure, poly, icoW, icoH); while (do_it) { int prevX; int prevY; Bool do_event; /* * This is not a good example of how to do event reading * in multi-threaded programs. More commonly there would * be one thread reading all events and dispatching them * to the appropriate thread. However, the threaded version * of ico was developed to test the MT Xlib implementation, * so it is useful to have it behave a little oddly. * For a discussion of how to write multi-threaded X programs, * see Gildea, S., "Multi-Threaded Xlib", The X Resource, * Issue 5, January 1993, pp. 159-166. */ if (blocking) { XIfEvent(dpy, &xev, predicate, (XPointer) closure->win); do_event = True; } else do_event = XCheckIfEvent(dpy, &xev, predicate, (XPointer) closure->win); if (do_event) { switch (xev.type) { case ConfigureNotify: #ifdef DEBUG printf("thread %x configure\n", xthread_self()); #endif if (xev.xconfigure.width != closure->winW || xev.xconfigure.height != closure->winH) icoX = icoY = 1; closure->winW = xev.xconfigure.width; closure->winH = xev.xconfigure.height; break; case KeyPress: #ifdef DEBUG printf("thread %x keypress\n", xthread_self()); #endif XLookupString(&xev.xkey, buf, 10, &ksym, NULL); do_it = ((ksym != XK_Q) && ksym != XK_q); break; case MapNotify: blocking = False; #ifdef DEBUG printf("thread %x unblocking\n", xthread_self()); #endif break; case UnmapNotify: blocking = True; #ifdef DEBUG printf("thread %x blocking\n", xthread_self()); #endif break; case ClientMessage: #ifdef DEBUG printf("thread %x message\n", xthread_self()); #endif if (xev.xclient.data.l[0] == wm_delete_window) do_it = False; else XBell (dpy, 0); continue; } } prevX = icoX; prevY = icoY; icoX += icoDeltaX; if (icoX < 0 || icoX + icoW > closure->winW) { icoX -= icodeltax2; icoDeltaX = - icoDeltaX; icodeltax2 = icoDeltaX * 2; } icoY += icoDeltaY; if (icoY < 0 || icoY + icoH > closure->winH) { icoY -= icodeltay2; icoDeltaY = - icoDeltaY; icodeltay2 = icoDeltaY * 2; } drawPoly(closure, poly, closure->gcontext, icoX, icoY, icoW, icoH, prevX, prevY); } XDestroyWindow(dpy, closure->win); #ifdef MULTITHREAD xmutex_lock(&count_mutex); thread_count--; if (thread_count == 0) { xcondition_broadcast(&count_cond); } xmutex_unlock(&count_mutex); #endif return NULL; } /****************************************************************************** * Description * Main routine. Process command-line arguments, then bounce a bounding * box inside the window. Call DrawIco() to redraw the icosahedron. *****************************************************************************/ static void giveObjHelp(void) { int i; Polyinfo *poly; printf("%-16s%-12s #Vert. #Edges #Faces %-16s\n", "Name", "ShortName", "Dual"); for (i=0; ilongname, poly->shortname, poly->numverts, poly->numedges, poly->numfaces, poly->dual); } } static Polyinfo * findpoly(const char *name) { int i; Polyinfo *poly; for (i=0; ilongname)==0 || strcmp(name,poly->shortname)==0) return poly; } icoFatal("can't find object %s", name); } int main(int argc, const char **argv) { const char *display = NULL; #ifdef MULTIBUFFER int mbevbase, mberrbase; #endif #ifdef MULTITHREAD int nthreads = 1; /* -threads: number of windows */ int i; #endif struct closure *closure; ProgramName = argv[0]; /* Process arguments: */ poly = findpoly("icosahedron"); /* default */ for (argv++, argc--; argc > 0; argv++, argc--) { if (!strcmp (*argv, "-display")) { if (argc < 2) icoFatal("missing argument for %s", *argv); display = *++argv; argc--; } else if (!strncmp (*argv, "-g", 2)) { if (argc < 2) icoFatal("missing argument for %s", *argv); geom = *++argv; argc--; } else if (!strcmp(*argv, "-r")) useRoot = 1; else if (!strcmp (*argv, "-d")) { if (argc < 2) icoFatal("missing argument for %s", *argv); dash = atoi(*++argv); argc--; } #ifdef MULTITHREAD else if (!strcmp(*argv, "-threads")) { if (argc < 2) icoFatal("missing argument for %s", *argv); nthreads = atoi(*++argv); argc--; } #endif else if (!strcmp(*argv, "-colors")) { if (argc < 2) icoFatal("missing argument for %s", *argv); colornames = ++argv; argc--; numcolors = 0; for ( ; argc > 0 && argv[0][0]!='-'; argv++, argc--, numcolors++) ; argv--; argc++; } else if (!strcmp (*argv, "-copy")) { #ifdef MULTIBUFFER update_action = MultibufferUpdateActionCopied; #endif } else if (!strcmp (*argv, "-untouched")) { #ifdef MULTIBUFFER update_action = MultibufferUpdateActionUntouched; #endif } else if (!strcmp (*argv, "-undefined")) { #ifdef MULTIBUFFER update_action = MultibufferUpdateActionUndefined; #endif } else if (!strcmp (*argv, "-lw")) { if (argc < 2) icoFatal("missing argument for %s", *argv); linewidth = atoi(*++argv); argc--; } else if (!strcmp (*argv, "-dbl")) { dblbuf = 1; #ifdef MULTIBUFFER multibufext = 1; #endif } else if (!strcmp(*argv, "-softdbl")) { dblbuf = 1; multibufext = 0; } else if (!strncmp(*argv, "-p", 2)) { numcolors = atoi(argv[0]+2); if (numcolors < 1 || numcolors > NumberPrimaries) numcolors = NumberPrimaries; colornames = Primaries; dofaces = 1; } else if (!strcmp(*argv, "-bg")) { if (argc < 2) icoFatal("missing argument for %s", *argv); background_colorname = *++argv; argc--; } else if (!strcmp(*argv, "-noedges")) doedges = 0; else if (!strcmp(*argv, "-faces")) dofaces = 1; else if (!strcmp(*argv, "-i")) invert = 1; else if (!strcmp(*argv, "-size")) { if (argc < 2) icoFatal("missing argument for %s", *argv); ico_geom = *++argv; argc--; } else if (!strcmp(*argv, "-delta")) { if (argc < 2) icoFatal("missing argument for %s", *argv); delta_geom = *++argv; argc--; } else if (!strcmp (*argv, "-sleep")) { float f; if (argc < 2) icoFatal("missing argument for %s", *argv); if (sscanf (*++argv, "%f", &f) < 1) icoFatal("invalid argument for %s", argv[-1]); msleepcount = (int) (f * 1000.0); argc--; } else if (!strcmp (*argv, "-obj")) { if (argc < 2) icoFatal("missing argument for %s", *argv); poly = findpoly(*++argv); argc--; } else if (!strcmp(*argv, "-dsync")) dsync = 1; else if (!strncmp(*argv, "-sync", 5)) xsync = 1; else if (!strcmp(*argv, "-objhelp")) { giveObjHelp(); exit(1); } else { /* unknown arg */ const char **cpp; fprintf (stderr, "usage: %s [options]\n\n", ProgramName); for (cpp = help_message; *cpp; cpp++) fprintf (stderr, "%s\n", *cpp); exit (1); } } if (!dofaces && !doedges) icoFatal("nothing to draw", NULL); #ifdef MULTITHREAD XInitThreads(); #endif if (!(dpy = XOpenDisplay(display))) icoFatal("cannot open display \"%s\"", XDisplayName(display)); wm_delete_window = XInternAtom (dpy, "WM_DELETE_WINDOW", False); if (xsync) XSynchronize(dpy, True); #ifdef MULTIBUFFER if (multibufext && !XmbufQueryExtension (dpy, &mbevbase, &mberrbase)) { multibufext = 0; } #endif #ifdef MULTITHREAD #ifndef XMUTEX_INITIALIZER xmutex_init(&count_mutex); #endif xcondition_init(&count_cond); /* start all threads here */ thread_count = nthreads; for (i=1; i <= nthreads; i++) { closure = (struct closure *) xalloc(sizeof(struct closure)); closure->thread_num = i; xthread_fork(do_ico_window, closure); } /* wait until all theads terminate */ xmutex_lock(&count_mutex); xcondition_wait(&count_cond, &count_mutex); xmutex_unlock(&count_mutex); #else /* start the animation */ closure = (struct closure *) xalloc(sizeof(struct closure)); do_ico_window(closure); #endif XCloseDisplay(dpy); return 0; } x11-apps-7.7+5+nmu1ubuntu1/ico/objplane.h0000664000000000000000000000141112167023104014677 0ustar /* objplane.h - structure values for plane */ { "plane", "plane", /* long and short names */ "cube", /* long name of dual */ 4, 4, 1, /* number of vertices, edges, and faces */ { /* vertices (x,y,z) */ /* all points must be within radius 1 of the origin */ #define T 1.0 { T, 0, 0 }, { -T, 0, 0 }, { 0, T, 0 }, { 0, -T, 0 }, #undef T }, { /* faces (numfaces + indexes into vertices) */ /* faces must be specified clockwise from the outside */ 4, 0, 2, 1, 3, } }, /* leave a comma to separate from the next include file */ /* end */ x11-apps-7.7+5+nmu1ubuntu1/ico/ChangeLog0000664000000000000000000004016112167023104014513 0ustar commit 0c5f08dee87e0453e3263f8aa5ca545a0a03353e Author: Alan Coopersmith Date: Tue Jan 15 18:19:49 2013 -0800 ico 1.0.4 Signed-off-by: Alan Coopersmith commit d065113b4fadbb674e6e6f2a7681105f4f0212d3 Author: Alan Coopersmith Date: Thu Jan 3 20:06:17 2013 -0800 Fix some 64-bit vs. 32-bit conversion errors ico.c:851:7: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] fg = WhitePixel(dpy, DefaultScreen(dpy)); ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ico.c:852:7: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] bg = BlackPixel(dpy, DefaultScreen(dpy)); ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ico.c:858:18: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] bg = cdef.pixel; ~ ~~~~~^~~~~ ico.c:866:18: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] fg = cdef.pixel; ~ ~~~~~^~~~~ ico.c:874:11: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] bg = tmp; Signed-off-by: Alan Coopersmith commit 99ca5c8deb4a3ebd4b2a7e64bd64ca9a91b6680c Author: Alan Coopersmith Date: Thu Jan 3 19:51:06 2013 -0800 Mark a couple parameters as unused to silence compiler warnings ico.c:436:20: warning: unused parameter 'display' [-Wunused-parameter] predicate(Display *display, XEvent *event, XPointer args) ico.c:511:51: warning: unused parameter 'firsttime' [-Wunused-parameter] setDisplayBuf(struct closure *closure, int n, int firsttime) Signed-off-by: Alan Coopersmith commit 94c5e76c2d1043a835b0872f78902ebdfc3c5492 Author: Alan Coopersmith Date: Tue Jun 5 17:50:45 2012 -0700 Add const qualifiers to fix gcc -Wwrite-strings warnings Signed-off-by: Alan Coopersmith commit 83a7600ae9dbe8b2ca0f9199222245792fb8c0d6 Author: Alan Coopersmith Date: Tue Jun 7 23:59:41 2011 -0700 Replace local checks for gcc with _X_NORETURN from xproto 7.0.17 Also declare icoFatal as static since it's only used in this one file. Signed-off-by: Alan Coopersmith Reviewed-by: Mark Kettenis Reviewed-by: Cyril Brulebois commit 7abead5688c1958822e3084a5c9854eb52ac58ec Author: Gaetan Nadon Date: Wed Jan 19 10:06:55 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 9d266c12261d32d2e3ceb167b16f6867e9ccc5fa Author: Gaetan Nadon Date: Wed Jan 12 16:28:02 2011 -0500 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS This silences an Autoconf warning commit 849d04b09a12e51fb4e17269e2e3a61ce205a014 Author: Alan Coopersmith Date: Sat Oct 30 13:11:36 2010 -0700 ico 1.0.3 Signed-off-by: Alan Coopersmith commit 9ac61910d314a548176a96565f29d986cae7f8b0 Author: Alan Coopersmith Date: Sat Oct 30 13:10:33 2010 -0700 Purge CVS version tags Signed-off-by: Alan Coopersmith commit 4a3421c6cb3e8571c07156e6756fd3d537978b42 Author: Alan Coopersmith Date: Sat Oct 30 13:09:38 2010 -0700 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now PKG_CONFIG_MODULES handles AC_SUBST of the CFLAGS & LIBS variables Signed-off-by: Alan Coopersmith commit 1a36145e7a8d11b4d80688c942427cfc48c63272 Author: Alan Coopersmith Date: Sat Oct 30 13:09:06 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS The existing statement can now be removed from the configuration file. Use automake provided $(AM_V_GEN) and XORG_DEFAULT_OPTIONS provided $(SED) Enables silent rule and use platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit 1e579cb7be71750e1d1fba0eaed58bc3bd428024 Author: Gaetan Nadon Date: Sat Oct 30 13:07:01 2010 -0700 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon Signed-off-by: Alan Coopersmith commit dc14f85015ed4f8ad1dd9456f3daa59d1b0edddf Author: Gaetan Nadon Date: Thu Feb 11 10:08:06 2010 -0500 config: move CWARNFLAGS from configure.ac to Makefile.am Compiler warning flags should be explicitly set in the makefile rather than being merged with other packages compiler flags. Signed-off-by: Gaetan Nadon commit 1decffa0f6fad067770c5b4de5a112993951f099 Author: Gaetan Nadon Date: Thu Nov 26 09:19:52 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit dbb254953e81d445e62ead7fddad9ebcbb068cb7 Author: Gaetan Nadon Date: Wed Oct 28 14:09:07 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit ae203a1bfd75964cc6b0ce95b702ec7e97eafc91 Author: Gaetan Nadon Date: Tue Oct 27 15:07:24 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit e641baa6ffa24aec30fd773606b61b4895dbadd9 Author: Gaetan Nadon Date: Mon Oct 26 22:08:38 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit bf4388c86ae8a7ce8e6471f272d299d353ce77a5 Author: Gaetan Nadon Date: Thu Oct 22 12:34:14 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit ea16526cf2fa968a47715cee48d60d3a0e925094 Author: Alan Coopersmith Date: Thu Oct 1 14:54:17 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit 5ca33a50e4a643b8ed7a525e39ecec9b34f1900a Author: Jens Stroebel Date: Wed Jan 14 06:23:35 2009 -0800 Correcting a typo in configure.ac preventing the Xorg headers from being found Signed-off-by: Dan Nicholson commit 874f71ca6bb7134d1b9172a28bda6146dd2c608e Author: Paulo Cesar Pereira de Andrade Date: Mon Jan 12 18:20:06 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings. Note that "ico" appears to be broken, and only work with the -r option, that causes it to not use XThreads, and only draw in the root screen (with "-threads 1" option, the default, it still use XThreads). commit c0227e77a62a422332edda6c8d8113fb4980ac7d Author: Keith Packard Date: Sat Oct 11 21:19:00 2008 -0700 Make sure each thread sees its expose event. Having a thread call XNextEvent may cause other threads to miss their initial expose event, blocking them for a long time. Use the existing predicate function and XIfEvent to wait for precisely the right expose event. Signed-off-by: Keith Packard commit 11308c41fe4c1bf99a6654fca294f3e098075a33 Author: Alan Coopersmith Date: Fri Jul 20 16:28:38 2007 -0700 Version bump: 1.0.2 commit 255c8078a0edfc289e434ba769fd50e05ab72ad2 Author: Alan Coopersmith Date: Fri Jul 20 16:17:31 2007 -0700 Fill in COPYING stub with copyright & licenses from source files commit 5a51d7e1db3694e41d55bc02208f3fa1b736e951 Author: Alan Coopersmith Date: Fri Jul 20 16:14:34 2007 -0700 Replace static changelog with dist-hook to generate from git log commit e7a16eb488b591af57561799525891be5030bf25 Author: Alan Coopersmith Date: Fri Jul 20 16:10:58 2007 -0700 Change ico_CFLAGS to AM_CFLAGS to stop automake-1.10 warning Makefile.am:27: compiling `ico.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.ac' commit e3146e963d7bf333d0e01d9d556d6c8be722898d Author: Alan Coopersmith Date: Wed Apr 11 15:37:10 2007 -0700 renamed: .cvsignore -> .gitignore commit db38b36c535baeda5bdc8a873b32f678e7df8e36 Author: Alan Coopersmith Date: Wed Apr 11 15:36:16 2007 -0700 Bug #10616: Man page typo: s/TREMINATION/TERMINATION/ X.Org Bugzilla #10616 Reported upstream from Debian Bug #395445 commit 366924f71f6e5db3641bc350a07d37f64fe6ea08 Author: Kevin E Martin Date: Wed Dec 21 02:29:42 2005 +0000 Update package version for X11R7 release. commit 82481ae9b8335ae924b4341d194c4f0ed51f1f03 Author: Adam Jackson Date: Mon Dec 19 16:22:40 2005 +0000 Stub COPYING files commit 52ad0990a0f63ef8601c56b3937afba0a511b376 Author: Kevin E Martin Date: Thu Dec 15 00:24:02 2005 +0000 Update package version number for final X11R7 release candidate. commit 22bef66811d55607c096b0e015fb91e31c3043c6 Author: Kevin E Martin Date: Tue Dec 6 22:48:16 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit f8a8eb25e339b5ae58c0bd6b9068338488d3be22 Author: Kevin E Martin Date: Sat Dec 3 05:49:16 2005 +0000 Update package version number for X11R7 RC3 release. commit 8e79cdd0c53ab420fa3b69003762d2d1ebfa0273 Author: Alan Coopersmith Date: Mon Nov 28 22:01:37 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit 3c4e96626a4fcc4df45bced95c44c5e99e605537 Author: Eric Anholt Date: Mon Nov 21 10:34:55 2005 +0000 Another pass at .cvsignores for apps. commit 3cb8504ab547357b6b538e1ffbb3000b5cc0b8e7 Author: Eric Anholt Date: Sun Nov 20 22:08:48 2005 +0000 Add/improve .cvsignore files for apps. commit 02b2de700f25d3be621d560b3042f7a7a89369e6 Author: Kevin E Martin Date: Wed Nov 9 21:09:19 2005 +0000 Update package version number for X11R7 RC2 release. commit 703edae088fb7bb409dbdb58d111ed9e4c31cf78 Author: Kean Johnson Date: Tue Nov 8 06:33:31 2005 +0000 See ChangeLog entry 2005-11-07 for details. commit fe9efd5cd0703005da9ceb55f59d376ba0b01226 Author: Kevin E Martin Date: Wed Oct 19 02:47:48 2005 +0000 Update package version number for RC1 release. commit 7ad280349d00bb52201dc43c21ac097ec97132dc Author: Alan Coopersmith Date: Mon Oct 17 23:56:19 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit cd8ac3431f4b2c6a8fad1031bf34d894fb6398ae Author: Alan Coopersmith Date: Fri Oct 14 00:25:41 2005 +0000 Use sed to fill in variables in man page commit a0f44d19aa84965a31303fd39f05631665fd7e37 Author: Adam Jackson Date: Wed Aug 17 19:49:17 2005 +0000 Get xthreadlib variable from Xlib. Bump to 0.99.1. commit 19fd5758771d31d13cc483cf80adafa3bf530132 Author: Alan Coopersmith Date: Sat Aug 13 02:13:30 2005 +0000 Update for modularization: include & , use XTHREADS define from XlibConf.h to enable multithreading Also ansify icoFatal prototype to clear Sun cc warnings. commit 979aa90d7b94494ce365b9dc3cf724a3f91f8598 Author: Alan Coopersmith Date: Mon Aug 1 20:25:27 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit 25ac536b836c2772784bd13b543d538a2673fb4c Author: Kevin E Martin Date: Fri Jul 29 21:22:29 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit 5c31a07dbcb735445951f7f7cae8579ee16262d5 Author: Adam Jackson Date: Wed Jul 20 19:31:48 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit 9e0555e9d980217dd20d1f7385ff47514675629c Author: Søren Sandmann Pedersen Date: Tue Jun 28 15:00:13 2005 +0000 Check in build system for ico commit 6a904d00db84e235ea2b0073fbcd078f8a96c9c2 Author: Egbert Eich Date: Fri Apr 23 19:54:33 2004 +0000 Merging XORG-CURRENT into trunk commit caf6767501c8176c02702e441ab422ced4ea5033 Author: Egbert Eich Date: Sun Mar 14 08:34:51 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit 81bd81a192d3e6cc4e8ac744d6f9dd844013c3de Author: Egbert Eich Date: Wed Mar 3 12:12:52 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit 0fe04de86a907b549e143b27ff5c16887ec7de2a Author: Egbert Eich Date: Thu Feb 26 13:36:15 2004 +0000 readding XFree86's cvs IDs commit dcd8f0f0b566a45609145651ae0c6d2cbed6bfc7 Author: Egbert Eich Date: Thu Feb 26 09:23:54 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit 996d4a49a21986ae0a8d3f4f047aa71422727925 Author: Kaleb Keithley Date: Tue Nov 25 19:29:02 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit c3b5b1a77685345b857f858fa3c226ec4a826414 Author: Kaleb Keithley Date: Fri Nov 14 16:48:57 2003 +0000 XFree86 4.3.0.1 commit 352df17fc71405e7bc36559ee8a72e21d7a5694a Author: Kaleb Keithley Date: Fri Nov 14 16:48:57 2003 +0000 Initial revision x11-apps-7.7+5+nmu1ubuntu1/ico/allobjs.h0000664000000000000000000000015012167023104014532 0ustar #include "objcube.h" #include "objico.h" #include "objocta.h" #include "objpyr.h" #include "objplane.h" x11-apps-7.7+5+nmu1ubuntu1/ico/objpyr.h0000664000000000000000000000214312167023104014415 0ustar /* objpyr.h - structure values for pyramid */ { "pyramid", "pyramid", /* long and short names */ "cube", /* long name of dual */ 5, 8, 5, /* number of vertices, edges, and faces */ { /* vertices (x,y,z) */ /* all points must be within radius 1 of the origin */ #define T 1.0 { T, 0, 0 }, { -T, 0, 0 }, { 0, T, 0 }, { 0, -T, 0 }, { 0, 0, T }, /* { 0, 0, -T }, */ #undef T }, { /* faces (numfaces + indexes into vertices) */ /* faces must be specified clockwise from the outside */ 3, 0, 4, 2, /* 3, 0, 2, 5, */ /* 3, 0, 5, 3, */ 3, 0, 3, 4, 3, 1, 2, 4, /* 3, 1, 5, 2, */ /* 3, 1, 3, 5, */ 3, 1, 4, 3, 4, 0, 2, 1, 3, } }, /* leave a comma to separate from the next include file */ /* end */ x11-apps-7.7+5+nmu1ubuntu1/ico/config.guess0000775000000000000000000012704512167023104015270 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011 Free Software Foundation, Inc. timestamp='2011-11-11' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo hexagon-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/ico/objcube.h0000664000000000000000000000133312167023104014521 0ustar /* objcube.h - structure values for cube */ { "cube", "cube", /* long and short names */ "octahedron", /* long name of dual */ 8, 12, 6, /* number of vertices, edges, and faces */ { /* vertices (x,y,z) */ /* all points must be within radius 1 of the origin */ #define T 0.577 { T, T, T }, { T, T, -T }, { T, -T, -T }, { T, -T, T }, { -T, T, T }, { -T, T, -T }, { -T, -T, -T }, { -T, -T, T }, #undef T }, { /* faces (numfaces + indexes into vertices) */ /* faces must be specified clockwise from the outside */ 4, 0, 1, 2, 3, 4, 7, 6, 5, 4, 4, 1, 0, 4, 5, 4, 3, 2, 6, 7, 4, 2, 1, 5, 6, 4, 0, 3, 7, 4, } }, /* leave a comma to separate from the next include file */ /* end */ x11-apps-7.7+5+nmu1ubuntu1/ico/config.h.in0000664000000000000000000000315012656634600014775 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION x11-apps-7.7+5+nmu1ubuntu1/ico/objico.h0000664000000000000000000000246212167023104014361 0ustar /* objico.h - structure values for icosahedron */ { "icosahedron", "ico", /* long and short names */ "dodecahedron", /* long name of dual */ 12, 30, 20, /* number of vertices, edges, and faces */ { /* vertices (x,y,z) */ /* all points must be within radius 1 of the origin */ { 0.00000000, 0.00000000, -0.95105650}, { 0.00000000, 0.85065080, -0.42532537}, { 0.80901698, 0.26286556, -0.42532537}, { 0.50000000, -0.68819095, -0.42532537}, {-0.50000000, -0.68819095, -0.42532537}, {-0.80901698, 0.26286556, -0.42532537}, { 0.50000000, 0.68819095, 0.42532537}, { 0.80901698, -0.26286556, 0.42532537}, { 0.00000000, -0.85065080, 0.42532537}, {-0.80901698, -0.26286556, 0.42532537}, {-0.50000000, 0.68819095, 0.42532537}, { 0.00000000, 0.00000000, 0.95105650} }, { /* faces (numfaces + indexes into vertices) */ /* faces must be specified clockwise from the outside */ 3, 0, 2, 1, 3, 0, 3, 2, 3, 0, 4, 3, 3, 0, 5, 4, 3, 0, 1, 5, 3, 1, 6, 10, 3, 1, 2, 6, 3, 2, 7, 6, 3, 2, 3, 7, 3, 3, 8, 7, 3, 3, 4, 8, 3, 4, 9, 8, 3, 4, 5, 9, 3, 5, 10, 9, 3, 5, 1, 10, 3, 10, 6, 11, 3, 6, 7, 11, 3, 7, 8, 11, 3, 8, 9, 11, 3, 9, 10, 11 } }, /* leave a comma to separate from the next include file */ /* end */ x11-apps-7.7+5+nmu1ubuntu1/ico/man/0000775000000000000000000000000012656635743013537 5ustar x11-apps-7.7+5+nmu1ubuntu1/ico/man/ico.man0000664000000000000000000000622012167023104014761 0ustar .TH ICO 1 __xorgversion__ .SH NAME ico \- animate an icosahedron or other polyhedron .SH SYNOPSIS .B ico [-display display] [-geometry geometry] [-r] [-d pattern] [-i] [-dbl] [-faces] [-noedges] [-sleep n] [-obj object] [-objhelp] [-colors color-list] .SH DESCRIPTION .I Ico displays a wire-frame rotating polyhedron, with hidden lines removed, or a solid-fill polyhedron with hidden faces removed. There are a number of different polyhedra available; adding a new polyhedron to the program is quite simple. .SH OPTIONS .TP .B -r Display on the root window instead of creating a new window. .TP .B -d pattern Specify a bit pattern for drawing dashed lines for wire frames. .TP .B -i Use inverted colors for wire frames. .TP .B -dbl Use double buffering on the display. This works for either wire frame or solid fill drawings. For solid fill drawings, using this switch results in substantially smoother movement. Note that this requires twice as many bit planes as without double buffering. Since some colors are typically allocated by other programs, most eight-bit-plane displays will probably be limited to eight colors when using double buffering. .TP .B -faces Draw filled faces instead of wire frames. .TP .B -noedges Don't draw the wire frames. Typically used only when -faces is used. .TP .B -sleep \fIn\fP Sleep n seconds between each move of the object. .TP .B -obj \fIobject\fP Specify what object to draw. If no object is specified, an icosahedron is drawn. .TP .B -objhelp Print out a list of the available objects, along with information about each object. .TP .B -colors \fIcolor color ...\fP Specify what colors should be used to draw the filled faces of the object. If less colors than faces are given, the colors are reused. .SH PROGRAM TERMINATION .LP Pressing "q" will close a window. If compiled with threads support, the program will stop only when all threads terminate. You can also close an animation window using the ICCCM \fIdelete\fP message (depending on your window manager, you will have a decoration button or menu to send such message). .SH ADDING POLYHEDRA .LP If you have the source to ico, it is very easy to add more polyhedra. Each polyhedron is defined in an include file by the name of objXXX.h, where XXX is something related to the name of the polyhedron. The format of the include file is defined in the file polyinfo.h. Look at the file objcube.h to see what the exact format of an objXXX.h file should be, then create your objXXX.h file in that format. .LP After making the new objXXX.h file (or copying in a new one from elsewhere), simply do a 'make depend'. This will recreate the file allobjs.h, which lists all of the objXXX.h files. Doing a 'make' after this will rebuild ico with the new object information. .SH "SEE ALSO" X(__miscmansuffix__) .SH BUGS .LP Pyramids and tetrahedrons with filled faces do not display correctly. .LP A separate color cell is allocated for each name in the -colors list, even when the same name may be specified twice. Color allocation fails in TrueColor displays and option \fI-faces\fP does not work well. .SH COPYRIGHT Copyright 1994 X Consortium .br See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. x11-apps-7.7+5+nmu1ubuntu1/ico/man/Makefile.am0000664000000000000000000000052112167023104015544 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = ico.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/ico/config.sub0000775000000000000000000010516212167023104014727 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011 Free Software Foundation, Inc. timestamp='2011-11-11' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/ico/polyinfo.h0000664000000000000000000000147012167023104014751 0ustar /* polyinfo.h * This is the description of one polyhedron file */ #define MAXVERTS 120 /* great rhombicosidodecahedron has 120 vertices */ #define MAXNV MAXVERTS #define MAXFACES 30 /* (hexakis icosahedron has 120 faces) */ #define MAXEDGES 180 /* great rhombicosidodecahedron has 180 edges */ #define MAXEDGESPERPOLY 20 typedef struct { double x, y, z; } Point3D; /* structure of the include files which define the polyhedra */ typedef struct { const char *longname; /* long name of object */ const char *shortname; /* short name of object */ const char *dual; /* long name of dual */ int numverts; /* number of vertices */ int numedges; /* number of edges */ int numfaces; /* number of faces */ Point3D v[MAXVERTS]; /* the vertices */ int f[MAXEDGES*2+MAXFACES]; /* the faces */ } Polyinfo; /* end */ x11-apps-7.7+5+nmu1ubuntu1/ico/Makefile.am0000664000000000000000000000304612167023104014776 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = ico AM_CFLAGS = $(ICO_CFLAGS) $(CWARNFLAGS) ico_LDADD = $(ICO_LIBS) $(XTHREADLIB) -lm ico_SOURCES = \ allobjs.h \ ico.c \ objcube.h \ objico.h \ objocta.h \ objplane.h \ objpyr.h \ polyinfo.h MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/ico/objocta.h0000664000000000000000000000130412167023104014527 0ustar /* objocta.h - structure values for octahedron */ { "octahedron", "octa", /* long and short names */ "cube", /* long name of dual */ 6, 12, 8, /* number of vertices, edges, and faces */ { /* vertices (x,y,z) */ /* all points must be within radius 1 of the origin */ #define T 1.0 { T, 0, 0 }, { -T, 0, 0 }, { 0, T, 0 }, { 0, -T, 0 }, { 0, 0, T }, { 0, 0, -T }, #undef T }, { /* faces (numfaces + indexes into vertices) */ /* faces must be specified clockwise from the outside */ 3, 0, 4, 2, 3, 0, 2, 5, 3, 0, 5, 3, 3, 0, 3, 4, 3, 1, 2, 4, 3, 1, 5, 2, 3, 1, 3, 5, 3, 1, 4, 3, } }, /* leave a comma to separate from the next include file */ /* end */ x11-apps-7.7+5+nmu1ubuntu1/ico/configure.ac0000664000000000000000000000356312167023104015234 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. AC_PREREQ([2.60]) AC_INIT([ico], [1.0.4], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [ico]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS AC_CONFIG_HEADERS([config.h]) # Checks for pkg-config packages PKG_CHECK_MODULES(ICO, [x11 >= 0.99.1 xproto >= 7.0.22]) XTHREADLIB=`$PKG_CONFIG --variable=xthreadlib x11` AC_SUBST(XTHREADLIB) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/ico/README0000664000000000000000000000152512167023104013622 0ustar ico is a simple animation program that may be used for testing various X11 operations and extensions. It displays a wire-frame rotating polyhedron, with hidden lines removed, or a solid-fill polyhedron with hidden faces removed. All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/ico http://cgit.freedesktop.org/xorg/app/ico For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/ico/COPYING0000664000000000000000000000657012167023104014002 0ustar Copyright (c) 1987, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ------------------------------------------------------------------------------ Copyright 2005 Red Hat, Inc. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Red Hat not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Red Hat makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. x11-apps-7.7+5+nmu1ubuntu1/ico/INSTALL0000664000000000000000000002622212167023104013774 0ustar Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 6. Often, you can also type `make uninstall' to remove the installed files again. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *Note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xwud/0000775000000000000000000000000012656635743013201 5ustar x11-apps-7.7+5+nmu1ubuntu1/xwud/ChangeLog0000664000000000000000000003445712167023104014743 0ustar commit 86d36843f3f087a6c1f3eb5a21385a116ae9e46a Author: Alan Coopersmith Date: Sat Mar 31 17:04:56 2012 -0700 xwud 1.0.4 Signed-off-by: Alan Coopersmith commit 2785ef0c967571977b78490eb501c5f9da91d48c Author: Alan Coopersmith Date: Fri Jan 6 20:07:40 2012 -0800 Replace malloc(strlen) + strcpy() with strdup() Signed-off-by: Alan Coopersmith commit 05c9c12b6491708bc9ed9ea6b7a5321928d5ac93 Author: Jeremy Huddleston Date: Sun May 8 09:48:55 2011 -0700 Mark Error as _X_NORETURN xwud.c:1031:6: warning: Array access (from variable 'pixels') results in a null pointer dereference pixels[i] = ~0L; ^~~~~~ xwud.c:1036:22: warning: Array access (from variable 'pixels') results in a null pointer dereference if ((color.pixel = pixels[pix]) == ~0L) { ^~~~~~ xwud.c:1101:6: warning: Array access (from variable 'rpixels') results in a null pointer dereference rpixels[i] = ~0L; ^~~~~~~ xwud.c:1100:6: warning: Array access (from variable 'pixels') results in a null pointer dereference pixels[i] = ~0L; ^~~~~~ Found-by: clang static analyzer Signed-off-by: Jeremy Huddleston commit b7751c561e500e066273d618bfb9967b89767559 Author: Gaetan Nadon Date: Wed Jan 19 10:06:57 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 4e97b1da43664f99400dc3b66afc416fb25c3bb1 Author: Gaetan Nadon Date: Thu Jan 13 17:15:37 2011 -0500 man: replace hard coded man page section with substitution strings Signed-off-by: Gaetan Nadon commit 70cc9502dc9757cffc165d73cfe8a29b1450df25 Author: Gaetan Nadon Date: Thu Jan 13 11:15:48 2011 -0500 man: remove trailing spaces and tabs Using s/[ \t]*$// Signed-off-by: Gaetan Nadon commit 1693c1bba2c03acd151329fb8ecc3f5c267f9576 Author: Alan Coopersmith Date: Sun Nov 7 10:40:46 2010 -0800 xwud 1.0.3 Signed-off-by: Alan Coopersmith commit f78df83d15e7b159617de3850b313d3f9850f643 Author: Alan Coopersmith Date: Sun Nov 7 10:39:49 2010 -0800 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS Regroup AC statements under the Autoconf initialization section. Regroup AM sttaements under the Automake initialization section. Add missing AC_CONFIG_SRCDIR Signed-off-by: Alan Coopersmith commit 60c96d9b2add63684c8e28a3221fee3d807f3926 Author: Alan Coopersmith Date: Sun Nov 7 10:38:07 2010 -0800 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now PKG_CONFIG_MODULES handles AC_SUBST of the CFLAGS & LIBS variables Signed-off-by: Alan Coopersmith commit 81777e705aab605d1f92edd01c3712033f7ee1cc Author: Alan Coopersmith Date: Sun Nov 7 10:37:23 2010 -0800 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS Enables use of platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit 0258e0ff9d6d56d2edc1c3287533771a0c3f08c3 Author: Gaetan Nadon Date: Sun Nov 7 10:36:55 2010 -0800 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon Signed-off-by: Alan Coopersmith commit 7bc31bddc140fdccefa6de2e8ae27ce6b28871ff Author: Jesse Adkins Date: Tue Sep 28 13:29:50 2010 -0700 Purge cvs tags. Signed-off-by: Jesse Adkins Signed-off-by: Alan Coopersmith commit 1a06eb65df2f13497ac2327cd847a393d3f3d0fc Author: Gaetan Nadon Date: Thu Nov 26 09:19:55 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit e1e912bb1474aaa3268c86e414d92260f80eaafc Author: Gaetan Nadon Date: Wed Oct 28 14:09:09 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit 38bc3567f7134b74160dc3096e31643c93bc3198 Author: Gaetan Nadon Date: Mon Oct 26 22:08:40 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit 55e770684fe1bb3de4174a33fecf8f10698d9d5d Author: Gaetan Nadon Date: Thu Oct 22 12:34:16 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit 86a450a54c878e8b3e235d17557d6d8e81a31caa Author: Jeremy Huddleston Date: Wed Oct 21 12:47:22 2009 -0700 This is not a GNU project, so declare it foreign. On Wed, 2009-10-21 at 13:36 +1000, Peter Hutterer wrote: > On Tue, Oct 20, 2009 at 08:23:55PM -0700, Jeremy Huddleston wrote: > > I noticed an INSTALL file in xlsclients and libXvMC today, and it > > was quite annoying to work around since 'autoreconf -fvi' replaces > > it and git wants to commit it. Should these files even be in git? > > Can I nuke them for the betterment of humanity and since they get > > created by autoreconf anyways? > > See https://bugs.freedesktop.org/show_bug.cgi?id=24206 As an interim measure, replace AM_INIT_AUTOMAKE([dist-bzip2]) with AM_INIT_AUTOMAKE([foreign dist-bzip2]). This will prevent the generation of the INSTALL file. It is also part of the 24206 solution. Signed-off-by: Jeremy Huddleston commit f4e1d310f6c421434c4f1101d08907de16fc855c Author: Alan Coopersmith Date: Mon Oct 12 21:41:45 2009 -0700 xwud 1.0.2 Signed-off-by: Alan Coopersmith commit a71d3b986cb4f8b88928c28a1986e913a954f503 Author: Alan Coopersmith Date: Mon Oct 12 21:39:27 2009 -0700 Fill in COPYING with copyright/license notices from code Signed-off-by: Alan Coopersmith commit 1da3e9b8ecd537546cb82d857b81704153a68621 Author: Alan Coopersmith Date: Mon Oct 12 21:38:52 2009 -0700 Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS Signed-off-by: Alan Coopersmith commit d49722c555eedf47eeb039e3e4bd7a5b4143fc75 Author: Alan Coopersmith Date: Thu Oct 1 14:54:32 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit a619bad7e2782594e608d1b1c890a2ef46e59659 Author: Alan Coopersmith Date: Sun May 3 16:19:38 2009 -0700 Plug leaks of color conversion arrays in Do_Direct [This bug was found by the Parfait bug checking tool. For more information see http://research.sun.com/projects/parfait ] Signed-off-by: Alan Coopersmith commit 5a9ab7d199e399872bd197c6b2de59f52e197efd Author: Matthieu Herrb Date: Fri Jan 30 11:58:40 2009 +0100 Add more input checks. From "nobody@example.com" through OpenBSD bug list. commit 11d54146e412a726807b8c0d5df8eb584084325d Author: Paulo Cesar Pereira de Andrade Date: Thu Jan 15 16:22:28 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings. commit f20c704dd2962fabaea95a1c118ceffe0898d572 Author: James Cloos Date: Thu Dec 6 16:37:35 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit 566fbfbf01b95de257414f936fb31447f82671de Author: James Cloos Date: Mon Sep 3 05:51:57 2007 -0400 Add *~ to .gitignore to skip patch/emacs droppings commit bd24795253bdae758bba7ae76a31c8024222ceb8 Author: James Cloos Date: Thu Aug 23 19:25:18 2007 -0400 Rename .cvsignore to .gitignore commit 41afbe4346cf615f18b9f7536a3a4f7b71588e26 Author: Kevin E Martin Date: Wed Dec 21 02:29:55 2005 +0000 Update package version for X11R7 release. commit 64a9fc88c3b8386a2ee3c924cf5ed6d1faf95fda Author: Adam Jackson Date: Mon Dec 19 16:22:48 2005 +0000 Stub COPYING files commit 1abccb01ea285b6dcee662cc6c7e9fcb44517c51 Author: Kevin E Martin Date: Thu Dec 15 00:24:12 2005 +0000 Update package version number for final X11R7 release candidate. commit fa7c02b03c22461caa3d6405e8a229a9c30dc917 Author: Kevin E Martin Date: Tue Dec 6 22:48:27 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit 5701442309db899c9cfeebafc4a583a613bb46f0 Author: Kevin E Martin Date: Sat Dec 3 05:49:29 2005 +0000 Update package version number for X11R7 RC3 release. commit 5898d50e437e95fe43da28da84a9f7746547ffd0 Author: Alan Coopersmith Date: Mon Nov 28 22:01:48 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit e2b49239bc7eadb51ffab09a177aeccf6c61e888 Author: Eric Anholt Date: Mon Nov 21 10:35:09 2005 +0000 Another pass at .cvsignores for apps. commit 6540c58fa278c3501cb7e8a00db3d517bdf13d93 Author: Eric Anholt Date: Sun Nov 20 22:08:56 2005 +0000 Add/improve .cvsignore files for apps. commit 5f443db03b3f4fb230e7eef41ecd37e79506d20d Author: Kevin E Martin Date: Wed Oct 19 02:47:58 2005 +0000 Update package version number for RC1 release. commit d71e00abb4917244ad0e3fa8137780e76ea4a30e Author: Alan Coopersmith Date: Mon Oct 17 23:56:25 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 3eff021e932202e1f2aadd7d07adb9717c414f22 Author: Alan Coopersmith Date: Fri Oct 14 00:25:48 2005 +0000 Use sed to fill in variables in man page commit 1eeb5a74483ae0d3f1e1dc2705a8f1448e97b109 Author: Alan Coopersmith Date: Mon Aug 1 20:25:33 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit f3b1e56ce3838f2e022557e119f470c31c319081 Author: Kevin E Martin Date: Fri Jul 29 21:22:39 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit 3175d21d65f84e0fb8f845df4ca7bf0e18ade4ff Author: Adam Jackson Date: Wed Jul 20 19:32:05 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit 78c7fa573ce8acc58820ef0f8b587cb49bc285b2 Author: Søren Sandmann Pedersen Date: Fri Jul 1 20:16:57 2005 +0000 Build system for xwud commit 110dc6336ccefd0657e662b5d58874d1e25de5f7 Author: Egbert Eich Date: Fri Apr 23 19:55:10 2004 +0000 Merging XORG-CURRENT into trunk commit 0a9f2be7f0b51123127a4171a73d2ec9336f05fa Author: Egbert Eich Date: Sun Mar 14 08:35:54 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit d89402e5ee8afc8581356c17b04d3c53d4eb87fb Author: Egbert Eich Date: Wed Mar 3 12:13:20 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit 42e4f6fc5373db981509e0702fe2a25808938a7c Author: Egbert Eich Date: Thu Feb 26 13:36:32 2004 +0000 readding XFree86's cvs IDs commit e00f6f921149cc0e2d2ba317b40bbf395cdece24 Author: Egbert Eich Date: Thu Feb 26 09:24:18 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit bfca9b37987a37138cbf7a1da98bc48675ff28ab Author: Kaleb Keithley Date: Tue Nov 25 19:29:23 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit 3160fb8048b7ecd003548d4424e012a8b600c65b Author: Kaleb Keithley Date: Fri Nov 14 16:49:24 2003 +0000 XFree86 4.3.0.1 commit da8d015481ebcb0a7605afee041fdbe29adf4183 Author: Kaleb Keithley Date: Fri Nov 14 15:54:55 2003 +0000 R6.6 is the Xorg base-line x11-apps-7.7+5+nmu1ubuntu1/xwud/config.guess0000775000000000000000000012704512167023104015505 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011 Free Software Foundation, Inc. timestamp='2011-11-11' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo hexagon-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xwud/config.h.in0000664000000000000000000000315012656634723015220 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION x11-apps-7.7+5+nmu1ubuntu1/xwud/man/0000775000000000000000000000000012656635743013754 5ustar x11-apps-7.7+5+nmu1ubuntu1/xwud/man/xwud.man0000664000000000000000000001310712167023104015415 0ustar .\" Copyright 1988, 1998 The Open Group .\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" .TH XWUD 1 __xorgversion__ .SH NAME xwud - image displayer for X .SH SYNOPSIS .B "xwud" [\-in \fIfile\fP] [\-noclick] [\-geometry \fIgeom\fP] [\-display \fIdisplay\fP] [\-new] [\-std ] [\-raw] [\-vis ] [\-scale] [\-help] [\-rv] [\-plane \fInumber\fP] [\-fg \fIcolor\fP] [\-bg \fIcolor\fP] [\-dumpheader] .SH DESCRIPTION .PP .I Xwud is an X Window System image undumping utility. .I Xwud allows X users to display in a window an image saved in a specially formatted dump file, such as produced by \fIxwd(__appmansuffix__)\fP. .SH OPTIONS .PP .TP 8 .B "\-bg \fIcolor\fP" If a bitmap image (or a single plane of an image) is displayed, this option can be used to specify the color to display for the "0" bits in the image. .PP .TP 8 .B "\-display \fIdisplay\fP" This option allows you to specify the server to connect to; see \fIX(__miscmansuffix__)\fP. .PP .TP 8 .B \-dumpheader This option prints out the XWD header information only. Nothing is displayed. .PP .TP 8 .B "\-fg \fIcolor\fP" If a bitmap image (or a single plane of an image) is displayed, this option can be used to specify the color to display for the "1" bits in the image. .PP .TP 8 .B "\-geometry \fIgeom\fP" This option allows you to specify the size and position of the window. Typically you will only want to specify the position, and let the size default to the actual size of the image. .PP .TP 8 .B "\-help" Print out a short description of the allowable options. .PP .TP 8 .B "\-in \fIfile\fP" This option allows the user to explicitly specify the input file on the command line. If no input file is given, the standard input is assumed. .PP .TP 8 .B \-new This option forces creation of a new colormap for displaying the image. If the image characteristics happen to match those of the display, this can get the image on the screen faster, but at the cost of using a new colormap (which on most displays will cause other windows to go technicolor). .PP .TP 8 .B "\-noclick" Clicking any button in the window will terminate the application, unless this option is specified. Termination can always be achieved by typing 'q', 'Q', or ctrl-c. .PP .TP 8 .B "\-plane \fInumber\fP" You can select a single bit plane of the image to display with this option. Planes are numbered with zero being the least significant bit. .PP .TP 8 .B \-raw This option forces the image to be displayed with whatever color values happen to currently exist on the screen. This option is mostly useful when undumping an image back onto the same screen that the image originally came from, while the original windows are still on the screen, and results in getting the image on the screen faster. .PP .TP 8 .B \-rv If a bitmap image (or a single plane of an image) is displayed, this option forces the foreground and background colors to be swapped. This may be needed when displaying a bitmap image which has the color sense of pixel values "0" and "1" reversed from what they are on your display. .PP .TP 8 .B \-scale Allow the window to be resized, and scale the image to the size of the window. .PP .TP 8 .B "\-std \fImaptype\fP" This option causes the image to be displayed using the specified Standard Colormap. The property name is obtained by converting the type to upper case, prepending "RGB_", and appending "_MAP". Typical types are "best", "default", and "gray". See \fIxstdcmap(__appmansuffix__)\fP for one way of creating Standard Colormaps. .PP .TP 8 .B "\-vis \fIvis-type-or-id\fP" This option allows you to specify a particular visual or visual class. The default is to pick the "best" one. A particular class can be specified: "StaticGray", "GrayScale", "StaticColor", "PseudoColor", "DirectColor", or "TrueColor". Or "Match" can be specified, meaning use the same class as the source image. Alternatively, an exact visual id (specific to the server) can be specified, either as a hexadecimal number (prefixed with "0x") or as a decimal number. Finally, "default" can be specified, meaning to use the same class as the colormap of the root window. Case is not significant in any of these strings. .SH ENVIRONMENT .PP .TP 8 .B DISPLAY To get default display. .SH FILES .PP .TP 8 .B XWDFile.h X Window Dump File format definition file. .SH BUGS xwud doesn't handle big/deep images very well on servers that don't have the BIG-REQUESTS extension. .SH SEE ALSO xwd(__appmansuffix__), xstdcmap(__appmansuffix__), X(__miscmansuffix__) .SH AUTHOR Bob Scheifler, MIT X Consortium x11-apps-7.7+5+nmu1ubuntu1/xwud/man/Makefile.am0000664000000000000000000000052212167023104015762 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = xwud.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/xwud/config.sub0000775000000000000000000010516212167023104015144 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011 Free Software Foundation, Inc. timestamp='2011-11-11' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xwud/Makefile.am0000664000000000000000000000261512167023104015214 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = xwud AM_CFLAGS = $(CWARNFLAGS) $(XWUD_CFLAGS) xwud_LDADD = $(XWUD_LIBS) xwud_SOURCES = \ xwud.c MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xwud/xwud.c0000664000000000000000000010717712167023104014324 0ustar /* Copyright 1985, 1986, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* xwud - marginally useful raster image undumper */ #include #include #include #include #include #include #define XK_LATIN1 #include #include #include static Atom wm_protocols; static Atom wm_delete_window; static int split; static char *progname; static void usage(void); static Bool Read(char *ptr, int size, int nitems, FILE *stream); static void putImage(Display *dpy, Window image_win, GC gc, XImage *out_image, int x, int y, int w, int h); static void putScaledImage(Display *display, Drawable d, GC gc, XImage *src_image, int exp_x, int exp_y, unsigned int exp_width, unsigned int exp_height, unsigned int dest_width, unsigned dest_height); static void Latin1Upper(char *s); static void Extract_Plane(XImage *in_image, XImage *out_image, int plane); static int EffectiveSize(XVisualInfo *vinfo); static int VisualRank(int class); static int IsGray(Display *dpy, XStandardColormap *stdmap); static void Do_StdGray(Display *dpy, XStandardColormap *stdmap, int ncolors, XColor *colors, XImage *in_image, XImage *out_image); static void Do_StdCol(Display *dpy, XStandardColormap *stdmap, int ncolors, XColor *colors, XImage *in_image, XImage *out_image); static Colormap CopyColormapAndFree(Display *dpy, Colormap colormap); static void Do_Pseudo(Display *dpy, Colormap *colormap, int ncolors, XColor *colors, XImage *in_image, XImage *out_image); static void Do_Direct(Display *dpy, XWDFileHeader *header, Colormap *colormap, int ncolors, XColor *colors, XImage *in_image, XImage *out_image, XVisualInfo *vinfo); static unsigned int Image_Size(XImage *image); static void Error(char *string) _X_NORETURN; static void _swapshort(char *bp, unsigned int n); static void _swaplong(char *bp, unsigned int n); static void DumpHeader(const XWDFileHeader *header, const char *win_name); static void usage(void) { fprintf(stderr, "usage: %s [-in ] [-noclick] [-geometry ] [-display ]\n", progname); fprintf(stderr, " [-new] [-std ] [-raw] [-vis ]\n"); fprintf(stderr, " [-help] [-rv] [-plane ] [-fg ] [-bg ]\n"); fprintf(stderr, " [-scale]\n"); exit(1); } static Bool Read(char *ptr, int size, int nitems, FILE *stream) { size *= nitems; while (size) { nitems = fread(ptr, 1, size, stream); if (nitems <= 0) return False; size -= nitems; ptr += nitems; } return True; } int main(int argc, char *argv[]) { Display *dpy; int screen; register int i; XImage in_image_struct; XImage *in_image, *out_image; XSetWindowAttributes attributes; XVisualInfo vinfo, *vinfos; long mask; register char *buffer; unsigned long swaptest = 1; int count, stdcnt; unsigned buffer_size; int win_name_size; int ncolors; char *file_name = NULL; char *win_name; Bool inverse = False, rawbits = False, newmap = False; Bool onclick = True; Bool scale = False; int plane = -1; char *std = NULL; char *vis = NULL; char *display_name = NULL; char *fgname = NULL; char *bgname = NULL; char *geom = NULL; int gbits = 0; XSizeHints hints; XTextProperty textprop; XClassHint class_hint; XColor *colors = NULL, color, igncolor; Window image_win; Colormap colormap; XEvent event; register XExposeEvent *expose = (XExposeEvent *)&event; GC gc; XGCValues gc_val; XWDFileHeader header; XWDColor xwdcolor; FILE *in_file = stdin; char *map_name; Atom map_prop; XStandardColormap *stdmaps, *stdmap = NULL; char c; int win_width, win_height; Bool dump_header = False; progname = argv[0]; for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-bg") == 0) { if (++i >= argc) usage(); bgname = argv[i]; continue; } if (strcmp(argv[i], "-display") == 0) { if (++i >= argc) usage(); display_name = argv[i]; continue; } if (strcmp(argv[i], "-dumpheader") == 0) { dump_header = True; continue; } if (strcmp(argv[i], "-fg") == 0) { if (++i >= argc) usage(); fgname = argv[i]; continue; } if (strcmp(argv[i], "-geometry") == 0) { if (++i >= argc) usage(); geom = argv[i]; continue; } if (strcmp(argv[i], "-help") == 0) { usage(); } if (strcmp(argv[i], "-in") == 0) { if (++i >= argc) usage(); file_name = argv[i]; continue; } if (strcmp(argv[i], "-inverse") == 0) { /* for compatibility */ inverse = True; continue; } if (strcmp(argv[i], "-new") == 0) { newmap = True; if (std) usage(); continue; } if (strcmp(argv[i], "-noclick") == 0) { onclick = False; continue; } if (strcmp(argv[i], "-plane") == 0) { if (++i >= argc) usage(); plane = atoi(argv[i]); continue; } if (strcmp(argv[i], "-raw") == 0) { rawbits = True; if (std) usage(); continue; } if (strcmp(argv[i], "-rv") == 0) { inverse = True; continue; } if (strcmp(argv[i], "-scale") == 0) { scale = True; continue; } if (strcmp(argv[i], "-split") == 0) { split = True; continue; } if (strcmp(argv[i], "-std") == 0) { if (++i >= argc) usage(); std = argv[i]; if (newmap || rawbits) usage(); continue; } if (strcmp(argv[i], "-vis") == 0) { if (++i >= argc) usage(); vis = argv[i]; continue; } usage(); } if (file_name) { in_file = fopen(file_name, "rb"); if (in_file == NULL) Error("Can't open input file as specified."); } #ifdef WIN32 else _setmode(fileno(in_file), _O_BINARY); #endif dpy = XOpenDisplay(display_name); if (dpy == NULL) { fprintf(stderr, "%s: unable to open display \"%s\"\n", progname, XDisplayName(display_name)); exit(1); } screen = DefaultScreen(dpy); /* * Read in header information. */ if(!Read((char *)&header, SIZEOF(XWDheader), 1, in_file)) Error("Unable to read dump file header."); if (*(char *) &swaptest) _swaplong((char *) &header, SIZEOF(XWDheader)); /* check to see if the dump file is in the proper format */ if (header.file_version != XWD_FILE_VERSION) { fprintf(stderr,"xwud: XWD file format version mismatch."); Error("exiting."); } if (header.header_size < SIZEOF(XWDheader)) { fprintf(stderr,"xwud: XWD header size is too small."); Error("exiting."); } /* alloc window name */ win_name_size = (header.header_size - SIZEOF(XWDheader)); if (win_name_size < 1) Error("win_name_size"); if((win_name = malloc((unsigned) win_name_size + 6)) == NULL) Error("Can't malloc window name storage."); strcpy(win_name, "xwud: "); /* read in window name */ if(!Read(win_name + 6, sizeof(char), win_name_size, in_file)) Error("Unable to read window name from dump file."); (win_name + 6)[win_name_size - 1] = 0; if (dump_header) { DumpHeader(&header, win_name); exit(0); } /* initialize the input image */ in_image = &in_image_struct; in_image->depth = header.pixmap_depth; in_image->format = header.pixmap_format; in_image->xoffset = header.xoffset; in_image->data = NULL; in_image->width = header.pixmap_width; in_image->height = header.pixmap_height; in_image->bitmap_pad = header.bitmap_pad; in_image->bytes_per_line = header.bytes_per_line; in_image->byte_order = header.byte_order; in_image->bitmap_unit = header.bitmap_unit; in_image->bitmap_bit_order = header.bitmap_bit_order; in_image->bits_per_pixel = header.bits_per_pixel; in_image->red_mask = header.red_mask; in_image->green_mask = header.green_mask; in_image->blue_mask = header.blue_mask; if (!XInitImage(in_image)) Error("Invalid input image header data."); /* read in the color map buffer */ if((ncolors = header.ncolors)) { colors = (XColor *)malloc((unsigned) ncolors * sizeof(XColor)); if (!colors) Error("Can't malloc color table"); for (i = 0; i < ncolors; i++) { if(!Read((char *) &xwdcolor, SIZEOF(XWDColor), 1, in_file)) Error("Unable to read color map from dump file."); colors[i].pixel = xwdcolor.pixel; colors[i].red = xwdcolor.red; colors[i].green = xwdcolor.green; colors[i].blue = xwdcolor.blue; colors[i].flags = xwdcolor.flags; } if (*(char *) &swaptest) { for (i = 0; i < ncolors; i++) { _swaplong((char *) &colors[i].pixel, sizeof(long)); _swapshort((char *) &colors[i].red, 3 * sizeof(short)); } } } else /* no color map exists, turn on the raw option */ rawbits = True; /* alloc the pixel buffer */ buffer_size = Image_Size(in_image); if((buffer = malloc(buffer_size)) == NULL) Error("Can't malloc data buffer."); /* read in the image data */ if (!Read(buffer, sizeof(char), (int)buffer_size, in_file)) Error("Unable to read pixmap from dump file."); /* close the input file */ (void) fclose(in_file); if (plane >= in_image->depth) Error("plane number exceeds image depth"); if ((in_image->format == XYPixmap) && (plane >= 0)) { buffer += in_image->bytes_per_line * in_image->height * (in_image->depth - (plane + 1)); in_image->depth = 1; ncolors = 0; } if (in_image->bits_per_pixel == 1 && in_image->depth == 1) { in_image->format = XYBitmap; newmap = False; rawbits = True; } in_image->data = buffer; if (std) { map_name = malloc(strlen(std) + 9); strcpy(map_name, "RGB_"); strcat(map_name, std); strcat(map_name, "_MAP"); Latin1Upper(map_name); map_prop = XInternAtom(dpy, map_name, True); if (!map_prop || !XGetRGBColormaps(dpy, RootWindow(dpy, screen), &stdmaps, &stdcnt, map_prop)) Error("specified standard colormap does not exist"); } vinfo.screen = screen; mask = VisualScreenMask; if (vis) { char *vt = strdup(vis); Latin1Upper(vt); if (strcmp(vt, "STATICGRAY") == 0) { vinfo.class = StaticGray; mask |= VisualClassMask; } else if (strcmp(vt, "GRAYSCALE") == 0) { vinfo.class = GrayScale; mask |= VisualClassMask; } else if (strcmp(vt, "STATICCOLOR") == 0) { vinfo.class = StaticColor; mask |= VisualClassMask; } else if (strcmp(vt, "PSEUDOCOLOR") == 0) { vinfo.class = PseudoColor; mask |= VisualClassMask; } else if (strcmp(vt, "DIRECTCOLOR") == 0) { vinfo.class = DirectColor; mask |= VisualClassMask; } else if (strcmp(vt, "TRUECOLOR") == 0) { vinfo.class = TrueColor; mask |= VisualClassMask; } else if (strcmp(vt, "MATCH") == 0) { vinfo.class = header.visual_class; mask |= VisualClassMask; } else if (strcmp(vt, "DEFAULT") == 0) { vinfo.visualid= XVisualIDFromVisual(DefaultVisual(dpy, screen)); mask |= VisualIDMask; } else { vinfo.visualid = 0; mask |= VisualIDMask; sscanf(vis, "0x%lx", &vinfo.visualid); if (!vinfo.visualid) sscanf(vis, "%lu", &vinfo.visualid); if (!vinfo.visualid) Error("invalid visual specifier"); } } if (rawbits && (in_image->depth > 1) && (plane < 0)) { vinfo.depth = in_image->depth; mask |= VisualDepthMask; } vinfos = XGetVisualInfo(dpy, mask, &vinfo, &count); if (count == 0) Error("no matching visual found"); /* find a workable visual */ if (std) { stdmap = &stdmaps[0]; if (mask & VisualIDMask) { for (i = 0; i < stdcnt; i++) { if (stdmaps[i].visualid == vinfo.visualid) { stdmap = &stdmaps[i]; break; } } if (stdmap->visualid != vinfo.visualid) Error("no standard colormap matching specified visual"); } for (i = 0; i < count; i++) { if (stdmap->visualid == vinfos[i].visualid) { vinfo = vinfos[i]; break; } } } else if ((in_image->depth == 1) || ((in_image->format == ZPixmap) && (plane >= 0)) || rawbits) { vinfo = vinfos[0]; if (!(mask & VisualIDMask)) { for (i = 0; i < count; i++) { if ((vinfos[i].visualid == XVisualIDFromVisual(DefaultVisual(dpy, screen))) && (vinfos[i].depth == DefaultDepth(dpy, screen))) { vinfo = vinfos[i]; break; } } } } else { /* get best visual */ vinfo = vinfos[0]; for (i = 0; i < count; i++) { int z1, z2; z2 = EffectiveSize(&vinfos[i]); if ((z2 >= ncolors) && (vinfos[i].depth == in_image->depth) && (vinfos[i].class == header.visual_class)) { vinfo = vinfos[i]; break; } z1 = EffectiveSize(&vinfo); if ((z2 > z1) || ((z2 == z1) && (VisualRank(vinfos[i].class) >= VisualRank(vinfo.class)))) vinfo = vinfos[i]; } if ((newmap || (vinfo.visual != DefaultVisual(dpy, screen))) && (vinfo.class != StaticGray) && (vinfo.class != StaticColor) && (vinfo.class == header.visual_class) && (vinfo.depth == in_image->depth) && ((vinfo.class == PseudoColor) || (vinfo.class == GrayScale) || ((vinfo.red_mask == header.red_mask) && (vinfo.green_mask == header.green_mask) && (vinfo.blue_mask == header.blue_mask)))) { rawbits = True; newmap = True; } } /* get the appropriate colormap */ if (newmap && (vinfo.class & 1) && (vinfo.depth == in_image->depth) && (vinfo.class == header.visual_class) && (vinfo.colormap_size >= ncolors) && (vinfo.red_mask == header.red_mask) && (vinfo.green_mask == header.green_mask) && (vinfo.blue_mask == header.blue_mask)) { colormap = XCreateColormap(dpy, RootWindow(dpy, screen), vinfo.visual, AllocAll); if (ncolors) { for (i = 0; i < ncolors; i++) colors[i].flags = DoRed|DoGreen|DoBlue; XStoreColors(dpy, colormap, colors, ncolors); } } else if (std) { colormap = stdmap->colormap; } else { if (!newmap && (vinfo.visual == DefaultVisual(dpy, screen))) colormap = DefaultColormap(dpy, screen); else colormap = XCreateColormap(dpy, RootWindow(dpy, screen), vinfo.visual, AllocNone); newmap = False; } /* create the output image */ if ((in_image->format == ZPixmap) && (plane >= 0)) { out_image = XCreateImage(dpy, vinfo.visual, 1, XYBitmap, 0, NULL, in_image->width, in_image->height, XBitmapPad(dpy), 0); out_image->data = malloc(Image_Size(out_image)); Extract_Plane(in_image, out_image, plane); ncolors = 0; } else if (rawbits || newmap) { out_image = in_image; } else { out_image = XCreateImage(dpy, vinfo.visual, vinfo.depth, (vinfo.depth == 1) ? XYBitmap : in_image->format, in_image->xoffset, NULL, in_image->width, in_image->height, XBitmapPad(dpy), 0); out_image->data = malloc(Image_Size(out_image)); if (std) { if (!stdmap->green_max && !stdmap->blue_max && IsGray(dpy, stdmap)) Do_StdGray(dpy, stdmap, ncolors, colors, in_image, out_image); else Do_StdCol(dpy, stdmap, ncolors, colors, in_image, out_image); } else if ((header.visual_class == TrueColor) || (header.visual_class == DirectColor)) Do_Direct(dpy, &header, &colormap, ncolors, colors, in_image, out_image, &vinfo); else Do_Pseudo(dpy, &colormap, ncolors, colors, in_image, out_image); } if (out_image->depth == 1) { if (fgname && XAllocNamedColor(dpy, colormap, fgname, &color, &igncolor)) gc_val.foreground = color.pixel; else if ((ncolors == 2) && XAllocColor(dpy, colormap, &colors[1])) gc_val.foreground = colors[1].pixel; else gc_val.foreground = BlackPixel (dpy, screen); if (bgname && XAllocNamedColor(dpy, colormap, bgname, &color, &igncolor)) gc_val.background = color.pixel; else if ((ncolors == 2) && XAllocColor(dpy, colormap, &colors[0])) gc_val.background = colors[0].pixel; else gc_val.background = WhitePixel (dpy, screen); if (inverse) { unsigned long tmp; tmp = gc_val.foreground; gc_val.foreground = gc_val.background; gc_val.background = tmp; } } else { gc_val.background = XGetPixel(out_image, 0, 0); gc_val.foreground = 0; } attributes.background_pixel = gc_val.background; attributes.border_pixel = gc_val.background; if (scale) attributes.bit_gravity = ForgetGravity; else attributes.bit_gravity = NorthWestGravity; attributes.event_mask = ButtonPressMask|ButtonReleaseMask|KeyPressMask| ExposureMask; if (scale) attributes.event_mask |= StructureNotifyMask; attributes.colormap = colormap; hints.x = header.window_x; hints.y = header.window_y; hints.width = out_image->width; hints.height = out_image->height; if (geom) gbits = XParseGeometry(geom, &hints.x, &hints.y, (unsigned int *)&hints.width, (unsigned int *)&hints.height); hints.flags = ((gbits & (XValue|YValue)) ? USPosition : 0) | ((gbits & (HeightValue|WidthValue)) ? USSize : PSize); if (!scale) { hints.flags |= PMaxSize; hints.max_width = (hints.width > out_image->width) ? hints.width : out_image->width; hints.max_height = (hints.height > out_image->height) ? hints.height : out_image->height; } if ((gbits & XValue) && (gbits & XNegative)) hints.x += DisplayWidth(dpy, screen) - hints.width; if ((gbits & YValue) && (gbits & YNegative)) hints.y += DisplayHeight(dpy, screen) - hints.height; /* create the image window */ image_win = XCreateWindow(dpy, RootWindow(dpy, screen), hints.x, hints.y, hints.width, hints.height, 0, vinfo.depth, InputOutput, vinfo.visual, CWBorderPixel|CWBackPixel|CWColormap|CWEventMask|CWBitGravity, &attributes); win_width = hints.width; win_height = hints.height; /* Setup for ICCCM delete window. */ wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", False); wm_delete_window = XInternAtom(dpy, "WM_DELETE_WINDOW", False); (void) XSetWMProtocols (dpy, image_win, &wm_delete_window, 1); textprop.value = (unsigned char *) win_name; textprop.encoding = XA_STRING; textprop.format = 8; textprop.nitems = strlen(win_name); class_hint.res_name = (char *)NULL; class_hint.res_class = "Xwud"; /* set standard properties */ XSetWMProperties(dpy, image_win, &textprop, (XTextProperty *)NULL, argv, argc, &hints, (XWMHints *)NULL, &class_hint); /* map the image window */ XMapWindow(dpy, image_win); gc = XCreateGC (dpy, image_win, GCForeground|GCBackground, &gc_val); while (1) { /* wait on mouse input event to terminate */ XNextEvent(dpy, &event); switch(event.type) { case ClientMessage: if (event.xclient.message_type == wm_protocols && event.xclient.data.l[0] == wm_delete_window) { XCloseDisplay(dpy); exit(0); /* ICCCM delete window */ } break; case ButtonPress: break; case ButtonRelease: if (onclick) { XCloseDisplay(dpy); exit(0); } break; case KeyPress: i = XLookupString(&event.xkey, &c, 1, NULL, NULL); if ((i == 1) && ((c == 'q') || (c == 'Q') || (c == '\03'))) { XCloseDisplay(dpy); exit(0); } break; case ConfigureNotify: win_width = event.xconfigure.width; win_height = event.xconfigure.height; break; case Expose: if (scale) putScaledImage(dpy, image_win, gc, out_image, expose->x, expose->y, expose->width, expose->height, win_width, win_height); else if ((expose->x < out_image->width) && (expose->y < out_image->height)) { if ((out_image->width - expose->x) < expose->width) expose->width = out_image->width - expose->x; if ((out_image->height - expose->y) < expose->height) expose->height = out_image->height - expose->y; putImage(dpy, image_win, gc, out_image, expose->x, expose->y, expose->width, expose->height); } break; } } exit(0); } static void putImage(Display *dpy, Window image_win, GC gc, XImage *out_image, int x, int y, int w, int h) { #define SPLIT_SIZE 100 int t_x, t_y, t_w, t_h; if (split) { for (t_y = y; t_y < y + h; t_y += t_h) { t_h = SPLIT_SIZE; if (t_y + t_h > y + h) t_h = y + h - t_y; for (t_x = x; t_x < x + w; t_x += t_w) { t_w = SPLIT_SIZE; if (t_x + t_w > x + w) t_w = x + w - t_x; XPutImage(dpy, image_win, gc, out_image, t_x, t_y, t_x, t_y, t_w, t_h); } } } else { XPutImage (dpy, image_win, gc, out_image, x, y, x, y, w, h); } } typedef short Position; typedef unsigned short Dimension; typedef unsigned long Pixel; #define roundint(x) (int)((x) + 0.5) typedef struct { Position *x, *y; Dimension *width, *height; } Table; static void putScaledImage(Display *display, Drawable d, GC gc, XImage *src_image, int exp_x, int exp_y, unsigned int exp_width, unsigned int exp_height, unsigned int dest_width, unsigned dest_height) { XImage *dest_image; Position x, y, min_y, max_y, exp_max_y, src_x, src_max_x, src_y; Dimension w, h, strip_height; Table table; Pixel pixel; double ratio_x, ratio_y; Bool fast8; if (dest_width == src_image->width && dest_height == src_image->height) { /* same for x and y, just send it out */ XPutImage(display, d, gc, src_image, exp_x, exp_y, exp_x, exp_y, exp_width, exp_height); return; } ratio_x = (double)dest_width / (double)src_image->width; ratio_y = (double)dest_height / (double)src_image->height; src_x = exp_x / ratio_x; if (src_x >= src_image->width) src_x = src_image->width - 1; src_y = exp_y / ratio_y; if (src_y >= src_image->height) src_y = src_image->height - 1; exp_max_y = exp_y + exp_height; src_max_x = roundint((exp_x + exp_width) / ratio_x) + 1; if (src_max_x > src_image->width) src_max_x = src_image->width; strip_height = 65536 / roundint(ratio_x * src_image->bytes_per_line); if (strip_height == 0) strip_height = 1; if (strip_height > exp_height) strip_height = exp_height; h = strip_height + roundint(ratio_y); dest_image = XCreateImage(display, DefaultVisualOfScreen( DefaultScreenOfDisplay(display)), src_image->depth, src_image->format, 0, NULL, dest_width, h, src_image->bitmap_pad, 0); dest_image->data = malloc(dest_image->bytes_per_line * h); fast8 = (src_image->depth == 8 && src_image->bits_per_pixel == 8 && dest_image->bits_per_pixel == 8 && src_image->format == ZPixmap); table.x = (Position *) malloc(sizeof(Position) * (src_image->width + 1)); table.y = (Position *) malloc(sizeof(Position) * (src_image->height + 1)); table.width = (Dimension *) malloc(sizeof(Dimension) * src_image->width); table.height = (Dimension *) malloc(sizeof(Dimension)*src_image->height); table.x[0] = 0; for (x = 1; x <= src_image->width; x++) { table.x[x] = roundint(ratio_x * x); table.width[x - 1] = table.x[x] - table.x[x - 1]; } table.y[0] = 0; for (y = 1; y <= src_image->height; y++) { table.y[y] = roundint(ratio_y * y); table.height[y - 1] = table.y[y] - table.y[y - 1]; } for (min_y = table.y[src_y]; min_y < exp_max_y; min_y = table.y[y]) { max_y = min_y + strip_height; if (max_y > exp_max_y) { strip_height = exp_max_y - min_y; max_y = exp_max_y; } for (y = src_y; table.y[y] < max_y; y++) { if (table.y[y] < min_y) continue; if (fast8) { for (x = src_x; x < src_max_x; x++) { pixel = ((unsigned char *)src_image->data) [y * src_image->bytes_per_line + x]; for (h = 0; h < table.height[y]; h++) { memset(dest_image->data + (table.y[y] + h - min_y) * dest_image->bytes_per_line + table.x[x], pixel, table.width[x]); } } } else { for (x = src_x; x < src_max_x; x++) { pixel = XGetPixel(src_image, x, y); for (h = 0; h < table.height[y]; h++) { for (w = 0; w < table.width[x]; w++) XPutPixel(dest_image, table.x[x] + w, table.y[y] + h - min_y, pixel); } } } } XPutImage(display, d, gc, dest_image, exp_x, 0, exp_x, min_y, exp_width, table.y[y] - min_y); if (y >= src_image->height) break; } XFree((char *)table.x); XFree((char *)table.y); XFree((char *)table.width); XFree((char *)table.height); XDestroyImage(dest_image); } static void Latin1Upper(char *s) { unsigned char *str = (unsigned char *)s; unsigned char c; for (; (c = *str); str++) { if ((c >= XK_a) && (c <= XK_z)) *str = c - (XK_a - XK_A); else if ((c >= XK_agrave) && (c <= XK_odiaeresis)) *str = c - (XK_agrave - XK_Agrave); else if ((c >= XK_oslash) && (c <= XK_thorn)) *str = c - (XK_oslash - XK_Ooblique); } } static void Extract_Plane(XImage *in_image, XImage *out_image, int plane) { register int x, y; for (y = 0; y < in_image->height; y++) for (x = 0; x < in_image->width; x++) XPutPixel(out_image, x, y, (XGetPixel(in_image, x, y) >> plane) & 1); } static int EffectiveSize(XVisualInfo *vinfo) { if ((vinfo->class == DirectColor) || (vinfo->class == TrueColor)) return (vinfo->red_mask | vinfo->green_mask | vinfo->blue_mask) + 1; else return vinfo->colormap_size; } static int VisualRank(int class) { switch (class) { case PseudoColor: return 5; case TrueColor: return 4; case DirectColor: return 3; case StaticColor: return 2; case GrayScale: return 1; case StaticGray: return 0; } /* NOTREACHED */ return -1; } static int IsGray(Display *dpy, XStandardColormap *stdmap) { XColor color; color.pixel = stdmap->base_pixel + (stdmap->red_max * stdmap->red_mult); XQueryColor(dpy, stdmap->colormap, &color); return (color.green || color.blue); } static void Do_StdGray(Display *dpy, XStandardColormap *stdmap, int ncolors, XColor *colors, XImage *in_image, XImage *out_image) { register int i, x, y; register XColor *color; unsigned lim; lim = stdmap->red_max + 1; for (i = 0, color = colors; i < ncolors; i++, color++) color->pixel = stdmap->base_pixel + (((((int)(30L * color->red + 59L * color->green + 11L * color->blue) / 100) * lim) >> 16) * stdmap->red_mult); for (y = 0; y < in_image->height; y++) { for (x = 0; x < in_image->width; x++) { XPutPixel(out_image, x, y, colors[XGetPixel(in_image, x, y)].pixel); } } } #define MapVal(val,lim,mult) ((((val * lim) + 32768) / 65535) * mult) static void Do_StdCol(Display *dpy, XStandardColormap *stdmap, int ncolors, XColor *colors, XImage *in_image, XImage *out_image) { register int i, x, y; register XColor *color; unsigned limr, limg, limb; limr = stdmap->red_max; limg = stdmap->green_max; limb = stdmap->blue_max; for (i = 0, color = colors; i < ncolors; i++, color++) color->pixel = stdmap->base_pixel + MapVal(color->red, limr, stdmap->red_mult) + MapVal(color->green, limg, stdmap->green_mult) + MapVal(color->blue, limb, stdmap->blue_mult); for (y = 0; y < in_image->height; y++) { for (x = 0; x < in_image->width; x++) { XPutPixel(out_image, x, y, colors[XGetPixel(in_image, x, y)].pixel); } } } static Colormap CopyColormapAndFree(Display *dpy, Colormap colormap) { if (colormap == DefaultColormap(dpy, DefaultScreen(dpy))) return XCopyColormapAndFree(dpy, colormap); Error("Visual type is not large enough to hold all colors of the image."); /*NOTREACHED*/ return (Colormap)0; } static void Do_Pseudo(Display *dpy, Colormap *colormap, int ncolors, XColor *colors, XImage *in_image, XImage *out_image) { register int i, x, y; register XColor *color; for (i = 0; i < ncolors; i++) colors[i].flags = 0; for (y = 0; y < in_image->height; y++) { for (x = 0; x < in_image->width; x++) { color = &colors[XGetPixel(in_image, x, y)]; if (!color->flags) { color->flags = DoRed | DoGreen | DoBlue; if (!XAllocColor(dpy, *colormap, color)) { *colormap = CopyColormapAndFree(dpy, *colormap); XAllocColor(dpy, *colormap, color); } } XPutPixel(out_image, x, y, color->pixel); } } } static void Do_Direct(Display *dpy, XWDFileHeader *header, Colormap *colormap, int ncolors, XColor *colors, XImage *in_image, XImage *out_image, XVisualInfo *vinfo) { register int x, y; XColor color; unsigned long rmask, gmask, bmask; unsigned long ormask, ogmask, obmask; unsigned long rshift = 0, gshift = 0, bshift = 0; unsigned long orshift = 0, ogshift = 0, obshift = 0; int i; unsigned long pix, xpix; unsigned long *pixels, *rpixels; rmask = header->red_mask; while (!(rmask & 1)) { rmask >>= 1; rshift++; } gmask = header->green_mask; while (!(gmask & 1)) { gmask >>= 1; gshift++; } bmask = header->blue_mask; while (!(bmask & 1)) { bmask >>= 1; bshift++; } if (in_image->depth <= 12) { pix = 1 << in_image->depth; pixels = (unsigned long *)malloc(sizeof(unsigned long) * pix); if (pixels == NULL) Error("Unable to allocate memory for pixel conversion"); for (i = 0; i < pix; i++) pixels[i] = ~0L; color.flags = DoRed | DoGreen | DoBlue; for (y = 0; y < in_image->height; y++) { for (x = 0; x < in_image->width; x++) { pix = XGetPixel(in_image, x, y); if ((color.pixel = pixels[pix]) == ~0L) { color.red = (pix >> rshift) & rmask; color.green = (pix >> gshift) & gmask; color.blue = (pix >> bshift) & bmask; if (ncolors) { color.red = colors[color.red].red; color.green = colors[color.green].green; color.blue = colors[color.blue].blue; } else { color.red = (((unsigned long)color.red * 65535) / rmask); color.green = (((unsigned long)color.green * 65535) / gmask); color.blue = (((unsigned long)color.blue * 65535) / bmask); } if (!XAllocColor(dpy, *colormap, &color)) { *colormap = CopyColormapAndFree(dpy, *colormap); XAllocColor(dpy, *colormap, &color); } pixels[pix] = color.pixel; } XPutPixel(out_image, x, y, color.pixel); } } free(pixels); } else if (header->visual_class == TrueColor && vinfo->class == TrueColor) { ormask = vinfo->red_mask; while (!(ormask & 1)) { ormask >>= 1; orshift++; } ogmask = vinfo->green_mask; while (!(ogmask & 1)) { ogmask >>= 1; ogshift++; } obmask = vinfo->blue_mask; while (!(obmask & 1)) { obmask >>= 1; obshift++; } for (y = 0; y < in_image->height; y++) { for (x = 0; x < in_image->width; x++) { pix = XGetPixel(in_image, x, y); xpix = (((((pix >> rshift) & rmask) * 65535 / rmask) * ormask / 65535) << orshift) | (((((pix >> gshift) & gmask) * 65535 / gmask) * ogmask / 65535) << ogshift) | (((((pix >> bshift) & bmask) * 65535 / bmask) * obmask / 65535) << obshift); XPutPixel(out_image, x, y, xpix); } } } else { if (header->visual_class == TrueColor) ncolors = 0; pix = 1 << 12; pixels = (unsigned long *)malloc(sizeof(unsigned long) * pix); rpixels = (unsigned long *)malloc(sizeof(unsigned long) * pix); if ((pixels == NULL) || (rpixels == NULL)) Error("Unable to allocate memory for pixel conversion"); for (i = 0; i < pix; i++) { pixels[i] = ~0L; rpixels[i] = ~0L; } color.flags = DoRed | DoGreen | DoBlue; for (y = 0; y < in_image->height; y++) { for (x = 0; x < in_image->width; x++) { pix = XGetPixel(in_image, x, y); xpix = ((pix >> 12) ^ pix) & ((1 << 12) - 1); if (((color.pixel = pixels[xpix]) == ~0L) || (rpixels[xpix] != pix)) { color.red = (pix >> rshift) & rmask; color.green = (pix >> gshift) & gmask; color.blue = (pix >> bshift) & bmask; if (ncolors) { color.red = colors[color.red].red; color.green = colors[color.green].green; color.blue = colors[color.blue].blue; } else { color.red = (((unsigned long)color.red * 65535) / rmask); color.green = (((unsigned long)color.green * 65535) / gmask); color.blue = (((unsigned long)color.blue * 65535) / bmask); } if (!XAllocColor(dpy, *colormap, &color)) { *colormap = CopyColormapAndFree(dpy, *colormap); XAllocColor(dpy, *colormap, &color); } pixels[xpix] = color.pixel; rpixels[xpix] = pix; } XPutPixel(out_image, x, y, color.pixel); } } free(pixels); free(rpixels); } } static unsigned int Image_Size(XImage *image) { if (image->format != ZPixmap) return(image->bytes_per_line * image->height * image->depth); return((unsigned)image->bytes_per_line * image->height); } static void Error(char *string) { fprintf(stderr, "xwud: Error => %s\n", string); if (errno != 0) { perror("xwud"); fprintf(stderr, "\n"); } exit(1); } static void _swapshort(char *bp, unsigned int n) { register char c; register char *ep = bp + n; while (bp < ep) { c = *bp; *bp = *(bp + 1); bp++; *bp++ = c; } } static void _swaplong(char *bp, unsigned int n) { register char c; register char *ep = bp + n; register char *sp; while (bp < ep) { sp = bp + 3; c = *sp; *sp = *bp; *bp++ = c; sp = bp + 1; c = *sp; *sp = *bp; *bp++ = c; bp += 2; } } static void DumpHeader(const XWDFileHeader *header, const char *win_name) { printf("window name: %s\n", win_name); printf("sizeof(XWDheader): %d\n", (int)sizeof(*header)); printf("header size: %d\n", (int)header->header_size); printf("file version: %d\n", (int)header->file_version); printf("pixmap format: %d\n", (int)header->pixmap_format); printf("pixmap depth: %d\n", (int)header->pixmap_depth); printf("pixmap width: %d\n", (int)header->pixmap_width); printf("pixmap height: %d\n", (int)header->pixmap_height); printf("x offset: %d\n", (int)header->xoffset); printf("byte order: %d\n", (int)header->byte_order); printf("bitmap unit: %d\n", (int)header->bitmap_unit); printf("bitmap bit order: %d\n", (int)header->bitmap_bit_order); printf("bitmap pad: %d\n", (int)header->bitmap_pad); printf("bits per pixel: %d\n", (int)header->bits_per_pixel); printf("bytes per line: %d\n", (int)header->bytes_per_line); printf("visual class: %d\n", (int)header->visual_class); printf("red mask: %d\n", (int)header->red_mask); printf("green mask: %d\n", (int)header->green_mask); printf("blue mask: %d\n", (int)header->blue_mask); printf("bits per rgb: %d\n", (int)header->bits_per_rgb); printf("colormap entries: %d\n", (int)header->colormap_entries); printf("num colors: %d\n", (int)header->ncolors); printf("window width: %d\n", (int)header->window_width); printf("window height: %d\n", (int)header->window_height); printf("window x: %d\n", (int)header->window_x); printf("window y: %d\n", (int)header->window_y); printf("border width: %d\n", (int)header->window_bdrwidth); } x11-apps-7.7+5+nmu1ubuntu1/xwud/configure.ac0000664000000000000000000000354512167023104015451 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xwud], [1.0.4], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xwud]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS # Checks for pkg-config packages PKG_CHECK_MODULES(XWUD, x11 xproto >= 7.0.17) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xwud/README0000664000000000000000000000135012167023104014033 0ustar xwud allows X users to display in a window an image saved in a specially formatted dump file, such as produced by xwd. All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xwud http://cgit.freedesktop.org/xorg/app/xwud For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xwud/COPYING0000664000000000000000000000217312167023104014212 0ustar Copyright 1985, 1986, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. x11-apps-7.7+5+nmu1ubuntu1/xwud/INSTALL0000664000000000000000000002622212167023104014211 0ustar Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 6. Often, you can also type `make uninstall' to remove the installed files again. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *Note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/oclock/0000775000000000000000000000000012656635743013464 5ustar x11-apps-7.7+5+nmu1ubuntu1/oclock/Clock.h0000664000000000000000000000457512167023104014656 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _XtClock_h #define _XtClock_h /*********************************************************************** * * Clock Widget * ***********************************************************************/ /* Parameters: Name Class RepType Default Value ---- ----- ------- ------------- background Background pixel White border BorderColor pixel Black borderWidth BorderWidth int 1 minute Foreground Pixel Black hour Foreground Pixel Black height Height int 120 mappedWhenManaged MappedWhenManaged Boolean True width Width int 120 x Position int 0 y Position int 0 */ #define XtNminute "minute" #define XtNhour "hour" #define XtNjewel "jewel" #define XtNshapeWindow "shapeWindow" #define XtCShapeWindow "ShapeWindow" #define XtNtransparent "transparent" #define XtCTransparent "Transparent" #define XtNjewelSize "jewelSize" #define XtNborderSize "borderSize" #define XtCBorderSize "BorderSize" typedef struct _ClockRec *ClockWidget; /* completely defined in ClockPrivate.h */ typedef struct _ClockClassRec *ClockWidgetClass; /* completely defined in ClockPrivate.h */ extern WidgetClass clockWidgetClass; #endif /* _XtClock_h */ /* DON'T ADD STUFF AFTER THIS #endif */ x11-apps-7.7+5+nmu1ubuntu1/oclock/app-defaults/0000775000000000000000000000000012167023104016024 5ustar x11-apps-7.7+5+nmu1ubuntu1/oclock/app-defaults/Clock-color0000664000000000000000000000016312167023104020116 0ustar Clock*Background: grey Clock*BorderColor: light blue Clock*hour: yellow Clock*jewel: yellow Clock*minute: yellow x11-apps-7.7+5+nmu1ubuntu1/oclock/ChangeLog0000664000000000000000000003600112167023104015211 0ustar commit 0563142cc89b04d1bca3208751b186df9649dbda Author: Alan Coopersmith Date: Fri Feb 10 21:25:41 2012 -0800 oclock 1.0.3 Signed-off-by: Alan Coopersmith commit 027f85a81df383155e365f160d7760fa50e48ebe Author: Alan Coopersmith Date: Fri Oct 14 23:12:05 2011 -0700 Enable the latent XKBStdBell code in oclock This code has been unreachable since the switch from Imake lost -DXKB, might as well hook it back up. Sadly it relies on the nonsensical use of libxkbfile for the Bell calls, but such is the state of our XKB Bell API. Signed-off-by: Alan Coopersmith commit 18873da4921369f687023522bc0f07e8e51c8f05 Author: Alan Coopersmith Date: Fri Oct 14 22:57:06 2011 -0700 Strip CVS/RCS id tags Signed-off-by: Alan Coopersmith commit 9e9ba1248f9fa8a43bb98be9bea024aaaa4f0d64 Author: Alan Coopersmith Date: Fri Oct 14 22:53:52 2011 -0700 Strip trailing whitespace Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' git diff -w & git diff -b show no diffs from this change Signed-off-by: Alan Coopersmith commit b1def38874735ca15025edd0d3776387fddeb7f3 Author: Julien Cristau Date: Tue Apr 26 18:36:48 2011 +0200 link against -lXt directly We use Xt, let's check for it explicitly in configure along with the other libs. Signed-off-by: Julien Cristau commit d8d86bc4d1f8c38d7ee7a9e127e43c6892a6033d Author: Alan Coopersmith Date: Mon Jan 24 22:09:43 2011 -0800 Combine usage output into a single string/fprintf call Signed-off-by: Alan Coopersmith commit 5058a07bd4be9f15094b7bbde0fd4d9a975d3ca9 Author: Gaetan Nadon Date: Wed Jan 19 10:06:55 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 379420630b1225d9aeed45a7b8b690e548244c14 Author: Gaetan Nadon Date: Thu Jan 13 11:15:47 2011 -0500 man: remove trailing spaces and tabs Using s/[ \t]*$// Signed-off-by: Gaetan Nadon commit 29f8733848d82ec2fd06b95ce5570f64c89ee58f Author: Gaetan Nadon Date: Wed Jan 12 16:28:02 2011 -0500 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS This silences an Autoconf warning commit 7e4dc63fb57cb8d74eb2cc77e3992d5339d97d42 Author: Gaetan Nadon Date: Wed Jan 12 15:29:49 2011 -0500 config: replace deprecated AC_HELP_STRING with AS_HELP_STRING This silences an Automake warning. Signed-off-by: Gaetan Nadon commit 52f1f49fa24a0459b6ca4db2f3f55700ba66f3c6 Author: Alan Coopersmith Date: Wed Sep 22 19:55:54 2010 -0700 oclock 1.0.2 Signed-off-by: Alan Coopersmith commit af0aaab315399dafdb29a487c841b7de8271079d Author: Alan Coopersmith Date: Wed Sep 22 19:53:41 2010 -0700 config: remove AC_SUBST of OCLOCK_CFLAGS & OCLOCK_LIBS PKG_CHECK_MODULES handles that automatically for us Signed-off-by: Alan Coopersmith commit a7515825e8d487ec58634dde47e110602617079f Author: Alan Coopersmith Date: Wed Sep 22 19:52:54 2010 -0700 config: Remove AC_PROG_CC & AC_PROG_INSTALL that XORG_DEFAULT_OPTIONS provide Signed-off-by: Alan Coopersmith commit d4b4454ad1aa65849a83f12938e6e2913d7e2ce9 Author: Gaetan Nadon Date: Tue Jul 20 18:45:18 2010 -0400 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon commit 375822dca8af44b7c38885877063ea961edc162c Author: Alan Coopersmith Date: Wed Sep 22 19:47:59 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS The existing statement can now be removed from the configuration file. Use automake provided $(AM_V_GEN) and XORG_DEFAULT_OPTIONS provided $(SED) Enables silent rule and use platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit 116e81ed700e02f7ca33d9e5befae9bef8398ae9 Author: Alan Coopersmith Date: Fri Aug 6 08:10:33 2010 -0700 Fill in COPYING file with copyright notices from source code Signed-off-by: Alan Coopersmith commit 36c59a40384192c5ae4a8036532968e96fe2f9c1 Author: Gaetan Nadon Date: Thu Feb 11 10:08:06 2010 -0500 config: move CWARNFLAGS from configure.ac to Makefile.am Compiler warning flags should be explicitly set in the makefile rather than being merged with other packages compiler flags. Signed-off-by: Gaetan Nadon commit 42362ed91f2fd2b8283778890923b336ef4caf8a Author: Gaetan Nadon Date: Sat Dec 19 20:48:47 2009 -0500 configure.ac: use backticks rather than $() for cmd subs Use "$PKG_CONFIG" rather than hard coded "pkg-config" Signed-off-by: Gaetan Nadon commit e053ca4439ec3e5feab7de4ace216ace4e5f31fd Author: Gaetan Nadon Date: Thu Nov 26 09:19:52 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit 1d1d81985cd3f334950afeb8db907aababbd5fac Author: Gaetan Nadon Date: Wed Oct 28 14:09:07 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit 826f9ffce175226b8aa377742e833afb4da75fa3 Author: Gaetan Nadon Date: Tue Oct 27 15:07:24 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit 31872e9a9c11edb98bd3f80898c758f906b73ae2 Author: Gaetan Nadon Date: Mon Oct 26 22:08:38 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit 626858ae023ca3ca69178d9d97f6777c9647c0a7 Author: Gaetan Nadon Date: Thu Oct 22 12:34:14 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit f698ed2d837837c4f8f8e0f26cb8780c352c5cdc Author: Alan Coopersmith Date: Thu Oct 1 14:54:18 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit 11e13bdf2bdc6cdc7f7d27427016eaf8c9ad48c3 Author: Paulo Cesar Pereira de Andrade Date: Mon Jan 12 18:53:19 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings. commit 8509d5cc01607e19590571b4e0d941b0e5900052 Author: Matthieu Herrb Date: Sat Mar 8 22:01:17 2008 +0100 Makefile.am: nuke RCS Id commit e86ed6c3e18f8c1b751ab3da248f30c930d8fb25 Author: James Cloos Date: Thu Dec 6 16:37:03 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit b876d58de971bd0f49be63a171f467dc2e20853e Author: James Cloos Date: Mon Sep 3 05:51:06 2007 -0400 Add *~ to .gitignore to skip patch/emacs droppings commit e76d84c2bec66612645e1b85828fa2407d4ff7b9 Author: James Cloos Date: Thu Aug 23 19:24:30 2007 -0400 Rename .cvsignore to .gitignore commit 7d50f6245b18b96d8b2bf76a62bb2f2ca4a32d6b Author: Kevin E Martin Date: Wed Dec 21 02:29:43 2005 +0000 Update package version for X11R7 release. commit 8beaf1035944b5d9da483940298ea6d14c68ee04 Author: Adam Jackson Date: Mon Dec 19 16:22:41 2005 +0000 Stub COPYING files commit 47d806d0d0893a348f7d8c5107129e1b1691889d Author: Kevin E Martin Date: Thu Dec 15 00:24:03 2005 +0000 Update package version number for final X11R7 release candidate. commit 01110cd495dc25e40e99dac70e104e97bfa88ec1 Author: Kevin E Martin Date: Wed Dec 7 16:17:58 2005 +0000 Change to use the app-defaults default dir configured in libXt. commit de145e0469b263c12499fb6827e8ca7290b9e174 Author: Kevin E Martin Date: Tue Dec 6 22:48:17 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit c5c9c2a0db7a375478dc58e9de96d2dc02dfd085 Author: Kevin E Martin Date: Sat Dec 3 05:49:16 2005 +0000 Update package version number for X11R7 RC3 release. commit 6e2eb6b70fe7a6309455a72dd9efec780a78bea3 Author: Alan Coopersmith Date: Mon Nov 28 22:01:37 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit 294fb296909b32db0f58a0ad5c78a63ecdfd83f0 Author: Eric Anholt Date: Mon Nov 21 10:34:56 2005 +0000 Another pass at .cvsignores for apps. commit 24f73d458c367328b5e97544052c53a0ba352890 Author: Eric Anholt Date: Sun Nov 20 22:08:49 2005 +0000 Add/improve .cvsignore files for apps. commit 233a988e813d0239ab567d66342e2b745584a72c Author: Kevin E Martin Date: Wed Oct 19 02:47:49 2005 +0000 Update package version number for RC1 release. commit e47bd2f5b354a14af9ba84cf9900dfc8e2f51b80 Author: Alan Coopersmith Date: Tue Oct 18 00:32:53 2005 +0000 Change default install dir for app-default files from $(sysconfdir)/X11/app-defaults to $(libdir)/X11/app-defaults to match the monolith & allow localization commit f1d6f0ee06acfb84ebbfa5841e18d9b3301c8619 Author: Alan Coopersmith Date: Mon Oct 17 23:56:20 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 3dd33cc2d36264c903a0032769ce6debc7780be5 Author: Alan Coopersmith Date: Fri Oct 14 00:25:42 2005 +0000 Use sed to fill in variables in man page commit 54fc284497e7a8399e2527d2198862011b85ef75 Author: Alan Coopersmith Date: Thu Oct 13 20:10:59 2005 +0000 Fix app-default files to install under the same names as in the monolith instead of their short names used only for 14-character filename length limited ancient filesystems commit 3d6bd1e2ab17b69f0b188325bbda62e56df13dbf Author: Alan Coopersmith Date: Mon Aug 1 20:25:28 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit 9c808e849cc65bf482f1e1f0b33fc82cd08a0593 Author: Kevin E Martin Date: Fri Jul 29 21:22:29 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit b986847c03da39c177ff8f4086e658c36228fdb2 Author: Alan Coopersmith Date: Tue Jul 26 15:44:01 2005 +0000 Replace more GNU make-ism's with more portable macros commit 9fea8d0cce13310b0549f9af164b04614dee26c6 Author: Adam Jackson Date: Wed Jul 20 19:31:49 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit 375d4ff16a93c5e1874b1a21c96a9549475ae6c4 Author: Matthieu Herrb Date: Sun Jul 17 20:11:01 2005 +0000 fix rules to work with non-GNU make and outside of $srcdir commit f9b186fdd589267fc8d448ffc5da6d775afe01f2 Author: Søren Sandmann Pedersen Date: Tue Jun 28 15:22:52 2005 +0000 Add buildsystem for oclock commit 9bc6e165c4c22f0eb412b306b7e0032a0f6dcac0 Author: Egbert Eich Date: Fri Apr 23 19:54:36 2004 +0000 Merging XORG-CURRENT into trunk commit b456377e090d94ffd38f64b7e0bf86f575b832c2 Author: Egbert Eich Date: Sun Mar 14 08:34:55 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit a99975463d105d5db7de3648c6fb0af568f87a70 Author: Egbert Eich Date: Wed Mar 3 12:12:53 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit 89b70b9fc003bb288a66eb1d4e868489dde88d65 Author: Egbert Eich Date: Thu Feb 26 13:36:15 2004 +0000 readding XFree86's cvs IDs commit dfbd841e966677b36ccf72f8f6492e1010831f5b Author: Egbert Eich Date: Thu Feb 26 09:23:57 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit bd8264b017134cc6def3657a3c770e1a9841ca67 Author: Kaleb Keithley Date: Tue Nov 25 19:29:02 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit 71633e81c3dd2135c7c4c67c954dc0b7f162f7dc Author: Kaleb Keithley Date: Fri Nov 14 16:48:57 2003 +0000 XFree86 4.3.0.1 commit c4bc1693ae8bbc4bff3891b1d06b110025c23579 Author: Kaleb Keithley Date: Fri Nov 14 15:54:53 2003 +0000 R6.6 is the Xorg base-line x11-apps-7.7+5+nmu1ubuntu1/oclock/oclmask.bit0000664000000000000000000000157512167023104015600 0ustar #define oclmask_width 32 #define oclmask_height 32 static unsigned char oclmask_bits[] = { 0x00, 0xf0, 0x07, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x80, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff, 0x01, 0xe0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x07, 0xf8, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0x1f, 0xfe, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xff, 0xff, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/oclock/config.guess0000664000000000000000000012776412167023104015775 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. timestamp='2010-08-21' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' HUP INT TERM # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-tilera-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/oclock/oclock.c0000664000000000000000000001212712167023104015060 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "Clock.h" #include #include #ifdef XKB #include #endif #include "oclock.bit" #include "oclmask.bit" static void die ( Widget w, XtPointer client_data, XtPointer call_data ); static void save ( Widget w, XtPointer client_data, XtPointer call_data ); static void usage ( void ); static void quit ( Widget w, XEvent *event, String *params, Cardinal *num_params ); static XtActionsRec actions[] = { {"quit", quit} }; static Atom wm_delete_window; static void die(Widget w, XtPointer client_data, XtPointer call_data) { XCloseDisplay(XtDisplay(w)); exit(0); } static void save(Widget w, XtPointer client_data, XtPointer call_data) { return; /* stateless */ } /* Exit with message describing command line format */ static void usage(void) { fprintf(stderr, "usage: oclock\n" " [-geometry [{width}][x{height}][{+-}{xoff}[{+-}{yoff}]]]\n" " [-display [{host}]:[{vs}]]\n" " [-fg {color}] [-bg {color}] [-bd {color}] [-bw {pixels}]\n" " [-minute {color}] [-hour {color}] [-jewel {color}]\n" " [-backing {backing-store}] [-shape] [-noshape] [-transparent]\n"); exit(1); } /* Command line options table. Only resources are entered here...there is a pass over the remaining options after XtParseCommand is let loose. */ static XrmOptionDescRec options[] = { {"-fg", "*Foreground", XrmoptionSepArg, NULL}, {"-bg", "*Background", XrmoptionSepArg, NULL}, {"-foreground", "*Foreground", XrmoptionSepArg, NULL}, {"-background", "*Background", XrmoptionSepArg, NULL}, {"-minute", "*clock.minute", XrmoptionSepArg, NULL}, {"-hour", "*clock.hour", XrmoptionSepArg, NULL}, {"-jewel", "*clock.jewel", XrmoptionSepArg, NULL}, {"-backing", "*clock.backingStore", XrmoptionSepArg, NULL}, {"-shape", "*clock.shapeWindow", XrmoptionNoArg, "TRUE"}, {"-noshape", "*clock.shapeWindow", XrmoptionNoArg, "FALSE"}, {"-transparent","*clock.transparent", XrmoptionNoArg, "TRUE"}, }; int main(int argc, char *argv[]) { XtAppContext xtcontext; Widget toplevel; Arg arg[2]; int i; toplevel = XtOpenApplication(&xtcontext, "Clock", options, XtNumber(options), &argc, argv, NULL, sessionShellWidgetClass, NULL, 0); if (argc != 1) usage(); XtAddCallback(toplevel, XtNsaveCallback, save, NULL); XtAddCallback(toplevel, XtNdieCallback, die, NULL); XtAppAddActions (xtcontext, actions, XtNumber(actions)); XtOverrideTranslations (toplevel, XtParseTranslationTable ("WM_PROTOCOLS: quit()")); i = 0; XtSetArg (arg[i], XtNiconPixmap, XCreateBitmapFromData (XtDisplay(toplevel), XtScreen(toplevel)->root, (char *)oclock_bits, oclock_width, oclock_height)); i++; XtSetArg (arg[i], XtNiconMask, XCreateBitmapFromData (XtDisplay(toplevel), XtScreen(toplevel)->root, (char *)oclmask_bits, oclmask_width, oclmask_height)); i++; XtSetValues (toplevel, arg, i); (void) XtCreateManagedWidget("clock", clockWidgetClass, toplevel, NULL, 0); XtRealizeWidget (toplevel); wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", False); (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel), &wm_delete_window, 1); XtAddEventHandler(toplevel, (EventMask) 0, TRUE, _XEditResCheckMessages, NULL); XtAppMainLoop(xtcontext); exit(0); } static void quit(Widget w, XEvent *event, String *params, Cardinal *num_params) { Arg arg; if (event->type == ClientMessage && event->xclient.data.l[0] != wm_delete_window) { #ifdef XKB XkbStdBell(XtDisplay(w), XtWindow(w), 0, XkbBI_BadValue); #else XBell(XtDisplay(w), 0); #endif } else { XtSetArg(arg, XtNjoinSession, False); XtSetValues(w, &arg, (Cardinal)1); die(w, NULL, NULL); } } x11-apps-7.7+5+nmu1ubuntu1/oclock/config.h.in0000664000000000000000000000322312656634603015501 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to use XkbStdBell */ #undef XKB x11-apps-7.7+5+nmu1ubuntu1/oclock/man/0000775000000000000000000000000012656635743014237 5ustar x11-apps-7.7+5+nmu1ubuntu1/oclock/man/oclock.man0000664000000000000000000000643612167023104016172 0ustar .\" Copyright 1989, 1998 The Open Group .\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" .\" .TH OCLOCK 1 __xorgversion__ .SH NAME oclock \- round X clock .SH SYNOPSIS .B oclock [\-option ... ] .SH DESCRIPTION .I Oclock simply displays the current time on an analog display. .SH OPTIONS .TP 8 .B \-fg \fIcolor\fB choose a different color for the both hands and the jewel of the clock .TP 8 .B \-bg \fIcolor\fB choose a different color for the background. .TP 8 .B \-jewel \fIcolor\fB choose a different color for the jewel on the clock. .TP 8 .B \-minute \fIcolor\fB choose a different color for the minute hand of the clock. .TP 8 .B \-hour \fIcolor\fB choose a different color for the hour hand of the clock. .TP 8 .B \-backing \fI{ WhenMapped Always NotUseful }\fB selects an appropriate level of backing store. .TP 8 .B \-geometry \fIgeometry\fB define the initial window geometry; see \fIX(__miscmansuffix__)\fP. .TP 8 .B \-display \fIdisplay\fB specify the display to use; see \fIX(__miscmansuffix__)\fP. .TP 8 .B \-bd \fIcolor\fB choose a different color for the window border. .TP 8 .B \-bw \fIwidth\fB choose a different width for the window border. As the Clock widget changes its border around quite a bit, this is most usefully set to zero. .TP 8 .B \-shape causes the clock to use the Shape extension to create an oval window. This is the default unless the shapeWindow resource is set to false. .TP 8 .B \-noshape causes the clock to not reshape itself and ancestors to exactly fit the outline of the clock. .TP 8 .B \-transparent causes the clock to consist only of the jewel, the hands, and the border. .SH COLORS If you would like your clock to be viewable in color, include the following in the #ifdef COLOR section you read with xrdb: .sp 1 *customization: -color .sp 1 .br This will cause oclock to pick up the colors in the app-defaults color customization file: __projectroot__/lib/X11/app-defaults/Clock-color. Below are the default colors: .sp 1 Clock*Background: grey .br Clock*BorderColor: light blue .br Clock*hour: yellow .br Clock*jewel: yellow .br Clock*minute: yellow .SH "SEE ALSO" X(__miscmansuffix__), X Toolkit documentation .SH AUTHOR Keith Packard, MIT X Consortium x11-apps-7.7+5+nmu1ubuntu1/oclock/man/Makefile.am0000664000000000000000000000052412167023104016247 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = oclock.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/oclock/transform.c0000664000000000000000000000625612167023104015627 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * transformed coordinate system objects for X */ #include #include "transform.h" #include static XPoint * TranslatePoints(TPoint *points, int n_points, Transform *t, int mode) { XPoint *xpoints; int i; double xoff = 0.0, yoff = 0.0; xpoints = (XPoint *) malloc ((unsigned)n_points * sizeof (*xpoints)); if (!xpoints) return NULL; for (i = 0; i < n_points; i++) { xpoints[i].x = Xx(points[i].x + xoff, points[i].y + yoff, t); xpoints[i].y = Xy(points[i].x + xoff, points[i].y + yoff, t); if (mode == CoordModePrevious) { xoff += points[i].x; yoff += points[i].y; } } return xpoints; } void TFillPolygon (register Display *dpy, Drawable d, GC gc, Transform *t, TPoint *points, int n_points, int shape, int mode) { XPoint *xpoints; xpoints = TranslatePoints (points, n_points, t, mode); if (xpoints) { XFillPolygon (dpy, d, gc, xpoints, n_points, shape, CoordModeOrigin); free (xpoints); } } void TDrawArc (register Display *dpy, Drawable d, GC gc, Transform *t, double x, double y, double width, double height, int angle1, int angle2) { int xx, xy, xw, xh; xx = Xx(x,y,t); xy = Xy(x,y,t); xw = Xwidth (width, height, t); xh = Xheight (width, height, t); if (xw < 0) { xx += xw; xw = -xw; } if (xh < 0) { xy += xh; xh = -xh; } XDrawArc (dpy, d, gc, xx, xy, xw, xh, angle1, angle2); } void TFillArc (register Display *dpy, Drawable d, GC gc, Transform *t, double x, double y, double width, double height, int angle1, int angle2) { int xx, xy, xw, xh; xx = Xx(x,y,t); xy = Xy(x,y,t); xw = Xwidth (width, height, t); xh = Xheight (width, height, t); if (xw < 0) { xx += xw; xw = -xw; } if (xh < 0) { xy += xh; xh = -xh; } XFillArc (dpy, d, gc, xx, xy, xw, xh, angle1, angle2); } void SetTransform (Transform *t, int xx1, int xx2, int xy1, int xy2, double tx1, double tx2, double ty1, double ty2) { t->mx = ((double) xx2 - xx1) / (tx2 - tx1); t->bx = ((double) xx1) - t->mx * tx1; t->my = ((double) xy2 - xy1) / (ty2 - ty1); t->by = ((double) xy1) - t->my * ty1; } x11-apps-7.7+5+nmu1ubuntu1/oclock/Clock.c0000664000000000000000000003747012167023104014651 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Clock.c * * a NeWS clone clock */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "ClockP.h" #include #include #include #include #include #include #define Time_t time_t #define offset(field) XtOffsetOf(ClockRec, clock.field) #define goffset(field) XtOffsetOf(WidgetRec, core.field) static XtResource resources[] = { {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), goffset(width), XtRImmediate, (XtPointer) 120}, {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), goffset(height), XtRImmediate, (XtPointer) 120}, {XtNminute, XtCForeground, XtRPixel, sizeof (Pixel), offset(minute), XtRString, XtDefaultForeground}, {XtNhour, XtCForeground, XtRPixel, sizeof (Pixel), offset(hour), XtRString, XtDefaultForeground}, {XtNjewel, XtCForeground, XtRPixel, sizeof (Pixel), offset(jewel), XtRString, XtDefaultForeground}, {XtNbackingStore, XtCBackingStore, XtRBackingStore, sizeof (int), offset (backing_store), XtRString, "default"}, {XtNborderSize, XtCBorderSize, XtRFloat, sizeof (float), offset (border_size), XtRString, "0.1"}, {XtNjewelSize, XtCBorderSize, XtRFloat, sizeof (float), offset (jewel_size), XtRString, "0.075"}, {XtNshapeWindow, XtCShapeWindow, XtRBoolean, sizeof (Boolean), offset (shape_window), XtRImmediate, (XtPointer) True}, {XtNtransparent, XtCTransparent, XtRBoolean, sizeof (Boolean), offset (transparent), XtRImmediate, (XtPointer) False}, }; #undef offset #undef goffset static void ClassInitialize ( void ); static void Initialize ( Widget greq, Widget gnew, ArgList args, Cardinal *num_args ); static void Resize ( Widget widget ); static void Realize ( Widget gw, XtValueMask *valueMask, XSetWindowAttributes *attrs ); static void Destroy ( Widget gw ); static void Redisplay ( Widget gw, XEvent *event, Region region ); static double clock_to_angle ( double clock ); static void new_time ( XtPointer client_data, XtIntervalId *id ); # define BORDER_SIZE(w) ((w)->clock.border_size) # define WINDOW_WIDTH(w) (2.0 - BORDER_SIZE(w)*2) # define WINDOW_HEIGHT(w) (2.0 - BORDER_SIZE(w)*2) # define MINUTE_WIDTH(w) (0.05) # define HOUR_WIDTH(w) (0.05) # define JEWEL_SIZE(w) ((w)->clock.jewel_size) # define MINUTE_LENGTH(w) (JEWEL_Y(w) - JEWEL_SIZE(w) / 2.0) # define HOUR_LENGTH(w) (MINUTE_LENGTH(w) * 0.6) # define JEWEL_X(w) (0.0) # define JEWEL_Y(w) (1.0 - (BORDER_SIZE(w) + JEWEL_SIZE(w))) ClockClassRec clockClassRec = { { /* core fields */ /* superclass */ &widgetClassRec, /* class_name */ "Clock", /* size */ sizeof(ClockRec), /* class_initialize */ ClassInitialize, /* class_part_initialize */ NULL, /* class_inited */ FALSE, /* initialize */ Initialize, /* initialize_hook */ NULL, /* realize */ Realize, /* actions */ NULL, /* num_actions */ 0, /* resources */ resources, /* num_resources */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, /* compress_exposure */ TRUE, /* compress_enterleave */ TRUE, /* visible_interest */ FALSE, /* destroy */ Destroy, /* resize */ Resize, /* expose */ Redisplay, /* set_values */ NULL, /* set_values_hook */ NULL, /* set_values_almost */ NULL, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ NULL, /* query_geometry */ XtInheritQueryGeometry, } }; static void ClassInitialize(void) { XtAddConverter( XtRString, XtRBackingStore, XmuCvtStringToBackingStore, NULL, 0 ); } WidgetClass clockWidgetClass = (WidgetClass) &clockClassRec; /* ARGSUSED */ static void Initialize (Widget greq, Widget gnew, ArgList args, Cardinal *num_args) { ClockWidget w = (ClockWidget)gnew; XtGCMask valuemask; XGCValues myXGCV; int shape_event_base, shape_error_base; valuemask = GCForeground; if (w->clock.transparent) { ; } else { myXGCV.foreground = w->clock.minute; w->clock.minuteGC = XtGetGC(gnew, valuemask, &myXGCV); myXGCV.foreground = w->clock.hour; w->clock.hourGC = XtGetGC(gnew, valuemask, &myXGCV); myXGCV.foreground = w->clock.jewel; w->clock.jewelGC = XtGetGC(gnew, valuemask, &myXGCV); myXGCV.foreground = w->core.background_pixel; w->clock.eraseGC = XtGetGC(gnew, valuemask, &myXGCV); } /* wait for Realize to add the timeout */ w->clock.interval_id = 0; if (w->clock.shape_window && !XShapeQueryExtension (XtDisplay (w), &shape_event_base, &shape_error_base)) w->clock.shape_window = False; w->clock.shape_mask = 0; w->clock.shapeGC = NULL; w->clock.shape_width = 0; w->clock.shape_height = 0; w->clock.polys_valid = 0; } static void Resize (Widget widget) { ClockWidget w = (ClockWidget) widget; XGCValues xgcv; Widget parent; XWindowChanges xwc; int face_width, face_height; int x, y; Pixmap shape_mask; if (!XtIsRealized((Widget) w)) return; /* * compute desired border size */ SetTransform (&w->clock.maskt, 0, w->core.width, w->core.height, 0, -1.0, 1.0, -1.0, 1.0); face_width = abs (Xwidth (BORDER_SIZE(w), BORDER_SIZE(w), &w->clock.maskt)); face_height = abs (Xheight (BORDER_SIZE(w), BORDER_SIZE(w), &w->clock.maskt)); /* * shape the windows and borders */ if (w->clock.shape_window) { SetTransform (&w->clock.t, face_width, w->core.width - face_width, w->core.height - face_height, face_height, -WINDOW_WIDTH(w)/2, WINDOW_WIDTH(w)/2, -WINDOW_HEIGHT(w)/2, WINDOW_HEIGHT(w)/2); /* * allocate a pixmap to draw shapes in */ if (w->clock.shape_mask && (w->clock.shape_width != w->core.width || w->clock.shape_height != w->core.height)) { XFreePixmap (XtDisplay (w), w->clock.shape_mask); w->clock.shape_mask = None; } if (!w->clock.shape_mask) { w->clock.shape_mask = XCreatePixmap (XtDisplay (w), XtWindow (w), w->core.width, w->core.height, 1); } shape_mask = w->clock.shape_mask; if (!w->clock.shapeGC) w->clock.shapeGC = XCreateGC (XtDisplay (w), shape_mask, 0, &xgcv); /* erase the pixmap */ XSetForeground (XtDisplay (w), w->clock.shapeGC, 0); XFillRectangle (XtDisplay (w), shape_mask, w->clock.shapeGC, 0, 0, w->core.width, w->core.height); XSetForeground (XtDisplay (w), w->clock.shapeGC, 1); /* * draw the bounding shape. Doing this first * eliminates extra exposure events. */ if (w->clock.border_size > 0.0 || !w->clock.transparent) { TFillArc (XtDisplay (w), shape_mask, w->clock.shapeGC, &w->clock.maskt, -1.0, -1.0, 2.0, 2.0, 0, 360 * 64); } if (w->clock.transparent) { if (w->clock.border_size > 0.0) { XSetForeground (XtDisplay (w), w->clock.shapeGC, 0); TFillArc (XtDisplay (w), shape_mask, w->clock.shapeGC, &w->clock.t, -WINDOW_WIDTH(w)/2, -WINDOW_HEIGHT(w)/2, WINDOW_WIDTH(w), WINDOW_HEIGHT(w), 0, 360 * 64); XSetForeground (XtDisplay (w), w->clock.shapeGC, 1); } paint_jewel (w, shape_mask, w->clock.shapeGC); paint_hands (w, shape_mask, w->clock.shapeGC, w->clock.shapeGC); } /* * Find the highest enclosing widget and shape it */ x = 0; y = 0; for (parent = (Widget) w; XtParent (parent); parent = XtParent (parent)) { x = x + parent->core.x + parent->core.border_width; y = y + parent->core.y + parent->core.border_width; } XShapeCombineMask (XtDisplay (parent), XtWindow (parent), ShapeBounding, x, y, shape_mask, ShapeSet); /* erase the pixmap */ XSetForeground (XtDisplay (w), w->clock.shapeGC, 0); XFillRectangle (XtDisplay (w), shape_mask, w->clock.shapeGC, 0, 0, w->core.width, w->core.height); XSetForeground (XtDisplay (w), w->clock.shapeGC, 1); /* * draw the clip shape */ if (w->clock.transparent) { paint_jewel (w, shape_mask, w->clock.shapeGC); paint_hands (w, shape_mask, w->clock.shapeGC, w->clock.shapeGC); } else { TFillArc (XtDisplay (w), shape_mask, w->clock.shapeGC, &w->clock.t, -WINDOW_WIDTH(w)/2, -WINDOW_HEIGHT(w)/2, WINDOW_WIDTH(w), WINDOW_HEIGHT(w), 0, 360 * 64); } XShapeCombineMask (XtDisplay (w), XtWindow (w), ShapeClip, 0, 0, shape_mask, ShapeSet); } else { /* * reconfigure the widget to split the availible * space between the window and the border */ if (face_width > face_height) xwc.border_width = face_height; else xwc.border_width = face_width; xwc.width = w->core.width - xwc.border_width * 2; xwc.height = w->core.height - xwc.border_width * 2; XConfigureWindow (XtDisplay (w), XtWindow (w), CWWidth|CWHeight|CWBorderWidth, &xwc); SetTransform (&w->clock.t, 0, xwc.width, xwc.height, 0, -WINDOW_WIDTH(w)/2, WINDOW_WIDTH(w)/2, -WINDOW_HEIGHT(w)/2, WINDOW_HEIGHT(w)/2); } } static void Realize (Widget gw, XtValueMask *valueMask, XSetWindowAttributes *attrs) { ClockWidget w = (ClockWidget)gw; if (w->clock.backing_store != Always + WhenMapped + NotUseful) { attrs->backing_store = w->clock.backing_store; *valueMask |= CWBackingStore; } if (w->clock.transparent) { attrs->background_pixel = w->clock.minute; *valueMask |= CWBackPixel; *valueMask &= ~CWBackPixmap; } XtCreateWindow( gw, (unsigned)InputOutput, (Visual *)CopyFromParent, *valueMask, attrs ); if (!w->clock.transparent) Resize (gw); new_time ((XtPointer) gw, NULL); } static void Destroy (Widget gw) { ClockWidget w = (ClockWidget)gw; if (w->clock.interval_id) XtRemoveTimeOut (w->clock.interval_id); if (! w->clock.transparent) { XtReleaseGC(gw, w->clock.minuteGC); XtReleaseGC(gw, w->clock.hourGC); XtReleaseGC(gw, w->clock.jewelGC); XtReleaseGC(gw, w->clock.eraseGC); } if (w->clock.shapeGC) XFreeGC(XtDisplay(gw), w->clock.shapeGC); if (w->clock.shape_mask) XFreePixmap (XtDisplay (w), w->clock.shape_mask); } /* ARGSUSED */ static void Redisplay(Widget gw, XEvent *event, Region region) { ClockWidget w; w = (ClockWidget) gw; if (!w->clock.transparent) { paint_jewel (w, XtWindow (w), w->clock.jewelGC); paint_hands (w, XtWindow (w), w->clock.minuteGC, w->clock.hourGC); } } /* * routines to draw the hands and jewel */ #ifndef PI /* may be found in */ # define PI (3.14159265358979323846) #endif /* * converts a number from 0..1 representing a clockwise radial distance * from the 12 oclock position to a radian measure of the counter-clockwise * distance from the 3 oclock position */ static double clock_to_angle (double clock) { if (clock >= .75) clock -= 1.0; return -2.0 * PI * clock + PI / 2.0; } /* ARGSUSED */ static void new_time (XtPointer client_data, XtIntervalId *id) { ClockWidget w = (ClockWidget)client_data; Time_t now; struct tm *tm; if (!w->clock.transparent) if (w->clock.polys_valid) { paint_hands (w, XtWindow (w), w->clock.eraseGC, w->clock.eraseGC); check_jewel (w, XtWindow (w), w->clock.jewelGC); } (void) time (&now); tm = localtime (&now); if (tm->tm_hour >= 12) tm->tm_hour -= 12; w->clock.hour_angle = clock_to_angle ((((double) tm->tm_hour) + ((double) tm->tm_min) / 60.0) / 12.0); w->clock.minute_angle = clock_to_angle (((double) tm->tm_min) / 60.0); /* * add the timeout before painting the hands, that may * take a while and we'd like the clock to keep up * with time changes. */ w->clock.interval_id = XtAppAddTimeOut (XtWidgetToApplicationContext((Widget) w), (60 - tm->tm_sec) * 1000, new_time, client_data); compute_hands (w); if (w->clock.transparent) Resize ((Widget)w); else paint_hands (w, XtWindow (w), w->clock.minuteGC, w->clock.hourGC); } /* new_time */ void paint_jewel (ClockWidget w, Drawable d, GC gc) { if (JEWEL_SIZE(w) > 0.0) { TFillArc (XtDisplay (w), d, gc, &w->clock.t, JEWEL_X(w) - JEWEL_SIZE(w) / 2.0, JEWEL_Y(w) - JEWEL_SIZE(w) / 2.0, JEWEL_SIZE(w), JEWEL_SIZE(w), 0, 360 * 64); } } #define sqr(x) ((x)*(x)) /* * check to see if the polygon intersects the circular jewel */ int check_jewel_poly (ClockWidget w, TPoint poly[POLY_SIZE]) { double a2, b2, c2, d2; double x, y, size; int i; if (JEWEL_SIZE(w) > 0.0) { x = JEWEL_X(w); y = JEWEL_Y(w); size = JEWEL_SIZE(w); /* * check each side of the polygon to see if the * distance from the line to the center of the * circular jewel is less than the radius. */ for (i = 0; i < POLY_SIZE-1; i++) { a2 = sqr (poly[i].x - x) + sqr (poly[i].y - y); b2 = sqr (poly[i+1].x - x) + sqr (poly[i+1].y - y); c2 = sqr (poly[i].x - poly[i+1].x) + sqr (poly[i].y - poly[i+1].y); d2 = a2 + b2 - c2; if ((d2 <= sqr (size) && a2 <= 2 * c2 && b2 <= 2 * c2) || a2 <= sqr (size) || b2 <= sqr (size)) return 1; } } return 0; } void check_jewel (ClockWidget w, Drawable d, GC gc) { if (!w->clock.polys_valid || JEWEL_SIZE(w) <= 0.0) return; if ((MINUTE_LENGTH(w) >= (JEWEL_Y(w) - JEWEL_SIZE(w)/2.0) && check_jewel_poly (w, w->clock.minute_poly)) || (HOUR_LENGTH(w) >= (JEWEL_Y(w) - JEWEL_SIZE(w)/2.0) && check_jewel_poly (w, w->clock.minute_poly))) { paint_jewel (w, d, gc); } } /* * A hand is a rectangle with a triangular cap at the far end. * This is represented with a five sided polygon. */ void compute_hand (ClockWidget w, double a, double l, double width, TPoint poly[POLY_SIZE]) { double c, s; c = cos(a); s = sin(a); poly[0].x = c * l; poly[0].y = s * l; poly[1].x = (l - width) * c - s * width; poly[1].y = (l - width) * s + c * width; poly[2].x = (-width) * c - s * width; poly[2].y = (-width) * s + c * width; poly[3].x = (-width) * c + s * width; poly[3].y = (-width) * s - c * width; poly[4].x = (l - width) * c + s * width; poly[4].y = (l - width) * s - c * width; poly[5].x = poly[0].x; poly[5].y = poly[0].y; } void compute_hands (ClockWidget w) { compute_hand (w, w->clock.minute_angle, MINUTE_LENGTH(w), MINUTE_WIDTH(w), w->clock.minute_poly); compute_hand (w, w->clock.hour_angle, HOUR_LENGTH(w), HOUR_WIDTH(w), w->clock.hour_poly); w->clock.polys_valid = 1; } void paint_hand (ClockWidget w, Drawable d, GC gc, TPoint poly[POLY_SIZE]) { TFillPolygon (XtDisplay (w), d, gc, &w->clock.t, poly, POLY_SIZE, Convex, CoordModeOrigin); } void paint_hands (ClockWidget w, Drawable d, GC minute_gc, GC hour_gc) { if (w->clock.polys_valid) { paint_hand (w, d, hour_gc, w->clock.hour_poly); paint_hand (w, d, minute_gc, w->clock.minute_poly); } } x11-apps-7.7+5+nmu1ubuntu1/oclock/oclock.bit0000664000000000000000000000157212167023104015416 0ustar #define oclock_width 32 #define oclock_height 32 static unsigned char oclock_bits[] = { 0x00, 0xf0, 0x07, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x80, 0x8f, 0xf8, 0x00, 0xc0, 0xc1, 0xc1, 0x01, 0xe0, 0x80, 0x80, 0x03, 0x30, 0x00, 0x00, 0x06, 0x18, 0x00, 0x00, 0x0c, 0x1c, 0x00, 0x00, 0x1c, 0x0c, 0x00, 0x70, 0x18, 0x06, 0x00, 0x78, 0x30, 0x06, 0x00, 0x3c, 0x30, 0x06, 0x00, 0x1e, 0x30, 0x03, 0x00, 0x0f, 0x60, 0x03, 0x80, 0x07, 0x60, 0x03, 0xc0, 0x03, 0x60, 0x03, 0xc0, 0x01, 0x60, 0x03, 0xc0, 0x01, 0x60, 0x03, 0xc0, 0x01, 0x60, 0x03, 0xc0, 0x01, 0x60, 0x06, 0xc0, 0x01, 0x30, 0x06, 0xc0, 0x01, 0x30, 0x06, 0xc0, 0x01, 0x30, 0x0c, 0xc0, 0x01, 0x18, 0x1c, 0xc0, 0x01, 0x1c, 0x18, 0xc0, 0x01, 0x0c, 0x30, 0xc0, 0x01, 0x06, 0xe0, 0xc0, 0x81, 0x03, 0xc0, 0x81, 0xc0, 0x01, 0x80, 0x0f, 0xf8, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/oclock/config.sub0000664000000000000000000010437612167023104015432 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. timestamp='2010-09-11' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile-* | tilegx-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; # This must be matched before tile*. tilegx*) basic_machine=tilegx-unknown os=-linux-gnu ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/oclock/Makefile.am0000664000000000000000000000335312167023104015477 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = oclock AM_CFLAGS = $(OCLOCK_CFLAGS) $(CWARNFLAGS) oclock_LDADD = $(OCLOCK_LIBS) -lm oclock_SOURCES = \ Clock.c \ Clock.h \ ClockP.h \ oclock.c \ transform.c \ transform.h # App default files (*.ad) DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ dist_appdefault_DATA = \ app-defaults/Clock-color EXTRA_DIST = oclock.bit oclmask.bit MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/oclock/transform.h0000664000000000000000000000467612167023104015640 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * header file for transformed coordinate system. No rotations * supported, as elipses cannot be rotated in X. */ typedef struct _transform { double mx, bx; double my, by; } Transform; typedef struct _TPoint { double x, y; } TPoint; typedef struct _TRectangle { double x, y, width, height; } TRectangle; # define Xx(x,y,t) ((int)((t)->mx * (x) + (t)->bx + 0.5)) # define Xy(x,y,t) ((int)((t)->my * (y) + (t)->by + 0.5)) # define Xwidth(w,h,t) ((int)((t)->mx * (w) + 0.5)) # define Xheight(w,h,t) ((int)((t)->my * (h) + 0.5)) # define Tx(x,y,t) ((((double) (x)) - (t)->bx) / (t)->mx) # define Ty(x,y,t) ((((double) (y)) - (t)->by) / (t)->my) # define Twidth(w,h,t) (((double) (w)) / (t)->mx) # define Theight(w,h,t) (((double) (h)) / (t)->my) extern void TFillPolygon ( Display *dpy, Drawable d, GC gc, Transform *t, TPoint *points, int n_points, int shape, int mode ); extern void TDrawArc ( Display *dpy, Drawable d, GC gc, Transform *t, double x, double y, double width, double height, int angle1, int angle2 ); extern void TFillArc ( Display *dpy, Drawable d, GC gc, Transform *t, double x, double y, double width, double height, int angle1, int angle2 ); extern void SetTransform ( Transform *t, int xx1, int xx2, int xy1, int xy2, double tx1, double tx2, double ty1, double ty2 ); x11-apps-7.7+5+nmu1ubuntu1/oclock/configure.ac0000664000000000000000000000456312167023104015735 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. AC_PREREQ([2.60]) AC_INIT([oclock], [1.0.3], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [oclock]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS AC_CONFIG_HEADERS([config.h]) # Optional dependencies AC_ARG_WITH(xkb, AS_HELP_STRING([--without-xkb], [Disable use of XKB to sound bells (Default is with-xkb)]), use_xkb="$withval", use_xkb="yes") if test x$use_xkb != xno ; then XKBMODULE="xkbfile" AC_DEFINE([XKB],1,[Define to use XkbStdBell]) fi # Checks for pkg-config packages PKG_CHECK_MODULES(OCLOCK, x11 xmu xext xt ${XKBMODULE}) xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` AC_ARG_WITH(appdefaultdir, AS_HELP_STRING([--with-appdefaultdir=], [specify directory for app-defaults files (default is autodetected)]), [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/oclock/README0000664000000000000000000000133612167023104014322 0ustar oclock is a simple analog clock using the SHAPE extension to make a round (possibly transparent) window. All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/oclock http://cgit.freedesktop.org/xorg/app/oclock For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/oclock/COPYING0000664000000000000000000000456512167023104014504 0ustar Copyright 1989, 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright (C) 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other deal- ings in this Software without prior written authorization from the X Consor- tium. x11-apps-7.7+5+nmu1ubuntu1/oclock/INSTALL0000664000000000000000000002622212167023104014474 0ustar Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 6. Often, you can also type `make uninstall' to remove the installed files again. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *Note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/oclock/ClockP.h0000664000000000000000000000610112167023104014761 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _ClockP_h #define _ClockP_h #include "Clock.h" #include #include "transform.h" #define POLY_SIZE 6 /* New fields for the clock widget instance record */ typedef struct { Pixel minute; Pixel hour; Pixel jewel; GC minuteGC; GC hourGC; GC jewelGC; GC eraseGC; GC shapeGC; /* pointer to GraphicsContext */ /* start of graph stuff */ int backing_store; /* backing store variety */ Boolean shape_window; /* use SetWindowShapeMask */ Boolean transparent; /* make window transparent */ float border_size; float jewel_size; XtIntervalId interval_id; Transform t; Transform maskt; Pixmap shape_mask; /* window shape */ int shape_width; /* window width when shape last made */ int shape_height; /* window height when shape last made */ double hour_angle; /* hour hand position */ double minute_angle; /* minute hand position */ int polys_valid; /* polygons contain good data */ TPoint minute_poly[POLY_SIZE]; /* polygon for minute hand */ TPoint hour_poly[POLY_SIZE]; /* polygon for hour hand */ } ClockPart; /* Full instance record declaration */ typedef struct _ClockRec { CorePart core; ClockPart clock; } ClockRec; /* New fields for the Clock widget class record */ typedef struct {int dummy;} ClockClassPart; /* Full class record declaration. */ typedef struct _ClockClassRec { CoreClassPart core_class; ClockClassPart clock_class; } ClockClassRec; /* Class pointer. */ extern ClockClassRec clockClassRec; extern void paint_jewel ( ClockWidget w, Drawable d, GC gc ); extern int check_jewel_poly ( ClockWidget w, TPoint poly[6] ); extern void check_jewel ( ClockWidget w, Drawable d, GC gc ); extern void compute_hand ( ClockWidget w, double a, double l, double width, TPoint poly[6] ); extern void compute_hands ( ClockWidget w ); extern void paint_hand ( ClockWidget w, Drawable d, GC gc, TPoint poly[6] ); extern void paint_hands ( ClockWidget w, Drawable d, GC minute_gc, GC hour_gc ); #endif /* _ClockP_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/0000775000000000000000000000000012656635743013327 5ustar x11-apps-7.7+5+nmu1ubuntu1/xedit/hook.c0000664000000000000000000007326312472175711014434 0ustar /* * Copyright (c) 1999 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/hook.c,v 1.9 2003/01/08 05:07:40 paulo Exp $ */ /* * This file is intended to be used to add all the necessary hooks to xedit * emulate certain features of emacs (and other text editors) that are better * kept only in xedit, to avoid unnecessary code in the Text Widget. * * The code here is not finished, and will probably be changed frequently. */ #include "xedit.h" #include "re.h" #include "util.h" #include #include #include /* * Types */ typedef struct _ReplaceEntry { hash_key *word; struct _ReplaceEntry *next; char *replace; } ReplaceEntry; typedef enum { SubstituteDisabled, SubstituteAsk, SubstituteNo, SubstituteYes } SubstitutionState; typedef struct _EditInfo { /* Xedit regex data */ re_cod regex; re_mat mats[10]; /* Last command entered */ char command[128]; /* String and flags used to compile regex */ char pattern[64]; char subst_pattern[64]; int pat_length; int flags; /* Substitution buffer */ char subst[64]; int soff, slen, sref; /* For interactive substitution */ int callback; Widget widget; char *text_line; SubstitutionState state; XawTextPosition from, to, start, end, first, last; /* Use if need to allocate a buffer to pass the entire line to reexec */ char *line; long lsize; /* Buffer to prepare replacement, if needs to expand backreferences */ char *buffer; long bsize; } EditInfo; /* * Prototypes */ static void ActionHook(Widget, XtPointer, String, XEvent*, String*, Cardinal*); static void AutoReplaceHook(Widget, String, XEvent*); static Bool StartAutoReplace(void); static char *ReplacedWord(char*, char*); static void AutoReplace(Widget, XEvent*); static void AutoReplaceCallback(Widget, XtPointer, XtPointer); static void SubstituteHook(Widget w, String action, XEvent *event); static void SubstituteCallback(Widget, XtPointer, XtPointer); /* * Initialization */ #define STRTBLSZ 11 static hash_table *replace_hash; static EditInfo einfo; extern Widget scratch; /* * Implementation */ Bool StartHooks(XtAppContext app) { static Bool first_time = True; if (first_time) { StartAutoReplace(); (void)XtAppAddActionHook(app, ActionHook, NULL); first_time = False; return (True); } return (False); } /*ARGSUSED*/ static void ActionHook(Widget w, XtPointer client_data, String action, XEvent *event, String *params, Cardinal *num_params) { AutoReplaceHook(w, action, event); SubstituteHook(w, action, event); } /*** auto replace ***/ struct { Widget widget; String text; Cardinal length; XawTextPosition left, right; Bool replace; Bool enabled; } auto_replace; static void AutoReplaceHook(Widget w, String action, XEvent *event) { static Bool multiply; if (w != textwindow || !auto_replace.enabled) return; if (auto_replace.widget != textwindow) { if (auto_replace.replace) { auto_replace.replace = False; XtRemoveCallback(auto_replace.widget, XtNpositionCallback, AutoReplaceCallback, NULL); } } else if (strcmp(action, "multiply") == 0) { multiply = True; return; } else if (strcmp(action, "numeric") == 0) { if (multiply) return; } else if (strcmp(action, "insert-char") && strcmp(action, "newline") && strcmp(action, "newline-and-indent")) { return; } multiply = False; AutoReplace(w, event); } static Bool StartAutoReplace(void) { Bool esc; int len, llen, rlen, count = 0; char ch, *tmp, *left, *right, *replace = app_resources.auto_replace; if (!replace || !*replace) return (False); replace_hash = hash_new(STRTBLSZ, NULL); left = XtMalloc(llen = 256); right = XtMalloc(rlen = 256); while (*replace) { /* skip white spaces */ while (*replace && isspace(*replace)) ++replace; if (!*replace) break; /* read left */ tmp = replace; while (*replace && !isspace(*replace)) ++replace; len = replace - tmp; if (len >= llen) left = XtRealloc(left, llen = len + 1); strncpy(left, tmp, len); left[len] = '\0'; /* skip white spaces */ while (*replace && isspace(*replace)) ++replace; /* read right */ len = 0; esc = False; while ((ch = *replace) != '\0') { ++replace; if (len + 2 >= rlen) right = XtRealloc(right, rlen += 256); if (ch == '\\') { if (esc) right[len++] = '\\'; esc = !esc; continue; } else if (ch == '\n' && !esc) break; else right[len++] = ch; esc = False; } right[len] = '\0'; (void)ReplacedWord(left, right); ++count; } XtFree(left); XtFree(right); return (auto_replace.enabled = count > 0); } static char * ReplacedWord(char *word, char *replace) { int length; ReplaceEntry *entry; length = strlen(word); entry = (ReplaceEntry *)hash_check(replace_hash, word, length); if (entry == NULL && replace != NULL) { entry = XtNew(ReplaceEntry); entry->word = XtNew(hash_key); entry->word->value = XtNewString(word); entry->word->length = length; entry->next = NULL; entry->replace = XtNewString(replace); hash_put(replace_hash, (hash_entry *)entry); } else if (replace) { XtFree(entry->replace); entry->replace = XtNewString(replace); } return (entry ? entry->replace : NULL); } static void AutoReplace(Widget w, XEvent *event) { static XComposeStatus compose = {NULL, 0}; KeySym keysym; XawTextBlock block; XawTextPosition left, right, pos; Widget source; int i, len, size; char *str, buf[32], mb[sizeof(wchar_t)]; size = XLookupString((XKeyEvent*)event, mb, sizeof(mb), &keysym, &compose); if (size != 1 || isalnum(*mb)) return; source = XawTextGetSource(w); right = XawTextGetInsertionPoint(w); left = XawTextSourceScan(source, right, XawstWhiteSpace, XawsdLeft, 1, False); if (left < 0 || left == right) return; len = 0; str = buf; size = sizeof(buf); pos = left; while (pos < right) { pos = XawTextSourceRead(source, pos, &block, right - pos); for (i = 0; i < block.length; i++) { if (block.format == FMT8BIT) *mb = block.ptr[i]; else wctomb(mb, ((wchar_t*)block.ptr)[i]); str[len++] = *mb; if (len + 2 >= size) { if (str == buf) str = XtMalloc(size += sizeof(buf)); else str = XtRealloc(str, size += sizeof(buf)); } } } str[len] = '\0'; if ((auto_replace.text = ReplacedWord(str, NULL)) != NULL) { auto_replace.length = strlen(auto_replace.text); auto_replace.left = left; auto_replace.right = right; auto_replace.replace = True; XtAddCallback(auto_replace.widget = w, XtNpositionCallback, AutoReplaceCallback, NULL); } if (str != buf) XtFree(str); } /*ARGSUSED*/ static void AutoReplaceCallback(Widget w, XtPointer client_data, XtPointer call_data) { int i, inc; XawTextBlock block, text; char buffer[1024], mb[sizeof(wchar_t)]; XawTextPosition left, right, pos; if (!auto_replace.replace || w != auto_replace.widget) return; XtRemoveCallback(auto_replace.widget, XtNpositionCallback, AutoReplaceCallback, NULL); auto_replace.replace = False; inc = XawTextGetInsertionPoint(w) - auto_replace.right; if (auto_replace.length + inc > sizeof(buffer)) block.ptr = XtMalloc(auto_replace.length + inc); else block.ptr = buffer; memcpy(block.ptr, auto_replace.text, auto_replace.length); block.length = auto_replace.length; pos = left = auto_replace.right; right = left + inc; while (pos < right) { pos = XawTextSourceRead(XawTextGetSource(w), pos, &text, inc); for (i = 0; i < text.length; i++) { if (text.format == FMT8BIT) *mb = text.ptr[i]; else wctomb(mb, ((wchar_t*)text.ptr)[i]); block.ptr[block.length++] = *mb; } } block.firstPos = 0; block.format = FMT8BIT; if (XawTextReplace(w, auto_replace.left, auto_replace.right + inc, &block) == XawEditDone) XawTextSetInsertionPoint(w, auto_replace.left + block.length); if (block.ptr != buffer) XtFree(block.ptr); } /*ARGUSED*/ void LineEditAction(Widget w, XEvent *event, String *params, Cardinal *num_params) { XawTextBlock block; if (international) { /* XXX FIXME */ fprintf(stderr, "LineEditAction: Not working in international mode.\n"); return; } block.firstPos = 0; block.format = FMT8BIT; block.ptr = einfo.command; block.length = strlen(einfo.command); XawTextReplace(filenamewindow, 0, XawTextLastPosition(filenamewindow), &block); XtSetKeyboardFocus(topwindow, filenamewindow); line_edit = True; } void LineEdit(Widget w) { /* Global usage variables */ XawTextPosition from, to, first, last, position, length, redisplay; int replace, compile, ecode, nth, flags, count, etype; char *command, *line, buffer[128]; XawTextBlock block; Widget source; XawTextScanDirection direction; xedit_flist_item *item; /* Variables used while parsing command */ int state, action, offset, icase, confirm; long lfrom, lto, lfinc, ltinc, number; char *ptr, *pstart, *pend, *rstart, *rend, *tmp; /* Variables used in the search/replace loop */ int len; XawTextPosition adjust = 0; command = GetString(filenamewindow); length = strlen(command); if (length >= sizeof(einfo.command)) { Feep(); return; } item = FindTextSource(XawTextGetSource(w), NULL); source = item->source; position = XawTextGetInsertionPoint(w); first = XawTextSourceScan(source, 0, XawstAll, XawsdLeft, 1, True); last = XawTextSourceScan(source, 0, XawstAll, XawsdRight, 1, True); compile = redisplay = nth = count = confirm = 0; direction = XawsdRight; flags = RE_STARTEND; /* Error types */ #define T_NONE 0 #define T_OPTION 1 #define T_ICASE 2 #define T_COMMAND 3 #define T_REPLACE 4 #define T_SEARCH 5 #define T_BACKSLASH 6 #define T_DIRECTION 7 #define T_COMMA 8 #define T_OFFSET 9 #define T_INCREMENT 10 #define T_NUMBER 11 #define T_UNFINISHED 12 #define T_RANGE 13 #define T_BACKREF 14 #define T_EDIT 15 etype = T_NONE; #define FAIL(code) { etype = code; goto fail; } /* Value for the line value, anything else is the line number */ #define L_FIRST -1 #define L_CURRENT -2 #define L_LAST -3 lfrom = L_FIRST; lto = L_LAST; /* Parsing states */ #define E_FINC 0 #define E_FROM 1 #define E_COMMA 2 #define E_TINC 3 #define E_TO 4 #define E_COMMAND 5 #define E_REGEX 6 #define E_SUBST 7 #define E_OPTIONS 8 state = E_FROM; /* Beginning interpretation */ /* Known commands */ #define A_SEARCH 0 #define A_REPLACE 1 action = A_SEARCH; /* Flag to replace all occurrences */ #define O_ALL -1 number = 1; lfinc = ltinc = 0; icase = offset = 0; pstart = pend = rstart = rend = NULL; if (einfo.state != SubstituteDisabled) { if (einfo.widget != w || strcmp(einfo.command, command)) { einfo.widget = w; einfo.state = SubstituteAsk; } else { XawTextPosition s_start, s_end; XawTextGetSelectionPos(w, &s_start, &s_end); if (s_start != einfo.start || s_end != einfo.end) einfo.state = SubstituteAsk; confirm = replace = 1; from = einfo.from; to = einfo.to; first = einfo.first; last = einfo.last; goto confirm_label; } } /* Remember last command */ strcpy(einfo.command, command); /* Loop parsing command */ for (ptr = einfo.command; *ptr;) { switch (*ptr++) { case 'c': if (state != E_OPTIONS && state != E_COMMAND && state != E_REGEX) FAIL(T_OPTION) confirm = 1; break; case 'g': if (state != E_OPTIONS && state != E_COMMAND && state != E_REGEX) FAIL(T_OPTION) offset = O_ALL; break; case 'i': if (state != E_OPTIONS && state != E_COMMAND && state != E_REGEX && state != E_FROM) FAIL(T_ICASE) icase = 1; break; case 's': if (state == E_FROM) lfrom = lto = L_CURRENT; else if (state == E_COMMA) { lto = L_CURRENT; ltinc = lfinc; } else if (state == E_TO) lto = L_LAST; else if (state == E_FINC) { ltinc = lfinc; lto = L_CURRENT; } else if (state != E_COMMAND && state != E_TINC) FAIL(T_COMMAND) action = A_REPLACE; state = E_REGEX; break; case '?': if (action == A_REPLACE) FAIL(T_REPLACE) case '/': if (state == E_TINC) state = action == A_REPLACE ? E_REGEX : E_FROM; else if (state == E_COMMA || state == E_FINC) { lto = L_LAST; state = E_FROM; } else if (state == E_TO) { if (ltinc == 0) lto = L_LAST; state = E_FROM; } else if (state == E_COMMAND) state = E_FROM; else if (state != E_REGEX && state != E_SUBST && state != E_FROM) FAIL(T_SEARCH) if (state != E_SUBST) direction = ptr[-1] == '/' ? XawsdRight : XawsdLeft; for (tmp = ptr; *tmp; tmp++) { if (*tmp == '\\') { if (*++tmp == '\0') FAIL(T_BACKSLASH) } else if (*tmp == ptr[-1]) break; } if (state == E_REGEX) { if (*tmp != ptr[-1]) FAIL(T_DIRECTION) pstart = ptr; pend = ptr = tmp; state = E_SUBST; } else if (state == E_FROM) { pstart = ptr; pend = ptr = tmp; state = E_OPTIONS; if (*ptr) ++ptr; } else { /* E_SUBST */ rstart = ptr; rend = tmp; state = E_OPTIONS; ptr = tmp; if (*ptr) ++ptr; } break; case ',': if (state == E_FROM) lfrom = L_FIRST; else if (state == E_FINC) lfrom = L_CURRENT; else if (state != E_COMMA) FAIL(T_COMMA) state = E_TO; break; case '%': if (state == E_FROM) { lfrom = L_FIRST; lto = L_LAST; state = E_COMMAND; } else FAIL(T_OFFSET) break; case '$': if (state != E_TO) FAIL(T_OFFSET) lto = L_LAST; state = E_COMMAND; break; case '.': if (state == E_FROM) { lfrom = L_CURRENT; state = E_COMMA; } else if (state == E_TO) { lto = L_CURRENT; state = E_COMMAND; } else FAIL(T_OFFSET) break; case '+': if (state == E_FROM) { lfinc = 1; lfrom = L_CURRENT; state = E_FINC; } else if (state == E_TO) { ltinc = 1; lto = L_CURRENT; state = E_TINC; } else FAIL(T_INCREMENT) break; case '-': case '^': if (state == E_FROM) { lfinc = -1; lfrom = L_CURRENT; state = E_FINC; } else if (state == E_TO) { ltinc = -1; lto = L_CURRENT; state = E_TINC; } else FAIL(T_INCREMENT) number = -1; break; case ';': if (state != E_FROM) FAIL(T_OFFSET) lfrom = L_CURRENT; lto = L_LAST; state = E_COMMAND; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': number = number * (ptr[-1] - '0'); while (isdigit(*ptr)) number = number * 10 + (*ptr++ - '0'); if (state == E_FROM) { lfrom = number; state = E_COMMA; } else if (state == E_FINC) { lfinc = number; state = E_COMMA; } else if (state == E_TO) { lto = number; state = E_COMMAND; } else if (state == E_TINC) { ltinc = number; state = E_COMMAND; } else if (state == E_OPTIONS && action == A_REPLACE) offset = number - 1; else FAIL(T_NUMBER) number = 1; break; case '\0': if (state == E_OPTIONS) break; default: FAIL(T_UNFINISHED) } } replace = action == A_REPLACE; switch (lfrom) { case L_FIRST: from = first; break; case L_LAST: from = LSCAN(last, 1, False); break; case L_CURRENT: if (lfinc <= 0) from = LSCAN(position, -lfinc + 1, False); else { from = RSCAN(position, lfinc + 1, False); from = LSCAN(from, 1, False); } break; default: from = RSCAN(first, lfrom, False); from = LSCAN(from, 1, False); break; } /* Just requesting to go to the numbered line */ if (state == E_COMMA || state == E_FINC) { XawTextSetInsertionPoint(w, from); return; } length = pend - pstart; if (pstart == NULL || (replace && rstart == NULL) || length >= sizeof(einfo.pattern) - 1) FAIL(T_UNFINISHED) /* Need to (re)compile regular expression pattern? */ if ((!!(einfo.flags & RE_ICASE) ^ icase) || einfo.pat_length != length || memcmp(pstart, einfo.pattern, length > einfo.pat_length ? einfo.pat_length : length)) { compile = 1; memcpy(einfo.pattern, pstart, length); einfo.pattern[length] = '\0'; einfo.flags = icase ? RE_ICASE : 0; } /* Check range of lines to operate on */ switch (lto) { case L_FIRST: to = RSCAN(first, 1, True); break; case L_LAST: to = last; break; case L_CURRENT: if (ltinc < 0) { to = LSCAN(position, -ltinc + 1, True); to = RSCAN(to, 2, True); } else to = RSCAN(position, ltinc + 1, True); break; default: to = RSCAN(first, lto, True); break; } if (from >= to) FAIL(T_RANGE) /* Set first and last position allowed to search/replace */ first = from; last = to; /* Check bounds to work on */ if (replace) { int i, j, ch; /* Check number of required match results and remove/parse backslashes */ einfo.slen = rend - rstart; einfo.sref = 0; einfo.soff = offset; for (i = j = 0; i < einfo.slen; i++) { ch = rstart[i]; if (ch == '\\') { ++i; switch (rstart[i]) { case '0': ch = '\0'; break; case 'a': ch = '\a'; break; case 'b': ch = '\b'; break; case 'f': ch = '\f'; break; case 'n': ch = '\n'; break; case 'r': ch = '\r'; break; case 't': ch = '\t'; break; case 'v': ch = '\v'; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': einfo.subst[j++] = '\\'; if (rstart[i] - '0' > einfo.sref) einfo.sref = rstart[i] - '0'; /* FALLTHROUGH */ default: ch = rstart[i]; break; } } einfo.subst[j++] = ch; } einfo.slen = j; } else if (einfo.widget != w) { /* Just a flag for backward search */ einfo.from = last; einfo.widget = w; } /* Compile pattern if required */ if (compile) { int ch; char *eptr, *pptr; /* Parse backslashes */ pptr = einfo.subst_pattern; for (eptr = einfo.pattern, ch = *eptr++; ch; ch = *eptr++) { if (ch == '\\') { switch (*eptr) { case '0': ch = '\0'; einfo.flags |= RE_PEND; break; case 'a': ch = '\a'; break; case 'b': ch = '\b'; break; case 'f': ch = '\f'; break; case 'n': ch = '\n'; break; case 'r': ch = '\r'; break; case 't': ch = '\t'; break; case 'v': ch = '\v'; break; default: break; } if (ch != '\\') ++eptr; } *pptr++ = ch; } *pptr = '\0'; refree(&einfo.regex); /* Allow nuls in search regex */ einfo.regex.re_endp = pptr; ecode = recomp(&einfo.regex, einfo.subst_pattern, einfo.flags); if (ecode) goto print; } if (!replace && position >= first && position <= last) { from = position; /* The backwards repetition currently is only backwards when * changing lines, so remember from where started, to also * search in the first line. */ if (LSCAN(from, 1, False) == from) { if (direction == XawsdLeft) einfo.from = from; } else flags |= RE_NOTBOL; } to = RSCAN(from, 1, True); if (confirm) { if (!replace) FAIL(T_UNFINISHED) einfo.widget = w; einfo.state = SubstituteAsk; einfo.from = from; einfo.to = to; einfo.first = first; einfo.last = last; } else einfo.state = SubstituteDisabled; confirm_label: if (replace) { redisplay = 1; XawTextDisableRedisplay(w); } for (;;) { if (confirm && einfo.state != SubstituteAsk) { /* Restore state from previous call */ ecode = 0; nth = einfo.soff; /* einfo.mats should not have changed */ if (einfo.state == SubstituteYes) { einfo.state = SubstituteAsk; line = einfo.text_line; goto substitute_label; } else { ++nth; einfo.state = SubstituteAsk; from = einfo.from = einfo.end; goto no_substitute_label; } } /* Read or use a line of text inplace */ position = from; length = to - from; XawTextSourceRead(source, position, &block, to - position); if (block.length >= length) line = block.ptr; else { if (length > einfo.lsize) { einfo.line = XtRealloc(einfo.line, to - from); einfo.lsize = to - from; } memcpy(einfo.line, block.ptr, block.length); length = block.length; for (position += length; position < to && block.length; position += block.length) { XawTextSourceRead(source, position, &block, to - position); memcpy(einfo.line + length, block.ptr, block.length); length += block.length; } line = einfo.line; } /* Execute expression */ einfo.mats[0].rm_so = 0; einfo.mats[0].rm_eo = to - from; /* If not last line or if it ends in a newline */ if (to != from) { if (to < last || (to > from && line[einfo.mats[0].rm_eo - 1] == '\n')) --einfo.mats[0].rm_eo; ecode = reexec(&einfo.regex, line, einfo.sref + 1, &einfo.mats[0], flags); if (replace && einfo.mats[0].rm_so == einfo.mats[0].rm_eo) /* Ignore empty matches */ ecode = RE_NOMATCH; if (ecode == 0 && confirm && (einfo.soff == O_ALL || nth == einfo.soff)) { einfo.end = from + einfo.mats[0].rm_eo; einfo.start = from + einfo.mats[0].rm_so; XawTextSetInsertionPoint(w, einfo.end); XawTextSetSelection(w, einfo.start, einfo.end); einfo.state = SubstituteAsk; einfo.from = from; einfo.to = to; einfo.first = first; einfo.last = last; einfo.text_line = line; break; } } else /* Check bellow will update offsets */ ecode = RE_NOMATCH; substitute_label: if (ecode == 0) { from += einfo.mats[0].rm_so; len = einfo.mats[0].rm_eo - einfo.mats[0].rm_so; /* Found match */ if (replace) { /* If not replacing all ocurrences, or if not * at the correct offset */ if (einfo.soff != O_ALL && nth < einfo.soff) { from += len; ++nth; continue; } /* Do the substitution */ block.firstPos = 0; block.format = FMT8BIT; if (einfo.sref) { /* Hard way */ int i, ref, xlen; for (i = length = 0; i < einfo.slen; i++) { if (length + 2 >= einfo.bsize) { einfo.bsize = einfo.bsize + 1024; einfo.buffer = XtRealloc(einfo.buffer, einfo.bsize); } if (einfo.subst[i] == '\\') { ++i; if (einfo.subst[i] >= '1' && einfo.subst[i] <= '9') { ref = einfo.subst[i] - '0'; xlen = einfo.mats[ref].rm_eo - einfo.mats[ref].rm_so; if (xlen < 0) /* Oops, something went wrong... */ FAIL(T_BACKREF) if (length + xlen >= einfo.bsize) { einfo.bsize += xlen + 1024 - (xlen % 1024); einfo.buffer = XtRealloc(einfo.buffer, einfo.bsize); } memcpy(einfo.buffer + length, line + einfo.mats[ref].rm_so, xlen); length += xlen; } else { einfo.buffer[length++] = einfo.subst[i - 1]; einfo.buffer[length++] = einfo.subst[i]; } } else einfo.buffer[length++] = einfo.subst[i]; } block.ptr = einfo.buffer; block.length = length; } else { block.ptr = einfo.subst; block.length = length = einfo.slen; } adjust = length - len; if (XawTextReplace(w, from, from + len, &block) != XawEditDone) FAIL(T_EDIT) last += adjust; to += adjust; from += length; no_substitute_label: if (einfo.soff != O_ALL) { nth = 0; to = RSCAN(from, 1, True); from = LSCAN(to, 1, False); if (to == last) { XawTextSetInsertionPoint(w, from); break; } } else flags |= RE_NOTBOL; } else { XawTextSetInsertionPoint(w, from + len); XawTextSetSelection(w, from, from + len); break; } } else if (ecode == RE_NOMATCH) { nth = 0; /* Try again in the next/previous line */ if (direction == XawsdLeft) { from = LSCAN(to - 1, 1 + (from != to), False); if (einfo.from <= first) { Feep(); if (++count > 1) { XawTextSetInsertionPoint(w, position); XawTextUnsetSelection(w); break; } from = LSCAN(last, 1, False); } to = RSCAN(from, 1, True); /* Can use einfo.from because replace is only done forward */ einfo.from = from; } else { if (to >= last) { Feep(); if (replace || ++count > 1) { XawTextSetInsertionPoint(w, position); XawTextUnsetSelection(w); einfo.state = SubstituteDisabled; confirm = 0; break; } to = first; } from = LSCAN(to + 1, 1, False); to = RSCAN(from, 1, True); } /* Reset flags now */ flags = RE_STARTEND; } else goto print; } if (redisplay) XawTextEnableRedisplay(w); /* If replacing not interatively return to the edit window after finished */ if (replace && !confirm) { Arg args[1]; XtSetKeyboardFocus(topwindow, textwindow); if (item->source != scratch) XtSetArg(args[0], XtNstring, item->name); else XtSetArg(args[0], XtNstring, NULL); XtSetValues(filenamewindow, args, 1); line_edit = False; } return; print: if (redisplay) XawTextEnableRedisplay(w); strcpy(buffer, "Regex error: "); length = 13; reerror(ecode, &einfo.regex, buffer + length, sizeof(buffer) - length - 2); strcat(buffer, "\n"); XeditPrintf("%s", buffer); refree(&einfo.regex); einfo.state = SubstituteDisabled; Feep(); return; fail: if (etype != T_NONE) { const char *errptr; switch (etype) { case T_OPTION: errptr = "Option needs a command"; break; case T_ICASE: errptr = "Icase needs an command defined or none for search"; break; case T_COMMAND: errptr = "Command incorrectly specified"; break; case T_REPLACE: errptr = "Can only search backwards"; break; case T_SEARCH: errptr = "Badly placed search/replace specifier"; break; case T_BACKSLASH: errptr = "A single backslash cannot be the last command character"; break; case T_DIRECTION: errptr = "Regular expression must be separeted by / or ? not both"; break; case T_COMMA: errptr = "Badly placed comma"; break; case T_OFFSET: errptr = "Badly placed line offset specifier"; break; case T_INCREMENT: errptr = "Badly placed line offset increment specifier"; break; case T_NUMBER: errptr = "Numeric argument not expected"; break; case T_UNFINISHED: errptr = "Unfinished command"; break; case T_RANGE: errptr = "Bad line range"; break; case T_BACKREF: /* This may be an internal re error, but most likely the * user asked for something like "s/re0(re1)re2/\2/" */ errptr = "Bad backreference"; break; case T_EDIT: errptr = "Failed to replace text"; break; default: errptr = "Unknown error"; break; } XeditPrintf("Error: %s.\n", errptr); } if (redisplay) XawTextEnableRedisplay(w); einfo.state = SubstituteDisabled; Feep(); } static void SubstituteHook(Widget w, String action, XEvent *event) { if (w != filenamewindow) return; if (line_edit && einfo.state == SubstituteAsk) { if (strcmp(action, "newline") == 0 || strcmp(action, "load-file") == 0) einfo.state = SubstituteAsk; else if (strcmp(action, "insert-char") == 0) { static XComposeStatus compose = {NULL, 0}; KeySym keysym; char mb[sizeof(wchar_t)]; if (XLookupString((XKeyEvent*)event, mb, sizeof(mb), &keysym, &compose) == 1) { if (*mb == 'y' || *mb == 'Y') einfo.state = SubstituteYes; else if (*mb == 'n' || *mb == 'N') einfo.state = SubstituteNo; else einfo.state = SubstituteDisabled; if (einfo.state != SubstituteDisabled) { einfo.callback = 1; XtAddCallback(filenamewindow, XtNpositionCallback, SubstituteCallback, NULL); } } } else if (strcmp(action, "cancel-find-file") == 0) einfo.state = SubstituteDisabled; } if (einfo.state == SubstituteDisabled && einfo.callback) { einfo.callback = 0; XtRemoveCallback(filenamewindow, XtNpositionCallback, SubstituteCallback, NULL); } } /*ARGSUSED*/ static void SubstituteCallback(Widget w, XtPointer client_data, XtPointer call_data) { XawTextBlock block; einfo.callback = 0; XtRemoveCallback(filenamewindow, XtNpositionCallback, SubstituteCallback, NULL); block.firstPos = 0; block.format = FMT8BIT; block.ptr = einfo.command; block.length = strlen(einfo.command); XawTextReplace(filenamewindow, 0, XawTextLastPosition(filenamewindow), &block); LineEdit(einfo.widget); } x11-apps-7.7+5+nmu1ubuntu1/xedit/util.c0000664000000000000000000006171712472175711014452 0ustar /* $XConsortium: util.c,v 1.16 92/08/12 16:46:22 converse Exp $ */ /* * COPYRIGHT 1987 * DIGITAL EQUIPMENT CORPORATION * MAYNARD, MASSACHUSETTS * ALL RIGHTS RESERVED. * * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR * ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. * * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT RIGHTS, * APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN ADDITION TO THAT * SET FORTH ABOVE. * * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Digital Equipment Corporation not be * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ /* $XFree86: xc/programs/xedit/util.c,v 1.26 2003/05/07 20:54:43 herrb Exp $ */ #include #include #include /* POSIX basename() */ #include /* for realpath() */ #include /* for ENOENT */ #include "xedit.h" #include #include /* for types.h */ #include #include #include #include /* * Prototypes */ static void SwitchSourceCallback(Widget, XtPointer, XtPointer); static int WindowIndex(Widget); static void ChangeTextWindow(Widget); /* * External */ extern void _XawTextShowPosition(TextWidget); /* * Initialization */ extern Widget scratch; extern Widget vpanes[2], labels[3], texts[3], forms[3]; extern XawTextWrapMode wrapmodes[3]; #ifndef va_copy # ifdef __va_copy # define va_copy __va_copy # else # error "no working va_copy was found" # endif #endif /* * Implementation */ void XeditPrintf(const char *format, ...) { static struct { XawTextPosition last; int size; int length; int repeat; char *buffer; } info; size_t size; va_list va; XawTextBlock text; XawTextPosition left, right; char buffer[BUFSIZ]; char *string, rbuffer[32]; va_start(va, format); size = vsnprintf(buffer, sizeof(buffer), format, va); va_end(va); /* Should never happen... */ if (size >= sizeof(buffer)) { strcpy(buffer + sizeof(buffer) - 5, "...\n"); size = sizeof(buffer) - 1; } else if (size) { left = right = XawTextSourceScan(XawTextGetSource(messwidget), 0, XawstAll, XawsdRight, 1, True); if (left == info.last && info.buffer && strcmp(buffer, info.buffer) == 0) { string = rbuffer; if (info.repeat == 1) left -= info.buffer[strlen(info.buffer) - 1] == '\n'; else left -= info.length; size = info.length = XmuSnprintf(rbuffer, sizeof(rbuffer), " [%d times]\n", ++info.repeat); } else { string = buffer; if (size >= info.size) info.buffer = XtMalloc(size + 1); strcpy(info.buffer, buffer); info.repeat = 1; } text.length = size; text.ptr = string; text.firstPos = 0; text.format = FMT8BIT; XawTextReplace(messwidget, left, right, &text); info.last = left + text.length; XawTextSetInsertionPoint(messwidget, info.last); } } Widget MakeCommandButton(Widget box, char *name, XtCallbackProc function) { Widget w = XtCreateManagedWidget(name, commandWidgetClass, box, NULL, ZERO); if (function != NULL) XtAddCallback(w, XtNcallback, function, (caddr_t) NULL); else XtVaSetValues(w, XtNsensitive, False, NULL); return w; } Widget MakeStringBox(Widget parent, String name, String string) { Arg args[5]; Cardinal numargs = 0; Widget StringW; XtSetArg(args[numargs], XtNeditType, XawtextEdit); numargs++; XtSetArg(args[numargs], XtNstring, string); numargs++; StringW = XtCreateManagedWidget(name, asciiTextWidgetClass, parent, args, numargs); return(StringW); } /* Function Name: GetString * Description: retrieves the string from a asciiText widget. * Arguments: w - the ascii text widget. * Returns: the filename. */ String GetString(Widget w) { String str; Arg arglist[1]; XtSetArg(arglist[0], XtNstring, &str); XtGetValues( w, arglist, ONE); return(str); } /* Function Name: MaybeCreateFile * Description: Checks to see if file exists, and if not, creates it. * Arguments: file - name of file to check. * Returns: permissions status */ FileAccess MaybeCreateFile(const char *file) { Boolean exists; int fd; if (access(file, F_OK) != 0) { fd = creat(file, 0666); if (fd != -1) close(fd); } return(CheckFilePermissions(file, &exists)); } FileAccess CheckFilePermissions(const char *file, Boolean *exists) { char temp[BUFSIZ], *ptr; if (access(file, F_OK) == 0) { *exists = TRUE; if (access(file, R_OK) != 0) return(NO_READ); if (access(file, R_OK | W_OK) == 0) return(WRITE_OK); return(READ_OK); } *exists = FALSE; strncpy(temp, file, sizeof(temp) - 1); temp[sizeof(temp) - 1] = '\0'; if ( (ptr = rindex(temp, '/')) == NULL) strcpy(temp, "."); else *ptr = '\0'; if (access(temp, R_OK | W_OK | X_OK) == 0) return(WRITE_OK); return(NO_READ); } xedit_flist_item * AddTextSource(Widget source, const char *name, const char *filename, int flags, FileAccess file_access) { xedit_flist_item *item; char *wid_name; item = (xedit_flist_item*)XtMalloc(sizeof(xedit_flist_item)); item->source = source; item->name = XtNewString(name); item->filename = XtNewString(filename); item->flags = flags; item->file_access = file_access; item->display_position = item->insert_position = 0; item->mode = 0; item->mtime = 0; item->properties = NULL; item->xldata = NULL; /* Try to load associated tags file */ SearchTagsFile(item); flist.itens = (xedit_flist_item**) XtRealloc((char*)flist.itens, sizeof(xedit_flist_item*) * (flist.num_itens + 1)); flist.itens[flist.num_itens++] = item; if (!flist.popup) { flist.popup = XtCreatePopupShell("fileMenu", simpleMenuWidgetClass, topwindow, NULL, 0); /* XXX hack: this don't allow setting the geometry of the popup widget * as it will override any settings when a menu entry is inserted * or deleted, but saves us the trouble generated by a resource * setting like: '*geometry: x' */ XtRealizeWidget(flist.popup); } if ((wid_name = strrchr(item->name, '/')) == NULL) wid_name = item->name; else ++wid_name; item->sme = XtVaCreateManagedWidget(wid_name, smeBSBObjectClass, flist.popup, XtNlabel, item->filename, NULL, NULL); XtAddCallback(item->sme, XtNcallback, SwitchSourceCallback, (XtPointer)item); SetTextProperties(item); return (item); } Bool KillTextSource(xedit_flist_item *item) { xedit_flist_item *nitem = NULL; unsigned idx, i; Arg targs[3]; Cardinal tnum_args; Arg largs[2]; Cardinal lnum_args; char label_buf[BUFSIZ]; for (idx = 0; idx < flist.num_itens; idx++) if (flist.itens[idx] == item) { if (idx + 1 < flist.num_itens) nitem = flist.itens[idx + 1]; else if (idx >= 1) nitem = flist.itens[idx - 1]; break; } if (idx >= flist.num_itens) return (False); flist.current = nitem; if (item == flist.other) flist.other = NULL; if (nitem->file_access == READ_OK) XmuSnprintf(label_buf, sizeof(label_buf), "%s READ ONLY", nitem->name); else if (nitem->file_access == WRITE_OK) XmuSnprintf(label_buf, sizeof(label_buf), "%s Read - Write", nitem->name); lnum_args = 0; XtSetArg(largs[lnum_args], XtNlabel, label_buf); ++lnum_args; if (nitem->flags & CHANGED_BIT) XtSetArg(largs[lnum_args], XtNleftBitmap, flist.pixmap); else XtSetArg(largs[lnum_args], XtNleftBitmap, None); ++lnum_args; tnum_args = 0; XtSetArg(targs[tnum_args], XtNtextSource, nitem->source); ++tnum_args; XtSetArg(targs[tnum_args], XtNdisplayPosition, nitem->display_position); ++tnum_args; XtSetArg(targs[tnum_args], XtNinsertPosition, nitem->insert_position); ++tnum_args; for (i = 0; i < 3; i++) if (XawTextGetSource(texts[i]) == item->source) { XtSetValues(labels[i], largs, lnum_args); XawTextDisableRedisplay(texts[i]); XtSetValues(texts[i], targs, tnum_args); UpdateTextProperties(0); _XawTextShowPosition((TextWidget)texts[i]); XawTextEnableRedisplay(texts[i]); if (texts[i] == textwindow) { Arg args[1]; if (nitem->source != scratch) XtSetArg(args[0], XtNstring, nitem->name); else XtSetArg(args[0], XtNstring, NULL); XtSetValues(filenamewindow, args, 1); } } UnsetTextProperties(item); XtFree(item->name); XtFree(item->filename); XtDestroyWidget(item->sme); XtDestroyWidget(item->source); XtFree((char*)item); if (idx < flist.num_itens - 1) memmove(&flist.itens[idx], &flist.itens[idx + 1], (flist.num_itens - idx) * sizeof(xedit_flist_item*)); --flist.num_itens; return (True); } xedit_flist_item * FindTextSource(Widget source, const char *filename) { unsigned i; if (source) { for (i = 0; i < flist.num_itens; i++) if (flist.itens[i]->source == source) return (flist.itens[i]); } else if (filename) { for (i = 0; i < flist.num_itens; i++) if (strcmp(flist.itens[i]->filename, filename) == 0) return (flist.itens[i]); } return (NULL); } void SwitchTextSource(xedit_flist_item *item) { Arg args[4]; Cardinal num_args; char label_buf[BUFSIZ]; xedit_flist_item *old_item = FindTextSource(XawTextGetSource(textwindow), NULL); int i; if (old_item != item) flist.other = old_item; flist.current = item; XawTextDisableRedisplay(textwindow); if (item->file_access == READ_OK) XmuSnprintf(label_buf, sizeof(label_buf), "%s READ ONLY", item->name); else if (item->file_access == WRITE_OK) XmuSnprintf(label_buf, sizeof(label_buf), "%s Read - Write", item->name); num_args = 0; XtSetArg(args[num_args], XtNlabel, label_buf); ++num_args; if (item->flags & CHANGED_BIT) XtSetArg(args[num_args], XtNleftBitmap, flist.pixmap); else XtSetArg(args[num_args], XtNleftBitmap, None); ++num_args; XtSetValues(labelwindow, args, num_args); for (i = 0; i < 3; i++) if (XawTextGetSource(texts[i]) == item->source && XtIsManaged(texts[i])) break; if (i < 3) { num_args = 0; XtSetArg(args[num_args], XtNdisplayPosition, &(item->display_position)); ++num_args; XtSetArg(args[num_args], XtNinsertPosition, &(item->insert_position)); ++num_args; XtGetValues(texts[i], args, num_args); } if (old_item != item) { int count, idx = 0; num_args = 0; XtSetArg(args[num_args], XtNdisplayPosition, &(old_item->display_position)); ++num_args; XtSetArg(args[num_args], XtNinsertPosition, &(old_item->insert_position)); ++num_args; XtGetValues(textwindow, args, num_args); for (count = 0, i = 0; i < 3; i++) if (XawTextGetSource(texts[i]) == old_item->source && XtIsManaged(texts[i])) { if (++count > 1) break; idx = i; } if (count == 1) { num_args = 0; XtSetArg(args[num_args], XtNdisplayPosition, &(old_item->display_position)); ++num_args; XtSetArg(args[num_args], XtNinsertPosition, &(old_item->insert_position)); ++num_args; XtGetValues(texts[idx], args, num_args); } } num_args = 0; XtSetArg(args[num_args], XtNtextSource, item->source); ++num_args; XtSetArg(args[num_args], XtNdisplayPosition, item->display_position); ++num_args; XtSetArg(args[num_args], XtNinsertPosition, item->insert_position); ++num_args; if (item->flags & WRAP_BIT) XtSetArg(args[num_args], XtNwrap, item->wrap); else XtSetArg(args[num_args], XtNwrap, wrapmodes[WindowIndex(textwindow)]); ++num_args; XtSetValues(textwindow, args, num_args); UpdateTextProperties(0); _XawTextShowPosition((TextWidget)textwindow); XawTextEnableRedisplay(textwindow); num_args = 0; if (item->source != scratch) { XtSetArg(args[num_args], XtNstring, item->name); ++num_args; } else { XtSetArg(args[num_args], XtNstring, NULL); ++num_args; } XtSetValues(filenamewindow, args, num_args); /* XXX This probably should be done by the TextWidget, i.e. notice * if the cursor became inivisible due to an horizontal scroll */ _XawTextShowPosition((TextWidget)filenamewindow); } char * ResolveName(char *filename) { #ifndef __UNIXOS2__ static char *name; char *result, *tmp = name; #endif if (filename == NULL) filename = GetString(filenamewindow); #ifndef __UNIXOS2__ /* Ensure not passing the same pointer again to realpath */ name = XtMalloc(BUFSIZ); XtFree(tmp); result = realpath(filename, name); if (result == NULL && errno == ENOENT) { int length; char *dir, *file; length = strlen(filename); tmp = dir = XtMalloc(length + 1); strcpy(dir, filename); file = basename(filename); dir = dirname(tmp); /* Creating a new file? */ if (dir && file && strcmp(dir, file) && access(dir, F_OK) == 0 && (result = realpath(dir, name)) == name) { int length = strlen(result); XmuSnprintf(result + length, BUFSIZ - length, "%s%s", result[length - 1] == '/' ? "" : "/", file); } XtFree(tmp); } return (result); #else return filename; #endif } static void ChangeTextWindow(Widget w) { Arg args[1]; if (textwindow != w) { xedit_flist_item *other, *current; other = FindTextSource(XawTextGetSource(textwindow), NULL); current = FindTextSource(XawTextGetSource(w), NULL); if (other != current) flist.other = other; if (current) flist.current = current; XtSetArg(args[0], XtNdisplayCaret, False); XtSetValues(textwindow, args, 1); XtSetArg(args[0], XtNdisplayCaret, True); XtSetValues(w, args, 1); XawTextUnsetSelection(textwindow); textwindow = w; } } /*ARGSUSED*/ void XeditFocus(Widget w, XEvent *event, String *params, Cardinal *num_params) { Arg args[1]; xedit_flist_item *item; int idx = WindowIndex(w); XtSetKeyboardFocus(topwindow, w); ChangeTextWindow(w); labelwindow = labels[idx]; item = FindTextSource(XawTextGetSource(textwindow), NULL); if (item->source != scratch) XtSetArg(args[0], XtNstring, item->name); else XtSetArg(args[0], XtNstring, NULL); XtSetValues(filenamewindow, args, 1); line_edit = False; } void PopupMenu(Widget w, XEvent *event, String *params, Cardinal *num_params) { Cardinal n_params = num_params ? *num_params : 0; if (*num_params && XmuCompareISOLatin1(*params, "editMenu") == 0) SetEditMenu(); XtCallActionProc(w, "XawPositionSimpleMenu", event, params, n_params); XtCallActionProc(w, "XtMenuPopup", event, params, n_params); } /*ARGSUSED*/ static void SwitchSourceCallback(Widget entry, XtPointer client_data, XtPointer call_data) { SwitchTextSource((xedit_flist_item*)client_data); } static int WindowIndex(Widget w) { int i; for (i = 0; i < 3; i++) if (texts[i] == w) return (i); return (-1); } void DeleteWindow(Widget w, XEvent *event, String *params, Cardinal *num_params) { Widget unmanage[2]; int idx = WindowIndex(w), uidx; Bool current = False; if (*num_params == 1 && (*params[0] == 'd' || *params[0] == 'D')) { if (XtIsManaged(XtParent(dirwindow))) SwitchDirWindow(False); return; } if (idx < 0 || (!XtIsManaged(texts[1]) && !XtIsManaged(texts[2]))) { Feep(); return; } if (num_params && *num_params == 1 && (*params[0] == 'o' || *params[0] == 'O')) current = True; uidx = XtIsManaged(texts[1]) ? 1 : 2; unmanage[0] = forms[uidx]; unmanage[1] = texts[uidx]; XtUnmanageChildren(unmanage, 2); if (!XtIsManaged(texts[2])) XtUnmanageChild(vpanes[1]); if ((!current && idx == 0) || (current && idx != 0)) { Arg args[4]; Cardinal num_args; String label_str; Pixmap label_pix; XawTextPosition d_pos, i_pos; Widget source; xedit_flist_item *item; num_args = 0; XtSetArg(args[num_args], XtNlabel, &label_str); ++num_args; XtSetArg(args[num_args], XtNleftBitmap, &label_pix); ++num_args; XtGetValues(labels[current ? idx : uidx], args, num_args); num_args = 0; XtSetArg(args[num_args], XtNlabel, label_str); ++num_args; XtSetArg(args[num_args], XtNleftBitmap, label_pix); ++num_args; XtSetValues(labels[0], args, num_args); num_args = 0; XtSetArg(args[num_args], XtNdisplayPosition, &d_pos); ++num_args; XtSetArg(args[num_args], XtNinsertPosition, &i_pos); ++num_args; XtSetArg(args[num_args], XtNtextSource, &source); ++num_args; XtGetValues(texts[current ? idx : uidx], args, num_args); num_args = 0; XtSetArg(args[num_args], XtNdisplayPosition, d_pos); ++num_args; XtSetArg(args[num_args], XtNinsertPosition, i_pos); ++num_args; XtSetArg(args[num_args], XtNtextSource, source); ++num_args; item = FindTextSource(source, NULL); if (item && (item->flags & WRAP_BIT)) XtSetArg(args[num_args], XtNwrap, item->wrap); else XtSetArg(args[num_args], XtNwrap, wrapmodes[WindowIndex(texts[current ? idx : uidx])]); XtSetValues(texts[0], args, num_args); UpdateTextProperties(0); } labelwindow = labels[0]; XeditFocus(texts[0], NULL, NULL, NULL); } void SwitchSource(Widget w, XEvent *event, String *params, Cardinal *num_params) { int idx = WindowIndex(w); Widget source; int i; if (idx < 0 || textwindow != texts[idx]) { Feep(); return; } source = XawTextGetSource(textwindow); for (i = 0; i < flist.num_itens; i++) if (flist.itens[i]->source == source) { if (i > 0 && i == flist.num_itens - 1) i = 0; else if (i < flist.num_itens - 1) ++i; else { Feep(); return; } break; } if (i >= flist.num_itens) { Feep(); return; } SwitchTextSource(flist.itens[i]); } void OtherWindow(Widget w, XEvent *event, String *params, Cardinal *num_params) { int oidx, idx = WindowIndex(w); if (idx < 0 || (!XtIsManaged(texts[1]) && !XtIsManaged(texts[2]))) { Feep(); return; } if (idx == 0) oidx = XtIsManaged(texts[1]) ? 1 : 2; else oidx = 0; XeditFocus(texts[oidx], event, params, num_params); } void SplitWindow(Widget w, XEvent *event, String *params, Cardinal *num_params) { Arg args[6]; Cardinal num_args; Widget nlabel, ntext, source, sink, manage[2]; Dimension width, height, bw; XawTextPosition i_pos, d_pos; String label_str; Pixmap label_pix; int idx = WindowIndex(w), dimension; Bool vert = True; xedit_flist_item *item; if (num_params && *num_params == 1 && (*params[0] == 'h' || *params[0] == 'H')) vert = False; if (idx < 0 || (vert && XtIsManaged(texts[1])) || (!vert && XtIsManaged(vpanes[1]))) { Feep(); return; } if (vert) { nlabel = labels[1]; ntext = texts[1]; } else { nlabel = labels[2]; ntext = texts[2]; } ChangeTextWindow(texts[idx]); labelwindow = labels[idx]; num_args = 0; XtSetArg(args[num_args], XtNinsertPosition, &i_pos); ++num_args; XtSetArg(args[num_args], XtNdisplayPosition, &d_pos); ++num_args; XtSetArg(args[num_args], XtNtextSource, &source); ++num_args; XtSetArg(args[num_args], XtNtextSink, &sink); ++num_args; XtSetArg(args[num_args], XtNwidth, &width); ++num_args; XtSetArg(args[num_args], XtNheight, &height); ++num_args; XtGetValues(w, args, num_args); num_args = 0; XtSetArg(args[num_args], XtNinternalBorderWidth, &bw); ++num_args; XtGetValues(XtParent(w), args, num_args); if (vert) { dimension = (int)height - (((int)bw) << 1); num_args = 0; XtSetArg(args[num_args], XtNheight, &height); ++num_args; XtGetValues(labelwindow, args, num_args); dimension -= (int)height; } else dimension = (int)width - (int)bw; dimension >>= 1; if (dimension <= 0 || dimension < XawTextSinkMaxHeight(sink, 3)) { Feep(); return; } num_args = 0; XtSetArg(args[num_args], XtNlabel, &label_str); ++num_args; XtSetArg(args[num_args], XtNleftBitmap, &label_pix); ++num_args; XtGetValues(labelwindow, args, num_args); if (vert) { if (XtIsManaged(texts[2])) { manage[0] = forms[2]; manage[1] = texts[2]; XtUnmanageChildren(manage, 2); XtUnmanageChild(vpanes[1]); } } else { if (XtIsManaged(texts[1])) { manage[0] = forms[1]; manage[1] = texts[1]; XtUnmanageChildren(manage, 2); } } XawTextDisableRedisplay(texts[0]); XawTextDisableRedisplay(ntext); if (textwindow == texts[1] || textwindow == texts[2]) { num_args = 0; XtSetArg(args[num_args], XtNdisplayPosition, d_pos); ++num_args; XtSetArg(args[num_args], XtNinsertPosition, i_pos); ++num_args; XtSetArg(args[num_args], XtNtextSource, source); ++num_args; ChangeTextWindow(texts[0]); XtSetValues(textwindow, args, num_args); XtSetKeyboardFocus(topwindow, textwindow); num_args = 0; XtSetArg(args[num_args], XtNlabel, label_str); ++num_args; XtSetArg(args[num_args], XtNleftBitmap, label_pix); ++num_args; XtSetValues(labelwindow = labels[0], args, num_args); } num_args = 0; XtSetArg(args[num_args], XtNlabel, label_str); ++num_args; XtSetArg(args[num_args], XtNleftBitmap, label_pix); ++num_args; XtSetValues(nlabel, args, num_args); num_args = 0; XtSetArg(args[num_args], XtNmin, dimension); ++num_args; XtSetArg(args[num_args], XtNmax, dimension); ++num_args; if (!vert) XtSetValues(vpanes[1], args, num_args); else XtSetValues(ntext, args, num_args); manage[0] = XtParent(nlabel); manage[1] = ntext; XtManageChildren(manage, 2); if (!vert) XtManageChild(vpanes[1]); num_args = 0; XtSetArg(args[num_args], XtNmin, 1); ++num_args; XtSetArg(args[num_args], XtNmax, 65535); ++num_args; if (!vert) { XtSetValues(vpanes[1], args, num_args); num_args = 0; } XtSetArg(args[num_args], XtNtextSource, source); ++num_args; XtSetArg(args[num_args], XtNdisplayPosition, d_pos); ++num_args; XtSetArg(args[num_args], XtNinsertPosition, i_pos); ++num_args; item = FindTextSource(source, NULL); if (item && (item->flags & WRAP_BIT)) XtSetArg(args[num_args], XtNwrap, item->wrap); else XtSetArg(args[num_args], XtNwrap, wrapmodes[WindowIndex(ntext)]); ++num_args; XtSetValues(ntext, args, num_args); UpdateTextProperties(0); _XawTextShowPosition((TextWidget)textwindow); _XawTextShowPosition((TextWidget)ntext); XawTextEnableRedisplay(textwindow); XawTextEnableRedisplay(ntext); } void SwitchDirWindow(Bool show) { static int map; /* There must be one instance of this * variable per top level window */ Widget manage[2]; if (!show && XtIsManaged(XtParent(dirwindow))) { manage[0] = dirlabel; manage[1] = XtParent(dirwindow); XtUnmanageChildren(manage, 2); XtUnmanageChild(vpanes[1]); XtManageChild(vpanes[0]); if (map == 2) { Arg args[2]; Dimension width, bw; XtSetArg(args[0], XtNwidth, &width); XtGetValues(texts[0], args, 1); XtSetArg(args[0], XtNinternalBorderWidth, &bw); XtGetValues(XtParent(texts[0]), args, 1); width = (width - bw) >> 1; XtSetArg(args[0], XtNmin, width); XtSetArg(args[0], XtNmax, width); XtSetValues(vpanes[0], args, 1); manage[0] = forms[2]; manage[1] = texts[2]; XtManageChildren(manage, 2); XtManageChild(vpanes[1]); XtSetArg(args[0], XtNmin, 1); XtSetArg(args[0], XtNmax, 65535); XtSetValues(vpanes[0], args, 1); } } else if (show && !XtIsManaged(XtParent(dirwindow))) { XtUnmanageChild(vpanes[0]); if (XtIsManaged(texts[2])) { manage[0] = forms[2]; manage[1] = texts[2]; XtUnmanageChildren(manage, 2); map = 2; } else { map = XtIsManaged(texts[1]); XtManageChild(vpanes[1]); } manage[0] = dirlabel; manage[1] = XtParent(dirwindow); XtManageChildren(manage, 2); } } /*ARGSUSED*/ void DirWindow(Widget w, XEvent *event, String *params, Cardinal *num_params) { Arg args[1]; char path[BUFSIZ + 1], *dir; if (XtIsManaged(XtParent(dirwindow))) return; if (*num_params == 1) { strncpy(path, params[0], sizeof(path) - 2); path[sizeof(path) - 2] = '\0'; } else { char *slash; xedit_flist_item *item = FindTextSource(XawTextGetSource(textwindow), NULL); if (item == NULL || item->source == scratch || (slash = rindex(item->filename, '/')) == NULL) strcpy(path, "./"); else { int len = slash - item->filename + 1; if (len > sizeof(path) - 2) len = sizeof(path) - 2; strncpy(path, item->filename, len); path[len] = '\0'; } } dir = ResolveName(path); if (dir != NULL) { strncpy(path, dir, sizeof(path) - 2); path[sizeof(path) - 2] = '\0'; if (*path && path[strlen(path) - 1] != '/') strcat(path, "/"); XtSetArg(args[0], XtNlabel, ""); XtSetValues(dirlabel, args, 1); SwitchDirWindow(True); DirWindowCB(dirwindow, path, NULL); } else Feep(); } x11-apps-7.7+5+nmu1ubuntu1/xedit/app-defaults/0000775000000000000000000000000012472176532015704 5ustar x11-apps-7.7+5+nmu1ubuntu1/xedit/app-defaults/Xedit-color0000664000000000000000000001264012472175711020021 0ustar ! $XFree86: xc/programs/xedit/Xedit-color.ad,v 1.14 2002/11/10 23:21:56 paulo Exp $ #include "Xedit" *background: gray70 *foreground: gray15 *borderColor: gray40 *Command.highlightThickness: 1 *Command.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray65 *Command.foreground: gray20 *Command.displayList:\ foreground gray92;\ line 1,0,-2,0;\ foreground gray95;\ line 2,1,-3,1;\ foreground gray74;\ segments 3,-3,-4,-3, 2,-4,-3,-4, 1,-6,-2,-6;\ point -1,-1;\ foreground gray80;\ line 0,0,0,-1;\ point -1,0 *Command.translations: #override \ : set-values(1, foreground, gray20, background, rgb:d/5/5) set()\n\ Button1: reset() set-values(1, foreground, gray20, background, gray70)\n\ : notify() unset() *Toggle.foreground: gray30 *Toggle.background: gray82 *Toggle.borderColor: gray90 *Toggle.displayList:\ foreground gray75;\ segments 0,1,0,-2,-1,1,-1,-2;\ foreground gray80;\ segments 0,0,-1,0,0,-1,-1,-1;\ points 1,1,1,-2,-2,1, -2,-2 *bc_label.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray65 *bc_label.displayList:\ foreground gray92;\ line 1,0,-2,0;\ foreground gray95;\ line 2,1,-3,1;\ foreground gray74;\ segments 3,-2,-4,-2, 2,-3,-3,-3, 1,-5,-2,-5 *bc_label.foreground: gray20 *formWindow.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray65 *formWindow.displayList:\ foreground gray92;\ line 1,0,-2,0;\ foreground gray95;\ line 2,1,-3,1;\ foreground gray74;\ segments 3,-2,-4,-2, 2,-3,-3,-3, 1,-5,-2,-5 *formWindow*backgroundPixmap: ParentRelative *formWindow*foreground: gray20 *formWindow*background: gray74 *formWindow.labelWindow.background: gray80 *formWindow.labelWindow.displayList:\ line-style onoffdash;\ foreground gray30;\ background gray96;\ draw-rect 3,2,15,14;\ foreground gray78;\ fill-rect 4,3,15,14 *dirlabel.foreground: gray20 *dirlabel.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray65 *dirlabel.displayList:\ foreground gray92;\ line 1,0,-2,0;\ foreground gray95;\ line 2,1,-3,1;\ foreground gray74;\ segments 3,-2,-4,-2, 2,-3,-3,-3, 1,-5,-2,-5 *dirwindow.background: gray96 *internalBorderColor: gray40 *Text*Text.background: gray96 *Text.background: gray96 *Text.?.background: gray96 *Text*cursorColor: rgb:d/5/5 *Text.displayList:\ foreground white;\ line 1,-1,-2,-1;\ foreground gray88;\ line 1,0,-2,0 *Scrollbar.foreground: rgb:a/5/5 *Scrollbar.background: gray60 *Text.Scrollbar.background: gray60 *Scrollbar.backgroundPixmap: gradient:horizontal?dimension=14&start=gray70&end=gray85 *hScrollbar.backgroundPixmap: gradient:vertical?dimension=14&start=gray85&end=gray70 *hScrollbar.displayList:\ foreground gray85;\ segments 1,-1,-2,-1,1,0,-2,0 *vScrollbar.displayList:\ foreground gray85;\ segments 0,1,0,-2,-1,1,-1,-2 *Scrollbar.thumb: vlines2 *hScrollbar.thumb: hlines2 *SimpleMenu*borderWidth: 0 *SimpleMenu*backgroundPixmap: xlogo11?foreground=gray90&background=gray88 *SimpleMenu*background: gray90 *SimpleMenu*foreground: gray20 *SimpleMenu.VerticalMargins: 3 *SimpleMenu.HorizontalMargins: 3 *SimpleMenu.SimpleMenu.VerticalMargins: 3 *SimpleMenu.SimpleMenu.HorizontalMargins: 3 *SimpleMenu.menuLabel.foreground: rgb:d/5/5 *SimpleMenu*displayList:\ foreground gray70;\ lines +2,-2,-2,-2,-2,+2;\ foreground gray95;\ lines -2,+1,+1,+1,+1,-2;\ foreground gray30;\ lines +1,-1,-1,-1,-1,+1;\ foreground gray80;\ lines -1,+0,+0,+0,+0,-1 *TransientShell.backgroundPixmap: xlogo11?foreground=gray90&background=gray87 *TransientShell.Form.backgroundPixmap: ParentRelative *TransientShell.Form.Label.backgroundPixmap: ParentRelative *ispell*Scrollbar.borderColor: gray50 *ispell*Scrollbar.displayList: *ispell*List.background: gray96 *ispell*word.background: gray96 *ispell*word.backgroundPixmap: XtUnspecifiedPixmap *ispell*word.translations:\ : highlight()\n\ : reset()\n\ : set()\n\ : notify() unset()\n *ispell*word.displayList: *ispell.Form.Form.borderColor: gray80 *ispell.Form.Form.displayList: \ foreground gray90;\ lines +1,-1,-1,-1,-1,+1;\ foreground gray30;\ lines -1,+0,+0,+0,+0,-1;\ foreground gray60;\ lines +2,-2,-2,-2,-2,+2 *ispell*status.backgroundPixmap: XtUnspecifiedPixmap *ispell*status.background: gray96 *ispell*terse.justify: right *ispell*terse.internalWidth: 10 *ispell*terse.background: gray75 *ispell*terse.foreground: gray20 *ispell*terse.highlightThickness: 0 *ispell*terse.displayList:\ line-style solid;\ foreground gray70;\ fill-arc 6,4,14,12;\ foreground gray90;\ draw-arc 6,4,14,12,45,180;\ draw-lines +0,-1,-1,-1,-1,+0;\ foreground gray50;\ draw-arc 6,4,14,12,225,180;\ draw-lines -2,+0,+0,+0,+0,-2;\ foreground gray45;\ dashes 2,1;\ line-style onoffdash;\ draw-rect +1,+1,-2,-2 *ispell*options.MenuButton.borderColor: gray70 *ispell*options.MenuButton.background: gray78 *ispell*options.MenuButton.backgroundPixmap: gradient:vertical?dimension=18&start=gray90&end=gray65 *ispell*options.MenuButton.displayList:\ foreground gray60;\ lines +2,-2,-2,-2,-2,+2;\ foreground gray95;\ lines -3,+1,+1,+1,+1,-3;\ foreground gray78;\ points -2,+1,+1,-2 *tip.foreground: rgb:48/48/00 *tip.backgroundPixmap: None *tip.borderWidth: 0 *tip.rightMargin: 7 *tip.bottomMargin: 3 *tip.displayList:\ foreground rgb:f/e/8;\ fill-rect 1,1,-2,-2;\ foreground rgb:d/c/6;\ draw-segments 0,1,0,-3,1,-2,-3,-2,-2,-3,-2,1,-3,0,1,0;\ foreground rgb:a/8/4;\ draw-lines 2,-1, -2,-1, -1,-2, -1,2 *grip.foreground: gray10 *grip.displayList:\ foreground gray80;\ points 0,0,0,-1,-1,-1,-1,0 x11-apps-7.7+5+nmu1ubuntu1/xedit/app-defaults/Xedit-sample0000664000000000000000000001750312472175711020167 0ustar ! $XFree86: xc/programs/xedit/Xedit-sample,v 1.7 1999/06/06 08:49:13 dawes Exp $ Xedit*insertFile*text.width: 150 Xedit*search*searchText.width: 192 Xedit*search*replaceText.width: 192 Xedit*search*case.horizDistance: 14 Xedit*Text.autoFill: false Xedit*cursorColor: red Xedit.geometry: 600x400 Xedit*font: -*-courier-bold-r-*-*-12-*-*-*-*-*-*-1 Xedit*Text.?.font: -*-courier-medium-r-*-*-12-*-*-*-*-*-*-1 Xedit*Text.rightMargin: 0 Xedit*filename.backgroundPixmap: gradient:vertical?dimension=3&start=rgb:e/d/d&end=rgb:f/e/e Xedit*filename.topMargin: 3 Xedit*messageWindow.backgroundPixmap: gradient:vertical?dimension=3&start=rgb:e/d/d&end=rgb:f/e/e Xedit*editWindow.backgroundPixmap: gradient:vertical?dimension=3&start=rgb:e/d/d&end=rgb:f/e/e Xedit*editWindow.wrap: Never Xedit*formWindow*font: -*-courier-bold-r-*-*-12-*-*-*-*-*-*-1 Xedit*formWindow*background: rgb:9/0/2 Xedit*formWindow*foreground: rgb:d/c/8 Xedit*formWindow*backgroundPixmap: XtUnspecifiedPixmap Xedit*formWindow.displayList:\ foreground rgb:3/0/1;\ draw-lines +1,-1,-1,-1,-1,+1;\ foreground rgb:d/0/3;\ draw-lines -1,+0,+0,+0,+0,-1;\ foreground rgb:b/2/3;\ draw-lines +2,-2,-2,-2,-2,+2;\ foreground rgb:8/0/1;\ draw-lines -2,+1,+1,+1,+1,-2 Xedit*bc_label.background: rgb:9/0/2 Xedit*bc_label.foreground: rgb:d/c/8 Xedit*bc_label.displayList:\ foreground rgb:3/0/1;\ draw-lines +1,-1,-1,-1,-1,+1;\ foreground rgb:d/0/3;\ draw-lines -1,+0,+0,+0,+0,-1;\ foreground rgb:b/2/3;\ draw-lines +2,-2,-2,-2,-2,+2;\ foreground rgb:8/0/1;\ draw-lines -2,+1,+1,+1,+1,-2 Xedit*Scrollbar.background: rgb:e/c/c Xedit*Scrollbar.foreground: rgb:a/7/7 Xedit*Scrollbar.borderColor: rgb:9/8/8 Xedit*vScrollbar.thumb: hlines2 Xedit*hScrollbar.thumb: vlines2 Xedit*Scrollbar.width: 12 Xedit*Scrollbar.height: 12 Xedit*Scrollbar.backgroundPixmap: gray3?background=rgb:c/a/a&foreground=rgb:d/b/b Xedit*Scrollbar.displayList:\ foreground rgb:7/4/4;\ draw-lines +0,-1,-1,-1,-1,+0;\ foreground rgb:4/2/2;\ draw-lines -2,+0,+0,+0,+0,-2 Xedit*Paned.internalBorderColor: rgb:9/8/8 Xedit*buttons.internalBorderColor: rgb:8/7/7 Xedit*Grip.width: 10 Xedit*Grip.height: 10 Xedit*Grip.foreground: IndianRed3 Xedit*Grip.displayList:\ foreground IndianRed1;\ draw-rect +0,+0,-2,-2;\ foreground IndianRed4;\ draw-lines +1,-1,-1,-1,-1,+1 Xedit*Command.internalWidth: 8 Xedit*Command.internalHeight: 2 Xedit*Command.borderWidth: 0 Xedit*Command.background: rgb:9/0/2 Xedit*Command.foreground: rgb:d/c/8 Xedit*Command.highlightThickness: 0 Xedit*Command.displayList:\ foreground rgb:3/0/1;\ draw-lines +1,-1,-1,-1,-1,+1;\ foreground rgb:d/0/3;\ draw-lines -1,+0,+0,+0,+0,-1;\ foreground rgb:b/2/3;\ draw-lines +2,-2,-2,-2,-2,+2;\ foreground rgb:8/0/1;\ draw-lines -2,+1,+1,+1,+1,-2 Xedit*Toggle.borderWidth: 1 Xedit*Toggle.borderColor: rgb:a/9/9 Xedit*Toggle.background: rgb:f/e/e Xedit*Toggle.foreground: rgb:9/0/2 Xedit*Toggle.highlightThickness: 1 Xedit*Toggle.internalWidth: 10 Xedit*Toggle.internalHeight: 2 Xedit*Toggle.justify: left Xedit*Toggle.displayList:\ foreground rgb:6/0/1;\ draw-lines +2,-2,-2,-2,-2,+2;\ foreground rgb:d/2/3;\ draw-lines -2,+1,+1,+1,+1,-2 Xedit*Form.background: rgb:f/e/e Xedit*Form.Label.background: rgb:f/e/e Xedit*Form.backgroundPixmap: gradient:vertical?dimension=3&start=rgb:e/d/d&end=rgb:f/e/e Xedit*Form.Label.backgroundPixmap: ParentRelative Xedit*Form*Text.backgroundPixmap: gradient:vertical?dimension=3&start=rgb:dc/cc/cc&end=rgb:ec/dc/dc Xedit*Form.Text.leftMargin: 5 Xedit*Form.Text.rightMargin: 4 Xedit*Form.Text.topMargin: 2 Xedit*Form.Text.bottomMargin: 2 Xedit*Form.Text.borderWidth: 2 Xedit*Form.Text.borderColor: rgb:9/0/2 Xedit*Form.Text.displayList:\ foreground gray50;\ draw-lines -1,+0,+0,+0,+0,-1;\ foreground gray80;\ draw-rect +1,+1,-1,-1 Xedit*Form.Label.font: fixed Xedit*Form.Command.internalWidth: 8 Xedit*Form.Command.internalHeight: 4 Xedit*Form.Command.borderWidth: 0 Xedit*Form.Command.background: rgb:9/0/2 Xedit*Form.Command.foreground: rgb:d/c/8 Xedit*Form.Command.highlightThickness: 0 Xedit*Form.Command.displayList:\ foreground rgb:3/0/1;\ draw-lines +2,-2,-2,-2,-2,+2;\ foreground rgb:d/0/3;\ draw-lines -2,+1,+1,+1,+1,-2;\ foreground rgb:b/2/3;\ draw-lines +3,-3,-3,-3,-3,+3;\ foreground rgb:8/0/1;\ draw-lines -3,+2,+2,+2,+2,-3;\ foreground rgb:9/8/8;\ draw-lines +2,-1,-1,-1,-1,+2;\ foreground rgb:f/e/e;\ draw-lines -1,+1,-1,+0,+0,+0,+0,-1,+1,-1 Xedit*SimpleMenu.displayList:\ foreground rgb:3/0/1;\ draw-lines +1,-1,-1,-1,-1,+1;\ foreground rgb:d/0/3;\ draw-lines -1,+0,+0,+0,+0,-1;\ foreground rgb:b/2/3;\ draw-lines +2,-2,-2,-2,-2,+2;\ foreground rgb:8/0/1;\ draw-lines -2,+1,+1,+1,+1,-2;\ foreground rgb:a/1/3;\ fill-rect +3,+4,-4,+22;\ foreground rgb:b/a/6;\ draw-line +4,+4,-5,+4;\ draw-line +4,+22,-5,+22 Xedit*SimpleMenu.VerticalMargins: 2 Xedit*SimpleMenu.HorizontalMargins: 2 Xedit*SimpleMenu.borderWidth: 0 Xedit*SimpleMenu.?.foreground: rgb:d/c/8 Xedit*SimpleMenu.background: rgb:9/0/2 Xedit*dirlabel*font: -*-courier-bold-r-*-*-12-*-*-*-*-*-*-1 Xedit*dirlabel*background: rgb:9/0/2 Xedit*dirlabel*foreground: rgb:d/c/8 Xedit*dirlabel*backgroundPixmap: XtUnspecifiedPixmap Xedit*dirlabel.displayList:\ foreground rgb:3/0/1;\ draw-lines +1,-1,-1,-1,-1,+1;\ foreground rgb:d/0/3;\ draw-lines -1,+0,+0,+0,+0,-1;\ foreground rgb:b/2/3;\ draw-lines +2,-2,-2,-2,-2,+2;\ foreground rgb:8/0/1;\ draw-lines -2,+1,+1,+1,+1,-2 Xedit*dirwindow*font: -*-courier-bold-r-*-*-12-*-*-*-*-*-*-1 Xedit*dirwindow*foreground: rgb:9/0/2 Xedit*dirwindow.backgroundPixmap: gradient:vertical?dimension=3&start=rgb:e/d/d&end=rgb:f/e/e Xedit*viewport*Scrollbar.thumb: hlines2 Xedit*ispell*text.width: 192 Xedit*ispell.form.defaultDistance: 4 Xedit*ispell*commands.Command.vertDistance: 0 Xedit*ispell*commands.Command.height: 22 Xedit*ispell*commands.check.vertDistance: 3 Xedit*ispell*commands.look.vertDistance: 3 Xedit*ispell*replaceAll.width: 39 Xedit*ispell*ignoreAll.width: 39 Xedit*ispell*check.width: 54 Xedit*ispell*look.width: 50 Xedit*ispell*undo.width: 104 Xedit*ispell*add.width: 52 Xedit*ispell*addUncap.width: 52 Xedit*ispell*suspend.width: 60 Xedit*ispell*suspend.internalWidth: 0 Xedit*ispell*cancel.width: 44 Xedit*ispell*cancel.internalWidth: 0 Xedit*ispell*terse.width: 101 Xedit*ispell*terse.height: 18 Xedit*ispell*terse.vertDistance: 2 Xedit*ispell*replace.internalWidth: 0 Xedit*ispell*viewport.height: 139 Xedit*ispell*list.foreground: rgb:9/0/2 Xedit*ispell*list.backgroundPixmap: gradient:vertical?dimension=3&start=rgb:e/d/d&end=rgb:f/e/e Xedit*ispell*borderColor: rgb:9/0/2 Xedit*ispell*word.font: -*-courier-medium-r-*-*-12-*-*-*-*-*-*-1 Xedit*ispell*word.displayList: Xedit*ispell*word.foreground: black Xedit*ispell*word.background: rgb:f/e/e Xedit*ispell*word.borderWidth: 1 Xedit*ispell*word.height: 18 Xedit*SimpleMenu.SimpleMenu.displayList:\ foreground rgb:3/0/1;\ draw-lines +1,-1,-1,-1,-1,+1;\ foreground rgb:d/0/3;\ draw-lines -1,+0,+0,+0,+0,-1;\ foreground rgb:b/2/3;\ draw-lines +2,-2,-2,-2,-2,+2;\ foreground rgb:8/0/1;\ draw-lines -2,+1,+1,+1,+1,-2 Xedit*columns*Label.width: 84 Xedit*columns.minWidth: 130 Xedit*columns.minHeight: 80 Xedit*columns.maxWidth: 130 Xedit*columns.maxHeight: 80 Xedit*columns*cancel.horizDistance: 6 Xedit*ispell*SimpleMenu.displayList:\ foreground rgb:3/0/1;\ draw-lines +1,-1,-1,-1,-1,+1;\ foreground rgb:d/0/3;\ draw-lines -1,+0,+0,+0,+0,-1;\ foreground rgb:b/2/3;\ draw-lines +2,-2,-2,-2,-2,+2;\ foreground rgb:8/0/1;\ draw-lines -2,+1,+1,+1,+1,-2 Xedit*ispell*MenuButton.borderColor: rgb:f/e/e Xedit*ispell*MenuButton.background: rgb:9/0/2 Xedit*ispell*MenuButton.foreground: rgb:d/c/8 Xedit*ispell*MenuButton.highlightThickness: 0 Xedit*ispell*MenuButton.displayList:\ foreground rgb:3/0/1;\ draw-lines +1,-1,-1,-1,-1,+1;\ foreground rgb:d/0/3;\ draw-lines -1,+0,+0,+0,+0,-1;\ foreground rgb:b/2/3;\ draw-lines +2,-2,-2,-2,-2,+2;\ foreground rgb:8/0/1;\ draw-lines -2,+1,+1,+1,+1,-2 Xedit*tip.background: yellow x11-apps-7.7+5+nmu1ubuntu1/xedit/app-defaults/Xedit0000664000000000000000000003651112472175711016710 0ustar ! $XFree86: xc/programs/xedit/Xedit.ad,v 1.23 2002/09/22 07:09:05 paulo Exp $ *geometry: 590x440 *input: TRUE *enableBackups: True *backupNameSuffix: ~ *changedBitmap: xlogo11 *international: False *hints:\ Use Control-S and Control-R to Search.\n\ Use Control-Shift-_ to Undo. Control-G to switch between Undo and Redo.\n\ Use Control-A to jump to the beginning of the line.\n\ Use Control-E to jump to the end of the line.\n\ Use Control-T to transpose characters.\n\ Use Control-K to cut to the end of the line. Control-Y to paste.\n\ Use Control-Q to escape control characters.\n\ Use Control-U[,] to multiply actions. Control-G to cancel.\n\ Use Control-Z to scroll one line up. Meta-Z to scroll one line down.\n\ Use Meta-Q to format a paragraph.\n\ Use Right-Button to extend selections.\n\ Use Meta-I to insert a file.\n\ Use Control-W to delete a selection, and/or jump to the selection mark.\n\ Use Control-X,Control-F to find a file. Tab for filename completion.\n\ Use Control-X,Control-S to save.\n\ Use Control-X,Control-C to exit.\n\ Use Control-C to paste the selection at CUT_BUFFER0.\n\ Use Control Left-Button to popup the File Menu.\n\ Use Control Middle-Button to popup the Edit Menu.\n\ Use Control Right-Button to popup the Option Menu.\n\ Use Control-X,Tab to Indent.\n\ Use Control-X,0 to delete current splitted window.\n\ Use Control-X,1 to delete other splitted window.\n\ Use Control-X,2 to split the window vertically.\n\ Use Control-X,3 to split the window horizontally.\n\ Use Control-X,b to switch to another file.\n\ Use Control-X,d to list directory. Control-G to Cancel.\n\ Use Control-X,k to close file being edited.\n\ Use Control-X,o to switch to another splitted window.\n\ Use Control-X,u to undo. Control-G to switch between Undo and Redo.\n\ Use Insert to toggle Overwrite mode.\n\ Use Control-G to interrupt the lisp subprocess.\n\ Use Escape to enter or leave regex search and replace mode.\n\ Use Alt-. to search tags for the selected symbol or find the next match. *formWindow*defaultDistance: 2 *formWindow.?.borderWidth: 0 *formWindow.min: 18 *formWindow.max: 18 *formWindow.showGrip: False *positionWindow.fromHoriz: labelWindow *positionWindow.horizDistance: 0 *positionWindow.left: chainRight *positionWindow.right: chainRight *positionWindow.width: 90 *positionWindow.label: error *positionWindow.justify: left *labelWindow*justify: center *labelWindow*label: no file yet *labelWindow.left: chainLeft *labelWindow.right: chainRight *quit.label: Quit *quit.tip: Close xedit window *save.label: Save *save.tip: Save current file *load.label: Load *load.tip: Load a new file *buttons*orientation: horizontal *buttons*showGrip: False *buttons.min: 18 *messageWindow.height: 50 *messageWindow.min: 18 *Paned*Text*allowResize: True *messageWindow.autoFill: False *messageWindow.scrollVertical: Never *editWindow.autoFill: False *editWindow.scrollVertical: Always *editWindow.showGrip: True xedit.textSource*enableUndo: True *bc_label*label: Use Control-S and Control-R to Search. *bc_label*showGrip: False *bc_label.min: 18 *dirlabel.showGrip: False *dirlabel.min: 18 *dirlabel.max: 18 *dirwindow.defaultColumns: 0 *dirwindow.verticalList: True *viewport.forceBars: True *viewport.allowVert: 1 *insertFile*text.width: 141 *insertFile*text.?.pieceSize: 256 *search*searchText.width: 157 *search*replaceText.width: 157 *search*case.horizDistance: 25 *search*Text.?.pieceSize: 256 *SimpleMenu.BackingStore: NotUseful *SimpleMenu.menuLabel.vertSpace: 80 *SimpleMenu.SmeBSB.HorizontalMargins: 16 *SimpleMenu.justify: center *SimpleMenu.menuLabel.height: 250 *SimpleMenu*cursor: left_ptr *fileMenu.label: File Menu *optionsMenu.label: Option Menu *optionsMenu.ispell.label: ispell... *editMenu.label: Edit Menu *editMenu.wrapMenuItem.label: Wrapping *editMenu.wrapMenuItem.leftBitmap: menu12 *wrapMenu.never.label: Never *wrapMenu.line.label: Line *wrapMenu.word.label: Word *editMenu.autoFill.label: Auto Fill *editMenu.justifyMenuItem.label: Justification *editMenu.justifyMenuItem.leftBitmap: menu12 *justifyMenu.left.label: Left *justifyMenu.right.label: Right *justifyMenu.center.label: Center *justifyMenu.full.label: Full *editMenu.breakColumns.label: Break Columns... *editMenu.scrollMenuItem.label: Scrollbars *editMenu.scrollMenuItem.leftBitmap: menu12 *scrollMenu.vertical.label: Vertical *scrollMenu.horizontal.label: Horizontal *editMenu.modeMenuItem.leftBitmap: menu12 *editMenu.modeMenuItem.label: Edit Mode *editModes.none.label: Plain/None *TransientShell*Text.translations: #override \ cS: no-op(r)\n\ cR: no-op(r)\n\ mI: no-op(r) *search.translations: #override \ :get-values(my, $w, width, $h, height)\ set-values(1, minWidth, $w, minHeight, $h, maxHeight, $h, allowShellResize, False) *insertFile.title: Insert File *insertFile.translations: #override \ :get-values(my, $w, width, $h, height)\ set-values(1, minWidth, $w, minHeight, $h, maxHeight, $h, allowShellResize, False) *baseTranslations: #override \ X,C:quit()\n\ X,S:save-file()\n\ X,F:find-file()\n\ Escape: line-edit() *messageWindow.Translations: #override \ X,C:quit()\n\ X,S:save-file()\n\ X,F:find-file()\n\ : no-op()\n\ : no-op()\n\ : set-keyboard-focus() select-start() *searchText.Translations: #override \ : no-op()\n\ : no-op()\n\ : set-keyboard-focus() select-start() *replaceText.Translations: #override \ : no-op()\n\ : no-op()\n\ : set-keyboard-focus() select-start() *editWindow.translations: #override \ X,E:lisp-eval()\n\ X,Tab:indent()\n\ X,:0:delete-window(current)\n\ X,:1:delete-window(other)\n\ X,:2:split-window(vertical)\n\ X,:3:split-window(horizontal)\n\ X,!l @Num_Lockb:switch-source()\n\ X,!l b:switch-source()\n\ X,!@Num_Lockb:switch-source()\n\ X,!b:switch-source()\n\ X,!l @Num_Lockd:dir-window()\n\ X,!l d:dir-window()\n\ X,!@Num_Lockd:dir-window()\n\ X,!d:dir-window()\n\ X,!l @Num_Lockk:kill-file()\n\ X,!l k:kill-file()\n\ X,!@Num_Lockk:kill-file()\n\ X,!k:kill-file()\n\ X,!l @Num_Locko:other-window()\n\ X,!l o:other-window()\n\ X,!@Num_Locko:other-window()\n\ X,!o:other-window()\n\ X,!l @Num_Locku:undo()\n\ X,!l u:undo()\n\ X,!@Num_Locku:undo()\n\ X,!u:undo()\n\ G: xedit-keyboard-reset()\n\ J: xedit-print-lisp-eval()\n\ :m.: tags()\n\ Tab: insert-char()\n\ !l @Num_Lockb:insert-char()\n\ !l b: insert-char()\n\ !@Num_Lockb:insert-char()\n\ !b: insert-char()\n\ !l @Num_Lockd:insert-char()\n\ !l d: insert-char()\n\ !@Num_Lockd:insert-char()\n\ !d: insert-char()\n\ !l k: insert-char()\n\ !l @Num_Lockk:insert-char()\n\ !@Num_Lockk:insert-char()\n\ !k: insert-char()\n\ !l @Num_Locko:insert-char()\n\ !l o: insert-char()\n\ !@Num_Locko:insert-char()\n\ !o: insert-char()\n\ !l @Num_Locku:insert-char()\n\ !l u: insert-char()\n\ !@Num_Locku:insert-char()\n\ !u: insert-char()\n\ ~s Insert: toggle-overwrite()\n\ c l @Num_Lock:xedit-focus() popup-menu(fileMenu)\n\ c @Num_Lock:xedit-focus() popup-menu(fileMenu)\n\ c l: xedit-focus() popup-menu(fileMenu)\n\ c: xedit-focus() popup-menu(fileMenu)\n\ c l @Num_Lock:xedit-focus() popup-menu(editMenu)\n\ c @Num_Lock:xedit-focus() popup-menu(editMenu)\n\ c l: xedit-focus() popup-menu(editMenu)\n\ c: xedit-focus() popup-menu(editMenu)\n\ c l @Num_Lock:xedit-focus() popup-menu(optionsMenu)\n\ c @Num_Lock:xedit-focus() popup-menu(optionsMenu)\n\ c l:xedit-focus() popup-menu(optionsMenu)\n\ c: xedit-focus() popup-menu(optionsMenu)\n\ : xedit-focus() select-start()\n\ : scroll-one-line-down()\n\ : scroll-one-line-up() *filename.?.pieceSize: 256 *filename.translations: #override \ cS: no-op(r)\n\ cR: no-op(r)\n\ mI: no-op(r)\n\ cG: cancel-find-file()\n\ Return: load-file()\n\ Tab: file-completion(h)\n\ Escape: cancel-find-file()\n\ : no-op()\n\ : no-op()\n\ : set-keyboard-focus() select-start() *ispell.translations: #override \ WM_PROTOCOLS: ispell(end) ! Sample dictionary, word chars and text mode resources setup !*ispell.dictionary: br !*ispell.dictionaries: br american americanmed+ english !*ispell*br.wordChars: áéíóúçÁÉÍÓÚÇàÀâêôÂÊÔüÜãõÃÕ- *ispell.ispellCommand: /usr/bin/aspell -B -m *ispell.lookCommand: /bin/egrep !*ispell*text.skipLines: .# *ispell.geometry: 0x0 *ispell.minWidth: 320 *ispell.minHeight: 245 *ispell*Label.borderWidth: 0 *ispell*Label.internalHeight: 4 *ispell*Label.justify: right *ispell*Label.width: 112 *ispell*Label.left: chainLeft *ispell*Label.right: chainLeft *ispell*Label.top: chainTop *ispell*Label.bottom: chainTop *ispell*mispelled.label: Misspelled word: *ispell*mispelled.top: chainTop *ispell*mispelled.bottom: chainTop *ispell*mispelled.internalWidth: 0 *ispell*repeated.label: Repeated words: *ispell*repeated.internalWidth: 0 *ispell*replacement.label: Replace with: *ispell*word.fromHoriz: mispelled *ispell*word.justify: left *ispell*word.borderWidth: 1 *ispell*word.internalWidth: 4 *ispell*word.internalHeight: 3 *ispell*word.width: 194 *ispell*word.left: chainLeft *ispell*word.right: chainRight *ispell*word.top: chainTop *ispell*word.bottom: chainTop *ispell*word.label: *ispell*word.tip: Press here to select this text *ispell*word.highlightThickness: 0 *ispell*text.fromHoriz: replacement *ispell*replacement.fromVert: mispelled *ispell*replacement.internalWidth: 0 *ispell*form.text.fromVert: word *ispell*form.text.width: 194 *ispell*form.text.top: chainTop *ispell*form.text.bottom: chainTop *ispell*form.text.left: chainLeft *ispell*form.text.right: chainRight *ispell*form.text.leftMargin: 4 *ispell*form.text.?.pieceSize: 256 *ispell*suggestions.label: Suggestions: *ispell*suggestions.fromVert: replacement *ispell*suggestions.internalWidth: 0 *ispell*viewport.fromHoriz: suggestions *ispell*viewport.fromVert: text *ispell*viewport.width: 194 *ispell*viewport.height: 143 *ispell*viewport.top: chainTop *ispell*viewport.bottom: chainBottom *ispell*viewport.left: chainLeft *ispell*viewport.right: chainRight *ispell*viewport.forceBars: 1 *ispell*viewport.allowVert: 1 *ispell*list.defaultColumns: 1 *ispell*list.longest: 16384 *ispell*commands.vertDistance: 5 *ispell*commands.fromVert: suggestions *ispell*commands.top: chainBottom *ispell*commands.bottom: chainBottom *ispell*commands.right: chainLeft *ispell*commands.left: chainLeft *ispell*check.label: Check *ispell*check.width: 54 *ispell*check.tip: Ask ispell about the word in the text field *ispell*look.label: Look *ispell*look.fromHoriz: check *ispell*look.horizDistance: 0 *ispell*look.width: 46 *ispell*look.tip: Runs the look command *ispell*undo.fromVert: check *ispell*undo.label: Undo *ispell*undo.width: 102 *ispell*undo.tip: Undo last action *ispell*replace.fromVert: undo *ispell*replace.label: Replace *ispell*replace.tip: Replace occurence of the word *ispell*replaceAll.fromVert: undo *ispell*replaceAll.fromHoriz: replace *ispell*replaceAll.label: All *ispell*replaceAll.tip: Replace all occurences of the word *ispell*ignore.fromVert: replace *ispell*ignore.label: Ignore *ispell*ignore.tip: Ignore this word *ispell*ignoreAll.fromVert: replaceAll *ispell*ignoreAll.fromHoriz: ignore *ispell*ignoreAll.label: All *ispell*ignoreAll.tip: Ignore all ocurrences of the word *ispell*add.fromVert: ignore *ispell*add.label: Add *ispell*add.width: 50 *ispell*add.tip: Add word to your private dictionary *ispell*addUncap.fromVert: ignoreAll *ispell*addUncap.fromHoriz: add *ispell*addUncap.label: Uncap *ispell*addUncap.horizDistance: 0 *ispell*addUncap.width: 50 *ispell*addUncap.tip: Add word uncapitalized, to your private dictionary *ispell*suspend.fromVert: add *ispell*suspend.label: Suspend *ispell*suspend.width: 57 *ispell*suspend.tip: Suspend ispell execution *ispell*cancel.fromHoriz: suspend *ispell*cancel.fromVert: addUncap *ispell*cancel.label: Close *ispell*cancel.width: 43 *ispell*cancel.horizDistance: 0 *ispell*cancel.tip: Terminates ispell process *ispell*replace.width: 65 *ispell*ignore.width: 65 *ispell*replaceAll.width: 35 *ispell*replaceAll.horizDistance: 0 *ispell*ignoreAll.width: 35 *ispell*ignoreAll.horizDistance: 0 *ispell*terse.fromVert: cancel *ispell*terse.Label: Terse Mode *ispell*terse.width: 104 *ispell*terse.borderWidth: 0 *ispell*terse.tip: Switch terse mode *ispell*status.fromVert: viewport *ispell*status.fromHoriz: suggestions *ispell*status.top: chainBottom *ispell*status.bottom: chainBottom *ispell*status.left: chainLeft *ispell*status.right: chainRight *ispell*status.width: 194 *ispell*status.borderWidth: 1 *ispell*status.justify: left *ispell*status.internalHeight: 2 *ispell*status.vertDistance: 2 *ispell*options.fromVert: status *ispell*options.fromHoriz: commands *ispell*options.bottom: chainBottom *ispell*options.top: chainBottom *ispell*options.left: chainLeft *ispell*options.right: chainRight *ispell*options.dict.width: 121 *ispell*options.horizDistance: 2 *ispell*options.vertDistance: 2 *ispell*options.defaultDistance: 2 *ispell*dict.highlightThickness: 0 *ispell*dict.justify: left *ispell*dict.resizable: False *ispell*dict.leftBitmap: menu12 *ispell*dict.label: Dictionary *ispell*dict.tip: Change dictionary *ispell*options.format.width: 65 *ispell*format.highlightThickness: 0 *ispell*format.justify: left *ispell*format.resizable: False *ispell*format.leftBitmap: menu12 *ispell*format.fromHoriz: dict *ispell*format.horizDistance: 0 *ispell*format.tip: Select text type *columns.minWidth: 140 *columns.minHeight: 76 *columns.maxWidth: 140 *columns.maxHeight: 76 *columns.form*defaultDistance: 4 *columns*left: chainLeft *columns*right: chainLeft *columns*top: chainTop *columns*bottom: chainTop *columns*Label.width: 96 *columns*Label.borderWidth: 0 *columns*Label.internalHeight: 4 *columns*Label.internalWidth: 2 *columns*Label.justify: right *columns*Text.width: 30 *columns*Command.width: 58 *columns*leftLabel.label: Left Column: *columns*left.fromHoriz: leftLabel *columns*rightLabel.label: Right Column: *columns*rightLabel.fromVert: leftLabel *columns*right.fromHoriz: rightLabel *columns*right.fromVert: left *columns*ok.fromVert: rightLabel *columns*cancel.fromHoriz: ok *columns*cancel.fromVert: rightLabel *columns*cancel.horizDistance: 12 *columns*Text.?.pieceSize: 8 *columns*Text.translations: #override \ cS: no-op(r)\n\ cR: no-op(r)\n\ mI: no-op(r)\n\ Return: set-columns(ok)\n\ Tab: change-field()\n\ cG: set-columns(cancel)\n\ Escape: set-columns(cancel)\n\ : no-op()\n\ : no-op()\n\ : set-keyboard-focus() select-start() *columns.translations: #override \ WM_PROTOCOLS: set-columns(cancel) ! EOF. x11-apps-7.7+5+nmu1ubuntu1/xedit/ChangeLog0000664000000000000000000013540412472176532015100 0ustar commit 436a71e7390c51134f4fac629bf8d4a98b0592c5 Author: Matt Turner Date: Sat Feb 21 13:43:04 2015 -0800 xedit 1.2.2 commit b8a142f798be57cd7f0d41b502f6960a9ffbae19 Author: Ted Tanberry Date: Sun Aug 10 22:25:08 2014 +0200 Include AM_PROG_AR to detect 'ar' instead of hard-coding it see Gentoo bug https://bugs.gentoo.org/show_bug.cgi?id=486470 Reviewed-by: Matthieu Herrb Signed-off-by: Alan Coopersmith commit 46a906557fcf321592d543d818bc8054aad0ee89 Author: Alan Coopersmith Date: Tue Sep 9 20:32:53 2014 -0700 Use automake subdir-objects option Stops automake from issuing a ton of warnings about how this will be the default soon. Signed-off-by: Alan Coopersmith commit 4c63319d249cb796b735ec56904c088c56a5171f Author: Alan Coopersmith Date: Tue Sep 9 20:26:15 2014 -0700 Check for pagesize options via autoconf instead of per-platform #ifdefs Signed-off-by: Alan Coopersmith commit 9f0f4a2c5495eec2d81a4381fb962fad93b2ddde Author: Alan Coopersmith Date: Tue Sep 9 20:05:27 2014 -0700 Copious const cleanup Removes 1554 gcc warnings of "discards ‘const’ qualifier" Signed-off-by: Alan Coopersmith commit 40615f52b8fe7478599ce4948ccc751aa0a34397 Author: Alan Coopersmith Date: Tue Sep 9 19:23:59 2014 -0700 Require OS to provide rename(2), as all POSIX.1-1990 & later OS'es do Sorry SVR1-SVR3. Signed-off-by: Alan Coopersmith commit 28fa5649850622482d068b56ff46a023bc14c264 Author: Alan Coopersmith Date: Sat May 31 21:39:32 2014 -0700 autogen.sh: Honor NOCONFIGURE=1 See http://people.gnome.org/~walters/docs/build-api.txt Signed-off-by: Alan Coopersmith commit 79ade2eda265d40c1485c3578e3b8e65e37daeae Author: Alan Coopersmith Date: Sat May 31 21:38:41 2014 -0700 configure: Drop AM_MAINTAINER_MODE Signed-off-by: Alan Coopersmith commit b79cac135ca7b788892ff199231be2bfce62a4a3 Author: Alan Coopersmith Date: Sat May 3 00:21:27 2014 -0700 Fix man page tbl markup '\" t is needed to work with Solaris man/nroff commands Other changes fix issues found on all platforms Signed-off-by: Alan Coopersmith commit 24b3001f0d857fa40225efc1db169b29e88b4b4d Author: Gaetan Nadon Date: Tue Dec 17 11:28:21 2013 -0500 Remove obsolete Imake SIGNALRETURNSINT Assume signal handlers return void, as C89 requires Signed-off-by: Gaetan Nadon commit 505fc48999ca2c7040a47900697d95c6ab78d009 Author: Stéphane Aulery Date: Sat Jul 6 15:40:00 2013 +0200 Drop CRAY support Signed-off-by: Stéphane Aulery Reviewed-by: Alan Coopersmith Signed-off-by: Alan Coopersmith commit bde5fc6b3c493365139eb4451cd1829bf48f7ac2 Author: Alan Coopersmith Date: Sat Jan 12 17:01:02 2013 -0800 xedit 1.2.1 Signed-off-by: Alan Coopersmith commit c13aa758f31596fbe3f99ce0f54f00493118e729 Author: Alan Coopersmith Date: Sat Jan 12 16:59:00 2013 -0800 Remove lisp/env.c from EXTRA_DIST to fix make_distcheck commit c110109f171 replaced it with getenv.c & setenv.c Signed-off-by: Alan Coopersmith commit df082b1133659d1e3b420c18efa6c2a4562add6c Author: Eric S. Raymond Date: Thu Aug 23 11:57:03 2012 -0400 Eliminate use of tab stops. Use real TBL markup. These changes help structural lifting to DocBook. Signed-off-by: Eric S. Raymond commit ce36f7be03ff0df79247baeda24d2c0a3b1ee0f7 Author: Thomas Klausner Date: Wed Jul 11 13:30:56 2012 +0200 Do not unconditionally define DEBUG. Signed-off-by: Alan Coopersmith commit 33dacadbfb9adcb36c9b7ccd4f64d12e7995fd33 Author: pcpa Date: Thu May 24 15:33:14 2012 -0300 Avoid problems with builds with -Werror=format-security. Signed-off-by: pcpa Signed-off-by: Alan Coopersmith commit 04ca5cd8abfe9851f0987b4739f9795e924024cf Author: pcpa Date: Thu May 24 15:29:01 2012 -0300 Use proper pointer when computing "realpath" of a new file. In some special conditions it previously could omit a slash, and instead of creating foo/bar/baz would create foo/barbaz. Signed-off-by: pcpa Signed-off-by: Alan Coopersmith commit 63c70c830c79f0b4cfc0f7393662a9cb1169973e Author: pcpa Date: Thu May 24 15:26:50 2012 -0300 Correct 64 bit overflow check and bignum code. Signed-off-by: pcpa Signed-off-by: Alan Coopersmith commit c110109f1710758d7c87c05720bdff4df316fc7d Author: pcpa Date: Thu May 24 14:40:35 2012 -0300 Update fallback implementation of missing libc functions This commit updates realpath.c from http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/realpath.c?rev=1.14;content-type=text/plain and lisp/env.c from http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/getenv.c?rev=1.10;content-type=text/plain and http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/setenv.c?rev=1.13;content-type=text/plain The update reason is to replace files under "4 clause BSD", that is considered problematic or require special documentation notation or conditions when redistributing free software. Signed-off-by: pcpa Signed-off-by: Alan Coopersmith commit b6927e08121d5ccd9ef061ec0c393a7e23220114 Author: Alan Coopersmith Date: Sun Dec 4 09:01:28 2011 -0800 Fix builds of lisp/core.c with Solaris Studio compilers Required in order to build with Studio cc now that xorg-macros is setting -errwarn=E_FUNC_HAS_NO_RETURN_STMT since a bug in the Solaris system headers causes the noreturn attribute to not be correctly applied to the exit() prototype in when building with Studio instead of gcc. Otherwise compiler exits with error: "lisp/core.c", line 4329: Function has no return statement : Lisp_Quit Uses Studio-specific pragma instead of adding another exit() prototype with a noreturn attribute to avoid causing gcc to warn about having a redundant prototype for the exit() function. Signed-off-by: Alan Coopersmith commit f5c245c4b24b25103fc6d8d3a77121a94689a5c0 Author: Jeremy Huddleston Date: Sun Sep 25 00:57:14 2011 -0700 Require xt >= 1.0 for appdefaultdir https://bugs.freedesktop.org/show_bug.cgi?id=7237 Signed-off-by: Jeremy Huddleston commit 5a9cffc3f443030ac93d890611316d0994f0cc13 Author: Gaetan Nadon Date: Wed Jan 19 10:06:56 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit e72e2768a573bc4d073ce2d56ab4e28678b559b2 Author: Gaetan Nadon Date: Thu Jan 13 17:15:36 2011 -0500 man: replace hard coded man page section with substitution strings Signed-off-by: Gaetan Nadon commit 5fb277811c7dde95aadb878542bb93672c0e8284 Author: Gaetan Nadon Date: Thu Jan 13 11:15:47 2011 -0500 man: remove trailing spaces and tabs Using s/[ \t]*$// Signed-off-by: Gaetan Nadon commit ab47a794352c16a00109bba2563b5dda53603225 Author: Gaetan Nadon Date: Wed Jan 12 16:28:02 2011 -0500 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS This silences an Autoconf warning commit a1dbd197be7bb13ed2f31ad8b55b2b762dbf70b6 Author: Gaetan Nadon Date: Wed Jan 12 15:29:50 2011 -0500 config: replace deprecated AC_HELP_STRING with AS_HELP_STRING This silences an Automake warning. Signed-off-by: Gaetan Nadon commit 3fc23c464e814cad0fcf318dfa06afb90006917c Author: Alan Coopersmith Date: Sat Oct 30 15:29:20 2010 -0700 xedit 1.2.0 Signed-off-by: Alan Coopersmith commit 503b075a868e8f88eb9816a1ce859e75e7341ca9 Author: Alan Coopersmith Date: Sat Oct 30 15:27:51 2010 -0700 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now Signed-off-by: Alan Coopersmith commit f3a39e6188f7ff4baec52d4bd2efc4f029b696c9 Author: Gaetan Nadon Date: Sat Oct 30 15:26:40 2010 -0700 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon Signed-off-by: Alan Coopersmith commit ee574a68128653e184389f66cfc5ca686f258455 Author: Alan Coopersmith Date: Thu Jul 1 17:51:53 2010 -0700 Xmu functions are called directly, so include it in PKG_CHECK_MODULES Signed-off-by: Alan Coopersmith commit 1da695772d64d4919a91c085d96ce1bd528d048e Author: Alan Coopersmith Date: Wed Jun 30 23:25:03 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS The existing statement can now be removed from the configuration file. Use automake provided $(AM_V_GEN) and XORG_DEFAULT_OPTIONS provided $(SED) Enables silent rule and use platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit b67fdbae96217bda5eecbff3706ff12a25ed2934 Author: Gaetan Nadon Date: Thu Mar 25 20:04:31 2010 -0400 xprint: remove conditionally defined related C code Reviewed-by: Jeremy Huddleston Signed-off-by: Gaetan Nadon commit 47b6e661024970b8f3b53d9f7930b9ec77ccdbdc Author: Gaetan Nadon Date: Thu Mar 25 19:55:11 2010 -0400 xprint: remove xprint related C code Signed-off-by: Gaetan Nadon commit 4f452ccf18993f3a68c6f30719fc6ed4e7fe9b13 Author: Gaetan Nadon Date: Thu Mar 25 19:37:54 2010 -0400 xprint: remove Xedit-xprint resource file Remove configuration regarding xprint support Signed-off-by: Gaetan Nadon commit 40b17bb87cb89a1b851e1d39e03431ecbc9c155e Author: Gaetan Nadon Date: Thu Mar 25 19:30:50 2010 -0400 config: remove dependency on xaw8 Remove configure option --enable-xprint Remove AM conditional USE_XPRINT Signed-off-by: Gaetan Nadon commit 553e84525830c551d423d837f7b317df10d69e3f Author: Gaetan Nadon Date: Sat Dec 19 20:48:48 2009 -0500 configure.ac: use backticks rather than $() for cmd subs Use "$PKG_CONFIG" rather than hard coded "pkg-config" Signed-off-by: Gaetan Nadon commit 7adc430f7e76a04cd0f2abfa6ea46a3035d8e2ab Author: Gaetan Nadon Date: Thu Nov 26 09:19:53 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit 8a56edb05d0881354ec0f5c849495e7604cf5ca7 Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit b495f585017d7d441bc2a7b117d400f2ee082a9c Author: Gaetan Nadon Date: Tue Oct 27 15:07:24 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit 7014a702382d55464aefdbd61405a1c49b30cf26 Author: Gaetan Nadon Date: Mon Oct 26 22:08:38 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit 64a4c3d43b8521c51d9ef77ce6987b274937818d Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit b5980a1f03ebbc97267682fa912f145728867364 Author: Paulo Cesar Pereira de Andrade Date: Mon Jan 26 20:14:44 2009 -0200 Set text properties after loading all command line files. This is more of a workaround for a problem where the first file will end up using the "text properties" of the last file with a syntax highlight definition. A more proper correction could be to actually display the last file loaded (and removed the duplicated code in xedit.c:main()). commit bb19bb3d1dd5bb9c0070f867324f740894c76887 Author: Paulo Cesar Pereira de Andrade Date: Mon Jan 12 20:33:01 2009 -0200 Correct problems in make distcheck. commit e7d66545e71cdd223761ce14416cbebccbd6dd75 Author: Paulo Cesar Pereira de Andrade Date: Tue Dec 2 02:25:41 2008 -0200 Use new XORG_CWARNFLAGS and XORG_CHANGELOG macros. Also correct a possible uninitialized variable. commit 99faa7b727a5441b0dfeed72f43571a85ff0a079 Author: Paulo Cesar Pereira de Andrade Date: Tue Dec 2 02:05:42 2008 -0200 Properly read symbol name in tags interface. If the symbol is not in a full text "Piece", XawTextSourceRead() will return an XawTextBlock that points to an incomplete buffer, and a new call must be made to read the remaining data. commit 2c5007e4aa838b0faf1020d90661adfe0a9b6275 Author: Paulo Cesar Pereira de Andrade Date: Tue Dec 2 01:27:52 2008 -0200 Don't put EOF in the unget buffer. commit e79879904eea8495b28d7895ce126269a9ef300f Author: A Costa Date: Thu Apr 28 01:47:05 2005 -0400 Man page typo fixes Debian bug#306707 commit ab754905b2878ba76e309963138bf47c2ae8df2a Author: Paulo Cesar Pereira de Andrade Date: Wed Nov 12 01:25:22 2008 -0200 Add missing check for symbolic links. It was properly checking when using +, but not when using +, what would allow loading the same file with different names (but save would be done to the real file, and not overwrite the link). commit cfc78a1c2452362a5e7c88ed239c9d7ef0240a4d Author: Peter Breitenlohner Date: Tue Nov 11 10:52:18 2008 +0100 reorganize app default files commit 9d4a9520409fdb50987be6f4ca2c8afd5b53c994 Author: Paulo Cesar Pereira de Andrade Date: Mon Nov 10 01:47:46 2008 -0200 Don't highlight quotes in nested syntax tables for "auto" mode. To properly do it, it should also match the pattern for the macro name, to know if it is a plain text one or not, otherwise, it will get confused with usage of the characters (') and (`). commit 0ab2815743d89b1cd283abaf4d2cb77fed4a2df4 Author: Peter Breitenlohner Date: Sun Nov 9 14:24:10 2008 +0100 avoid race condition for parallel jobs commit 01ba3d66731e679d07f7083306a712bbfed16b38 Author: Paulo Cesar Pereira de Andrade Date: Fri Nov 7 16:41:36 2008 -0200 Xedit version 1.1.2. Also update to use ``git log'' instead of ``git-log'', to match newer versions of git. commit 0d133999449ce7c5db19d46680430ab16e81e4fd Author: Peter Breitenlohner Date: Thu Nov 6 21:19:56 2008 +0100 enabled VPATH build commit f5edc6424b6553d58e271f64471cef32e063dd19 Author: Paulo Cesar Pereira de Andrade Date: Wed Oct 8 19:21:28 2008 -0300 Rewrite double click confirmation code. Remove the double_click global boolean, and change dc_state to a bit field, instead of a single state variable. The old code was the xedit original code with minimal changes, but was a bit confusing when two confirmations would be required. Also, this patch moves the check for file overwriting before MaybeCreateFile() as it can actually call creat(), what means that it can no longer ask for confirmations, as the file has been just backed up, and a zero sized one created. commit d96491aad5542f052b722b94d86f0ce7661ae98b Merge: cc7cb04 f1efec7 Author: Paulo Cesar Pereira de Andrade Date: Fri Sep 26 17:47:32 2008 -0300 Merge branch 'master' of ssh://pcpa@git.freedesktop.org/git/xorg/app/xedit commit cc7cb041c4144f1401fd520f05018028c0e0c87e Author: Paulo Cesar Pereira de Andrade Date: Fri Sep 26 17:34:50 2008 -0300 Proper implementation of AddDoubleClickCallback I tracked it down to http://cvsweb.xfree86.org/cvsweb/xc/programs/xedit/commands.c?rev=1.5&content-type=text/vnd.viewcvs-markup After my patches to libXaw. Instead of checking for "if (XtIsSubclass(w, asciiSrcObjectClass)) {" it should really do something like "if (isXaw7orNewer) {". But I believe only XFree86 and Xorg versions of Xaw have the XawVersion macro in XawInit.h... This corrects the problem described in http://bugs.freedesktop.org/show_bug.cgi?id=17726 And the main reason is that xedit always default'ed to use a 8 bits iso8859-x locale, while in Xorg it was modified to use multibyte by default. commit f1efec76814500a14acf7c64184ebef1a28e264d Author: Jeremy Huddleston Date: Mon Aug 4 13:22:52 2008 -0700 Fixed filename conflict during compilation on case-insensitive file systems. commit dc857b78c00432de6d57124ca2e060ef0a76684f Author: Paulo Cesar Pereira de Andrade Date: Thu Jul 31 14:17:17 2008 -0300 Correct make dist and update to xedit-1.1.1. commit bc470a831ee3c8d5aa254661122187048f245c92 Author: Paulo Cesar Pereira de Andrade Date: Wed Jul 30 18:52:32 2008 -0300 Update to xedit 1.1.0. commit fb6c60031936bdaaeb808fb61b3073bdb058607a Author: Paulo Cesar Pereira de Andrade Date: Thu Jul 10 16:38:09 2008 -0300 Update file type pattern matching. Consider a file ending in .l a lisp source file. Allow an arbitrary number of bytes following the filename for xconf and xlog modes. Don't use make mode for "Imakefile". Require a slash before [Mm]akefile.*. commit ed21e75c45e92c4c52f80bdb5fba0e17f5afaca1 Author: Paulo Cesar Pereira de Andrade Date: Tue Jul 8 18:53:50 2008 -0300 CancelFindFile is almost the same as XeditFocus, and could be merged in a same Xt action. For the moment, automatically leave line_edit in XeditFocus. There is one other bug that should be fixed, that I am trying to repeat (having the same file loaded twice when using tags) before a new release. Thre is also a problem in Xaw when deleting large amounts of selections that crashes xedit, aparently due to Xaw Text widget doing some wrong math and attempting to allocate a huge chunk of memory. commit c23ce2ff2439f09d00dc2c226562d44f02ca591a Author: Paulo Cesar Pereira de Andrade Date: Sat May 10 21:38:23 2008 -0300 Fix an off by one error check that can lead to an infinite loop. This can happen when using the line edit mode to search&replace regexes. commit 2b4ebe868b660a69800dc5fe801bbcc05ccaefac Author: Paulo Cesar Pereira de Andrade Date: Sat May 10 21:36:36 2008 -0300 Warn if a newer version of a file exists before overwritting it. commit 0b8304c49ab2958bc2b4ef7286467a71faa38f41 Author: Paulo Cesar Pereira de Andrade Date: Sat Apr 12 17:43:04 2008 -0300 Add python mode. This mode adds syntax highlight and automatic indentation. Unlike most other modes with automatic indentation, this mode most only reads one line back to figure the proper indentation. Some features include: o When the first character in a line is typped, it automatically moves it to the proper tab stop. o Increments one indentation level if line ends in ':'. o Properly handle vector/hash table declarations. commit 614563884d2b19e514af233089e392127c4f4027 Author: Paulo Cesar Pereira de Andrade Date: Sun Mar 16 20:51:25 2008 -0300 Compile warning fixes. Add parenthesis around a test where after macro expansion it looked like boolexpr==boolres==boolres. "Ansifiy" a function without arguments. commit 60643e8f0dcd86e65400160c0a6e264e7a2a081c Author: Paulo Cesar Pereira de Andrade Date: Tue Mar 11 22:28:04 2008 -0300 Support multiple make jobs. Minor patch to avoid requiring xedit to have some special rule in a buildsystem that defaults to something like "make -j 16". commit ee636f8565931f8d897b6c8c07eb08d41695778c Author: Paulo Cesar Pereira de Andrade Date: Tue Mar 11 21:52:58 2008 -0300 Fix an incorrect buffer size calculation and allocation. commit 5bd8082a9788a1b5343eb03400944a03e4250577 Author: Paulo Cesar Pereira de Andrade Date: Wed Mar 12 21:59:34 2008 -0300 Add perl and "auto tools" modes. Auto mode has only syntax highlight mode; needs some tweaking to ignore "'" characters where they are allowed, i.e. usually descriptions. Perl mode has syntax highlight and indentation support. May need some tweaking for some files where it may parse back too much lines before assuming the indentation is correct. commit a17bf690a8f80f252c3a831c79d6e8d11ce8d66c Author: Paulo Cesar Pereira de Andrade Date: Tue Mar 11 21:51:57 2008 -0300 Add support for scrolling textwindow with mouse wheel. commit b1dd01f67a48785678209b90c1b0e4f44621c146 Author: Paulo Cesar Pereira de Andrade Date: Wed Mar 12 21:53:48 2008 -0300 Add a tags interface to xedit. To use the tags, first create a tags file with a command like "ctags -R". The interface can be disabled with resources, see the updated man page. Tag files are searched descending to the root directory. Multiple tags files are properly handled, and multiple symbol definitions can be searched. commit 3468f9f2cb65294771e1095a14b7263ae0a6a043 Author: Paulo Cesar Pereira de Andrade Date: Tue Mar 11 21:50:13 2008 -0300 Update syntax highlight table and some minor tweaks including: o Don't cause an warning due to an unused variable after macro expansion in some indentation tables. o Properly handle c++ style comments in preprocessor lines. Also highlight strings and character constants. o Change color of "quote" property in lisp mode. This is mainly due to an undesirable side effect of using the same XrmQuark in different syntax highlight definitions, causing the first one to be used, and later defined ones to be ignored. commit 371c42ab955357d586cf4501762f6e9cf1be53b8 Author: Paulo Cesar Pereira de Andrade Date: Tue Mar 11 21:49:14 2008 -0300 Add support to enter line number in command line. This works the same way as for vi, i.e. "xedit file +num" will load file and move cursor to line "num". commit cb30367f10f2e38065d336d331afdc50900de76d Author: Paulo Cesar Pereira de Andrade Date: Tue Mar 11 21:48:58 2008 -0300 Generic lisp interface bug fixes including: o Allow calling disassemble in all function types o Don't limit amount of bytes to generate a hash table o Allow "unreadable" symbol names to be keywords commit 953664369cc66ba17c7b9c1939fd9d7f6c6137ad Author: Paulo Cesar Pereira de Andrade Date: Tue Mar 11 21:48:39 2008 -0300 Fix several problems in the line edit mode. Also allow replacing control characters in the replace pattern as well as nul characters. commit a2c47d3487aaf4667926195ba3f5b05b94626daf Author: Paulo Cesar Pereira de Andrade Date: Tue Mar 11 21:46:58 2008 -0300 Fix several generic bugs including: o Several memory read/write errors. o Implement smarter XeditPrintf that will show how many times a text has been printed. o Check all arguments to XeditPrintf to ensure the '%' character cannot be sent to it. o Some minor reindentation to code that still had the original 2 spaces indentation. commit a1949714b99a502a57b3dd7a99e619c10211d9fc Author: Paulo Cesar Pereira de Andrade Date: Tue Mar 11 21:46:38 2008 -0300 Make ispell interface work correctly again. This new interface should work properly with asciiSrc and multiSrc widgets, i.e. single byte and multibyte. Also added an empty dictionary entry that is understood by aspell as the "default" dictionary. Code is also more robust to detect aspell exiting too early. commit f1d58be104f4020ef718a542d7f5ca72cd1f531b Author: Paulo Cesar Pereira de Andrade Date: Tue Mar 11 21:44:25 2008 -0300 Readd support for *international resource and default to false. This allows several features, like syntax highlight and indentation, turned off to be enabled again. commit 7d5dbf4a19ec6bbd36784f5d7307629b69dda873 Author: Paulo Cesar Pereira de Andrade Date: Wed Mar 12 21:52:30 2008 -0300 Add a generic hash table interface to replace the other implementations. commit 2f7992eaefb19f23c127e15624ba38208c03439b Author: Paulo Cesar Pereira de Andrade Date: Tue Mar 11 21:43:04 2008 -0300 Update build for sane defaults. Check for existing system functions. Don't add test program sources with main functions to libraries. Build test programs. commit 19e3f51f9758e2708fb4abfa364b346591089bcd Author: Paulo Cesar Pereira de Andrade Date: Tue Mar 11 21:41:45 2008 -0300 Add updated/meaningful README, COPYING and AUTHORS files. commit 618a07e8131f49bbda77d2cfe5832218a561a5c8 Author: Paulo Cesar Pereira de Andrade Date: Tue Jul 1 18:17:44 2008 -0300 Fix a bug in the regex library The bug causes the regex parser to enter an infinite loop with certain special patterns with alternatives. Test cases also added to ensure the bug will be triggered by the tests if it is somehow reinstantiated. Also testing commit to xedit git repository. commit 946b5b745d9d326799a23f7210b799e1b690643d Author: James Cloos Date: Thu Dec 6 16:37:12 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit dd27b05c49b6e747203c83a96ca812993b2a2def Author: James Cloos Date: Mon Sep 3 05:51:19 2007 -0400 Add *~ to .gitignore to skip patch/emacs droppings commit e582ba82e04632157c8a7ead56b62da7ba0eddfe Author: James Cloos Date: Thu Aug 23 19:24:44 2007 -0400 Rename .cvsignore to .gitignore commit baafaa1dee42640d15f4e74ff43b0ee3343de940 Author: Adam Jackson Date: Wed Apr 26 23:39:19 2006 +0000 Bump to 1.0.2 commit 86e42e7030394b58d9b16eddd9ccc90efa3a11b2 Author: Adam Jackson Date: Mon Apr 3 19:42:16 2006 +0000 Bug #6480: Cygwin build fix. (Yaakov Selkowitz) commit beae4e7a8875dfe3bdae54bd3f48b922a8f8a3c1 Author: Kevin E Martin Date: Wed Dec 21 02:29:49 2005 +0000 Update package version for X11R7 release. commit ac432c05b782f4d97943de23b97d4b3878e8fe02 Author: Adam Jackson Date: Mon Dec 19 16:22:43 2005 +0000 Stub COPYING files commit 814ad517c4de7dfecbc51636e00a62289af45a8f Author: Kevin E Martin Date: Thu Dec 15 00:24:06 2005 +0000 Update package version number for final X11R7 release candidate. commit e70ce0696695b7e6d627d046c19c3b6c9a8ce3da Author: Kevin E Martin Date: Wed Dec 7 16:17:59 2005 +0000 Change to use the app-defaults default dir configured in libXt. commit 6090b669a399c4663517b845d76945c6c2f97ef9 Author: Kevin E Martin Date: Tue Dec 6 22:48:21 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit 2abc4c46f8d89aa95262db207f7796ee4ee2e2ea Author: Kevin E Martin Date: Sat Dec 3 05:49:19 2005 +0000 Update package version number for X11R7 RC3 release. commit 83a772ee412acc4cea221e1eb416dfb641f074ed Author: Alan Coopersmith Date: Mon Nov 28 22:01:41 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit 08e9327b251c7bebf85befe0c927ed82183ac874 Author: Eric Anholt Date: Mon Nov 21 10:35:00 2005 +0000 Another pass at .cvsignores for apps. commit e63cf486fac692f01a5717da970eaee2b711acec Author: Eric Anholt Date: Sun Nov 20 22:08:52 2005 +0000 Add/improve .cvsignore files for apps. commit 312e176e35cb16b7ea2ab4ea706132786a4aa511 Author: Alan Coopersmith Date: Sun Nov 20 04:13:45 2005 +0000 Add dependency on xp module when building with Xprint support. commit cd2d0c1372d85eba2c097c652004f97eb0821cd1 Author: Kevin E Martin Date: Wed Nov 9 21:09:20 2005 +0000 Update package version number for X11R7 RC2 release. commit 0d4e6039465c3ecadaf76c0558ecc77931c0aa54 Author: Alan Hourihane Date: Fri Oct 28 15:45:02 2005 +0000 build fix commit 4f20443995b7e8b90058be829bbbbad8f5f8c935 Author: Adam Jackson Date: Sun Oct 23 20:03:47 2005 +0000 Bug #1860: Prevent walking off the end of the scan_types array. commit 83ba7062d74bb228ba9daddd1f4524dee905d4f2 Author: Alan Hourihane Date: Fri Oct 21 08:18:25 2005 +0000 remove redundant include commit d9db7305c78e1b93c9b15f73356b8afd5cb26709 Author: Alan Hourihane Date: Thu Oct 20 18:24:27 2005 +0000 programs/xedit/xedit.h //bugs.freedesktop.org/show_bug.cgi?id=790) commit 54c3139890ae810b4c18eed15c82303917bcb2b9 Author: Kevin E Martin Date: Wed Oct 19 02:47:53 2005 +0000 Update package version number for RC1 release. commit 3dbe6f823ce929fee91555933312c2ad81c6f371 Author: Alan Coopersmith Date: Tue Oct 18 00:32:55 2005 +0000 Change default install dir for app-default files from $(sysconfdir)/X11/app-defaults to $(libdir)/X11/app-defaults to match the monolith & allow localization commit cd4bfca48225f3eb78095f4437be8667c9dde5a6 Author: Alan Coopersmith Date: Mon Oct 17 23:56:22 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 636d350681f43816c658e09704242e0cad31de56 Author: Kevin E Martin Date: Sun Oct 16 06:06:57 2005 +0000 Change man sources from xedit.1 to xedit.man to allow the man page to be processed. Move man page to top level dir to pass check-tarball test. commit 47709c7118e6280221931189019a3fab1bfdc691 Author: Alan Coopersmith Date: Fri Oct 14 00:25:44 2005 +0000 Use sed to fill in variables in man page commit 1c94f8dbcfcf16a01e792942632d0a89df6d0768 Author: Kevin E Martin Date: Wed Oct 5 03:27:56 2005 +0000 Add missing files to EXTRA_DIST commit ebd7eea10cf5add145b0428e953fce3691b8423a Author: Adam Jackson Date: Wed Sep 28 03:04:23 2005 +0000 Don't override , automake predefines it. commit dad8235ff737556e2eaa645a5d7b48641eba270a Author: Kristian Høgsberg Date: Tue Sep 27 20:20:36 2005 +0000 Only add -DINCLUDE_XPRINT_SUPPORT if the Xaw version supports it. commit bc2182af2f8d9455f9caeb686b71cae4ff1bc0bc Author: Matthieu Herrb Date: Sun Aug 28 17:58:39 2005 +0000 Install the lisp files. commit d0691d15ae7cf68c8a617322a2a4a77d36c704d1 Author: Kevin E Martin Date: Fri Jul 29 21:22:32 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit aebfa8db8c0069d4474841414012b7f19ec14d53 Author: Matthieu Herrb Date: Sat Jul 23 16:12:58 2005 +0000 Fix DEP_* reference commit d9d6a51c74d055e93b2fb8450ef9de162e35945f Author: Matthieu Herrb Date: Sat Jul 23 16:12:33 2005 +0000 - fix DEP_* references - fix GNU-make only rule for app-defaults commit 0842c698bd90b2f47d808d47b37912a7a0e3ba78 Author: Adam Jackson Date: Wed Jul 20 19:31:52 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit c46761f286f8c9a41ee0e510211b5ed667a78479 Author: Søren Sandmann Pedersen Date: Tue Jul 12 18:45:46 2005 +0000 - lib/lbxutil/lbxutil.pc.in: link to lbxutil, not Xfixes - symlink.sh: add xedit.h, add xedit/lis/mp directory, add xfs - xc/programs/xedit: include "lisp/../xedit.h" instead of xedit/xedit.h - Change include of "foo.h" to in various places in xc/programs/lbxproxy and xc/programs/xfs - add build system for xfs - add forgotten lbxproxytrans.c file commit fc1f512d7cd7876f79190511315fe219667b2e81 Author: Søren Sandmann Pedersen Date: Tue Jul 12 17:41:52 2005 +0000 Build system for xprint commit 6bc36c6c67fed984af4f60224a7ea693d1b7d217 Author: Alexander Gottwald Date: Wed Apr 20 16:18:03 2005 +0000 Move variable declaration to top. Makes gcc2 happy. commit 33c2d047571cd4ebce2eb630515fc33aa3f05b98 Author: Roland Mainz Date: Mon Apr 11 01:06:15 2005 +0000 xc/programs/Xserver/Xprint/attributes.c xc/programs/glxgears/glxgears.c xc/programs/xdbedizzy/xdbedizzy.c xc/programs/xedit/Imakefile xc/programs/xedit/Xedit-xprint.ad xc/programs/xedit/util.c xc/programs/xedit/xedit.h xc/programs/xlogo/print.c xc/programs/xlogo/xlogo.c xc/programs/xlogo/xlogo.h xc/programs/xman/Imakefile xc/programs/xman/print.h xc/programs/xmore/Imakefile xc/programs/xmore/print.c xc/programs/xmore/print.h xc/programs/xmore/printdialog.c xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c xc/programs/xphelloworld/xphelloworld/xphelloworld.c xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c //bugs.freedesktop.org/show_bug.cgi?id=790) attachment #2379 (https://bugs.freedesktop.org/attachment.cgi?id=2379) Implement support client+Xserver support for passing output (stdout+stderr) of the spooler command started by the Xprint server back to the application using the "xp-spooler-command-results" XPJobAttr attribute (applications can fetch the attribute value after the XPEndJobNotify event was received; more details can be found in http://xprint.mozdev.org/docs/dtprint_fspec.ps). commit bd31ddba0725738848be8298a7b1dd691c103fa3 Author: Egbert Eich Date: Mon Apr 4 10:17:07 2005 +0000 Fixed sentinels in Xt, editres and xedit to reduce number of warnings with gcc4 (Andreas Schwab). commit dfb0b2dac20f575a7be260895f2847daeeacb819 Author: Roland Mainz Date: Mon Jan 3 01:06:36 2005 +0000 xc/lib/XprintAppUtil/xpapputil.c xc/lib/XprintAppUtil/xpapputil.h xc/lib/XprintUtil/xprintutil.c xc/lib/XprintUtil/xprintutil.h xc/programs/glxgears/glxgears.c xc/programs/xdbedizzy/xdbedizzy.c xc/programs/xedit/Xedit-xprint.ad xc/programs/xedit/commands.c xc/programs/xlogo/print.c xc/programs/xlsfonts/xlsfonts.c xc/programs/xlsfonts/xlsfonts.man xc/programs/xlsfonts/xlsfonts.sgml xc/programs/xman/Xman-xprint.ad xc/programs/xman/handler.c xc/programs/xman/print.c xc/programs/xman/print.h xc/programs/xmore/XMore.ad xc/programs/xmore/print.c xc/programs/xmore/print.h xc/programs/xmore/printdialog.c xc/programs/xmore/printdialog.h xc/programs/xmore/printdialogprivates.h xc/programs/xmore/xmore.c xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c xc/programs/xphelloworld/xphelloworld/xphelloworld.c xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c xc/programs/xphelloworld/xpxthelloworld/xpxthelloworld.c xc/programs/xplsprinters/xplsprinters.c //bugs.freedesktop.org/show_bug.cgi?id=1706) attachment #1615 (https://bugs.freedesktop.org/attachment.cgi?id=1615): XprintUtils 2004/Q3 update. This adds various new features to the XprintUtils library including support for page resolutions where X_resolution!=Y_resolution, listfonts-mode control and initial framework for the COLORSPACE extension. Patch by Roland Mainz and Julien Lafon . commit 5581ed55c6918f69786d63e9a401f9d8b33a66d2 Author: Markus Kuhn Date: Sat Dec 4 00:43:16 2004 +0000 Encoding of numerous files changed to UTF-8 commit 4d6b4556b8517ac36d6f87837dfb936872581b12 Author: Roland Mainz Date: Tue Oct 12 22:46:40 2004 +0000 Fix for https://freedesktop.org/bugzilla/show_bug.cgi?id=1601 - Fix problems with wrong page counts in xedit&co. when a global "*geometry" resource was overriding the internal geometry management used by XawPrintShell(=usually adjust to current page size, the resource was turning this into a static value). (Original patch by Felix Schulte ) commit 98e553431586c07fe0534c01c0a6e1b15ddc8958 Author: Egbert Eich Date: Tue Sep 21 17:57:40 2004 +0000 Merged over libXpm security fix provided by Chris Evans, Matthieu Herrb and Alan Coopersmith from release 6.8.1. Fail during initialization with error if font/fontset is not set for widget. This prevents a sig11 later when the non-existent font/fontset structs are referenced. Check if xf86Info.kbdProc pointer is really set before calling it on abort as this pointer won't be set if the new modular keyboard driver is used (Matthias Hopf). Added new libs to the bindist control files. Removed inclusion of unnecessary kernel header on Linux. This may fail in an -ansi environment. commit 3981cffbb6f4f4fe4227481c51083063a9ea995e Author: Kevin E Martin Date: Thu Sep 2 08:40:32 2004 +0000 Restore xman and xedit changes that were previously reverted, and make Xprint support optional (Bug #1273, Roland Mainz). commit 6b12ddbb33c8722e50e7f69f456ba0ba72b76ddd Author: Kristian Høgsberg Date: Mon Aug 16 16:36:16 2004 +0000 As discussed and agreed on on the release-wranglers meeting of August 16, I'm committing the patch from bug #1060 to back out unconditional Xprint functionality. Back out Xprint changes. Revert xman to CVS of June 5, revert xlogo to CVS of May 8, revert xedit to CVS of April 25, to back out unconditional Xprint support. Fix up Xprint config logic to be like the rest of the extensions: BuildXprint is a one-stop option for disabling everything Xprint related. XprtServer controls building Xprt, BuildXprintLib controls building Xprint libs and BuildXprintClients controls building clients related to Xprint. BuiltXprint defaults to YES and the other options respects relevant settings, i.e. BuildServer and BuildServersOnly. Build Xaw regardless of BuildXprintLib setting. Only build xphelloworld, xplsprinters and xprehashprinterlist when BuildXprintClients it YES. Disable building xmore, it has always supported XawPrintShell. Make Xprint support depend on BuildXprintLib. commit d980ac394b3f828ce3c03d5894218d712d7b2846 Author: Roland Mainz Date: Thu Jul 29 00:40:35 2004 +0000 Fix for https://freedesktop.org/bugzilla/show_bug.cgi?id=938 - Update XawPrintShell per feedback and review comments. commit d88d25361d5c03e126f040d08c4e005494ca9bfe Author: Roland Mainz Date: Tue Jun 8 02:44:35 2004 +0000 Fix for http://freedesktop.org/bugzilla/show_bug.cgi?id=668 - Add print support to xman commit cf44083fa20c4f39a89a63ced16974c832039325 Author: Roland Mainz Date: Sun May 30 22:44:01 2004 +0000 Fix for http://freedesktop.org/bugzilla/show_bug.cgi?id=695 - Add print support to Xedit commit 3b70888a54396c1b5ab67be863b189c7b8775695 Author: Roland Mainz Date: Sun May 30 00:52:30 2004 +0000 Fix for http://freedesktop.org/bugzilla/show_bug.cgi?id=693 - XMore and XawPrintDialog work-in-progress, fixing various problems and adding framework for i18n. commit aa3ab858ee6f5e51e0816dac708142bbcc38da5b Author: Roland Mainz Date: Mon May 24 03:17:44 2004 +0000 Fix for http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=611 - Adding simple text viewer (xmore) commit 5d7513ad1d0c061f97373b684d669ebf98d7867e Author: Egbert Eich Date: Thu May 6 17:31:17 2004 +0000 BugZilla #601: Fixing makedepend choking on floating point exception because CHAR_BIT is defined to __CHAR_BIT__ which is a compiler intrinsic define. BugZilla #605: Fixing build on IA64 which is broken due to the inclusion of the kernel header asm/page.h. Kernel headers however don't work with -ansi. The inclusion of asm/page.h can however savely be removed as it there are plenty of other ways to determine the page size. commit 9f5d0de96f079e84c648a0173bffac8ec2c3bef5 Author: Egbert Eich Date: Fri Apr 23 19:54:46 2004 +0000 Merging XORG-CURRENT into trunk commit 91547cc15f41faa1a55f2d764f67abd24777e9be Author: Egbert Eich Date: Sun Mar 14 08:35:19 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit 8293776acb1b916f1f7199e975bae4d370668243 Author: Egbert Eich Date: Wed Mar 3 12:13:05 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit b7c2da33938e1091850181d827a9ef6f51575883 Author: Egbert Eich Date: Thu Feb 26 13:36:24 2004 +0000 readding XFree86's cvs IDs commit e502fd1629139ee9e5df1f0bdeb454710ab6adfa Author: Egbert Eich Date: Thu Feb 26 09:24:06 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit dc1aded02ad02936526d5528b6504121cf86e1b1 Author: Kaleb Keithley Date: Mon Feb 23 20:35:39 2004 +0000 Import most of XFree86 4.4RC3. This import excludes files which have the new license. If we want to, later we can import 4.4RC3 again and pick up the files that have the new license, but for now the vendor branch is "pure." commit 71331fcaaca36aadf8f4857526a4ca2162b71df4 Author: Egbert Eich Date: Thu Jan 29 08:09:08 2004 +0000 Importing vendor version xf86-012804-2330 on Thu Jan 29 00:06:33 PST 2004 commit 39a948f028c2e3cb3083d7d2f847acbd27facc23 Author: Kaleb Keithley Date: Fri Dec 19 20:55:55 2003 +0000 XFree86 4.3.99.902 (RC 2) commit 54593d8ebb341f7c2a0321fbf4207d7848b44a7f Author: Kaleb Keithley Date: Fri Dec 19 20:55:55 2003 +0000 Initial revision commit 0912e16e368c939d60f7b1400a247c6e5f080ff6 Author: Kaleb Keithley Date: Thu Dec 4 22:03:48 2003 +0000 XFree86 4.3.99.901 (RC 1) commit 10dc4a2c37597e02c12a9df3e9dba02a73bfc11b Author: Kaleb Keithley Date: Tue Nov 25 19:29:12 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit 8ae60bfe8a4b233100f5128859c76239e5789f70 Author: Kaleb Keithley Date: Fri Nov 14 16:49:22 2003 +0000 XFree86 4.3.0.1 commit 0a193e032ba1ecf3f003e027e833dc9d274cb740 Author: Kaleb Keithley Date: Fri Nov 14 16:49:22 2003 +0000 Initial revision x11-apps-7.7+5+nmu1ubuntu1/xedit/commands.c0000664000000000000000000006513512472175711015274 0ustar /* $XConsortium: commands.c,v 1.33 91/10/21 14:32:18 eswu Exp $ */ /* * COPYRIGHT 1987 * DIGITAL EQUIPMENT CORPORATION * MAYNARD, MASSACHUSETTS * ALL RIGHTS RESERVED. * * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR * ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. * * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT RIGHTS, * APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN ADDITION TO THAT * SET FORTH ABOVE. * * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Digital Equipment Corporation not be * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ /* $XFree86: xc/programs/xedit/commands.c,v 1.29tsi Exp $ */ #include #include #include "xedit.h" #include #include #include #include #include #include #include #include #include #include /* Turn a NULL pointer string into an empty string */ #define NULLSTR(x) (((x)!=NULL)?(x):("")) #define Error(x) { printf x ; exit(EXIT_FAILURE); } #define Assertion(expr, msg) { if (!(expr)) { Error msg } } #define Log(x) { if (True) printf x; } void ResetSourceChanged(xedit_flist_item*); static void ResetDC(Widget, XtPointer, XtPointer); static void AddDoubleClickCallback(Widget, Bool); static Bool ReallyDoLoad(char*, char*); static char *makeBackupName(String, String, unsigned); /* * External */ extern void _XawTextShowPosition(TextWidget); extern Widget scratch, texts[3], labels[3]; #define DC_UNSAVED (1 << 0) #define DC_LOADED (1 << 1) #define DC_CLOBBER (1 << 2) #define DC_KILL (1 << 3) #define DC_SAVE (1 << 4) #define DC_NEWER (1 << 5) static int dc_state; static void AddDoubleClickCallback(Widget w, Bool state) { if (state) XtAddCallback(w, XtNcallback, ResetDC, NULL); else XtRemoveCallback(w, XtNcallback, ResetDC, NULL); } /* Function Name: ResetDC * Description: Resets the double click flag. * Arguments: w - the text widget. * junk, garbage - *** NOT USED *** * Returns: none. */ /* ARGSUSED */ static void ResetDC(Widget w, XtPointer junk, XtPointer garbage) { AddDoubleClickCallback(w, FALSE); } /*ARGSUSED*/ void QuitAction(Widget w, XEvent *event, String *params, Cardinal *num_params) { DoQuit(w, NULL, NULL); } /*ARGSUSED*/ void DoQuit(Widget w, XtPointer client_data, XtPointer call_data) { unsigned i; Bool source_changed = False; if (!(dc_state & DC_UNSAVED)) { for (i = 0; i < flist.num_itens; i++) if (flist.itens[i]->flags & CHANGED_BIT) { source_changed = True; break; } } if (!source_changed) { #ifndef __UNIXOS2__ XeditLispCleanUp(); #endif exit(0); } XeditPrintf("Unsaved changes. Save them, or Quit again.\n"); Feep(); dc_state |= DC_UNSAVED; AddDoubleClickCallback(XawTextGetSource(textwindow), True); } static char * makeBackupName(String buf, String filename, unsigned len) { if (app_resources.backupNamePrefix && strlen(app_resources.backupNamePrefix)) { if (strchr(app_resources.backupNamePrefix, '/')) XmuSnprintf(buf, len, "%s%s%s", app_resources.backupNamePrefix, filename, app_resources.backupNameSuffix); else { char fname[BUFSIZ]; char *name, ch; strncpy(fname, filename, sizeof(fname) - 1); fname[sizeof(fname) - 1] = '\0'; if ((name = strrchr(fname, '/')) != NULL) ++name; else name = filename; ch = *name; *name = '\0'; ++name; XmuSnprintf(buf, len, "%s%s%c%s%s", fname, app_resources.backupNamePrefix, ch, name, app_resources.backupNameSuffix); } } else XmuSnprintf(buf, len, "%s%s", filename, app_resources.backupNameSuffix); return (strcmp(filename, buf) ? buf : NULL); } /*ARGSUSED*/ void SaveFile(Widget w, XEvent *event, String *params, Cardinal *num_params) { if (line_edit) { /* Don't try to save buffer with regex string. * Call CancelFindFile() to leave line_edit mode. */ XeditPrintf("Save: Leaving line edit mode -- nothing saved.\n"); CancelFindFile(w, event, params, num_params); Feep(); } else DoSave(w, NULL, NULL); } /*ARGSUSED*/ void DoSave(Widget w, XtPointer client_data, XtPointer call_data) { String name = GetString(filenamewindow); String filename = ResolveName(name); FileAccess file_access; xedit_flist_item *item; Boolean exists; Widget source = XawTextGetSource(textwindow); char buffer[BUFSIZ]; struct stat st; static const char *nothing_saved = " -- nothing saved.\n"; if (!filename) { XmuSnprintf(buffer, sizeof(buffer), "%s%s", "Save: Can't resolve pathname", nothing_saved); goto error; } else if (*name == '\0') { XmuSnprintf(buffer, sizeof(buffer), "%s%s", "Save: No filename specified", nothing_saved); goto error; } item = FindTextSource(NULL, filename); if (item != NULL && item->source != source) { if (!(dc_state & DC_LOADED)) { XmuSnprintf(buffer, sizeof(buffer), "%s%s%s%s", "Save: file ", name, " is already loaded, " "Save again to unload it", nothing_saved); Feep(); dc_state |= DC_LOADED; AddDoubleClickCallback(XawTextGetSource(textwindow), True); goto error; } else { KillTextSource(item); item = FindTextSource(source = XawTextGetSource(textwindow), NULL); dc_state &= ~DC_LOADED; } } else if (item && !(item->flags & CHANGED_BIT)) { if (!(dc_state & DC_SAVE)) { XmuSnprintf(buffer, sizeof(buffer), "%s%s", "Save: No changes need to be saved, " "save again to override", nothing_saved); Feep(); dc_state |= DC_SAVE; AddDoubleClickCallback(XawTextGetSource(textwindow), True); goto error; } else dc_state &= ~DC_SAVE; } file_access = CheckFilePermissions(filename, &exists); if (exists) { if (stat(filename, &st) != 0) { XmuSnprintf(buffer, sizeof(buffer), "%s%s%s", "Save: cannot stat ", name, nothing_saved); goto error; } else if (!S_ISREG(st.st_mode)) { XmuSnprintf(buffer, sizeof(buffer), "%s%s%s%s", "Save: file ", name, "is not a regular file", nothing_saved); goto error; } } if (!item || strcmp(item->filename, filename)) { if (file_access == WRITE_OK && exists) { if (!(dc_state & DC_CLOBBER)) { XmuSnprintf(buffer, sizeof(buffer), "%s%s%s%s", "Save: file ", name, " already exists, " "save again to override", nothing_saved); Feep(); dc_state |= DC_CLOBBER; AddDoubleClickCallback(XawTextGetSource(textwindow), True); goto error; } else dc_state &= ~DC_CLOBBER; } if (!item) item = FindTextSource(source, NULL); } if (item && item->mtime && exists && item->mtime < st.st_mtime) { if (!(dc_state & DC_NEWER)) { XmuSnprintf(buffer, sizeof(buffer), "%s%s", "Save: Newer file exists, " "save again to override", nothing_saved); Feep(); dc_state |= DC_NEWER; AddDoubleClickCallback(XawTextGetSource(textwindow), True); goto error; } else dc_state &= DC_NEWER; } if (app_resources.enableBackups && exists) { char backup_file[BUFSIZ]; if (makeBackupName(backup_file, filename, sizeof(backup_file)) == NULL || rename(filename, backup_file) != 0) { XeditPrintf("Error backing up file: %s\n", filename); } } switch (file_access = MaybeCreateFile(filename)) { case NO_READ: case READ_OK: XeditPrintf("File %s could not be opened for writing.\n", name); Feep(); break; case WRITE_OK: if (XawAsciiSaveAsFile(source, filename)) { int i; Arg args[1]; XmuSnprintf(buffer, sizeof(buffer), "%s Read - Write", name); XtSetArg(args[0], XtNlabel, buffer); for (i = 0; i < 3; i++) if (XawTextGetSource(texts[i]) == source) XtSetValues(labels[i], args, 1); XeditPrintf("Saved file: %s\n", name); if (item && item->source != scratch) { XtSetArg(args[0], XtNlabel, filename); XtSetValues(item->sme, args, 1); XtSetArg(args[0], XtNeditType, XawtextEdit); XtSetValues(item->source, args, 1); XtFree(item->name); XtFree(item->filename); item->name = XtNewString(name); item->filename = XtNewString(filename); item->flags = EXISTS_BIT; } else { item = flist.itens[0]; XtRemoveCallback(scratch, XtNcallback, SourceChanged, (XtPointer)item); item->source = scratch = XtVaCreateWidget("textSource", international ? multiSrcObjectClass : asciiSrcObjectClass, topwindow, XtNtype, XawAsciiFile, XtNeditType, XawtextEdit, NULL, NULL); ResetSourceChanged(item); XtAddCallback(scratch, XtNcallback, SourceChanged, (XtPointer)item); item = AddTextSource(source, name, filename, EXISTS_BIT, file_access); XtAddCallback(item->source, XtNcallback, SourceChanged, (XtPointer)item); } /* Keep file protection mode */ if (item->mode) chmod(filename, item->mode); /* Remember time of last modification */ if (stat(filename, &st) == 0) item->mtime = st.st_mtime; item->flags |= EXISTS_BIT; ResetSourceChanged(item); } else { XeditPrintf("Error saving file: %s\n", name); Feep(); } break; default: Feep(); break; } return; error: XeditPrintf("%s", buffer); Feep(); } /*ARGSUSED*/ void DoLoad(Widget w, XtPointer client_data, XtPointer call_data) { if (ReallyDoLoad(GetString(filenamewindow), ResolveName(NULL))) { SwitchDirWindow(False); XtSetKeyboardFocus(topwindow, textwindow); } } Bool LoadFileInTextwindow(char *name, char *resolved_name) { return (ReallyDoLoad(name, resolved_name)); } static Bool ReallyDoLoad(char *name, char *filename) { Arg args[5]; Cardinal num_args = 0; xedit_flist_item *item; Widget source = XawTextGetSource(textwindow); if (!filename) { XeditPrintf("Load: Can't resolve pathname.\n"); Feep(); return (False); } else if (*name == '\0') { XeditPrintf("Load: No file specified.\n"); Feep(); } if ((item = FindTextSource(NULL, filename)) != NULL) { SwitchTextSource(item); return (True); } else { struct stat st; if (stat(filename, &st) == 0 && !S_ISREG(st.st_mode)) { if (S_ISDIR(st.st_mode)) { char path[BUFSIZ + 1]; strncpy(path, filename, sizeof(path) - 2); path[sizeof(path) - 2] = '\0'; if (*path) { if (path[strlen(path) - 1] != '/') strcat(path, "/"); } else strcpy(path, "./"); XtSetArg(args[0], XtNlabel, ""); XtSetValues(dirlabel, args, 1); SwitchDirWindow(True); DirWindowCB(dirwindow, path, NULL); return (False); } } } { Boolean exists; int flags; FileAccess file_access; switch( file_access = CheckFilePermissions(filename, &exists) ) { case NO_READ: if (exists) XeditPrintf("File %s, %s", name, "exists, and could not be opened for reading.\n"); else XeditPrintf("File %s %s %s", name, "does not exist, and", "the directory could not be opened for writing.\n"); Feep(); return (False); case READ_OK: XtSetArg(args[num_args], XtNeditType, XawtextRead); num_args++; XeditPrintf("File %s opened READ ONLY.\n", name); break; case WRITE_OK: XtSetArg(args[num_args], XtNeditType, XawtextEdit); num_args++; XeditPrintf("File %s opened read - write.\n", name); break; default: Feep(); return (False); } if (exists) { flags = EXISTS_BIT; XtSetArg(args[num_args], XtNstring, filename); num_args++; } else { flags = 0; XtSetArg(args[num_args], XtNstring, NULL); num_args++; } source = XtVaCreateWidget("textSource", international ? multiSrcObjectClass : asciiSrcObjectClass, topwindow, XtNtype, XawAsciiFile, XtNeditType, XawtextEdit, NULL, NULL); XtSetValues(source, args, num_args); item = AddTextSource(source, name, filename, flags, file_access); XtAddCallback(item->source, XtNcallback, SourceChanged, (XtPointer)item); if (exists && file_access == WRITE_OK) { struct stat st; if (stat(item->filename, &st) == 0) { item->mode = st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); item->mtime = st.st_mtime; } } SwitchTextSource(item); ResetSourceChanged(item); } return (True); } /* Function Name: SourceChanged * Description: A callback routine called when the source has changed. * Arguments: w - the text source that has changed. * client_data - xedit_flist_item associated with text buffer. * call_data - NULL is unchanged * Returns: none. */ /*ARGSUSED*/ void SourceChanged(Widget w, XtPointer client_data, XtPointer call_data) { xedit_flist_item *item = (xedit_flist_item*)client_data; Bool changed = (Bool)(long)call_data; if (changed) { if (item->flags & CHANGED_BIT) return; item->flags |= CHANGED_BIT; } else { if (item->flags & CHANGED_BIT) ResetSourceChanged(item); return; } if (flist.pixmap) { Arg args[1]; Cardinal num_args; int i; num_args = 0; XtSetArg(args[num_args], XtNleftBitmap, flist.pixmap); ++num_args; XtSetValues(item->sme, args, num_args); for (i = 0; i < 3; i++) if (XawTextGetSource(texts[i]) == item->source) XtSetValues(labels[i], args, num_args); } } /* Function Name: ResetSourceChanged. * Description: Sets the source changed to FALSE, and * registers a callback to set it to TRUE when * the source has changed. * Arguments: item - item with widget to register the callback on. * Returns: none. */ void ResetSourceChanged(xedit_flist_item *item) { Arg args[1]; Cardinal num_args; int i; num_args = 0; XtSetArg(args[num_args], XtNleftBitmap, None); ++num_args; XtSetValues(item->sme, args, num_args); dc_state = 0; for (i = 0; i < 3; i++) { if (XawTextGetSource(texts[i]) == item->source) XtSetValues(labels[i], args, num_args); AddDoubleClickCallback(XawTextGetSource(texts[i]), False); } num_args = 0; XtSetArg(args[num_args], XtNsourceChanged, False); ++num_args; XtSetValues(item->source, args, num_args); item->flags &= ~CHANGED_BIT; } /*ARGSUSED*/ void KillFile(Widget w, XEvent *event, String *params, Cardinal *num_params) { xedit_flist_item *item = FindTextSource(XawTextGetSource(textwindow), NULL); if (item->source == scratch) { Feep(); return; } if (item->flags & CHANGED_BIT) { if (!(dc_state & DC_KILL)) { XeditPrintf("Kill: Unsaved changes. Kill again to override.\n"); Feep(); dc_state |= DC_KILL; AddDoubleClickCallback(XawTextGetSource(textwindow), True); return; } dc_state &= ~DC_KILL; } KillTextSource(item); } /*ARGSUSED*/ void FindFile(Widget w, XEvent *event, String *params, Cardinal *num_params) { char *string; char *slash; XawTextBlock block; XawTextPosition end = XawTextSourceScan(XawTextGetSource(filenamewindow), 0, XawstAll, XawsdRight, 1, True); slash = NULL; if (!line_edit) { string = GetString(filenamewindow); if (string) slash = strrchr(string, '/'); } else { string = ""; line_edit = False; } block.firstPos = 0; block.format = FMT8BIT; block.ptr = string; block.length = slash ? slash - string + 1 : 0; if (block.length != end) XawTextReplace(filenamewindow, 0, end, &block); XawTextSetInsertionPoint(filenamewindow, end); XtSetKeyboardFocus(topwindow, filenamewindow); } /*ARGSUSED*/ void LoadFile(Widget w, XEvent *event, String *params, Cardinal *num_params) { if (line_edit) LineEdit(textwindow); else if (ReallyDoLoad(GetString(filenamewindow), ResolveName(NULL))) { SwitchDirWindow(False); XtSetKeyboardFocus(topwindow, textwindow); } } /*ARGSUSED*/ void CancelFindFile(Widget w, XEvent *event, String *params, Cardinal *num_params) { Arg args[1]; xedit_flist_item *item; XtSetKeyboardFocus(topwindow, textwindow); item = FindTextSource(XawTextGetSource(textwindow), NULL); if (item->source != scratch) XtSetArg(args[0], XtNstring, item->name); else XtSetArg(args[0], XtNstring, NULL); XtSetValues(filenamewindow, args, 1); /* XXX This probably should be done by the TextWidget, i.e. notice * if the cursor became inivisible due to an horizontal scroll */ _XawTextShowPosition((TextWidget)filenamewindow); if (XtIsManaged(XtParent(dirwindow))) SwitchDirWindow(False); line_edit = False; } static int compar(_Xconst void *a, _Xconst void *b) { return (strcmp(*(char **)a, *(char **)b)); } /*ARGSUSED*/ void FileCompletion(Widget w, XEvent *event, String *params, Cardinal *num_params) { XawTextBlock block; String text; int length; char **matches, *save, *dir_name, *file_name, match[257]; unsigned n_matches, len, mlen, buflen; DIR *dir; Bool changed, slash = False, has_dot = False; #define SM_NEVER 0 #define SM_HINT 1 #define SM_ALWAYS 2 int show_matches; text = GetString(filenamewindow); if (!text) { Feep(); return; } else if (line_edit) { Feep(); line_edit = 0; } { XawTextPosition pos = XawTextGetInsertionPoint(w); char *cslash = strchr(&text[pos], '/'), *cdot = strchr(&text[pos], '.'); if (cslash != NULL || cdot != NULL) { if (cslash != NULL && (cdot == NULL || cdot > cslash)) { length = cslash - text; slash = True; } else { length = cdot - text; has_dot = True; } } else length = strlen(text); } if (*num_params == 1 && length == strlen(text)) { switch (params[0][0]) { case 'n': /* Never */ case 'N': show_matches = SM_NEVER; break; case 'h': /* Hint */ case 'H': show_matches = SM_HINT; break; case 'a': /* Always */ case 'A': show_matches = SM_ALWAYS; break; default: show_matches = SM_NEVER; XtAppWarning(XtWidgetToApplicationContext(w), "Bad argument to file-completion, " "must be Never, Hint or Always"); break; } } else show_matches = SM_NEVER; matches = NULL; n_matches = buflen = 0; save = XtMalloc(length + 1); memmove(save, text, length); save[length] = '\0'; if (save[0] == '~' && save[1]) { char *slash2 = strchr(save, '/'); if (slash2) { struct passwd *pw; char home[BUFSIZ]; char *name; int slen = strlen(save), diff = slash2 - save; *slash2 = '\0'; name = save + 1; if (strlen(name) != 0) pw = getpwnam(name); else pw = getpwuid(getuid()); if (pw) { char fname[BUFSIZ]; int hlen; strncpy(home, pw->pw_dir, sizeof(home) - 1); home[sizeof(home) - 1] = '\0'; hlen = strlen(home); strncpy(fname, slash2 + 1, sizeof(fname) - 1); fname[sizeof(fname) - 1] = '\0'; save = XtRealloc(save, slen - diff + hlen + 2); (void)memmove(save, home, hlen); save[hlen] = '/'; strcpy(&save[hlen + 1], fname); /* expand directory */ block.length = strlen(save); block.ptr = save; block.firstPos = 0; block.format = FMT8BIT; XawTextReplace(filenamewindow, 0, length, &block); XawTextSetInsertionPoint(filenamewindow, length = block.length); } else *slash2 = '/'; } } if ((file_name = strrchr(save, '/')) != NULL) { *file_name = '\0'; ++file_name; dir_name = save; if (!file_name[0]) slash = True; if (!dir_name[0]) dir_name = "/"; } else { dir_name = "."; file_name = save; } len = strlen(file_name); if ((dir = opendir(dir_name)) != NULL) { char path[BUFSIZ], *pptr; struct dirent *ent; int isdir = 0, first = 1, bytes; XmuSnprintf(path, sizeof(path), "%s/", dir_name); pptr = path + strlen(path); bytes = sizeof(path) - (pptr - path) - 1; mlen = 0; match[0] = '\0'; while ((ent = readdir(dir)) != NULL) { unsigned d_namlen = strlen(ent->d_name); if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; if (d_namlen >= len && strncmp(ent->d_name, file_name, len) == 0) { char *tmp = &(ent->d_name[len]), *mat = match; struct stat st; Bool is_dir = FALSE; strncpy(pptr, ent->d_name, bytes); pptr[bytes] = '\0'; if (stat(path, &st) != 0) /* Should check errno, may be a broken symbolic link * a directory with r-- permission, etc */ continue; else if (first || show_matches != SM_NEVER) { is_dir = S_ISDIR(st.st_mode); } if (first) { strncpy(match, tmp, sizeof(match) - 1); match[sizeof(match) - 2] = '\0'; mlen = strlen(match); first = 0; isdir = is_dir; } else { while (*tmp && *mat && *tmp++ == *mat) ++mat; if (mlen > mat - match) { mlen = mat - match; match[mlen] = '\0'; } } if (show_matches != SM_NEVER) { matches = (char **)XtRealloc((char*)matches, sizeof(char**) * (n_matches + 1)); buflen += d_namlen + 1; if (is_dir) { matches[n_matches] = XtMalloc(d_namlen + 2); strcpy(matches[n_matches], ent->d_name); strcat(matches[n_matches], "/"); ++buflen; } else matches[n_matches] = XtNewString(ent->d_name); } else if (mlen == 0 && n_matches >= 1) { ++n_matches; break; } ++n_matches; } } closedir(dir); changed = mlen != 0; if (first || n_matches) { Bool free_matches = True, add_slash = n_matches == 1 && isdir && !slash; if (mlen && has_dot && match[mlen - 1] == '.') --mlen; if (mlen || add_slash) { XawTextPosition pos; block.firstPos = 0; block.format = FMT8BIT; if (mlen) { pos = length; block.length = mlen; block.ptr = match; XawTextReplace(filenamewindow, pos, pos, &block); XawTextSetInsertionPoint(filenamewindow, pos + block.length); } if (add_slash) { XawTextPosition actual = XawTextGetInsertionPoint(w); pos = XawTextSourceScan(XawTextGetSource(w), 0, XawstAll, XawsdRight, 1, True); block.length = 1; block.ptr = "/"; XawTextReplace(filenamewindow, pos, pos, &block); if (actual == pos) XawTextSetInsertionPoint(filenamewindow, pos + 1); } } else if (n_matches != 1 || isdir) { if (show_matches == SM_NEVER) Feep(); } if (show_matches != SM_NEVER) { if (show_matches == SM_ALWAYS || (!changed && n_matches != 1)) { char **list = NULL, *label; int n_list; Arg args[2]; XtSetArg(args[0], XtNlist, &list); XtSetArg(args[1], XtNnumberStrings, &n_list); XtGetValues(dirwindow, args, 2); matches = (char **)XtRealloc((char*)matches, sizeof(char**) * (n_matches + 2)); matches[n_matches++] = XtNewString("./"); matches[n_matches++] = XtNewString("../"); qsort(matches, n_matches, sizeof(char*), compar); XtSetArg(args[0], XtNlist, matches); XtSetArg(args[1], XtNnumberStrings, n_matches); XtSetValues(dirwindow, args, 2); if (n_list > 0 && (n_list != 1 || list[0] != XtName(dirwindow))) { while (--n_list > -1) XtFree(list[n_list]); XtFree((char*)list); } label = ResolveName(dir_name); XtSetArg(args[0], XtNlabel, label); XtSetValues(dirlabel, args, 1); SwitchDirWindow(True); free_matches = False; } } if (free_matches && matches) { while (--n_matches > -1) XtFree(matches[n_matches]); XtFree((char*)matches); } } else Feep(); } else Feep(); XtFree(save); } /*ARGSUSED*/ void DirWindowCB(Widget w, XtPointer user_data, XtPointer call_data) { XawListReturnStruct *file_info = (XawListReturnStruct *)call_data; char *dir_name, *string, path[BUFSIZ]; Arg args[2]; if (file_info == NULL) string = (char *)user_data; else string = file_info->string; XtSetArg(args[0], XtNlabel, &dir_name); XtGetValues(dirlabel, args, 1); if (*dir_name == '\0') { strncpy(path, string, sizeof(path) - 1); path[sizeof(path) - 1] = '\0'; } else if (strcmp(dir_name, "/") == 0) XmuSnprintf(path, sizeof(path), "/%s", string); else XmuSnprintf(path, sizeof(path), "%s/%s", dir_name, string); if (*string && string[strlen(string) - 1] == '/') { DIR *dir; if ((dir = opendir(path)) != NULL) { struct dirent *ent; struct stat st; unsigned d_namlen; Bool isdir; char **entries = NULL, **list = NULL; int n_entries = 0, n_list = 0; char *label, *pptr = path + strlen(path); int bytes = sizeof(path) - (pptr - path) - 1; while ((ent = readdir(dir)) != NULL) { d_namlen = strlen(ent->d_name); strncpy(pptr, ent->d_name, bytes); pptr[bytes] = '\0'; if (stat(path, &st) != 0) /* Should check errno, may be a broken symbolic link * a directory with r-- permission, etc */ continue; else isdir = S_ISDIR(st.st_mode); entries = (char **)XtRealloc((char*)entries, sizeof(char*) * (n_entries + 1)); if (isdir) { entries[n_entries] = XtMalloc(d_namlen + 2); strcpy(entries[n_entries], ent->d_name); strcat(entries[n_entries], "/"); } else entries[n_entries] = XtNewString(ent->d_name); ++n_entries; } closedir(dir); XtSetArg(args[0], XtNlist, &list); XtSetArg(args[1], XtNnumberStrings, &n_list); XtGetValues(dirwindow, args, 2); if (n_entries == 0) { entries = (char**)XtMalloc(sizeof(char*) * 2); /* Directory has read but not execute permission? */ entries[n_entries++] = XtNewString("./"); entries[n_entries++] = XtNewString("../"); } qsort(entries, n_entries, sizeof(char*), compar); XtSetArg(args[0], XtNlist, entries); XtSetArg(args[1], XtNnumberStrings, n_entries); XtSetValues(dirwindow, args, 2); if (n_list > 0 && (n_list != 1 || list[0] != XtName(dirwindow))) { while (--n_list > -1) XtFree(list[n_list]); XtFree((char*)list); } *pptr = '\0'; if ((label = ResolveName(path)) == NULL) { Feep(); label = path; } XtSetArg(args[0], XtNlabel, label); XtSetValues(dirlabel, args, 1); strncpy(path, label, sizeof(path) - 2); if (*path && path[strlen(path) - 1] != '/') strcat(path, "/"); XtSetArg(args[0], XtNstring, path); XtSetValues(filenamewindow, args, 1); XtSetKeyboardFocus(topwindow, filenamewindow); XawTextSetInsertionPoint(filenamewindow, strlen(path)); } else Feep(); } else { (void)ReallyDoLoad(path, ResolveName(path)); SwitchDirWindow(False); XtSetKeyboardFocus(topwindow, textwindow); } } x11-apps-7.7+5+nmu1ubuntu1/xedit/config.guess0000775000000000000000000012425712472175763015657 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-02-12' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) eval $set_cc_for_build X86_64_ABI= # If there is a compiler, see if it is configured for 32-bit objects. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_X32 >/dev/null then X86_64_ABI=x32 fi fi echo x86_64-unknown-linux-gnu${X86_64_ABI} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xedit/xedit.c0000664000000000000000000004625112472175711014606 0ustar /* $XConsortium: xedit.c,v 1.28 94/03/26 17:06:28 rws Exp $ */ /* * COPYRIGHT 1987 * DIGITAL EQUIPMENT CORPORATION * MAYNARD, MASSACHUSETTS * ALL RIGHTS RESERVED. * * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR * ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. * * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT RIGHTS, * APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN ADDITION TO THAT * SET FORTH ABOVE. * * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Digital Equipment Corporation not be * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ /* $XFree86: xc/programs/xedit/xedit.c,v 1.17 2002/09/22 07:09:05 paulo Exp $ */ #include "xedit.h" #include #include #include #include #include #define randomize() srand((unsigned)time((time_t*)NULL)) static XtActionsRec actions[] = { {"quit", QuitAction}, {"save-file", SaveFile}, {"load-file", LoadFile}, {"find-file", FindFile}, {"cancel-find-file", CancelFindFile}, {"file-completion", FileCompletion}, {"popup-menu", PopupMenu}, {"kill-file", KillFile}, {"split-window", SplitWindow}, {"dir-window", DirWindow}, {"delete-window", DeleteWindow}, {"xedit-focus", XeditFocus}, {"other-window", OtherWindow}, {"switch-source", SwitchSource}, #ifndef __UNIXOS2__ {"lisp-eval", XeditLispEval}, {"xedit-print-lisp-eval", XeditPrintLispEval}, {"xedit-keyboard-reset",XeditKeyboardReset}, #endif {"ispell", IspellAction}, {"line-edit", LineEditAction}, {"tags", TagsAction} }; #define DEF_HINT_INTERVAL 300 /* in seconds, 5 minutes */ static Atom wm_delete_window; static Widget hintswindow; static int position_format_mask; static XawTextPositionInfo infos[3]; Widget topwindow, textwindow, messwidget, labelwindow, filenamewindow; Widget scratch, hpane, vpanes[2], labels[3], texts[3], forms[3], positions[3]; Widget options_popup, dirlabel, dirwindow; Boolean international; Boolean line_edit; XawTextWrapMode wrapmodes[3]; extern void ResetSourceChanged(xedit_flist_item*); static void makeButtonsAndBoxes(Widget); static void HintsTimer(XtPointer, XtIntervalId*); static void PositionChanged(Widget, XtPointer, XtPointer); static void StartFormatPosition(void); static void StartHints(void); Display *CurDpy; struct _app_resources app_resources; struct _xedit_flist flist; #define Offset(field) XtOffsetOf(struct _app_resources, field) static XtResource resources[] = { {"enableBackups", "EnableBackups", XtRBoolean, sizeof(Boolean), Offset(enableBackups), XtRImmediate, FALSE}, {"backupNamePrefix", "BackupNamePrefix", XtRString, sizeof(char *), Offset(backupNamePrefix),XtRString, ""}, {"backupNameSuffix", "BackupNameSuffix", XtRString, sizeof(char *), Offset(backupNameSuffix),XtRString, ".BAK"}, {"hints", "Hint", XtRString, sizeof(char *), Offset(hints.resource), XtRImmediate, NULL}, {"hintsInterval", XtCInterval, XtRInt, sizeof(long), Offset(hints.interval), XtRImmediate, (XtPointer)DEF_HINT_INTERVAL}, {"changedBitmap", XtRBitmap, XtRString, sizeof(char*), Offset(changed_pixmap_name), XtRString, "dot"}, {"positionFormat", "Format", XtRString, sizeof(char*), Offset(position_format), XtRString, "L%l"}, {"autoReplace", "Replace", XtRString, sizeof(char*), Offset(auto_replace), XtRImmediate, NULL}, {"tagsName", "TagsName", XtRString, sizeof(char *), Offset(tagsName), XtRString, "tags"}, {"loadTags", "LoadTags", XtRBoolean, sizeof(Boolean), Offset(loadTags), XtRImmediate, (XtPointer)TRUE}, }; #undef Offset int main(int argc, char *argv[]) { Boolean exists; char *filename; FileAccess file_access; Widget source; XtAppContext appcon; Boolean show_dir; xedit_flist_item *first_item; unsigned int i, lineno; lineno = 0; show_dir = FALSE; first_item = NULL; topwindow = XtAppInitialize(&appcon, "Xedit", NULL, 0, &argc, argv, NULL, NULL, 0); XtAppAddActions(appcon, actions, XtNumber(actions)); XtOverrideTranslations(topwindow, XtParseTranslationTable("WM_PROTOCOLS: quit()")); XtGetApplicationResources(topwindow, (XtPointer) &app_resources, resources, XtNumber(resources), NULL, 0); CurDpy = XtDisplay(topwindow); XawSimpleMenuAddGlobalActions(appcon); XtRegisterGrabAction(PopupMenu, True, ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync); makeButtonsAndBoxes(topwindow); StartHints(); StartFormatPosition(); (void)StartHooks(appcon); if (position_format_mask == 0) { for (i = 0; i < 3; i++) XtRemoveCallback(texts[i], XtNpositionCallback, PositionChanged, NULL); } XtRealizeWidget(topwindow); #ifndef __UNIXOS2__ XeditLispInitialize(); #endif options_popup = XtCreatePopupShell("optionsMenu", simpleMenuWidgetClass, topwindow, NULL, 0); XtRealizeWidget(options_popup); XtAddCallback(XtCreateManagedWidget("ispell", smeBSBObjectClass, options_popup, NULL, 0), XtNcallback, IspellCallback, NULL); CreateEditPopup(); wm_delete_window = XInternAtom(XtDisplay(topwindow), "WM_DELETE_WINDOW", False); (void)XSetWMProtocols(XtDisplay(topwindow), XtWindow(topwindow), &wm_delete_window, 1); /* This first call is just to save the default font and colors */ UpdateTextProperties(0); if (argc > 1) { xedit_flist_item *item; Arg args[2]; unsigned int num_args; for (i = 1; i < argc; i++) { struct stat st; if (argv[i][0] == '+') { char *endptr; lineno = strtol(argv[i], &endptr, 10); /* Don't warn about incorrect input? */ if (*endptr) lineno = 0; continue; } filename = ResolveName(argv[i]); if (filename == NULL || FindTextSource(NULL, filename) != NULL) continue; num_args = 0; if (stat(filename, &st) == 0 && !S_ISREG(st.st_mode)) { if (S_ISDIR(st.st_mode)) { if (!first_item) { char path[BUFSIZ + 1]; strncpy(path, filename, sizeof(path) - 2); path[sizeof(path) - 2] = '\0'; if (*path) { if (path[strlen(path) - 1] != '/') strcat(path, "/"); } else strcpy(path, "./"); XtSetArg(args[0], XtNlabel, ""); XtSetValues(dirlabel, args, 1); SwitchDirWindow(True); DirWindowCB(dirwindow, path, NULL); show_dir = True; } continue; } } switch (file_access = CheckFilePermissions(filename, &exists)) { case NO_READ: if (exists) XeditPrintf("File %s exists, and could not be opened for " "reading.\n", argv[i]); else XeditPrintf("File %s does not exist, and the directory " "could not be opened for writing.\n", argv[i]); break; case READ_OK: XtSetArg(args[num_args], XtNeditType, XawtextRead); num_args++; XeditPrintf("File %s opened READ ONLY.\n", argv[i]); break; case WRITE_OK: XtSetArg(args[num_args], XtNeditType, XawtextEdit); num_args++; XeditPrintf("File %s opened read - write.\n", argv[i]); break; } if (file_access != NO_READ) { int flags; if (exists) { flags = EXISTS_BIT; XtSetArg(args[num_args], XtNstring, filename);num_args++; } else { flags = 0; XtSetArg(args[num_args], XtNstring, NULL); num_args++; } source = XtVaCreateWidget("textSource", international ? multiSrcObjectClass : asciiSrcObjectClass, topwindow, XtNtype, XawAsciiFile, XtNeditType, XawtextEdit, NULL, NULL); XtSetValues(source, args, num_args); item = AddTextSource(source, argv[i], filename, flags, file_access); XtAddCallback(item->source, XtNcallback, SourceChanged, (XtPointer)item); if (exists && file_access == WRITE_OK) { item->mode = st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); item->mtime = st.st_mtime; } if (!first_item && !show_dir) first_item = item; ResetSourceChanged(item); } } } if (!flist.pixmap && strlen(app_resources.changed_pixmap_name)) { XrmValue from, to; from.size = strlen(app_resources.changed_pixmap_name); from.addr = app_resources.changed_pixmap_name; to.size = sizeof(Pixmap); to.addr = (XtPointer)&(flist.pixmap); XtConvertAndStore(flist.popup, XtRString, &from, XtRBitmap, &to); } if (first_item == NULL) { XtSetKeyboardFocus(topwindow, filenamewindow); XtVaSetValues(textwindow, XtNwrap, XawtextWrapLine, NULL); } else { SwitchTextSource(first_item); XtSetKeyboardFocus(topwindow, textwindow); if (lineno) { XawTextPosition position; source = XawTextGetSource(textwindow); position = RSCAN(XawTextGetInsertionPoint(textwindow), lineno, False); position = LSCAN(position, 1, False); XawTextSetInsertionPoint(textwindow, position); } } XtAppMainLoop(appcon); return EXIT_SUCCESS; } static void makeButtonsAndBoxes(Widget parent) { Widget outer, b_row, viewport; Arg arglist[10]; Cardinal num_args; xedit_flist_item *item; static char *labelWindow = "labelWindow", *editWindow = "editWindow"; static char *formWindow = "formWindow", *positionWindow = "positionWindow"; outer = XtCreateManagedWidget("paned", panedWidgetClass, parent, NULL, ZERO); b_row = XtCreateManagedWidget("buttons", panedWidgetClass, outer, NULL, ZERO); { MakeCommandButton(b_row, "quit", DoQuit); MakeCommandButton(b_row, "save", DoSave); MakeCommandButton(b_row, "load", DoLoad); filenamewindow = MakeStringBox(b_row, "filename", NULL); } hintswindow = XtCreateManagedWidget("bc_label", labelWidgetClass, outer, NULL, ZERO); num_args = 0; XtSetArg(arglist[num_args], XtNeditType, XawtextEdit); ++num_args; messwidget = XtCreateManagedWidget("messageWindow", asciiTextWidgetClass, outer, arglist, num_args); num_args = 0; XtSetArg(arglist[num_args], XtNorientation, XtorientHorizontal); ++num_args; hpane = XtCreateManagedWidget("hpane", panedWidgetClass, outer, arglist, num_args); num_args = 0; XtSetArg(arglist[num_args], XtNorientation, XtorientVertical); ++num_args; vpanes[0] = XtCreateManagedWidget("vpane", panedWidgetClass, hpane, arglist, num_args); XtSetArg(arglist[num_args], XtNheight, 1); ++num_args; XtSetArg(arglist[num_args], XtNwidth, 1); ++num_args; vpanes[1] = XtCreateWidget("vpane", panedWidgetClass, hpane, arglist, num_args); forms[0] = XtCreateManagedWidget(formWindow, formWidgetClass, vpanes[0], NULL, 0); labelwindow = XtCreateManagedWidget(labelWindow,labelWidgetClass, forms[0], NULL, 0); labels[0] = labelwindow; positions[0] = XtCreateManagedWidget(positionWindow,labelWidgetClass, forms[0], NULL, 0); forms[2] = XtCreateWidget(formWindow, formWidgetClass, vpanes[1], NULL, 0); labels[2] = XtCreateManagedWidget(labelWindow,labelWidgetClass, forms[2], NULL, 0); positions[2] = XtCreateManagedWidget(positionWindow,labelWidgetClass, forms[2], NULL, 0); num_args = 0; XtSetArg(arglist[num_args], XtNtype, XawAsciiFile); ++num_args; XtSetArg(arglist[num_args], XtNeditType, XawtextEdit); ++num_args; textwindow = XtCreateManagedWidget(editWindow, asciiTextWidgetClass, vpanes[0], arglist, num_args); /* Get international resource value form the textwindow */ num_args = 0; XtSetArg(arglist[num_args], XtNinternational, &international); ++num_args; XtGetValues(textwindow, arglist, num_args); num_args = 0; XtSetArg(arglist[num_args], XtNtype, XawAsciiFile); ++num_args; XtSetArg(arglist[num_args], XtNeditType, XawtextEdit); ++num_args; scratch = XtVaCreateWidget("textSource", international ? multiSrcObjectClass : asciiSrcObjectClass, topwindow, XtNtype, XawAsciiFile, XtNeditType, XawtextEdit, NULL, NULL); XtSetValues(scratch, arglist, num_args); num_args = 0; XtSetArg(arglist[num_args], XtNtextSource, scratch); ++num_args; XtSetValues(textwindow, arglist, num_args); texts[0] = textwindow; num_args = 0; XtSetArg(arglist[num_args], XtNtextSource, scratch); ++num_args; XtSetArg(arglist[num_args], XtNdisplayCaret, False); ++num_args; texts[2] = XtCreateWidget(editWindow, asciiTextWidgetClass, vpanes[1], arglist, num_args); forms[1] = XtCreateWidget(formWindow, formWidgetClass, vpanes[0], NULL, 0); labels[1] = XtCreateManagedWidget(labelWindow,labelWidgetClass, forms[1], NULL, 0); positions[1] = XtCreateManagedWidget(positionWindow,labelWidgetClass, forms[1], NULL, 0); texts[1] = XtCreateWidget(editWindow, asciiTextWidgetClass, vpanes[0], arglist, num_args); dirlabel = XtCreateWidget("dirlabel", labelWidgetClass, vpanes[1], NULL, 0); num_args = 0; XtSetArg(arglist[num_args], XtNheight, 1); ++num_args; XtSetArg(arglist[num_args], XtNwidth, 1); ++num_args; viewport = XtCreateWidget("viewport", viewportWidgetClass, vpanes[1], arglist, num_args); dirwindow = XtCreateManagedWidget("dirwindow", listWidgetClass, viewport, NULL, 0); item = AddTextSource(scratch, "*scratch*", "*scratch*", 0, WRITE_OK); item->wrap = XawtextWrapLine; item->flags |= WRAP_BIT; XtAddCallback(item->source, XtNcallback, SourceChanged, (XtPointer)item); ResetSourceChanged(item); flist.current = item; for (num_args = 0; num_args < 3; num_args++) XtAddCallback(texts[num_args], XtNpositionCallback, PositionChanged, NULL); for (num_args = 0; num_args < 3; num_args++) { XtSetArg(arglist[0], XtNwrap, &wrapmodes[num_args]); XtGetValues(texts[num_args], arglist, 1); } XtAddCallback(dirwindow, XtNcallback, DirWindowCB, NULL); } /* Function Name: Feep * Description: feeps the bell. * Arguments: none. * Returns: none. */ void Feep(void) { XBell(CurDpy, 0); } #define l_BIT 0x01 #define c_BIT 0x02 #define p_BIT 0x04 #define s_BIT 0x08 #define MAX_FMT_LEN 30 static void StartFormatPosition(void) { char *fmt = app_resources.position_format; if (fmt) while (*fmt) if (*fmt++ == '%') { int len = 0; if (*fmt == '-') { ++fmt; ++len; } while (*fmt >= '0' && *fmt <= '9') { ++fmt; if (++len >= MAX_FMT_LEN) { XtAppWarning(XtWidgetToApplicationContext(topwindow), "Format too large to formatPosition"); position_format_mask = 0; return; } } switch (*fmt++) { case 'l': position_format_mask |= l_BIT; break; case 'c': position_format_mask |= c_BIT; break; case 'p': position_format_mask |= p_BIT; break; case 's': position_format_mask |= s_BIT; break; case '%': break; default: { char msg[256]; XmuSnprintf(msg, sizeof(msg), "Unknown format \"%%%c\" in positionFormat", fmt[-1]); XtAppWarning(XtWidgetToApplicationContext(topwindow), msg); position_format_mask = 0; return; } } } } /*ARGSUSED*/ static void PositionChanged(Widget w, XtPointer client_data, XtPointer call_data) { int idx; XawTextPositionInfo *info = (XawTextPositionInfo*)call_data; for (idx = 0; idx < 3; idx++) if (w == texts[idx]) break; if (idx > 2) return; if (((position_format_mask & l_BIT) && infos[idx].line_number != info->line_number) || ((position_format_mask & c_BIT) && infos[idx].column_number != info->column_number) || ((position_format_mask & p_BIT) && infos[idx].insert_position != info->insert_position) || ((position_format_mask & s_BIT) && infos[idx].last_position != info->last_position) || infos[idx].overwrite_mode != info->overwrite_mode) { int len = 6; Arg args[1]; char buffer[256], *str = app_resources.position_format; char fmt_buf[MAX_FMT_LEN + 2], *fmt; memcpy(&infos[idx], info, sizeof(XawTextPositionInfo)); if (info->overwrite_mode) strcpy(buffer, "Ovrwt "); else strcpy(buffer, " "); while (*str) { switch (*str) { case '%': fmt = fmt_buf; *fmt++ = *str++; if (*str == '-') *fmt++ = *str++; /*CONSTCOND*/ while (*str >= '0' && *str <= '9') { /* StartPositionFormat() already checked the format * length. */ *fmt++ = *str++; } *fmt++ = 'd'; *fmt = '\0'; switch (*str) { case 'l': XmuSnprintf(&buffer[len], sizeof(buffer) - len, fmt_buf, info->line_number); break; case 'c': XmuSnprintf(&buffer[len], sizeof(buffer) - len, fmt_buf, info->column_number); break; case 'p': XmuSnprintf(&buffer[len], sizeof(buffer) - len, fmt_buf, info->insert_position); break; case 's': XmuSnprintf(&buffer[len], sizeof(buffer) - len, fmt_buf, info->last_position); break; case '%': strcpy(&buffer[len], "%"); break; } len += strlen(&buffer[len]); break; default: buffer[len++] = *str; break; } if (len >= sizeof(buffer) - 1) break; ++str; } buffer[len] = '\0'; XtSetArg(args[0], XtNlabel, buffer); XtSetValues(positions[idx], args, 1); } } /*ARGSUSED*/ static void HintsTimer(XtPointer closure, XtIntervalId *id) { Arg args[1]; xedit_hints *hints = (xedit_hints*)closure; hints->cur_hint = rand() % hints->num_hints; XtSetArg(args[0], XtNlabel, hints->hints[hints->cur_hint]); XtSetValues(hintswindow, args, 1); hints->timer = XtAppAddTimeOut(XtWidgetToApplicationContext(topwindow), hints->interval, HintsTimer, closure); } #define MAX_HINT_LEN 255 #define MIN_HINT_INTERVAL 5 static void StartHints(void) { char *str, *p; unsigned i, len; xedit_hints *hints = &(app_resources.hints); /* if resource was not set, or was overriden */ if (hints->resource == NULL || !*hints->resource) return; randomize(); if (hints->interval < MIN_HINT_INTERVAL) hints->interval = DEF_HINT_INTERVAL; hints->interval *= 1000; hints->hints = (char**)XtMalloc(sizeof(char*)); hints->hints[hints->cur_hint = 0] = p = hints->resource; hints->num_hints = 1; while ((p = strchr(p, '\n')) != NULL) { if (*++p == '\0') break; hints->hints = (char**) XtRealloc((char*)hints->hints, sizeof(char*) * (hints->num_hints + 1)); hints->hints[hints->num_hints++] = p; } /* make a private copy of the resource values, so that one can change * the Xrm database safely. */ for (i = 0; i < hints->num_hints; i++) { if ((p = strchr(hints->hints[i], '\n')) != NULL) len = p - hints->hints[i]; else len = strlen(hints->hints[i]); if (len > MAX_HINT_LEN) len = MAX_HINT_LEN; str = XtMalloc(len + 1); strncpy(str, hints->hints[i], len); str[len] = '\0'; hints->hints[i] = str; } hints->timer = XtAppAddTimeOut(XtWidgetToApplicationContext(topwindow), hints->interval, HintsTimer, (XtPointer)hints); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/0000775000000000000000000000000012472176532014266 5ustar x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/mp/0000775000000000000000000000000012472176532014702 5ustar x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/mp/mpi.c0000664000000000000000000010751012472175711015635 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/mp/mpi.c,v 1.12 2002/11/20 07:44:43 paulo Exp $ */ #include "mp.h" #ifdef __UNIXOS2__ # define finite(x) isfinite(x) #endif /* * Prototypes */ /* do the hard work of mpi_add and mpi_sub */ static void mpi_addsub(mpi *rop, mpi *op1, mpi *op2, int sub); /* logical functions implementation */ static INLINE BNS mpi_logic(BNS op1, BNS op2, BNS op); static void mpi_log(mpi *rop, mpi *op1, mpi *op2, BNS op); /* internal mpi_seti, whithout memory allocation */ static void _mpi_seti(mpi *rop, long si); /* * Initialization */ static BNS onedig[1] = { 1 }; static mpi mpone = { 1, 1, 0, (BNS*)&onedig }; /* * Implementation */ void mpi_init(mpi *op) { op->sign = 0; op->size = op->alloc = 1; op->digs = mp_malloc(sizeof(BNS)); op->digs[0] = 0; } void mpi_clear(mpi *op) { op->sign = 0; op->size = op->alloc = 0; mp_free(op->digs); } void mpi_set(mpi *rop, mpi *op) { if (rop != op) { if (rop->alloc < op->size) { rop->digs = mp_realloc(rop->digs, sizeof(BNS) * op->size); rop->alloc = op->size; } rop->size = op->size; memcpy(rop->digs, op->digs, sizeof(BNS) * op->size); rop->sign = op->sign; } } void mpi_seti(mpi *rop, long si) { unsigned long ui; int sign = si < 0; int size; if (si == MINSLONG) { ui = MINSLONG; size = 2; } else { if (sign) ui = -si; else ui = si; if (ui < CARRY) size = 1; else size = 2; } if (rop->alloc < size) { rop->digs = mp_realloc(rop->digs, sizeof(BNS) * size); rop->alloc = size; } rop->size = size; /* store data in small mp integer */ rop->digs[0] = (BNS)ui; if (size > 1) rop->digs[1] = (BNS)(ui >> BNSBITS); rop->size = size; /* adjust result sign */ rop->sign = sign; } static void _mpi_seti(mpi *rop, long si) { unsigned long ui; int sign = si < 0; int size; if (si == MINSLONG) { ui = MINSLONG; size = 2; } else { if (sign) ui = -si; else ui = si; if (ui < CARRY) size = 1; else size = 2; } rop->digs[0] = (BNS)ui; if (size > 1) rop->digs[1] = (BNS)(ui >> BNSBITS); rop->size = size; rop->sign = sign; } void mpi_setd(mpi *rop, double d) { long i; double mantissa; int shift, exponent; BNI size; if (isnan(d)) d = 0.0; else if (!finite(d)) d = copysign(1.0, d) * DBL_MAX; /* check if number is larger than 1 */ if (fabs(d) < 1.0) { rop->digs[0] = 0; rop->size = 1; rop->sign = d < 0.0; return; } mantissa = frexp(d, &exponent); if (mantissa < 0) mantissa = -mantissa; size = (exponent + (BNSBITS - 1)) / BNSBITS; shift = BNSBITS - (exponent & (BNSBITS - 1)); /* adjust amount of memory */ if (rop->alloc < size) { rop->digs = mp_realloc(rop->digs, sizeof(BNS) * size); rop->alloc = size; } rop->size = size; /* adjust the exponent */ if (shift < BNSBITS) mantissa = ldexp(mantissa, -shift); /* convert double */ for (i = size - 1; i >= 0 && mantissa != 0.0; i--) { mantissa = ldexp(mantissa, BNSBITS); rop->digs[i] = (BNS)mantissa; mantissa -= rop->digs[i]; } for (; i >= 0; i--) rop->digs[i] = 0; /* normalize */ if (size > 1 && rop->digs[size - 1] == 0) --rop->size; rop->sign = d < 0.0; } /* how many BNS in the given base, log(base) / log(CARRY) */ #ifdef LONG64 static double str_bases[37] = { 0.0000000000000000, 0.0000000000000000, 0.0312500000000000, 0.0495300781475362, 0.0625000000000000, 0.0725602529652301, 0.0807800781475362, 0.0877298413143002, 0.0937500000000000, 0.0990601562950723, 0.1038102529652301, 0.1081072380824156, 0.1120300781475362, 0.1156387411919092, 0.1189798413143002, 0.1220903311127662, 0.1250000000000000, 0.1277332137890731, 0.1303101562950723, 0.1327477347951120, 0.1350602529652300, 0.1372599194618363, 0.1393572380824156, 0.1413613111267817, 0.1432800781475362, 0.1451205059304602, 0.1468887411919092, 0.1485902344426084, 0.1502298413143002, 0.1518119060977367, 0.1533403311127662, 0.1548186346995899, 0.1562500000000000, 0.1576373162299517, 0.1589832137890731, 0.1602900942795302, 0.1615601562950723, }; #else static double str_bases[37] = { 0.0000000000000000, 0.0000000000000000, 0.0625000000000000, 0.0990601562950723, 0.1250000000000000, 0.1451205059304602, 0.1615601562950723, 0.1754596826286003, 0.1875000000000000, 0.1981203125901446, 0.2076205059304602, 0.2162144761648311, 0.2240601562950723, 0.2312774823838183, 0.2379596826286003, 0.2441806622255325, 0.2500000000000000, 0.2554664275781462, 0.2606203125901445, 0.2654954695902241, 0.2701205059304602, 0.2745198389236725, 0.2787144761648311, 0.2827226222535633, 0.2865601562950723, 0.2902410118609203, 0.2937774823838183, 0.2971804688852168, 0.3004596826286003, 0.3036238121954733, 0.3066806622255324, 0.3096372693991797, 0.3125000000000000, 0.3152746324599034, 0.3179664275781462, 0.3205801885590604, 0.3231203125901446, }; #endif void mpi_setstr(mpi *rop, char *str, int base) { long i; /* counter */ int sign; /* result sign */ BNI carry; /* carry value */ BNI value; /* temporary value */ BNI size; /* size of result */ char *ptr; /* end of valid input */ /* initialization */ sign = 0; carry = 0; /* skip leading spaces */ while (isspace(*str)) ++str; /* check if sign supplied */ if (*str == '-') { sign = 1; ++str; } else if (*str == '+') ++str; /* skip leading zeros */ while (*str == '0') ++str; ptr = str; while (*ptr) { if (*ptr >= '0' && *ptr <= '9') { if (*ptr - '0' >= base) break; } else if (*ptr >= 'A' && *ptr <= 'Z') { if (*ptr - 'A' + 10 >= base) break; } else if (*ptr >= 'a' && *ptr <= 'z') { if (*ptr - 'a' + 10 >= base) break; } else break; ++ptr; } /* resulting size */ size = (ptr - str) * str_bases[base] + 1; /* make sure rop has enough storage */ if (rop->alloc < size) { rop->digs = mp_realloc(rop->digs, size * sizeof(BNS)); rop->alloc = size; } rop->size = size; /* initialize rop to zero */ memset(rop->digs, '\0', size * sizeof(BNS)); /* set result sign */ rop->sign = sign; /* convert string */ for (; str < ptr; str++) { value = *str; if (islower(value)) value = toupper(value); value = value > '9' ? value - 'A' + 10 : value - '0'; value += (BNI)rop->digs[0] * base; carry = value >> BNSBITS; rop->digs[0] = (BNS)value; for (i = 1; i < size; i++) { value = (BNI)rop->digs[i] * base + carry; carry = value >> BNSBITS; rop->digs[i] = (BNS)value; } } /* normalize */ if (rop->size > 1 && rop->digs[rop->size - 1] == 0) --rop->size; } void mpi_add(mpi *rop, mpi *op1, mpi *op2) { mpi_addsub(rop, op1, op2, 0); } void mpi_addi(mpi *rop, mpi *op1, long op2) { BNS digs[2]; mpi op; op.digs = (BNS*)digs; _mpi_seti(&op, op2); mpi_addsub(rop, op1, &op, 0); } void mpi_sub(mpi *rop, mpi *op1, mpi *op2) { mpi_addsub(rop, op1, op2, 1); } void mpi_subi(mpi *rop, mpi *op1, long op2) { BNS digs[2]; mpi op; op.digs = (BNS*)digs; _mpi_seti(&op, op2); mpi_addsub(rop, op1, &op, 1); } static void mpi_addsub(mpi *rop, mpi *op1, mpi *op2, int sub) { long xlen; /* maximum result size */ if (sub ^ (op1->sign == op2->sign)) { /* plus one for possible carry */ xlen = MAX(op1->size, op2->size) + 1; if (rop->alloc < xlen) { rop->digs = mp_realloc(rop->digs, sizeof(BNS) * xlen); rop->alloc = xlen; } rop->size = mp_add(rop->digs, op1->digs, op2->digs, op1->size, op2->size); rop->sign = op1->sign; } else { long cmp; /* check for larger operator */ cmp = mpi_cmpabs(op1, op2); if (cmp == 0) { rop->digs[0] = 0; rop->size = 1; rop->sign = 0; } else { xlen = MAX(op1->size, op2->size); if (rop->alloc < xlen) { rop->digs = mp_realloc(rop->digs, sizeof(BNS) * xlen); rop->alloc = xlen; } if (cmp > 0) { rop->size = mp_sub(rop->digs, op1->digs, op2->digs, op1->size, op2->size); rop->sign = op1->sign; } else { rop->size = mp_sub(rop->digs, op2->digs, op1->digs, op2->size, op1->size); rop->sign = sub ^ op2->sign; } } } } void mpi_mul(mpi *rop, mpi *op1, mpi *op2) { int sign; /* sign flag */ BNS *digs; /* result data */ long xsize; /* result size */ /* get result sign */ sign = op1->sign ^ op2->sign; /* check for special cases */ if (op1->size == 1) { if (*op1->digs == 0) { /* multiply by 0 */ mpi_seti(rop, 0); return; } else if (*op1->digs == 1) { /* multiply by +-1 */ if (rop->alloc < op2->size) { rop->digs = mp_realloc(rop->digs, sizeof(BNS) * op2->size); rop->alloc = op2->size; } rop->size = op2->size; memmove(rop->digs, op2->digs, sizeof(BNS) * op2->size); rop->sign = op2->size > 1 || *op2->digs ? sign : 0; return; } } else if (op2->size == 1) { if (*op2->digs == 0) { /* multiply by 0 */ mpi_seti(rop, 0); return; } else if (*op2->digs == 1) { /* multiply by +-1 */ if (rop->alloc < op1->size) { rop->digs = mp_realloc(rop->digs, sizeof(BNS) * op1->size); rop->alloc = op1->size; } rop->size = op1->size; memmove(rop->digs, op1->digs, sizeof(BNS) * op1->size); rop->sign = op1->size > 1 || *op1->digs ? sign : 0; return; } } /* allocate result data and set it to zero */ xsize = op1->size + op2->size; if (rop->digs == op1->digs || rop->digs == op2->digs) /* rop is also an operand */ digs = mp_calloc(1, sizeof(BNS) * xsize); else { if (rop->alloc < xsize) { rop->digs = mp_realloc(rop->digs, sizeof(BNS) * xsize); rop->alloc = xsize; } digs = rop->digs; memset(digs, '\0', sizeof(BNS) * xsize); } /* multiply operands */ xsize = mp_mul(digs, op1->digs, op2->digs, op1->size, op2->size); /* store result in rop */ if (digs != rop->digs) { /* if rop was an operand, free old data */ mp_free(rop->digs); rop->digs = digs; } rop->size = xsize; /* set result sign */ rop->sign = sign; } void mpi_muli(mpi *rop, mpi *op1, long op2) { BNS digs[2]; mpi op; op.digs = (BNS*)digs; _mpi_seti(&op, op2); mpi_mul(rop, op1, &op); } void mpi_div(mpi *rop, mpi *num, mpi *den) { mpi_divqr(rop, NULL, num, den); } void mpi_rem(mpi *rop, mpi *num, mpi *den) { mpi_divqr(NULL, rop, num, den); } /* * Could/should be changed to not allocate qdigs if qrop is NULL * Performance wouldn't suffer too much with a test on every loop iteration. */ void mpi_divqr(mpi *qrop, mpi *rrop, mpi *num, mpi *den) { long i, j; /* counters */ int qsign; /* sign of quotient */ int rsign; /* sign of remainder */ BNI qsize; /* size of quotient */ BNI rsize; /* size of remainder */ BNS qest; /* estimative of quotient value */ BNS *qdigs, *rdigs; /* work copy or result */ BNS *ndigs, *ddigs; /* work copy or divisor and dividend */ BNI value; /* temporary result */ long svalue; /* signed temporary result (2's complement) */ BNS carry, scarry, denorm; /* carry and normalization */ BNI dpos, npos; /* offsets in data */ /* get signs */ rsign = num->sign; qsign = rsign ^ den->sign; /* check for special case */ if (num->size < den->size) { /* quotient is zero and remainder is numerator */ if (rrop && rrop->digs != num->digs) { if (rrop->alloc < num->size) { rrop->digs = mp_realloc(rrop->digs, sizeof(BNS) * num->size); rrop->alloc = num->size; } rrop->size = num->size; memcpy(rrop->digs, num->digs, sizeof(BNS) * num->size); rrop->sign = rsign; } if (qrop) mpi_seti(qrop, 0); return; } /* estimate result sizes */ rsize = den->size; qsize = num->size - den->size + 1; /* offsets */ npos = num->size - 1; dpos = den->size - 1; /* allocate space for quotient and remainder */ if (qrop == NULL || qrop->digs == num->digs || qrop->digs == den->digs) qdigs = mp_calloc(1, sizeof(BNS) * qsize); else { if (qrop->alloc < qsize) { qrop->digs = mp_realloc(qrop->digs, sizeof(BNS) * qsize); qrop->alloc = qsize; } memset(qrop->digs, '\0', sizeof(BNS) * qsize); qdigs = qrop->digs; } if (rrop) { if (rrop->digs == num->digs || rrop->digs == den->digs) rdigs = mp_calloc(1, sizeof(BNS) * rsize); else { if (rrop->alloc < rsize) { rrop->digs = mp_realloc(rrop->digs, sizeof(BNS) * rsize); rrop->alloc = rsize; } memset(rrop->digs, '\0', sizeof(BNS) * rsize); rdigs = rrop->digs; } } else rdigs = NULL; /* fix gcc warning */ /* special case, only one word in divisor */ if (dpos == 0) { for (carry = 0, i = npos; i >= 0; i--) { value = ((BNI)carry << BNSBITS) + num->digs[i]; qdigs[i] = (BNS)(value / den->digs[0]); carry = (BNS)(value % den->digs[0]); } if (rrop) rdigs[0] = carry; goto mpi_divqr_done; } /* make work copy of numerator */ ndigs = mp_malloc(sizeof(BNS) * (num->size + 1)); /* allocate one extra word an update offset */ memcpy(ndigs, num->digs, sizeof(BNS) * num->size); ndigs[num->size] = 0; ++npos; /* normalize */ denorm = (BNS)((BNI)CARRY / ((BNI)(den->digs[dpos]) + 1)); if (denorm > 1) { /* i <= num->size because ndigs has an extra word */ for (carry = 0, i = 0; i <= num->size; i++) { value = ndigs[i] * (BNI)denorm + carry; ndigs[i] = (BNS)value; carry = (BNS)(value >> BNSBITS); } /* make work copy of denominator */ ddigs = mp_malloc(sizeof(BNS) * den->size); memcpy(ddigs, den->digs, sizeof(BNS) * den->size); for (carry = 0, i = 0; i < den->size; i++) { value = ddigs[i] * (BNI)denorm + carry; ddigs[i] = (BNS)value; carry = (BNS)(value >> BNSBITS); } } else /* only allocate copy of denominator if going to change it */ ddigs = den->digs; /* divide mp integers */ for (j = qsize - 1; j >= 0; j--, npos--) { /* estimate quotient */ if (ndigs[npos] == ddigs[dpos]) qest = (BNS)SMASK; else qest = (BNS)((((BNI)(ndigs[npos]) << BNSBITS) + ndigs[npos - 1]) / ddigs[dpos]); while ((value = ((BNI)(ndigs[npos]) << BNSBITS) + ndigs[npos - 1] - qest * (BNI)(ddigs[dpos])) < CARRY && ddigs[dpos - 1] * (BNI)qest > (value << BNSBITS) + ndigs[npos - 2]) --qest; /* multiply and subtract */ carry = scarry = 0; for (i = 0; i < den->size; i++) { value = qest * (BNI)ddigs[i] + carry; carry = (BNS)(value >> BNSBITS); svalue = (long)ndigs[npos - dpos + i - 1] - (long)(value & SMASK) - (long)scarry; ndigs[npos - dpos + i - 1] = (BNS)svalue; scarry = svalue < 0; } svalue = (long)ndigs[npos] - (long)(carry & SMASK) - (long)scarry; ndigs[npos] = (BNS)svalue; if (svalue & LMASK) { /* quotient too big */ --qest; carry = 0; for (i = 0; i < den->size; i++) { value = ndigs[npos - dpos + i - 1] + (BNI)carry + (BNI)ddigs[i]; ndigs[npos - dpos + i - 1] = (BNS)value; carry = (BNS)(value >> BNSBITS); } ndigs[npos] += carry; } qdigs[j] = qest; } /* calculate remainder */ if (rrop) { for (carry = 0, j = dpos; j >= 0; j--) { value = ((BNI)carry << BNSBITS) + ndigs[j]; rdigs[j] = (BNS)(value / denorm); carry = (BNS)(value % denorm); } } mp_free(ndigs); if (ddigs != den->digs) mp_free(ddigs); mpi_divqr_done: if (rrop) { if (rrop->digs != rdigs) mp_free(rrop->digs); /* normalize remainder */ for (i = rsize - 1; i >= 0; i--) if (rdigs[i] != 0) break; if (i != rsize - 1) { if (i < 0) { rsign = 0; rsize = 1; } else rsize = i + 1; } rrop->digs = rdigs; rrop->sign = rsign; rrop->size = rsize; } /* normalize quotient */ if (qrop) { if (qrop->digs != qdigs) mp_free(qrop->digs); for (i = qsize - 1; i >= 0; i--) if (qdigs[i] != 0) break; if (i != qsize - 1) { if (i < 0) { qsign = 0; qsize = 1; } else qsize = i + 1; } qrop->digs = qdigs; qrop->sign = qsign; qrop->size = qsize; } else mp_free(qdigs); } long mpi_divqri(mpi *qrop, mpi *num, long den) { BNS ddigs[2]; mpi dop, rrop; long remainder; dop.digs = (BNS*)ddigs; _mpi_seti(&dop, den); memset(&rrop, '\0', sizeof(mpi)); mpi_init(&rrop); mpi_divqr(qrop, &rrop, num, &dop); remainder = rrop.digs[0]; if (rrop.size > 1) remainder |= (BNI)(rrop.digs[1]) << BNSBITS; if (rrop.sign) remainder = -remainder; mpi_clear(&rrop); return (remainder); } void mpi_divi(mpi *rop, mpi *num, long den) { BNS ddigs[2]; mpi dop; dop.digs = (BNS*)ddigs; _mpi_seti(&dop, den); mpi_divqr(rop, NULL, num, &dop); } long mpi_remi(mpi *num, long den) { return (mpi_divqri(NULL, num, den)); } void mpi_mod(mpi *rop, mpi *num, mpi *den) { mpi_rem(rop, num, den); if (num->sign ^ den->sign) mpi_add(rop, rop, den); } long mpi_modi(mpi *num, long den) { long remainder; remainder = mpi_remi(num, den); if (num->sign ^ (den < 0)) remainder += den; return (remainder); } void mpi_gcd(mpi *rop, mpi *num, mpi *den) { long cmp; mpi rem; /* check if result already given */ cmp = mpi_cmpabs(num, den); /* check if num is equal to den or if num is zero */ if (cmp == 0 || (num->size == 1 && num->digs[0] == 0)) { mpi_set(rop, den); rop->sign = 0; return; } /* check if den is not zero */ if (den->size == 1 && den->digs[0] == 0) { mpi_set(rop, num); rop->sign = 0; return; } /* don't call mpi_init, relies on realloc(0, size) == malloc(size) */ memset(&rem, '\0', sizeof(mpi)); /* if num larger than den */ if (cmp > 0) { mpi_rem(&rem, num, den); if (rem.size == 1 && rem.digs[0] == 0) { /* exact division */ mpi_set(rop, den); rop->sign = 0; mpi_clear(&rem); return; } mpi_set(rop, den); } else { mpi_rem(&rem, den, num); if (rem.size == 1 && rem.digs[0] == 0) { /* exact division */ mpi_set(rop, num); rop->sign = 0; mpi_clear(&rem); return; } mpi_set(rop, num); } /* loop using positive values */ rop->sign = rem.sign = 0; /* cannot optimize this inverting rem/rop assignment earlier * because rop mais be an operand */ mpi_swap(rop, &rem); /* Euclides algorithm */ for (;;) { mpi_rem(&rem, &rem, rop); if (rem.size == 1 && rem.digs[0] == 0) break; mpi_swap(rop, &rem); } mpi_clear(&rem); } void mpi_lcm(mpi *rop, mpi *num, mpi *den) { mpi gcd; /* check for zero operand */ if ((num->size == 1 && num->digs[0] == 0) || (den->size == 1 && den->digs[0] == 0)) { rop->digs[0] = 0; rop->sign = 0; return; } /* don't call mpi_init, relies on realloc(0, size) == malloc(size) */ memset(&gcd, '\0', sizeof(mpi)); mpi_gcd(&gcd, num, den); mpi_div(&gcd, den, &gcd); mpi_mul(rop, &gcd, num); rop->sign = 0; mpi_clear(&gcd); } void mpi_pow(mpi *rop, mpi *op, unsigned long exp) { mpi zop, top; if (exp == 2) { mpi_mul(rop, op, op); return; } /* check for op**0 */ else if (exp == 0) { rop->digs[0] = 1; rop->size = 1; rop->sign = 0; return; } else if (exp == 1) { mpi_set(rop, op); return; } else if (op->size == 1) { if (op->digs[0] == 0) { mpi_seti(rop, 0); return; } else if (op->digs[0] == 1) { mpi_seti(rop, op->sign && (exp & 1) ? -1 : 1); return; } } memset(&zop, '\0', sizeof(mpi)); memset(&top, '\0', sizeof(mpi)); mpi_set(&zop, op); mpi_set(&top, op); for (--exp; exp; exp >>= 1) { if (exp & 1) mpi_mul(&zop, &top, &zop); mpi_mul(&top, &top, &top); } mpi_clear(&top); rop->sign = zop.sign; mp_free(rop->digs); rop->digs = zop.digs; rop->size = zop.size; } /* Find integer root of given number using the iteration * x{n+1} = ((K-1) * x{n} + N / x{n}^(K-1)) / K */ int mpi_root(mpi *rop, mpi *op, unsigned long nth) { long bits, cmp; int exact; int sign; mpi *r, t, temp, quot, old, rem; sign = op->sign; /* divide by zero op**1/0 */ if (nth == 0) { int one = 1, zero = 0; one = one / zero; } /* result is complex */ if (sign && !(nth & 1)) { int one = 1, zero = 0; one = one / zero; } /* special case op**1/1 = op */ if (nth == 1) { mpi_set(rop, op); return (1); } bits = mpi_getsize(op, 2) - 2; if (bits < 0 || bits / nth == 0) { /* integral root is surely less than 2 */ exact = op->size == 1 && (op->digs[0] == 1 || op->digs[0] == 0); mpi_seti(rop, sign ? -1 : op->digs[0] == 0 ? 0 : 1); return (exact == 1); } /* initialize */ if (rop != op) r = rop; else { r = &t; memset(r, '\0', sizeof(mpi)); } memset(&temp, '\0', sizeof(mpi)); memset(", '\0', sizeof(mpi)); memset(&old, '\0', sizeof(mpi)); memset(&rem, '\0', sizeof(mpi)); if (sign) r->sign = 0; /* root aproximation */ mpi_ash(r, op, -(bits - (bits / nth))); for (;;) { mpi_pow(&temp, r, nth - 1); mpi_divqr(", &rem, op, &temp); cmp = mpi_cmpabs(r, "); if (cmp == 0) { exact = mpi_cmpi(&rem, 0) == 0; break; } else if (cmp < 0) { if (mpi_cmpabs(r, &old) == 0) { exact = 0; break; } mpi_set(&old, r); } mpi_muli(&temp, r, nth - 1); mpi_add(", ", &temp); mpi_divi(r, ", nth); } mpi_clear(&temp); mpi_clear("); mpi_clear(&old); mpi_clear(&rem); if (r != rop) { mpi_set(rop, r); mpi_clear(r); } rop->sign = sign; return (exact); } /* * Find square root using the iteration: * x{n+1} = (x{n}+N/x{n})/2 */ int mpi_sqrt(mpi *rop, mpi *op) { long bits, cmp; int exact; mpi *r, t, quot, rem, old; /* result is complex */ if (op->sign) { int one = 1, zero = 0; one = one / zero; } bits = mpi_getsize(op, 2) - 2; if (bits < 2) { /* integral root is surely less than 2 */ exact = op->size == 1 && (op->digs[0] == 1 || op->digs[0] == 0); mpi_seti(rop, op->digs[0] == 0 ? 0 : 1); return (exact == 1); } /* initialize */ if (rop != op) r = rop; else { r = &t; memset(r, '\0', sizeof(mpi)); } memset(", '\0', sizeof(mpi)); memset(&rem, '\0', sizeof(mpi)); memset(&old, '\0', sizeof(mpi)); /* root aproximation */ mpi_ash(r, op, -(bits - (bits / 2))); for (;;) { if (mpi_cmpabs(r, &old) == 0) { exact = 0; break; } mpi_divqr(", &rem, op, r); cmp = mpi_cmpabs(", r); if (cmp == 0) { exact = mpi_cmpi(&rem, 0) == 0; break; } else if (cmp > 0 && rem.size == 1 && rem.digs[0] == 0) mpi_subi(", ", 1); mpi_set(&old, r); mpi_add(r, r, "); mpi_ash(r, r, -1); } mpi_clear("); mpi_clear(&rem); mpi_clear(&old); if (r != rop) { mpi_set(rop, r); mpi_clear(r); } return (exact); } void mpi_ash(mpi *rop, mpi *op, long shift) { long i; /* counter */ long xsize; /* maximum result size */ BNS *digs; /* check for 0 shift, multiply/divide by 1 */ if (shift == 0) { if (rop != op) { if (rop->alloc < op->size) { rop->digs = mp_realloc(rop->digs, sizeof(BNS) * op->size); rop->alloc = op->size; } rop->size = op->size; memcpy(rop->digs, op->digs, sizeof(BNS) * op->size); } return; } else if (op->size == 1 && op->digs[0] == 0) { rop->sign = 0; rop->size = 1; rop->digs[0] = 0; return; } /* check shift and initialize */ if (shift > 0) xsize = op->size + (shift / BNSBITS) + 1; else { xsize = op->size - ((-shift) / BNSBITS); if (xsize <= 0) { rop->size = 1; rop->sign = op->sign; rop->digs[0] = op->sign ? 1 : 0; return; } } /* allocate/adjust memory for result */ if (rop == op) digs = mp_malloc(sizeof(BNS) * xsize); else { if (rop->alloc < xsize) { rop->digs = mp_realloc(rop->digs, sizeof(BNS) * xsize); rop->alloc = xsize; } digs = rop->digs; } /* left shift, multiply by power of two */ if (shift > 0) rop->size = mp_lshift(digs, op->digs, op->size, shift); /* right shift, divide by power of two */ else { long carry = 0; if (op->sign) { BNI words, bits; words = -shift / BNSBITS; bits = -shift % BNSBITS; for (i = 0; i < words; i++) carry |= op->digs[xsize + i]; if (!carry) { for (i = 0; i < bits; i++) if (op->digs[op->size - xsize] & (1 << i)) { carry = 1; break; } } } rop->size = mp_rshift(digs, op->digs, op->size, -shift); if (carry) /* emulates two's complement subtracting 1 from the result */ rop->size = mp_add(digs, digs, mpone.digs, rop->size, 1); } if (rop->digs != digs) { mp_free(rop->digs); rop->alloc = rop->size; rop->digs = digs; } rop->sign = op->sign; } static INLINE BNS mpi_logic(BNS op1, BNS op2, BNS op) { switch (op) { case '&': return (op1 & op2); case '|': return (op1 | op2); case '^': return (op1 ^ op2); } return (SMASK); } static void mpi_log(mpi *rop, mpi *op1, mpi *op2, BNS op) { long i; /* counter */ long c, c1, c2; /* carry */ BNS *digs, *digs1, *digs2; /* pointers to mp data */ BNI size, size1, size2; BNS sign, sign1, sign2; BNS n, n1, n2; /* logical operands */ BNI sum; /* initialize */ size1 = op1->size; size2 = op2->size; sign1 = op1->sign ? SMASK : 0; sign2 = op2->sign ? SMASK : 0; sign = mpi_logic(sign1, sign2, op); size = MAX(size1, size2); if (sign) ++size; if (rop->alloc < size) { rop->digs = mp_realloc(rop->digs, sizeof(BNS) * size); rop->alloc = size; } digs = rop->digs; digs1 = op1->digs; digs2 = op2->digs; c = c1 = c2 = 1; /* apply logical operation */ for (i = 0; i < size; i++) { if (i >= size1) n1 = sign1; else if (sign1) { sum = (BNI)(BNS)(~digs1[i]) + c1; c1 = (long)(sum >> BNSBITS); n1 = (BNS)sum; } else n1 = digs1[i]; if (i >= size2) n2 = sign2; else if (sign2) { sum = (BNI)(BNS)(~digs2[i]) + c2; c2 = (long)(sum >> BNSBITS); n2 = (BNS)sum; } else n2 = digs2[i]; n = mpi_logic(n1, n2, op); if (sign) { sum = (BNI)(BNS)(~n) + c; c = (long)(sum >> BNSBITS); digs[i] = (BNS)sum; } else digs[i] = n; } /* normalize */ for (i = size - 1; i >= 0; i--) if (digs[i] != 0) break; if (i != size - 1) { if (i < 0) { sign = 0; size = 1; } else size = i + 1; } rop->sign = sign != 0; rop->size = size; } void mpi_and(mpi *rop, mpi *op1, mpi *op2) { mpi_log(rop, op1, op2, '&'); } void mpi_ior(mpi *rop, mpi *op1, mpi *op2) { mpi_log(rop, op1, op2, '|'); } void mpi_xor(mpi *rop, mpi *op1, mpi *op2) { mpi_log(rop, op1, op2, '^'); } void mpi_com(mpi *rop, mpi *op) { static BNS digs[1] = { 1 }; static mpi one = { 0, 1, 1, (BNS*)&digs }; mpi_log(rop, rop, &one, '^'); } void mpi_neg(mpi *rop, mpi *op) { int sign = op->sign ^ 1; if (rop->digs != op->digs) { if (rop->alloc < op->size) { rop->digs = mp_realloc(rop->digs, sizeof(BNS) * rop->size); rop->alloc = op->size; } rop->size = op->size; memcpy(rop->digs, op->digs, sizeof(BNS) * rop->size); } rop->sign = sign; } void mpi_abs(mpi *rop, mpi *op) { if (rop->digs != op->digs) { if (rop->alloc < op->size) { rop->digs = mp_realloc(rop->digs, sizeof(BNS) * rop->size); rop->alloc = op->size; } rop->size = op->size; memcpy(rop->digs, op->digs, sizeof(BNS) * rop->size); } rop->sign = 0; } int mpi_cmp(mpi *op1, mpi *op2) { if (op1->sign ^ op2->sign) return (op1->sign ? -1 : 1); if (op1->size == op2->size) { long i, cmp = 0; for (i = op1->size - 1; i >= 0; i--) if ((cmp = (long)op1->digs[i] - (long)op2->digs[i]) != 0) break; return (cmp == 0 ? 0 : (cmp < 0) ^ op1->sign ? -1 : 1); } return ((op1->size < op2->size) ^ op1->sign ? -1 : 1); } int mpi_cmpi(mpi *op1, long op2) { long cmp; if (op1->size > 2) return (op1->sign ? -1 : 1); cmp = op1->digs[0]; if (op1->size == 2) { cmp |= (long)op1->digs[1] << BNSBITS; if (cmp == MINSLONG) return (op2 == cmp && op1->sign ? 0 : op1->sign ? -1 : 1); } if (op1->sign) cmp = -cmp; return (cmp - op2); } int mpi_cmpabs(mpi *op1, mpi *op2) { if (op1->size == op2->size) { long i, cmp = 0; for (i = op1->size - 1; i >= 0; i--) if ((cmp = (long)op1->digs[i] - (long)op2->digs[i]) != 0) break; return (cmp); } return ((op1->size < op2->size) ? -1 : 1); } int mpi_cmpabsi(mpi *op1, long op2) { unsigned long cmp; if (op1->size > 2) return (1); cmp = op1->digs[0]; if (op1->size == 2) cmp |= (unsigned long)op1->digs[1] << BNSBITS; return (cmp > op2 ? 1 : cmp == op2 ? 0 : -1); } int mpi_sgn(mpi *op) { return (op->sign ? -1 : op->size > 1 || op->digs[0] ? 1 : 0); } void mpi_swap(mpi *op1, mpi *op2) { if (op1 != op2) { mpi swap; memcpy(&swap, op1, sizeof(mpi)); memcpy(op1, op2, sizeof(mpi)); memcpy(op2, &swap, sizeof(mpi)); } } int mpi_fiti(mpi *op) { if (op->size == 1) return (1); else if (op->size == 2) { unsigned long value = ((BNI)(op->digs[1]) << BNSBITS) | op->digs[0]; if (value & MINSLONG) return (op->sign && value == MINSLONG) ? 1 : 0; return (1); } return (0); } long mpi_geti(mpi *op) { long value; value = op->digs[0]; if (op->size > 1) value |= (BNI)(op->digs[1]) << BNSBITS; return (op->sign && value != MINSLONG ? -value : value); } double mpi_getd(mpi *op) { long i, len; double d = 0.0; int exponent; #define FLOATDIGS sizeof(double) / sizeof(BNS) switch (op->size) { case 2: d = (BNI)(op->digs[1]) << BNSBITS; case 1: d += op->digs[0]; return (op->sign ? -d : d); default: break; } for (i = 0, len = op->size; len > 0 && i < FLOATDIGS; i++) d = ldexp(d, BNSBITS) + op->digs[--len]; d = frexp(d, &exponent); if (len > 0) exponent += len * BNSBITS; if (d == 0.0) return (d); d = ldexp(d, exponent); return (op->sign ? -d : d); } /* how many digits in a given base, floor(log(CARRY) / log(base)) */ #ifdef LONG64 static char dig_bases[37] = { 0, 0, 32, 20, 16, 13, 12, 11, 10, 10, 9, 9, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, }; #else static char dig_bases[37] = { 0, 0, 16, 10, 8, 6, 6, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, }; #endif /* how many digits per bit in a given base, log(2) / log(base) */ static double bit_bases[37] = { 0.0000000000000000, 0.0000000000000000, 1.0000000000000000, 0.6309297535714575, 0.5000000000000000, 0.4306765580733931, 0.3868528072345416, 0.3562071871080222, 0.3333333333333334, 0.3154648767857287, 0.3010299956639811, 0.2890648263178878, 0.2789429456511298, 0.2702381544273197, 0.2626495350371936, 0.2559580248098155, 0.2500000000000000, 0.2446505421182260, 0.2398124665681315, 0.2354089133666382, 0.2313782131597592, 0.2276702486969530, 0.2242438242175754, 0.2210647294575037, 0.2181042919855316, 0.2153382790366965, 0.2127460535533632, 0.2103099178571525, 0.2080145976765095, 0.2058468324604344, 0.2037950470905062, 0.2018490865820999, 0.2000000000000000, 0.1982398631705605, 0.1965616322328226, 0.1949590218937863, 0.1934264036172708, }; /* normalization base for string conversion, pow(base, dig_bases[base]) & ~CARRY */ #ifdef LONG64 static BNS big_bases[37] = { 0x00000001, 0x00000001, 0x00000000, 0xCFD41B91, 0x00000000, 0x48C27395, 0x81BF1000, 0x75DB9C97, 0x40000000, 0xCFD41B91, 0x3B9ACA00, 0x8C8B6D2B, 0x19A10000, 0x309F1021, 0x57F6C100, 0x98C29B81, 0x00000000, 0x18754571, 0x247DBC80, 0x3547667B, 0x4C4B4000, 0x6B5A6E1D, 0x94ACE180, 0xCAF18367, 0x0B640000, 0x0E8D4A51, 0x1269AE40, 0x17179149, 0x1CB91000, 0x23744899, 0x2B73A840, 0x34E63B41, 0x40000000, 0x4CFA3CC1, 0x5C13D840, 0x6D91B519, 0x81BF1000, }; #else static BNS big_bases[37] = { 0x0001, 0x0001, 0x0000, 0xE6A9, 0x0000, 0x3D09, 0xB640, 0x41A7, 0x8000, 0xE6A9, 0x2710, 0x3931, 0x5100, 0x6F91, 0x9610, 0xC5C1, 0x0000, 0x1331, 0x16C8, 0x1ACB, 0x1F40, 0x242D, 0x2998, 0x2F87, 0x3600, 0x3D09, 0x44A8, 0x4CE3, 0x55C0, 0x5F45, 0x6978, 0x745F, 0x8000, 0x8C61, 0x9988, 0xA77B, 0xb640, }; #endif unsigned long mpi_getsize(mpi *op, int base) { unsigned long value, bits; value = op->digs[op->size - 1]; /* count leading bits */ if (value) { unsigned long count, carry; for (count = 0, carry = CARRY >> 1; carry; count++, carry >>= 1) if (value & carry) break; bits = BNSBITS - count; } else bits = 0; return ((bits + (op->size - 1) * BNSBITS) * bit_bases[base] + 1); } char * mpi_getstr(char *str, mpi *op, int base) { long i; /* counter */ BNS *digs, *xdigs; /* copy of op data */ BNI size; /* size of op */ BNI digits; /* digits per word in given base */ BNI bigbase; /* big base of given base */ BNI strsize; /* size of resulting string */ char *cp; /* pointer in str for conversion */ /* initialize */ size = op->size; strsize = mpi_getsize(op, base) + op->sign + 1; if (str == NULL) str = mp_malloc(strsize); /* check for zero */ if (size == 1 && op->digs[0] == 0) { str[0] = '0'; str[1] = '\0'; return (str); } digits = dig_bases[base]; bigbase = big_bases[base]; cp = str + strsize; *--cp = '\0'; /* make copy of op data and adjust digs */ xdigs = mp_malloc(size * sizeof(BNS)); memcpy(xdigs, op->digs, size * sizeof(BNS)); digs = xdigs + size - 1; /* convert to string */ for (;;) { long count = -1; BNI value; BNS quotient, remainder = 0; /* if power of two base */ if ((base & (base - 1)) == 0) { for (i = 0; i < size; i++) { quotient = remainder; remainder = digs[-i]; digs[-i] = quotient; if (count < 0 && quotient) count = i; } } else { for (i = 0; i < size; i++) { value = digs[-i] + ((BNI)remainder << BNSBITS); quotient = (BNS)(value / bigbase); remainder = (BNS)(value % bigbase); digs[-i] = quotient; if (count < 0 && quotient) count = i; } } quotient = remainder; for (i = 0; i < digits; i++) { if (quotient == 0 && count < 0) break; remainder = quotient % base; quotient /= base; *--cp = remainder < 10 ? remainder + '0' : remainder - 10 + 'A'; } if (count < 0) break; digs -= count; size -= count; } /* adjust sign */ if (op->sign) *--cp = '-'; /* remove any extra characters */ if (cp > str) strcpy(str, cp); mp_free(xdigs); return (str); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/mp/mp.c0000664000000000000000000004767412472175711015502 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/mp/mp.c,v 1.2 2002/11/08 08:01:00 paulo Exp $ */ #include "mp.h" /* * TODO: * o Optimize squaring * o Write better division code and move from mpi.c to here * o Make multiplication code don't required memory to be zeroed * + The first step is easy, just multiply the low word, * then the high word, that may overlap with the result * of the first multiply (in case of carry), and then * just make sure carry is properly propagated in the * subsequent multiplications. * + Some code needs also to be rewritten because some * intermediate addition code in mp_mul, mp_karatsuba_mul, * and mp_toom_mul is assuming the memory is zeroed. */ /* * Prototypes */ /* out of memory handler */ static void mp_outmem(void); /* memory allocation fallback functions */ static void *_mp_malloc(size_t); static void *_mp_calloc(size_t, size_t); static void *_mp_realloc(void*, size_t); static void _mp_free(void*); /* * Initialization */ static mp_malloc_fun __mp_malloc = _mp_malloc; static mp_calloc_fun __mp_calloc = _mp_calloc; static mp_realloc_fun __mp_realloc = _mp_realloc; static mp_free_fun __mp_free = _mp_free; /* * Implementation */ static void mp_outmem(void) { fprintf(stderr, "out of memory in MP library.\n"); exit(1); } static void * _mp_malloc(size_t size) { return (malloc(size)); } void * mp_malloc(size_t size) { void *pointer = (*__mp_malloc)(size); if (pointer == NULL) mp_outmem(); return (pointer); } mp_malloc_fun mp_set_malloc(mp_malloc_fun fun) { mp_malloc_fun old = __mp_malloc; __mp_malloc = fun; return (old); } static void * _mp_calloc(size_t nmemb, size_t size) { return (calloc(nmemb, size)); } void * mp_calloc(size_t nmemb, size_t size) { void *pointer = (*__mp_calloc)(nmemb, size); if (pointer == NULL) mp_outmem(); return (pointer); } mp_calloc_fun mp_set_calloc(mp_calloc_fun fun) { mp_calloc_fun old = __mp_calloc; __mp_calloc = fun; return (old); } static void * _mp_realloc(void *old, size_t size) { return (realloc(old, size)); } void * mp_realloc(void *old, size_t size) { void *pointer = (*__mp_realloc)(old, size); if (pointer == NULL) mp_outmem(); return (pointer); } mp_realloc_fun mp_set_realloc(mp_realloc_fun fun) { mp_realloc_fun old = __mp_realloc; __mp_realloc = fun; return (old); } static void _mp_free(void *pointer) { free(pointer); } void mp_free(void *pointer) { (*__mp_free)(pointer); } mp_free_fun mp_set_free(mp_free_fun fun) { mp_free_fun old = __mp_free; __mp_free = fun; return (old); } long mp_add(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2) { BNI value; /* intermediate result */ BNS carry; /* carry flag */ long size; /* result size */ if (len1 < len2) MP_SWAP(op1, op2, len1, len2); /* unroll start of loop */ value = (BNI)op1[0] + op2[0]; rop[0] = value; carry = value >> BNSBITS; /* add op1 and op2 */ for (size = 1; size < len2; size++) { value = (BNI)op1[size] + op2[size] + carry; rop[size] = value; carry = value >> BNSBITS; } if (rop != op1) { for (; size < len1; size++) { value = (BNI)op1[size] + carry; rop[size] = value; carry = value >> BNSBITS; } } else { /* if rop == op1, than just adjust carry */ for (; carry && size < len1; size++) { value = (BNI)op1[size] + carry; rop[size] = value; carry = value >> BNSBITS; } size = len1; } if (carry) rop[size++] = carry; return (size); } long mp_sub(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2) { long svalue; /* intermediate result */ BNS carry; /* carry flag */ long size; /* result size */ /* special case */ if (op1 == op2) { rop[0] = 0; return (1); } /* unroll start of loop */ svalue = (long)op1[0] - op2[0]; rop[0] = svalue; carry = svalue < 0; /* subtracts op2 from op1 */ for (size = 1; size < len2; size++) { svalue = (long)(op1[size]) - op2[size] - carry; rop[size] = svalue; carry = svalue < 0; } if (rop != op1) { for (; size < len1; size++) { svalue = op1[size] - carry; rop[size] = svalue; carry = svalue < 0; } } else { /* if rop == op1, than just adjust carry */ for (; carry && size < len1; size++) { svalue = (long)op1[size] - carry; rop[size] = svalue; carry = svalue < 0; } size = len1; } /* calculate result size */ while (size > 1 && rop[size - 1] == 0) --size; return (size); } long mp_lshift(BNS *rop, BNS *op, BNI len, long shift) { long i, size; BNI words, bits; /* how many word and bit shifts */ words = shift / BNSBITS; bits = shift % BNSBITS; size = len + words; if (bits) { BNS hi, lo; BNI carry; int adj; for (i = 1, carry = CARRY >> 1; carry; i++, carry >>= 1) if (op[len - 1] & carry) break; adj = (bits + (BNSBITS - i)) / BNSBITS; size += adj; lo = hi = op[0]; rop[words] = lo << bits; for (i = 1; i < len; i++) { hi = op[i]; rop[words + i] = hi << bits | (lo >> (BNSBITS - bits)); lo = hi; } if (adj) rop[size - 1] = hi >> (BNSBITS - bits); } else memmove(rop + size - len, op, sizeof(BNS) * len); if (words) memset(rop, '\0', sizeof(BNS) * words); return (size); } long mp_rshift(BNS *rop, BNS *op, BNI len, long shift) { int adj = 0; long i, size; BNI words, bits; /* how many word and bit shifts */ words = shift / BNSBITS; bits = shift % BNSBITS; size = len - words; if (bits) { BNS hi, lo; BNI carry; for (i = 0, carry = CARRY >> 1; carry; i++, carry >>= 1) if (op[len - 1] & carry) break; adj = (bits + i) / BNSBITS; if (size - adj == 0) { rop[0] = 0; return (1); } hi = lo = op[words + size - 1]; rop[size - 1] = hi >> bits; for (i = size - 2; i >= 0; i--) { lo = op[words + i]; rop[i] = (lo >> bits) | (hi << (BNSBITS - bits)); hi = lo; } if (adj) rop[0] |= lo << (BNSBITS - bits); } else memmove(rop, op + len - size, size * sizeof(BNS)); return (size - adj); } /* rop must be a pointer to len1 + len2 elements * rop cannot be either op1 or op2 * rop must be all zeros */ long mp_base_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2) { long i, j; /* counters */ BNI value; /* intermediate result */ BNS carry; /* carry value */ long size = len1 + len2; /* simple optimization: first pass does not need to deference rop[i+j] */ if (op1[0]) { value = (BNI)(op1[0]) * op2[0]; rop[0] = value; carry = (BNS)(value >> BNSBITS); for (j = 1; j < len2; j++) { value = (BNI)(op1[0]) * op2[j] + carry; rop[j] = value; carry = (BNS)(value >> BNSBITS); } rop[j] = carry; } /* do the multiplication */ for (i = 1; i < len1; i++) { if (op1[i]) { /* unrool loop initialization */ value = (BNI)(op1[i]) * op2[0] + rop[i]; rop[i] = value; carry = (BNS)(value >> BNSBITS); /* multiply */ for (j = 1; j < len2; j++) { value = (BNI)(op1[i]) * op2[j] + rop[i + j] + carry; rop[i + j] = value; carry = (BNS)(value >> BNSBITS); } rop[i + j] = carry; } } if (size > 1 && rop[size - 1] == 0) --size; return (size); } /* Karatsuba method * t + ((a0 + a1) (b0 + b1) - t - u) x + ux² * where t = a0b0 and u = a1b1 * * Karatsuba method reduces the number of multiplications. Example: * Square a 40 length number * instead of a plain 40*40 = 1600 multiplies/adds, it does: * 20*20+20*20+20*20 = 1200 * but since it is recursive, every 20*20=400 is reduced to * 10*10+10*10+10*10=300 * and so on. * The multiplication by x and x² is a just a shift, as it is a * power of two, and is implemented below by just writting at the * correct offset */ long mp_karatsuba_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2) { BNI x; /* shift count */ BNI la0, la1, lb0, lb1; /* length of a0, a1, b0, and b1 */ BNS *t; /* temporary memory for t product */ BNS *u; /* temporary memory for u product */ BNS *r; /* pointer to rop */ long xlen, tlen, ulen; /* calculate value of x, that is 2^(BNSBITS*x) */ if (len1 >= len2) x = (len1 + 1) >> 1; else x = (len2 + 1) >> 1; /* calculate length of operands */ la0 = x; la1 = len1 - x; lb0 = x; lb1 = len2 - x; /* allocate buffer for t and (a0 + a1) */ tlen = la0 + lb0; t = mp_malloc(sizeof(BNS) * tlen); /* allocate buffer for u and (b0 + b1) */ if (la1 + lb1 < lb0 + lb1 + 1) ulen = lb0 + lb1 + 1; else ulen = la1 + lb1; u = mp_malloc(sizeof(BNS) * ulen); /* calculate a0 + a1, store result in t */ tlen = mp_add(t, op1, op1 + x, la0, la1); /* calculate b0 + b1, store result in u */ ulen = mp_add(u, op2, op2 + x, lb0, lb1); /* store (a0 + a1) * (b0 + b1) in rop */ r = rop + x; /* multiplied by 2^(BNSBITS*x) */ xlen = mp_mul(r, t, u, tlen, ulen); /* must zero t and u memory, this is required for mp_mul */ /* calculate t = a0 * b0 */ tlen = la0 + lb0; memset(t, '\0', sizeof(BNS) * tlen); tlen = mp_mul(t, op1, op2, la0, lb0); /* calculate u = a1 * b1 */ ulen = la1 + lb1; memset(u, '\0', sizeof(BNS) * ulen); ulen = mp_mul(u, op1 + x, op2 + x, la1, lb1); /* subtract t from partial result */ xlen = mp_sub(r, r, t, xlen, tlen); /* subtract u form partial result */ xlen = mp_sub(r, r, u, xlen, ulen); /* add ux^2 to partial result */ r = rop + (x << 1); /* multiplied by x^2 = 2^(BNSBITS*x*2) */ xlen = len1 + len2; xlen = mp_add(r, r, u, xlen, ulen); /* now add t to final result */ xlen = mp_add(rop, rop, t, xlen, tlen); mp_free(t); mp_free(u); if (xlen > 1 && rop[xlen - 1] == 0) --xlen; return (xlen); } /* Toom method (partially based on GMP documentation) * Evaluation at k = [ 0 1/2 1 2 oo ] * U(x) = (U2k + U1)k + U0 * V(x) = (V2k + V1)k + V0 * W(x) = U(x)V(x) * * Sample: * 123 * 456 * * EVALUATION: * U(0) = (1*0+2)*0+3 => 3 * U(1) = 1+(2+3*2)*2 => 17 * U(2) = 1+2+3 => 6 * U(3) = (1*2+2)*2+3 => 11 * U(4) = 1+(2+3*0)*0 => 1 * * V(0) = (4*0+5)*0+6 => 6 * V(1) = 4+(5+6*2)*2 => 38 * V(2) = 4+5+6 => 15 * V(3) = (4*2+5)*2+6 => 32 * V(4) = 4+(5+6*0)*0 => 4 * * U = [ 3 17 6 11 1 ] * V = [ 6 38 15 32 4 ] * W = [ 18 646 90 352 4 ] * * After that, we have: * a = 18 (w0 already known) * b = 16w0 + 8w1 + 4w2 + 2w3 + w4 * c = w0 + w1 + w2 + w3 + w4 * d = w0 + 2w1 + 4w2 + 8w3 + 16w4 * e = 4 (w4 already known) * * INTERPOLATION: * b = b -16a - e (354) * c = c - a - e (68) * d = d - a - 16e (270) * * w = (b + d) - 8c = (10w1+8w2+10w3) - (8w1+8w2+8w3) = 2w1+2w3 * w = 2c - w (56) * b = b/2 = 4w1+w+w3 * b = b-c = 4w1+w+w3 - w1+w2+w3 = 3w1+w2 * c = w/2 (w2 = 28) * b = b-c = 3w1+c - c = 3w1 * b = b/3 (w1 = 27) * d = d/2 * d = d-b-w = b+w+4w3 - b-w = 4w3 * d = d/4 (w3 = 13) * * RESULT: * w4*10^4 + w3*10³ + w2*10² + w1*10 + w0 * 40000 + 13000 + 2800 + 270 + 18 * 10 is the base where the calculation was done * * This sample uses small numbers, so it does not show the * advantage of the method. But for example (in base 10), when squaring * 123456789012345678901234567890 * The normal method would do 30*30=900 multiplications * Karatsuba method would do 15*15*3=675 multiplications * Toom method would do 10*10*5=500 multiplications * Toom method has a larger overhead if compared with Karatsuba method, * due to evaluation and interpolation, so it should be used for larger * numbers, so that the computation time of evaluation/interpolation * would be smaller than the time spent using other methods. * * Note that Karatsuba method can be seen as a special case of * Toom method, i.e: * U1U0 * V1V0 * with k = [ 0 1 oo ] * U = [ U0 U1+U0 U1 ] * V = [ V0 V1+V0 V1 ] * W = [ U0*V0 (U1+U0)*(V1+V0) (U1+V1) ] * * w0 = U0*V0 * w = (U1+U0)*(V1+V0) * w2 = (U1*V1) * * w1 = w - w0 - w2 * w2x² + w1x + w0 * * See Knuth's Seminumerical Algorithms for a sample implemention * using 4 stacks and k = [ 0 1 2 3 ... ], based on the size of the * input. */ long mp_toom_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2) { long size, xsize, i; BNI value; /* used in division */ BNS carry; BNI x; /* shift count */ BNI l1, l2; BNI al, bl, cl, dl, el, Ul[3], Vl[3]; BNS *a, *b, *c, *d, *e, *U[3], *V[3]; /* x is the base i.e. 2^(BNSBITS*x) */ x = (len1 + len2 + 4) / 6; l1 = len1 - (x << 1); /* length of remaining piece of op1 */ l2 = len2 - (x << 1); /* length of remaining piece of op2 */ /* allocate memory for storing U and V */ U[0] = mp_malloc(sizeof(BNS) * (x + 2)); V[0] = mp_malloc(sizeof(BNS) * (x + 2)); U[1] = mp_malloc(sizeof(BNS) * (x + 1)); V[1] = mp_malloc(sizeof(BNS) * (x + 1)); U[2] = mp_malloc(sizeof(BNS) * (x + 2)); V[2] = mp_malloc(sizeof(BNS) * (x + 2)); /* EVALUATE U AND V */ /* Numbers are in the format U2x²+U1x+U0 and V2x²+V1x+V0 */ /* U[0] = U2+U1*2+U0*4 */ /* store U1*2 in U[1], this value is used twice */ Ul[1] = mp_lshift(U[1], op1 + x, x, 1); /* store U0*4 in U[0] */ Ul[0] = mp_lshift(U[0], op1, x, 2); /* add U1*2 to U[0] */ Ul[0] = mp_add(U[0], U[0], U[1], Ul[0], Ul[1]); /* add U2 to U[0] */ Ul[0] = mp_add(U[0], U[0], op1 + x + x, Ul[0], l1); /* U[2] = U2*4+U1*2+U0 */ /* store U2*4 in U[2] */ Ul[2] = mp_lshift(U[2], op1 + x + x, l1, 2); /* add U1*2 to U[2] */ Ul[2] = mp_add(U[2], U[2], U[1], Ul[2], Ul[1]); /* add U0 to U[2] */ Ul[2] = mp_add(U[2], U[2], op1, Ul[2], x); /* U[1] = U2+U1+U0 */ Ul[1] = mp_add(U[1], op1, op1 + x, x, x); Ul[1] = mp_add(U[1], U[1], op1 + x + x, Ul[1], l1); /* Evaluate V[x], same code as U[x] */ Vl[1] = mp_lshift(V[1], op2 + x, x, 1); Vl[0] = mp_lshift(V[0], op2, x, 2); Vl[0] = mp_add(V[0], V[0], V[1], Vl[0], Vl[1]); Vl[0] = mp_add(V[0], V[0], op2 + x + x, Vl[0], l2); Vl[2] = mp_lshift(V[2], op2 + x + x, l2, 2); Vl[2] = mp_add(V[2], V[2], V[1], Vl[2], Vl[1]); Vl[2] = mp_add(V[2], V[2], op2, Vl[2], x); Vl[1] = mp_add(V[1], op2, op2 + x, x, x); Vl[1] = mp_add(V[1], V[1], op2 + x + x, Vl[1], l2); /* MULTIPLY U[] AND V[] */ /* calculate (U2+U1*2+U0*4) * (V2+V1*2+V0*4) */ b = mp_calloc(1, sizeof(BNS) * (Ul[0] * Vl[0])); bl = mp_mul(b, U[0], V[0], Ul[0], Vl[0]); mp_free(U[0]); mp_free(V[0]); /* calculate (U2+U1+U0) * (V2+V1+V0) */ c = mp_calloc(1, sizeof(BNS) * (Ul[1] * Vl[1])); cl = mp_mul(c, U[1], V[1], Ul[1], Vl[1]); mp_free(U[1]); mp_free(V[1]); /* calculate (U2*4+U1*2+U0) * (V2*4+V1*2+V0) */ d = mp_calloc(1, sizeof(BNS) * (Ul[2] * Vl[2])); dl = mp_mul(d, U[2], V[2], Ul[2], Vl[2]); mp_free(U[2]); mp_free(V[2]); /* calculate U0 * V0 */ a = mp_calloc(1, sizeof(BNS) * (x + x)); al = mp_mul(a, op1, op2, x, x); /* calculate U2 * V2 */ e = mp_calloc(1, sizeof(BNS) * (l1 + l2)); el = mp_mul(e, op1 + x + x, op2 + x + x, l1, l2); /* INTERPOLATE COEFFICIENTS */ /* b = b - 16a - e */ size = mp_lshift(rop, a, al, 4); bl = mp_sub(b, b, rop, bl, size); bl = mp_sub(b, b, e, bl, el); /* c = c - a - e*/ cl = mp_sub(c, c, a, cl, al); cl = mp_sub(c, c, e, cl, el); /* d = d - a - 16e */ dl = mp_sub(d, d, a, dl, al); size = mp_lshift(rop, e, el, 4); dl = mp_sub(d, d, rop, dl, size); /* w = (b + d) - 8c */ size = mp_add(rop, b, d, bl, dl); xsize = mp_lshift(rop + size, c, cl, 3); /* rop has enough storage */ size = mp_sub(rop, rop, rop + size, size, xsize); /* w = 2c - w*/ xsize = mp_lshift(rop + size, c, cl, 1); size = mp_sub(rop, rop + size, rop, xsize, size); /* b = b/2 */ bl = mp_rshift(b, b, bl, 1); /* b = b - c */ bl = mp_sub(b, b, c, bl, cl); /* c = w / 2 */ cl = mp_rshift(c, rop, size, 1); /* b = b - c */ bl = mp_sub(b, b, c, bl, cl); /* b = b/3 */ /* maybe the most expensive calculation */ i = bl - 1; value = b[i]; b[i] = value / 3; for (--i; i >= 0; i--) { carry = value % 3; value = ((BNI)carry << BNSBITS) + b[i]; b[i] = (BNS)(value / 3); } /* d = d/2 */ dl = mp_rshift(d, d, dl, 1); /* d = d - b - w */ dl = mp_sub(d, d, b, dl, bl); dl = mp_sub(d, d, rop, dl, size); /* d = d/4 */ dl = mp_rshift(d, d, dl, 2); /* STORE RESULT IN ROP */ /* first clear memory used as temporary variable w and 8c */ memset(rop, '\0', sizeof(BNS) * (len1 + len2)); i = x * 4; xsize = (len1 + len2) - i; size = mp_add(rop + i, rop + i, e, xsize, el) + i; i = x * 3; xsize = size - i; size = mp_add(rop + i, rop + i, d, xsize, dl) + i; i = x * 2; xsize = size - i; size = mp_add(rop + i, rop + i, c, xsize, cl) + i; i = x; xsize = size - i; size = mp_add(rop + i, rop + i, b, xsize, bl) + i; size = mp_add(rop, rop, a, size, al); mp_free(e); mp_free(d); mp_free(c); mp_free(b); mp_free(a); if (size > 1 && rop[size - 1] == 0) --size; return (size); } long mp_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2) { if (len1 < len2) MP_SWAP(op1, op2, len1, len2); if (len1 < KARATSUBA || len2 < KARATSUBA) return (mp_base_mul(rop, op1, op2, len1, len2)); else if (len1 < TOOM && len2 < TOOM && len2 > ((len1 + 1) >> 1)) return (mp_karatsuba_mul(rop, op1, op2, len1, len2)); else if (len1 >= TOOM && len2 >= TOOM && (len2 + 2) / 3 == (len1 + 2) / 3) return (mp_toom_mul(rop, op1, op2, len1, len2)); else { long xsize, psize, isize; BNS *ptr; /* adjust index pointer and estimated size of result */ isize = 0; xsize = len1 + len2; mp_mul(rop, op1, op2, len2, len2); /* adjust pointers */ len1 -= len2; op1 += len2; /* allocate buffer for intermediate multiplications */ if (len1 > len2) ptr = mp_calloc(1, sizeof(BNS) * (len2 + len2)); else ptr = mp_calloc(1, sizeof(BNS) * (len1 + len2)); /* loop multiplying len2 size operands at a time */ while (len1 >= len2) { isize += len2; psize = mp_mul(ptr, op1, op2, len2, len2); mp_add(rop + isize, rop + isize, ptr, xsize - isize, psize); len1 -= len2; op1 += len2; /* multiplication routines require zeroed memory */ memset(ptr, '\0', sizeof(BNS) * (MIN(len1, len2) + len2)); } /* len1 was not a multiple of len2 */ if (len1) { isize += len2; psize = mp_mul(ptr, op2, op1, len2, len1); mp_add(rop + isize, rop + isize, ptr, xsize, psize); } /* adjust result size */ if (rop[xsize - 1] == 0) --xsize; mp_free(ptr); return (xsize); } } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/mp/mp.h0000664000000000000000000003067112472175711015474 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/mp/mp.h,v 1.5tsi Exp $ */ #include #include #ifdef sun #include #endif #include #include #include #include #include #ifndef __mp_h_ #define __mp_h_ #ifdef __GNUC__ #define INLINE __inline__ #else #define INLINE /**/ #endif /* this normally is better for multiplication and also * simplify addition loops putting the larger value first */ #define MP_SWAP(op1, op2, len1, len2) { \ BNS *top = op1; \ BNI tlen = len1; \ \ op1 = op2; \ len1 = len2; \ op2 = top; \ len2 = tlen; \ } /* * At least this length to use Karatsuba multiplication method */ #define KARATSUBA 32 /* * At least this length to use Toom multiplication method */ #define TOOM 128 #if ULONG_MAX > 4294967295UL /* sizeof(long) == 8 and sizeof(int) == 4 */ # define BNI unsigned long # define BNS unsigned int # define MINSLONG 0x8000000000000000UL # define MAXSLONG 0x7fffffffffffffffUL # define CARRY 0x100000000 # define LMASK 0xffffffff00000000UL # define SMASK 0x00000000ffffffffUL # define BNIBITS 64 # define BNSBITS 32 # ifndef LONG64 # define LONG64 # endif #else /* sizeof(long) == 4 and sizeof(short) == 2 */ # define BNI unsigned long # define BNS unsigned short # define MINSLONG 0x80000000UL # define MAXSLONG 0x7fffffffUL # define CARRY 0x10000 # define LMASK 0xffff0000UL # define SMASK 0x0000ffffUL # define BNIBITS 32 # define BNSBITS 16 #endif #ifdef MAX #undef MAX #endif #define MAX(a, b) ((a) > (b) ? (a) : (b)) #ifdef MIN #undef MIN #endif #define MIN(a, b) ((a) < (b) ? (a) : (b)) /* * Types */ typedef struct _mpi { unsigned int size : 31; unsigned int sign : 1; BNI alloc; BNS *digs; /* LSF format */ } mpi; typedef struct _mpr { mpi num; mpi den; } mpr; typedef void *(*mp_malloc_fun)(size_t); typedef void *(*mp_calloc_fun)(size_t, size_t); typedef void *(*mp_realloc_fun)(void*, size_t); typedef void (*mp_free_fun)(void*); /* * Prototypes */ /* GENERIC FUNCTIONS */ /* memory allocation wrappers */ void *mp_malloc(size_t size); void *mp_calloc(size_t nmemb, size_t size); void *mp_realloc(void *pointer, size_t size); void mp_free(void *pointer); mp_malloc_fun mp_set_malloc(mp_malloc_fun); mp_calloc_fun mp_set_calloc(mp_calloc_fun); mp_realloc_fun mp_set_realloc(mp_realloc_fun); mp_free_fun mp_set_free(mp_free_fun); /* adds op1 and op2, stores result in rop * rop must pointer to at least len1 + len2 + 1 elements * rop can be either op1 or op2 */ long mp_add(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2); /* subtracts op2 from op1, stores result in rop * rop must pointer to at least len1 + len2 elements * op1 must be >= op2 * rop can be either op1 or op2 */ long mp_sub(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2); /* shift op to the left shift bits * rop must have enough storage for result * rop can be op */ long mp_lshift(BNS *rop, BNS *op, BNI len, long shift); /* shift op to the right shift bits * shift must be positive * rop can be op */ long mp_rshift(BNS *rop, BNS *op, BNI len, long shift); /* use simple generic multiplication method * rop cannot be the same as op1 or op2 * rop must be zeroed * op1 can be op2 */ long mp_base_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2); /* use Karatsuba method * MIN(len1, len2) must be larger than (MAX(len1, len2) + 1) >> 1 * MAX(len1, len2) should be at least 2 * rop cannot be the same as op1 or op2 * rop must be zeroed * op1 can be op2 */ long mp_karatsuba_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2); /* use Toom method * len1 / 3 should be equal to len2 / 3 * len1 / 3 should be at least 1 * rop cannot be the same as op1 or op2 * rop must be zeroed * op1 can be op2 */ long mp_toom_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2); /* chooses the available multiplication methods based on it's input * rop must be a pointer to len1 + len2 elements * rop cannot be the same as op1 or op2 * rop must be zeroed * op1 can be op2 */ long mp_mul(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2); /* INTEGER FUNCTIONS */ /* initialize op and set it to 0 */ void mpi_init(mpi *op); /* clear memory associated to op */ void mpi_clear(mpi *op); /* set rop to the value of op */ void mpi_set(mpi *rop, mpi *op); /* set rop to the value of si */ void mpi_seti(mpi *rop, long si); /* set rop to the floor(fabs(d)) */ void mpi_setd(mpi *rop, double d); /* initialize rop to number representation in str in the given base. * leading zeros are skipped. * if sign present, it is processed. * base must be in the range 2 to 36. */ void mpi_setstr(mpi *rop, char *str, int base); /* adds two mp integers */ void mpi_add(mpi *rop, mpi *op1, mpi *op2); /* adds op1 and op2 */ void mpi_addi(mpi *rop, mpi *op1, long op2); /* subtracts two mp integers */ void mpi_sub(mpi *rop, mpi *op1, mpi *op2); /* subtracts op2 from op1 */ void mpi_subi(mpi *rop, mpi *op1, long op2); /* multiply two mp integers */ void mpi_mul(mpi *rop, mpi *op1, mpi *op2); /* multiply op1 by op2 */ void mpi_muli(mpi *rop, mpi *op1, long op2); /* divides num by den and sets rop to result */ void mpi_div(mpi *rop, mpi *num, mpi *den); /* divides num by den and sets rop to the remainder */ void mpi_rem(mpi *rop, mpi *num, mpi *den); /* divides num by den, sets quotient to qrop and remainder to rrop * qrop is truncated towards zero. * qrop and rrop are optional * qrop and rrop cannot be the same variable */ void mpi_divqr(mpi *qrop, mpi *rrop, mpi *num, mpi *den); /* divides num by then and stores result in rop */ void mpi_divi(mpi *rop, mpi *num, long den); /* divides num by den and returns remainder */ long mpi_remi(mpi *num, long den); /* divides num by den * stores quotient in qrop and returns remainder */ long mpi_divqri(mpi *qrop, mpi *num, long den); /* sets rop to num modulo den */ void mpi_mod(mpi *rop, mpi *num, mpi *den); /* returns num modulo den */ long mpi_modi(mpi *num, long den); /* sets rop to the greatest common divisor of num and den * result is always positive */ void mpi_gcd(mpi *rop, mpi *num, mpi *den); /* sets rop to the least common multiple of num and den * result is always positive */ void mpi_lcm(mpi *rop, mpi *num, mpi *den); /* sets rop to op raised to exp */ void mpi_pow(mpi *rop, mpi *op, unsigned long exp); /* sets rop to the integer part of the nth root of op. * returns 1 if result is exact, 0 otherwise */ int mpi_root(mpi *rop, mpi *op, unsigned long nth); /* sets rop to the integer part of the square root of op. * returns 1 if result is exact, 0 otherwise */ int mpi_sqrt(mpi *rop, mpi *op); /* bit shift, left if shift positive, right if negative * a fast way to multiply and divide by powers of two */ void mpi_ash(mpi *rop, mpi *op, long shift); /* sets rop to op1 logand op2 */ void mpi_and(mpi *rop, mpi *op1, mpi *op2); /* sets rop to op1 logior op2 */ void mpi_ior(mpi *rop, mpi *op1, mpi *op2); /* sets rop to op1 logxor op2 */ void mpi_xor(mpi *rop, mpi *op1, mpi *op2); /* sets rop to one's complement of op */ void mpi_com(mpi *rop, mpi *op); /* sets rop to -op */ void mpi_neg(mpi *rop, mpi *op); /* sets rop to the absolute value of op */ void mpi_abs(mpi *rop, mpi *op); /* compares op1 and op2 * returns >0 if op1 > op2, 0 if op1 = op2, and <0 if op1 < op2 */ int mpi_cmp(mpi *op1, mpi *op2); /* mpi_cmp with a long integer operand */ int mpi_cmpi(mpi *op1, long op2); /* compares absolute value of op1 and op2 * returns >0 if abs(op1) > abs(op2), 0 if abs(op1) = abs(op2), * and <0 if abs(op1) < abs(op2) */ int mpi_cmpabs(mpi *op1, mpi *op2); /* mpi_cmpabs with a long integer operand */ int mpi_cmpabsi(mpi *op1, long op2); /* returns 1 if op1 > 0, 0 if op1 = 0, and -1 if op1 < 0 */ int mpi_sgn(mpi *op); /* fastly swaps contents of op1 and op2 */ void mpi_swap(mpi *op1, mpi *op2); /* returns 1 if op fits in a signed long int, 0 otherwise */ int mpi_fiti(mpi *op); /* converts mp integer to long int * to know if the value will fit, call mpi_fiti */ long mpi_geti(mpi *op); /* convert mp integer to double */ double mpi_getd(mpi *op); /* returns exact number of characters to represent mp integer * in given base, excluding sign and ending null character. * base must be in the range 2 to 36 */ unsigned long mpi_getsize(mpi *op, int base); /* returns pointer to string with representation of mp integer * if str is not NULL, it must have enough space to store integer * representation, if NULL a newly allocated string is returned. * base must be in the range 2 to 36 */ char *mpi_getstr(char *str, mpi *op, int base); /* RATIO FUNCTIONS */ #define mpr_num(op) (&((op)->num)) #define mpr_den(op) (&((op)->den)) /* initialize op and set it to 0/1 */ void mpr_init(mpr *op); /* clear memory associated to op */ void mpr_clear(mpr *op); /* set rop to the value of op */ void mpr_set(mpr *rop, mpr *op); /* set rop to num/den */ void mpr_seti(mpr *rop, long num, long den); /* set rop to the value of d */ void mpr_setd(mpr *rop, double d); /* initialize rop to number representation in str in the given base. * leading zeros are skipped. * if sign present, it is processed. * base must be in the range 2 to 36. */ void mpr_setstr(mpr *rop, char *str, int base); /* remove common factors of op */ void mpr_canonicalize(mpr *op); /* adds two mp rationals */ void mpr_add(mpr *rop, mpr *op1, mpr *op2); /* adds op1 and op2 */ void mpr_addi(mpr *rop, mpr *op1, long op2); /* subtracts two mp rationals */ void mpr_sub(mpr *rop, mpr *op1, mpr *op2); /* subtracts op2 from op1 */ void mpr_subi(mpr *rop, mpr *op1, long op2); /* multiply two mp rationals */ void mpr_mul(mpr *rop, mpr *op1, mpr *op2); /* multiply op1 by op2 */ void mpr_muli(mpr *rop, mpr *op1, long op2); /* divide two mp rationals */ void mpr_div(mpr *rop, mpr *op1, mpr *op2); /* divides op1 by op2 */ void mpr_divi(mpr *rop, mpr *op1, long op2); /* sets rop to 1/op */ void mpr_inv(mpr *rop, mpr *op); /* sets rop to -op */ void mpr_neg(mpr *rop, mpr *op); /* sets rop to the absolute value of op */ void mpr_abs(mpr *rop, mpr *op); /* compares op1 and op2 * returns >0 if op1 > op2, 0 if op1 = op2, and <0 if op1 < op2 */ int mpr_cmp(mpr *op1, mpr *op2); /* mpr_cmp with a long integer operand */ int mpr_cmpi(mpr *op1, long op2); /* compares absolute value of op1 and op2 * returns >0 if abs(op1) > abs(op2), 0 if abs(op1) = abs(op2), * and <0 if abs(op1) < abs(op2) */ int mpr_cmpabs(mpr *op1, mpr *op2); /* mpr_cmpabs with a long integer operand */ int mpr_cmpabsi(mpr *op1, long op2); /* fastly swaps contents of op1 and op2 */ void mpr_swap(mpr *op1, mpr *op2); /* returns 1 if op fits in a signed long int, 0 otherwise */ int mpr_fiti(mpr *op); /* convert mp rational to double */ double mpr_getd(mpr *op); /* returns pointer to string with representation of mp rational * if str is not NULL, it must have enough space to store rational * representation, if NULL a newly allocated string is returned. * base must be in the range 2 to 36 */ char *mpr_getstr(char *str, mpr *op, int base); #endif /* __mp_h_ */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/mp/mpr.c0000664000000000000000000002130412472175711015642 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86$ */ #include "mp.h" /* * TODO: * Implement a fast gcd and divexact for integers, so that this code * could be changed to do intermediary calculations faster using smaller * numbers. */ /* * Prototypes */ /* do the hard work of mpr_add and mpr_sub */ static void mpr_addsub(mpr *rop, mpr *op1, mpr *op2, int sub); /* do the hard work of mpr_cmp and mpr_cmpabs */ static int mpr_docmp(mpr *op1, mpr *op2, int sign); /* * Implementation */ void mpr_init(mpr *op) { op->num.digs = mp_malloc(sizeof(BNS)); op->num.sign = 0; op->num.size = op->num.alloc = 1; op->num.digs[0] = 0; op->den.digs = mp_malloc(sizeof(BNS)); op->den.sign = 0; op->den.size = op->den.alloc = 1; op->den.digs[0] = 1; } void mpr_clear(mpr *op) { op->num.sign = 0; op->num.size = op->num.alloc = 0; mp_free(op->num.digs); op->den.sign = 0; op->den.size = op->den.alloc = 0; mp_free(op->den.digs); } void mpr_set(mpr *rop, mpr *op) { if (rop != op) { mpi_set(mpr_num(rop), mpr_num(op)); mpi_set(mpr_den(rop), mpr_den(op)); } } void mpr_seti(mpr *rop, long num, long den) { mpi_seti(mpr_num(rop), num); mpi_seti(mpr_den(rop), den); } void mpr_setd(mpr *rop, double d) { double val, num; int e, sign; /* initialize */ if (d < 0) { sign = 1; val = -d; } else { sign = 0; val = d; } val = frexp(val, &e); while (modf(val, &num) != 0.0 && val <= DBL_MAX / 2.0) { --e; val *= 2.0; } if (e >= 0) { mpi_setd(mpr_num(rop), d); mpi_seti(mpr_den(rop), 1); } else { mpi_setd(mpr_num(rop), sign ? -num : num); mpi_setd(mpr_den(rop), ldexp(1.0, -e)); } } void mpr_setstr(mpr *rop, char *str, int base) { char *slash = strchr(str, '/'); mpi_setstr(mpr_num(rop), str, base); if (slash != NULL) mpi_setstr(mpr_den(rop), slash + 1, base); else mpi_seti(mpr_den(rop), 1); } void mpr_canonicalize(mpr *op) { mpi gcd; memset(&gcd, '\0', sizeof(mpi)); mpi_gcd(&gcd, mpr_num(op), mpr_den(op)); if (mpi_cmpabsi(&gcd, 1)) { mpi_div(mpr_num(op), mpr_num(op), &gcd); mpi_div(mpr_den(op), mpr_den(op), &gcd); } if (op->den.sign) { op->num.sign = !op->num.sign; op->den.sign = 0; } mpi_clear(&gcd); } void mpr_add(mpr *rop, mpr *op1, mpr *op2) { mpr_addsub(rop, op1, op2, 0); } void mpr_addi(mpr *rop, mpr *op1, long op2) { mpi prod; memset(&prod, '\0', sizeof(mpi)); mpi_muli(&prod, mpr_den(op1), op2); mpi_add(mpr_num(rop), mpr_num(op1), &prod); mpi_clear(&prod); } void mpr_sub(mpr *rop, mpr *op1, mpr *op2) { mpr_addsub(rop, op1, op2, 1); } void mpr_subi(mpr *rop, mpr *op1, long op2) { mpi prod; memset(&prod, '\0', sizeof(mpi)); mpi_muli(&prod, mpr_den(op1), op2); mpi_sub(mpr_num(rop), mpr_num(op1), &prod); mpi_clear(&prod); } static void mpr_addsub(mpr *rop, mpr *op1, mpr *op2, int sub) { mpi prod1, prod2; memset(&prod1, '\0', sizeof(mpi)); memset(&prod2, '\0', sizeof(mpi)); mpi_mul(&prod1, mpr_num(op1), mpr_den(op2)); mpi_mul(&prod2, mpr_num(op2), mpr_den(op1)); if (sub) mpi_sub(mpr_num(rop), &prod1, &prod2); else mpi_add(mpr_num(rop), &prod1, &prod2); mpi_clear(&prod1); mpi_clear(&prod2); mpi_mul(mpr_den(rop), mpr_den(op1), mpr_den(op2)); } void mpr_mul(mpr *rop, mpr *op1, mpr *op2) { /* check if temporary storage is required */ if (op1 == op2 && rop == op1) { mpi prod; memset(&prod, '\0', sizeof(mpi)); mpi_mul(&prod, mpr_num(op1), mpr_num(op2)); mpi_mul(mpr_den(rop), mpr_den(op1), mpr_den(op2)); mpi_set(mpr_num(rop), &prod); mpi_clear(&prod); } else { mpi_mul(mpr_num(rop), mpr_num(op1), mpr_num(op2)); mpi_mul(mpr_den(rop), mpr_den(op1), mpr_den(op2)); } } void mpr_muli(mpr *rop, mpr *op1, long op2) { mpi_muli(mpr_num(rop), mpr_num(op1), op2); } void mpr_div(mpr *rop, mpr *op1, mpr *op2) { /* check if temporary storage is required */ if (op1 == op2 && rop == op1) { mpi prod; memset(&prod, '\0', sizeof(mpi)); mpi_mul(&prod, mpr_num(op1), mpr_den(op2)); mpi_mul(mpr_den(rop), mpr_num(op2), mpr_den(op1)); mpi_set(mpr_num(rop), &prod); mpi_clear(&prod); } else { mpi_mul(mpr_num(rop), mpr_num(op1), mpr_den(op2)); mpi_mul(mpr_den(rop), mpr_num(op2), mpr_den(op1)); } } void mpr_divi(mpr *rop, mpr *op1, long op2) { mpi_muli(mpr_den(rop), mpr_den(op1), op2); } void mpr_inv(mpr *rop, mpr *op) { if (rop == op) mpi_swap(mpr_num(op), mpr_den(op)); else { mpi_set(mpr_num(rop), mpr_den(op)); mpi_set(mpr_den(rop), mpr_num(op)); } } void mpr_neg(mpr *rop, mpr *op) { mpi_neg(mpr_num(rop), mpr_num(op)); mpi_set(mpr_den(rop), mpr_den(op)); } void mpr_abs(mpr *rop, mpr *op) { if (mpr_num(op)->sign) mpi_neg(mpr_num(rop), mpr_num(op)); else mpi_set(mpr_num(rop), mpr_num(op)); /* op may not be canonicalized */ if (mpr_den(op)->sign) mpi_neg(mpr_den(rop), mpr_den(op)); else mpi_set(mpr_den(rop), mpr_den(op)); } int mpr_cmp(mpr *op1, mpr *op2) { return (mpr_docmp(op1, op2, 1)); } int mpr_cmpi(mpr *op1, long op2) { int cmp; mpr rat; mpr_init(&rat); mpi_seti(mpr_num(&rat), op2); cmp = mpr_docmp(op1, &rat, 1); mpr_clear(&rat); return (cmp); } int mpr_cmpabs(mpr *op1, mpr *op2) { return (mpr_docmp(op1, op2, 0)); } int mpr_cmpabsi(mpr *op1, long op2) { int cmp; mpr rat; mpr_init(&rat); mpi_seti(mpr_num(&rat), op2); cmp = mpr_docmp(op1, &rat, 0); mpr_clear(&rat); return (cmp); } static int mpr_docmp(mpr *op1, mpr *op2, int sign) { int cmp, neg; mpi prod1, prod2; neg = 0; if (sign) { /* if op1 is negative */ if (mpr_num(op1)->sign ^ mpr_den(op1)->sign) { /* if op2 is positive */ if (!(mpr_num(op2)->sign ^ mpr_den(op2)->sign)) return (-1); else neg = 1; } /* if op2 is negative */ else if (mpr_num(op2)->sign ^ mpr_den(op2)->sign) return (1); /* else same sign */ } /* if denominators are equal, compare numerators */ if (mpi_cmpabs(mpr_den(op1), mpr_den(op2)) == 0) { cmp = mpi_cmpabs(mpr_num(op1), mpr_num(op2)); if (cmp == 0) return (0); if (sign && neg) return (cmp < 0 ? 1 : -1); return (cmp); } memset(&prod1, '\0', sizeof(mpi)); memset(&prod2, '\0', sizeof(mpi)); /* "divide" op1 by op2 * if result is smaller than 1, op1 is smaller than op2 */ mpi_mul(&prod1, mpr_num(op1), mpr_den(op2)); mpi_mul(&prod2, mpr_num(op2), mpr_den(op1)); cmp = mpi_cmpabs(&prod1, &prod2); mpi_clear(&prod1); mpi_clear(&prod2); if (sign && neg) return (cmp < 0 ? 1 : -1); return (cmp); } void mpr_swap(mpr *op1, mpr *op2) { if (op1 != op2) { mpr swap; memcpy(&swap, op1, sizeof(mpr)); memcpy(op1, op2, sizeof(mpr)); memcpy(op2, &swap, sizeof(mpr)); } } int mpr_fiti(mpr *op) { return (mpi_fiti(mpr_num(op)) && mpi_fiti(mpr_den(op))); } double mpr_getd(mpr *op) { return (mpi_getd(mpr_num(op)) / mpi_getd(mpr_den(op))); } char * mpr_getstr(char *str, mpr *op, int base) { int len; if (str == NULL) { len = mpi_getsize(mpr_num(op), base) + mpr_num(op)->sign + 1 + mpi_getsize(mpr_den(op), base) + mpr_den(op)->sign + 1; str = mp_malloc(len); } (void)mpi_getstr(str, mpr_num(op), base); len = strlen(str); str[len] = '/'; (void)mpi_getstr(str + len + 1, mpr_den(op), base); return (str); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/require.h0000664000000000000000000000330512472175711016112 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/require.h,v 1.4tsi Exp $ */ #ifndef Lisp_require_h #define Lisp_require_h #include "lisp/private.h" #include "lisp/helper.h" #ifdef SHARED_MODULES #include #endif LispObj *Lisp_Load(LispBuiltin*); LispObj *Lisp_Require(LispBuiltin*); #endif /* Lisp_require_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/getenv.c0000664000000000000000000000540612472175711015725 0ustar /* $OpenBSD: getenv.c,v 1.10 2010/08/23 22:31:50 millert Exp $ */ /* * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include #include char *__findenv(const char *name, int len, int *offset); /* * __findenv -- * Returns pointer to value associated with name, if any, else NULL. * Starts searching within the environmental array at offset. * Sets offset to be the offset of the name/value combination in the * environmental array, for use by putenv(3), setenv(3) and unsetenv(3). * Explicitly removes '=' in argument name. * * This routine *should* be a static; don't use it. */ char * __findenv(const char *name, int len, int *offset) { extern char **environ; int i; const char *np; char **p, *cp; if (name == NULL || environ == NULL) return (NULL); for (p = environ + *offset; (cp = *p) != NULL; ++p) { for (np = name, i = len; i && *cp; i--) if (*cp++ != *np++) break; if (i == 0 && *cp++ == '=') { *offset = p - environ; return (cp); } } return (NULL); } /* * getenv -- * Returns ptr to value associated with name, if any, else NULL. */ char * getenv(const char *name) { int offset = 0; const char *np; for (np = name; *np && *np != '='; ++np) ; return (__findenv(name, (int)(np - name), &offset)); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/time.h0000664000000000000000000000311312472175711015371 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/time.h,v 1.3tsi Exp $ */ #ifndef Lisp_time_h #define Lisp_time_h #include "lisp/private.h" LispObj *Lisp_Time(LispBuiltin*); #endif /* Lisp_time_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/debugger.c0000664000000000000000000005352212472175711016223 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/debugger.c,v 1.24tsi Exp $ */ #include #include "lisp/io.h" #include "lisp/debugger.h" #include "lisp/write.h" #ifdef DEBUGGER #define DebuggerHelp 0 #define DebuggerAbort 1 #define DebuggerBacktrace 2 #define DebuggerContinue 3 #define DebuggerFinish 4 #define DebuggerFrame 5 #define DebuggerNext 6 #define DebuggerPrint 7 #define DebuggerStep 8 #define DebuggerBreak 9 #define DebuggerDelete 10 #define DebuggerDown 11 #define DebuggerUp 12 #define DebuggerInfo 13 #define DebuggerWatch 14 #define DebuggerInfoBreakpoints 0 #define DebuggerInfoBacktrace 1 /* * Prototypes */ static char *format_integer(int); static void LispDebuggerCommand(LispObj *obj); /* * Initialization */ static struct { const char *name; int action; } const commands[] = { {"help", DebuggerHelp}, {"abort", DebuggerAbort}, {"backtrace", DebuggerBacktrace}, {"b", DebuggerBreak}, {"break", DebuggerBreak}, {"bt", DebuggerBacktrace}, {"continue", DebuggerContinue}, {"d", DebuggerDelete}, {"delete", DebuggerDelete}, {"down", DebuggerDown}, {"finish", DebuggerFinish}, {"frame", DebuggerFrame}, {"info", DebuggerInfo}, {"n", DebuggerNext}, {"next", DebuggerNext}, {"print", DebuggerPrint}, {"run", DebuggerContinue}, {"s", DebuggerStep}, {"step", DebuggerStep}, {"up", DebuggerUp}, {"watch", DebuggerWatch}, }; static struct { const char *name; int subaction; } const info_commands[] = { {"breakpoints", DebuggerInfoBreakpoints}, {"stack", DebuggerInfoBacktrace}, {"watchpoints", DebuggerInfoBreakpoints}, }; static const char *debugger_help = "Available commands are:\n\ \n\ help - This message.\n\ abort - Abort the current execution, and return to toplevel.\n\ backtrace, bt - Print backtrace.\n\ b, break - Set breakpoint at function name argument.\n\ continue - Continue execution.\n\ d, delete - Delete breakpoint(s), all breakpoint if no arguments given.\n\ down - Set environment to frame called by the current one.\n\ finish - Executes until current form is finished.\n\ frame - Set environment to selected frame.\n\ info - Prints information about the debugger state.\n\ n, next - Evaluate next form.\n\ print - Print value of variable name argument.\n\ run - Continue execution.\n\ s, step - Evaluate next form, stopping on any subforms.\n\ up - Set environment to frame that called the current one.\n\ \n\ Commands may be abbreviated.\n"; static const char *debugger_info_help = "Available subcommands are:\n\ \n\ breakpoints - List and prints status of breakpoints, and watchpoints.\n\ stack - Backtrace of stack.\n\ watchpoints - List and prints status of watchpoints, and breakpoints.\n\ \n\ Subcommands may be abbreviated.\n"; /* Debugger variables layout (if you change it, update description): * * DBG * is a macro for lisp__data.dbglist * is a NIL terminated list * every element is a list in the format (NOT NIL terminated): * (list* NAM ARG ENV HED LEX) * where * NAM is an ATOM for the function/macro name * or NIL for lambda expressions * ARG is NAM arguments (a LIST) * ENV is the value of lisp__data.stack.base (a FIXNUM) * LEN is the value of lisp__data.env.length (a FIXNUM) * LEX is the value of lisp__data.env.lex (a FIXNUM) * new elements are added to the beggining of the DBG list * * BRK * is macro for lisp__data.brklist * is a NIL terminated list * every element is a list in the format (NIL terminated): * (list NAM IDX TYP HIT VAR VAL FRM) * where * NAM is an ATOM for the name of the object at * wich the breakpoint was added * IDX is a FIXNUM, the breakpoint number * must be stored, as breakpoints may be deleted * TYP is a FIXNUM that must be an integer of enum LispBreakType * HIT is a FIXNUM, with the number of times this breakpoint was * hitted. * VAR variable to watch a SYMBOL (not needed for breakpoints) * VAL value of watched variable (not needed for breakpoints) * FRM frame where variable started being watched * (not needed for breakpoints) * new elements are added to the end of the list */ /* * Implementation */ void LispDebugger(LispDebugCall call, LispObj *name, LispObj *arg) { int force = 0; LispObj *obj, *prev; switch (call) { case LispDebugCallBegin: ++lisp__data.debug_level; GCDisable(); DBG = CONS(CONS(name, CONS(arg, CONS(FIXNUM(lisp__data.stack.base), CONS(FIXNUM(lisp__data.env.length), FIXNUM(lisp__data.env.lex))))), DBG); GCEnable(); for (obj = BRK; obj != NIL; obj = CDR(obj)) if (ATOMID(CAR(CAR(obj))) == ATOMID(name) && FIXNUM_VALUE(CAR(CDR(CDR(CAR(obj))))) == LispDebugBreakFunction) break; if (obj != NIL) { long counter; /* if not at a fresh line */ if (LispGetColumn(NIL)) LispFputc(Stdout, '\n'); LispFputs(Stdout, "BREAK #"); LispWriteObject(NIL, CAR(CDR(CAR(obj)))); LispFputs(Stdout, "> ("); LispWriteObject(NIL, CAR(CAR(DBG))); LispFputc(Stdout, ' '); LispWriteObject(NIL, CAR(CDR(CAR(DBG)))); LispFputs(Stdout, ")\n"); force = 1; /* update hits counter */ counter = FIXNUM_VALUE(CAR(CDR(CDR(CDR(CAR(obj)))))); CAR(CDR(CDR(CDR(CAR(obj))))) FIXNUM(counter + 1); } break; case LispDebugCallEnd: DBG = CDR(DBG); if (lisp__data.debug_level < lisp__data.debug_step) lisp__data.debug_step = lisp__data.debug_level; --lisp__data.debug_level; break; case LispDebugCallFatal: LispDebuggerCommand(NIL); return; case LispDebugCallWatch: break; } /* didn't return, check watchpoints */ if (call == LispDebugCallEnd || call == LispDebugCallWatch) { watch_again: for (prev = obj = BRK; obj != NIL; prev = obj, obj = CDR(obj)) { if (FIXNUM_VALUE(CAR(CDR(CDR(CAR(obj))))) == LispDebugBreakVariable) { /* the variable */ LispObj *wat = CAR(CDR(CDR(CDR(CDR(CAR(obj)))))); void *sym = LispGetVarAddr(CAAR(obj)); LispObj *frm = CAR(CDR(CDR(CDR(CDR(CDR(CDR(CAR(obj)))))))); if ((sym == NULL && lisp__data.debug_level <= 0) || (sym != wat->data.opaque.data && FIXNUM_VALUE(frm) > lisp__data.debug_level)) { LispFputs(Stdout, "WATCH #"); LispFputs(Stdout, format_integer(FIXNUM_VALUE(CAR(CDR(CAR(obj)))))); LispFputs(Stdout, "> "); LispFputs(Stdout, STRPTR(CAR(CAR(obj)))); LispFputs(Stdout, " deleted. Variable does not exist anymore.\n"); /* force debugger to stop */ force = 1; if (obj == prev) { BRK = CDR(BRK); goto watch_again; } else RPLACD(prev, CDR(obj)); obj = prev; } else { /* current value */ LispObj *cur = *(LispObj**)wat->data.opaque.data; /* last value */ LispObj *val = CAR(CDR(CDR(CDR(CDR(CDR(CAR(obj))))))); if (XEQUAL(val, cur) == NIL) { long counter; LispFputs(Stdout, "WATCH #"); LispFputs(Stdout, format_integer(FIXNUM_VALUE(CAR(CDR(CAR(obj)))))); LispFputs(Stdout, "> "); LispFputs(Stdout, STRPTR(CAR(CAR(obj)))); LispFputc(Stdout, '\n'); LispFputs(Stdout, "OLD: "); LispWriteObject(NIL, val); LispFputs(Stdout, "\nNEW: "); LispWriteObject(NIL, cur); LispFputc(Stdout, '\n'); /* update current value */ CAR(CDR(CDR(CDR(CDR(CDR(CAR(obj))))))) = cur; /* update hits counter */ counter = FIXNUM_VALUE(CAR(CDR(CDR(CDR(CAR(obj)))))); CAR(CDR(CDR(CDR(CAR(obj))))) = FIXNUM(counter + 1); /* force debugger to stop */ force = 1; } } } } if (call == LispDebugCallWatch) /* special call, just don't keep gc protected variables that may be * using a lot of memory... */ return; } switch (lisp__data.debug) { case LispDebugUnspec: LispDebuggerCommand(NIL); goto debugger_done; case LispDebugRun: if (force) LispDebuggerCommand(NIL); goto debugger_done; case LispDebugFinish: if (!force && (call != LispDebugCallEnd || lisp__data.debug_level != lisp__data.debug_step)) goto debugger_done; break; case LispDebugNext: if (call == LispDebugCallBegin) { if (!force && lisp__data.debug_level != lisp__data.debug_step) goto debugger_done; } else if (call == LispDebugCallEnd) { if (!force && lisp__data.debug_level >= lisp__data.debug_step) goto debugger_done; } break; case LispDebugStep: break; } if (call == LispDebugCallBegin) { LispFputc(Stdout, '#'); LispFputs(Stdout, format_integer(lisp__data.debug_level)); LispFputs(Stdout, "> ("); LispWriteObject(NIL, CAR(CAR(DBG))); LispFputc(Stdout, ' '); LispWriteObject(NIL, CAR(CDR(CAR(DBG)))); LispFputs(Stdout, ")\n"); LispDebuggerCommand(NIL); } else if (call == LispDebugCallEnd) { LispFputc(Stdout, '#'); LispFputs(Stdout, format_integer(lisp__data.debug_level + 1)); LispFputs(Stdout, "= "); LispWriteObject(NIL, arg); LispFputc(Stdout, '\n'); LispDebuggerCommand(NIL); } else if (force) LispDebuggerCommand(arg); debugger_done: return; } static void LispDebuggerCommand(LispObj *args) { LispObj *obj, *frm, *curframe; int i = 0, frame, matches, action = -1, subaction = 0; char *cmd, *arg, *ptr, line[256]; int envbase = lisp__data.stack.base, envlen = lisp__data.env.length, envlex = lisp__data.env.lex; frame = lisp__data.debug_level; curframe = CAR(DBG); line[0] = '\0'; arg = line; for (;;) { LispFputs(Stdout, DBGPROMPT); LispFflush(Stdout); if (LispFgets(Stdin, line, sizeof(line)) == NULL) { LispFputc(Stdout, '\n'); return; } /* get command */ ptr = line; while (*ptr && isspace(*ptr)) ++ptr; cmd = ptr; while (*ptr && !isspace(*ptr)) ++ptr; if (*ptr) *ptr++ = '\0'; if (*cmd) { /* if *cmd is nul, then arg may be still set */ /* get argument(s) */ while (*ptr && isspace(*ptr)) ++ptr; arg = ptr; /* goto end of line */ if (*ptr) { while (*ptr) ++ptr; --ptr; while (*ptr && isspace(*ptr)) --ptr; if (*ptr) *++ptr = '\0'; } } if (*cmd == '\0') { if (action < 0) { if (lisp__data.debug == LispDebugFinish) action = DebuggerFinish; else if (lisp__data.debug == LispDebugNext) action = DebuggerNext; else if (lisp__data.debug == LispDebugStep) action = DebuggerStep; else if (lisp__data.debug == LispDebugRun) action = DebuggerContinue; else continue; } } else { for (i = matches = 0; i < sizeof(commands) / sizeof(commands[0]); i++) { const char *str = commands[i].name; ptr = cmd; while (*ptr && *ptr == *str) { ++ptr; ++str; } if (*ptr == '\0') { action = commands[i].action; if (*str == '\0') { matches = 1; break; } ++matches; } } if (matches == 0) { LispFputs(Stdout, "* Command unknown: "); LispFputs(Stdout, cmd); LispFputs(Stdout, ". Type help for help.\n"); continue; } else if (matches > 1) { LispFputs(Stdout, "* Command is ambiguous: "); LispFputs(Stdout, cmd); LispFputs(Stdout, ". Type help for help.\n"); continue; } } switch (action) { case DebuggerHelp: LispFputs(Stdout, debugger_help); break; case DebuggerInfo: if (*arg == '\0') { LispFputs(Stdout, debugger_info_help); break; } for (i = matches = 0; i < sizeof(info_commands) / sizeof(info_commands[0]); i++) { const char *str = info_commands[i].name; ptr = arg; while (*ptr && *ptr == *str) { ++ptr; ++str; } if (*ptr == '\0') { subaction = info_commands[i].subaction; if (*str == '\0') { matches = 1; break; } ++matches; } } if (matches == 0) { LispFputs(Stdout, "* Command unknown: "); LispFputs(Stdout, arg); LispFputs(Stdout, ". Type info for help.\n"); continue; } else if (matches > 1) { LispFputs(Stdout, "* Command is ambiguous: "); LispFputs(Stdout, arg); LispFputs(Stdout, ". Type info for help.\n"); continue; } switch (subaction) { case DebuggerInfoBreakpoints: LispFputs(Stdout, "Num\tHits\tType\t\tWhat\n"); for (obj = BRK; obj != NIL; obj = CDR(obj)) { /* breakpoint number */ LispFputc(Stdout, '#'); LispWriteObject(NIL, CAR(CDR(CAR(obj)))); /* number of hits */ LispFputc(Stdout, '\t'); LispWriteObject(NIL, CAR(CDR(CDR(CDR(CAR(obj)))))); /* breakpoint type */ LispFputc(Stdout, '\t'); switch ((int)FIXNUM_VALUE(CAR(CDR(CDR(CAR(obj)))))) { case LispDebugBreakFunction: LispFputs(Stdout, "Function"); break; case LispDebugBreakVariable: LispFputs(Stdout, "Variable"); break; } /* breakpoint object */ LispFputc(Stdout, '\t'); LispWriteObject(NIL, CAR(CAR(obj))); LispFputc(Stdout, '\n'); } break; case DebuggerInfoBacktrace: goto debugger_print_backtrace; } break; case DebuggerAbort: while (lisp__data.mem.level) { --lisp__data.mem.level; if (lisp__data.mem.mem[lisp__data.mem.level]) free(lisp__data.mem.mem[lisp__data.mem.level]); } lisp__data.mem.index = 0; LispTopLevel(); if (!lisp__data.running) { LispMessage("*** Fatal: nowhere to longjmp."); abort(); } /* don't need to restore environment */ siglongjmp(lisp__data.jmp, 1); /*NOTREACHED*/ break; case DebuggerBreak: for (ptr = arg; *ptr; ptr++) { if (isspace(*ptr)) break; else *ptr = toupper(*ptr); } if (!*arg || *ptr || strchr(arg, '(') || strchr(arg, '(') || strchr(arg, ';')) { LispFputs(Stdout, "* Bad function name '"); LispFputs(Stdout, arg); LispFputs(Stdout, "' specified.\n"); } else { for (obj = frm = BRK; obj != NIL; frm = obj, obj = CDR(obj)) ; i = lisp__data.debug_break; ++lisp__data.debug_break; GCDisable(); obj = CONS(ATOM(arg), CONS(FIXNUM(i), CONS(FIXNUM(LispDebugBreakFunction), CONS(FIXNUM(0), NIL)))); if (BRK == NIL) BRK = CONS(obj, NIL); else RPLACD(frm, CONS(obj, NIL)); GCEnable(); } break; case DebuggerWatch: { void *sym; int vframe; LispObj *val, *atom; /* make variable name uppercase, an ATOM */ ptr = arg; while (*ptr) { *ptr = toupper(*ptr); ++ptr; } atom = ATOM(arg); val = LispGetVar(atom); if (val == NULL) { LispFputs(Stdout, "* No variable named '"); LispFputs(Stdout, arg); LispFputs(Stdout, "' in the selected frame.\n"); break; } /* variable is available at the current frame */ sym = LispGetVarAddr(atom); /* find the lowest frame where the variable is visible */ vframe = 0; if (frame > 0) { for (; vframe < frame; vframe++) { for (frm = DBG, i = lisp__data.debug_level; i > vframe; frm = CDR(frm), i--) ; obj = CAR(frm); lisp__data.stack.base = FIXNUM_VALUE(CAR(CDR(CDR(obj)))); lisp__data.env.length = FIXNUM_VALUE(CAR(CDR(CDR(CDR(obj))))); lisp__data.env.lex = FIXNUM_VALUE(CDR(CDR(CDR(CDR(obj))))); if (LispGetVarAddr(atom) == sym) /* got variable initial frame */ break; } vframe = i; if (vframe != frame) { /* restore environment */ for (frm = DBG, i = lisp__data.debug_level; i > frame; frm = CDR(frm), i--) ; obj = CAR(frm); lisp__data.stack.base = FIXNUM_VALUE(CAR(CDR(CDR(obj)))); lisp__data.env.length = FIXNUM_VALUE(CAR(CDR(CDR(CDR(obj))))); lisp__data.env.lex = FIXNUM_VALUE(CDR(CDR(CDR(CDR(obj))))); } } i = lisp__data.debug_break; ++lisp__data.debug_break; for (obj = frm = BRK; obj != NIL; frm = obj, obj = CDR(obj)) ; GCDisable(); obj = CONS(atom, /* NAM */ CONS(FIXNUM(i), /* IDX */ CONS(FIXNUM(LispDebugBreakVariable), /* TYP */ CONS(FIXNUM(0), /* HIT */ CONS(OPAQUE(sym, 0), /* VAR */ CONS(val, /* VAL */ CONS(FIXNUM(vframe),/* FRM */ NIL))))))); /* add watchpoint */ if (BRK == NIL) BRK = CONS(obj, NIL); else RPLACD(frm, CONS(obj, NIL)); GCEnable(); } break; case DebuggerDelete: if (*arg == 0) { int confirm = 0; for (;;) { int ch; LispFputs(Stdout, "* Delete all breakpoints? (y or n) "); LispFflush(Stdout); if ((ch = LispFgetc(Stdin)) == '\n') continue; while ((i = LispFgetc(Stdin)) != '\n' && i != EOF) ; if (tolower(ch) == 'n') break; else if (tolower(ch) == 'y') { confirm = 1; break; } } if (confirm) BRK = NIL; } else { for (ptr = arg; *ptr;) { while (*ptr && isdigit(*ptr)) ++ptr; if (*ptr && !isspace(*ptr)) { *ptr = '\0'; LispFputs(Stdout, "* Bad breakpoint number '"); LispFputs(Stdout, arg); LispFputs(Stdout, "' specified.\n"); break; } i = atoi(arg); for (obj = frm = BRK; frm != NIL; obj = frm, frm = CDR(frm)) if (FIXNUM_VALUE(CAR(CDR(CAR(frm)))) == i) break; if (frm == NIL) { LispFputs(Stdout, "* No breakpoint number "); LispFputs(Stdout, arg); LispFputs(Stdout, " available.\n"); break; } if (obj == frm) BRK = CDR(BRK); else RPLACD(obj, CDR(frm)); while (*ptr && isspace(*ptr)) ++ptr; arg = ptr; } } break; case DebuggerFrame: i = -1; ptr = arg; if (*ptr) { i = 0; while (*ptr && isdigit(*ptr)) { i *= 10; i += *ptr - '0'; ++ptr; } if (*ptr) { LispFputs(Stdout, "* Frame identifier must " "be a positive number.\n"); break; } } else goto debugger_print_frame; if (i >= 0 && i <= lisp__data.debug_level) goto debugger_new_frame; LispFputs(Stdout, "* No such frame "); LispFputs(Stdout, format_integer(i)); LispFputs(Stdout, ".\n"); break; case DebuggerDown: if (frame + 1 > lisp__data.debug_level) { LispFputs(Stdout, "* Cannot go down.\n"); break; } i = frame + 1; goto debugger_new_frame; break; case DebuggerUp: if (frame == 0) { LispFputs(Stdout, "* Cannot go up.\n"); break; } i = frame - 1; goto debugger_new_frame; break; case DebuggerPrint: ptr = arg; while (*ptr) { *ptr = toupper(*ptr); ++ptr; } obj = LispGetVar(ATOM(arg)); if (obj != NULL) { LispWriteObject(NIL, obj); LispFputc(Stdout, '\n'); } else { LispFputs(Stdout, "* No variable named '"); LispFputs(Stdout, arg); LispFputs(Stdout, "' in the selected frame.\n"); } break; case DebuggerBacktrace: debugger_print_backtrace: if (DBG == NIL) { LispFputs(Stdout, "* No stack.\n"); break; } DBG = LispReverse(DBG); for (obj = DBG, i = 0; obj != NIL; obj = CDR(obj), i++) { frm = CAR(obj); LispFputc(Stdout, '#'); LispFputs(Stdout, format_integer(i)); LispFputs(Stdout, "> ("); LispWriteObject(NIL, CAR(frm)); LispFputc(Stdout, ' '); LispWriteObject(NIL, CAR(CDR(frm))); LispFputs(Stdout, ")\n"); } DBG = LispReverse(DBG); break; case DebuggerContinue: lisp__data.debug = LispDebugRun; goto debugger_command_done; case DebuggerFinish: if (lisp__data.debug != LispDebugFinish) { lisp__data.debug_step = lisp__data.debug_level - 2; lisp__data.debug = LispDebugFinish; } else lisp__data.debug_step = lisp__data.debug_level - 1; goto debugger_command_done; case DebuggerNext: if (lisp__data.debug != LispDebugNext) { lisp__data.debug = LispDebugNext; lisp__data.debug_step = lisp__data.debug_level + 1; } goto debugger_command_done; case DebuggerStep: lisp__data.debug = LispDebugStep; goto debugger_command_done; } continue; debugger_new_frame: /* goto here with i as the new frame value, after error checking */ if (i != frame) { frame = i; for (frm = DBG, i = lisp__data.debug_level; i > frame; frm = CDR(frm), i--) ; curframe = CAR(frm); lisp__data.stack.base = FIXNUM_VALUE(CAR(CDR(CDR(curframe)))); lisp__data.env.length = FIXNUM_VALUE(CAR(CDR(CDR(CDR(curframe))))); lisp__data.env.lex = FIXNUM_VALUE(CDR(CDR(CDR(CDR(curframe))))); } debugger_print_frame: LispFputc(Stdout, '#'); LispFputs(Stdout, format_integer(frame)); LispFputs(Stdout, "> ("); LispWriteObject(NIL, CAR(curframe)); LispFputc(Stdout, ' '); LispWriteObject(NIL, CAR(CDR(curframe))); LispFputs(Stdout, ")\n"); } debugger_command_done: lisp__data.stack.base = envbase; lisp__data.env.length = envlen; lisp__data.env.lex = envlex; } static char * format_integer(int integer) { static char buffer[16]; sprintf(buffer, "%d", integer); return (buffer); } #endif /* DEBUGGER */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/format.c0000664000000000000000000015631012472175711015726 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/format.c,v 1.29tsi Exp $ */ #include "lisp/io.h" #include "lisp/write.h" #include "lisp/format.h" #include #define MAXFMT 8 #define NOERROR 0 /* parse error codes */ #define PARSE_2MANYPARM 1 /* too many directive parameters */ #define PARSE_2MANYATS 2 /* more than one @ in directive */ #define PARSE_2MANYCOLS 3 /* more than one : in directive */ #define PARSE_NOARGSLEFT 4 /* no arguments left to format */ #define PARSE_BADFMTARG 5 /* argument is not an integer or char */ #define PARSE_BADDIRECTIVE 6 /* unknown format directive */ #define PARSE_BADINTEGER 7 /* bad integer representation */ /* merge error codes */ #define MERGE_2MANY 1 /* too many parameters to directive */ #define MERGE_NOCHAR 2 /* parameter must be a character */ #define MERGE_NOINT 3 /* parameter must be an integer */ /* generic error codes */ #define GENERIC_RADIX 1 /* radix not in range 2-36 */ #define GENERIC_NEGATIVE 2 /* parameter is negative */ #define GENERIC_BADSTRING 3 /* argument is not a string */ #define GENERIC_BADLIST 4 /* argument is not a list */ #define IF_SPECIFIED(arg) (arg).specified ? &((arg).value) : NULL #define UPANDOUT_NORMAL 1 #define UPANDOUT_COLLON 2 #define UPANDOUT_HASH 4 /* only useful inside a ~{ iteration * forces loop finalization. */ #define ITERATION_NORMAL 1 #define ITERATION_LAST 2 /* * Types */ /* parameter to format */ typedef struct { unsigned int achar : 1; /* value was specified as a character */ unsigned int specified : 1; /* set if value was specified */ unsigned int offset : 30; /* offset in format string, for error printing */ int value; } FmtArg; /* information about format parameters */ typedef struct { unsigned int atsign : 1; /* @ specified */ unsigned int collon : 1; /* : specified */ unsigned int command : 8; /* the format command */ unsigned int count : 4; /* number of arguments processed */ unsigned int offset : 10; /* offset in format string, for error printing */ char *base, *format; FmtArg arguments[MAXFMT]; } FmtArgs; /* used for combining default format parameter values */ typedef struct { int achar; int value; } FmtDef; /* number of default format parameter values and defaults */ typedef struct { int count; FmtDef defaults[MAXFMT]; } FmtDefs; /* used on recursive calls to LispFormat */ typedef struct { FmtArgs args; LispObj *base_arguments; /* pointer to first format argument */ int total_arguments; /* number of objects in base_arguments */ char **format; /* if need to update format string pointer */ LispObj **object; /* CAR(arguments), for plural check */ LispObj **arguments; /* current element of base_arguments */ int *num_arguments; /* number of arguments after arguments */ int upandout; /* information for recursive calls */ int iteration; /* only set if in ~:{... or ~:@{ and in the * last argument list, hint for upandout */ } FmtInfo; /* * Prototypes */ static void merge_arguments(FmtArgs*, const FmtDefs*, int*); static char *parse_arguments(char*, FmtArgs*, int*, LispObj**, int*); static void merge_error(FmtArgs*, int); static void parse_error(FmtArgs*, int); static void generic_error(FmtArgs*, int); static void format_error(FmtArgs*, const char*); static int format_object(LispObj*, LispObj*); static void format_ascii(LispObj*, LispObj*, FmtArgs*); static void format_in_radix(LispObj*, LispObj*, int, FmtArgs*); static void format_radix_special(LispObj*, LispObj*, FmtArgs*); static void format_roman(LispObj*, LispObj*, FmtArgs*); static void format_english(LispObj*, LispObj*, FmtArgs*); static void format_character(LispObj*, LispObj*, FmtArgs*); static void format_fixed_float(LispObj*, LispObj*, FmtArgs*); static void format_exponential_float(LispObj*, LispObj*, FmtArgs*); static void format_general_float(LispObj*, LispObj*, FmtArgs*); static void format_dollar_float(LispObj*, LispObj*, FmtArgs*); static void format_tabulate(LispObj*, FmtArgs*); static void format_goto(FmtInfo*); static void format_indirection(LispObj*, LispObj*, FmtInfo*); static void list_formats(FmtInfo*, int, char**, char***, int*, int*, int*, int*); static void free_formats(char**, int); static void format_case_conversion(LispObj*, FmtInfo*); static void format_conditional(LispObj*, FmtInfo*); static void format_iterate(LispObj*, FmtInfo*); static void format_justify(LispObj*, FmtInfo*); static void LispFormat(LispObj*, FmtInfo*); /* * Initialization */ static const FmtDefs AsciiDefs = { 4, { {0, 0}, /* mincol */ {0, 1}, /* colinc */ {0, 0}, /* minpad */ {1, ' '}, /* padchar */ }, }; static const FmtDefs IntegerDefs = { 4, { {0, 0}, /* mincol */ {1, ' '}, /* padchar */ {1, ','}, /* commachar */ {0, 3}, /* commainterval */ }, }; static const FmtDefs RadixDefs = { 5, { {0, 10}, /* radix */ {0, 0}, /* mincol */ {1, ' '}, /* padchar */ {1, ','}, /* commachar */ {0, 3}, /* commainterval */ }, }; static const FmtDefs NoneDefs = { 0, }; static const FmtDefs FixedFloatDefs = { 5, { {0, 0}, /* w */ {0, 16}, /* d */ {0, 0}, /* k */ {1, '\0'}, /* overflowchar */ {1, ' '}, /* padchar */ }, }; static const FmtDefs ExponentialFloatDefs = { 7, { {0, 0}, /* w */ {0, 16}, /* d */ {0, 0}, /* e */ {0, 1}, /* k */ {1, '\0'}, /* overflowchar */ {1, ' '}, /* padchar */ {1, 'E'}, /* exponentchar */ /* XXX if/when more than one float format, * should default to object type */ }, }; static const FmtDefs DollarFloatDefs = { 4, { {0, 2}, /* d */ {0, 1}, /* n */ {0, 0}, /* w */ {1, ' '}, /* padchar */ }, }; static const FmtDefs OneDefs = { 1, { {0, 1}, }, }; static const FmtDefs TabulateDefs = { 2, { {0, 0}, /* colnum */ {0, 1}, /* colinc */ }, }; extern LispObj *Oprint_escape; /* * Implementation */ static void merge_arguments(FmtArgs *arguments, const FmtDefs *defaults, int *code) { int count; const FmtDef *defaul; FmtArg *argument; defaul = &(defaults->defaults[0]); argument = &(arguments->arguments[0]); for (count = 0; count < defaults->count; count++, argument++, defaul++) { if (count >= arguments->count) argument->specified = 0; if (argument->specified) { if (argument->achar != defaul->achar) { *code = defaul->achar ? MERGE_NOCHAR : MERGE_NOINT; arguments->offset = argument->offset; return; } } else { argument->specified = 0; argument->achar = defaul->achar; argument->value = defaul->value; } } /* check if extra arguments were provided */ if (arguments->count > defaults->count) *code = MERGE_2MANY; } /* the pointer arguments may be null, useful when just testing/parsing * the directive parameters */ static char * parse_arguments(char *format, FmtArgs *arguments, int *num_objects, LispObj **objects, int *code) { int test; char *ptr; FmtArg *argument; unsigned int tmpcmd = 0; /* initialize */ test = objects == NULL || code == NULL || num_objects == NULL; ptr = format; argument = &(arguments->arguments[0]); arguments->atsign = arguments->collon = arguments->command = 0; /* parse format parameters */ for (arguments->count = 0;; arguments->count++) { arguments->offset = ptr - format + 1; if (arguments->count >= MAXFMT) { if (!test) *code = PARSE_2MANYPARM; return (ptr); } if (*ptr == '\'') { /* character parameter value */ ++ptr; /* skip ' */ argument->achar = argument->specified = 1; argument->value = *ptr++; } else if (*ptr == ',') { /* use default parameter value */ argument->achar = 0; argument->specified = 0; /* don't increment ptr, will be incremented below */ } else if (*ptr == '#') { /* number of arguments is value */ ++ptr; /* skip # */ argument->achar = 0; argument->specified = 1; if (!test) argument->value = *num_objects; } else if (*ptr == 'v' || *ptr == 'V') { /* format object argument is value */ LispObj *object; ++ptr; /* skip V */ if (!test) { if (!CONSP(*objects)) { *code = PARSE_NOARGSLEFT; return (ptr); } object = CAR((*objects)); if (FIXNUMP(object)) { argument->achar = 0; argument->specified = 1; argument->value = FIXNUM_VALUE(object); } else if (SCHARP(object)) { argument->achar = argument->specified = 1; argument->value = SCHAR_VALUE(object); } else { *code = PARSE_BADFMTARG; return (ptr); } *objects = CDR(*objects); --*num_objects; } } else if (isdigit(*ptr) || *ptr == '-' || *ptr == '+') { /* integer parameter value */ int sign; argument->achar = 0; argument->specified = 1; if (!isdigit(*ptr)) { sign = *ptr++ == '-'; } else sign = 0; if (!test && !isdigit(*ptr)) { *code = PARSE_BADINTEGER; return (ptr); } argument->value = *ptr++ - '0'; while (isdigit(*ptr)) { argument->value = (argument->value * 10) + (*ptr++ - '0'); if (argument->value > 65536) { if (!test) { *code = PARSE_BADINTEGER; return (ptr); } } } if (sign) argument->value = -argument->value; } else /* no more arguments to format */ break; if (*ptr == ',') ++ptr; /* remember offset of format parameter, for better error printing */ argument->offset = arguments->offset; argument++; } /* check for extra flags */ for (;;) { if (*ptr == '@') { /* check for special parameter atsign */ if (arguments->atsign) { if (!test) { *code = PARSE_2MANYATS; return (ptr); } } ++ptr; ++arguments->offset; arguments->atsign = 1; } else if (*ptr == ':') { /* check for special parameter collon */ if (arguments->collon) { if (!test) { *code = PARSE_2MANYCOLS; return (ptr); } } ++ptr; ++arguments->offset; arguments->collon = 1; } else /* next value is format command */ break; } if (!test) *code = NOERROR; arguments->command = *ptr++; tmpcmd = arguments->command; if (islower(tmpcmd)) arguments->command = toupper(tmpcmd); ++arguments->offset; return (ptr); } static void parse_error(FmtArgs *args, int code) { static const char * const errors[] = { NULL, "too many parameters to directive", "too many @ parameters", "too many : parameters", "no arguments left to format", "argument is not a fixnum integer or a character", "unknown format directive", "parameter is not a fixnum integer", }; format_error(args, errors[code]); } static void merge_error(FmtArgs *args, int code) { static const char * const errors[] = { NULL, "too many parameters to directive", "argument must be a character", "argument must be a fixnum integer", }; format_error(args, errors[code]); } static void generic_error(FmtArgs *args, int code) { static const char * const errors[] = { NULL, "radix must be in the range 2 to 36, inclusive", "parameter must be positive", "argument must be a string", "argument must be a list", }; format_error(args, errors[code]); } static void format_error(FmtArgs *args, const char *str) { char *message; int errorlen, formatlen; /* number of bytes of format to be printed */ formatlen = (args->format - args->base) + args->offset; /* length of specific error message */ errorlen = strlen(str) + 1; /* plus '\n' */ /* XXX allocate string with LispMalloc, * so that it will be freed in LispTopLevel */ message = LispMalloc(formatlen + errorlen + 1); sprintf(message, "%s\n", str); memcpy(message + errorlen, args->base, formatlen); message[errorlen + formatlen] = '\0'; LispDestroy("FORMAT: %s", message); } static int format_object(LispObj *stream, LispObj *object) { int length; length = LispWriteObject(stream, object); return (length); } static void format_ascii(LispObj *stream, LispObj *object, FmtArgs *args) { GC_ENTER(); LispObj *string = NIL; int length = 0, atsign = args->atsign, collon = args->collon, mincol = args->arguments[0].value, colinc = args->arguments[1].value, minpad = args->arguments[2].value, padchar = args->arguments[3].value; /* check/correct arguments */ if (mincol < 0) mincol = 0; if (colinc < 0) colinc = 1; if (minpad < 0) minpad = 0; /* XXX pachar can be the null character? */ if (object == NIL) length = collon ? 2 : 3; /* () or NIL */ /* left padding */ if (atsign) { /* if length not yet known */ if (object == NIL) { string = LSTRINGSTREAM("", STREAM_READ | STREAM_WRITE, 0); GC_PROTECT(string); length = LispWriteObject(string, object); } /* output minpad characters at left */ if (minpad) { length += minpad; LispWriteChars(stream, padchar, minpad); } if (colinc) { /* puts colinc spaces at a time, * until at least mincol chars out */ while (length < mincol) { LispWriteChars(stream, padchar, colinc); length += colinc; } } } if (object == NIL) { if (collon) LispWriteStr(stream, "()", 2); else LispWriteStr(stream, Snil->value, 3); } else { /* if string is not NIL, atsign was specified * and object printed to string */ if (string == NIL) length = format_object(stream, object); else { int size; const char *str = LispGetSstring(SSTREAMP(string), &size); LispWriteStr(stream, str, size); } } /* right padding */ if (!atsign) { /* output minpad characters at left */ if (minpad) { length += minpad; LispWriteChars(stream, padchar, minpad); } if (colinc) { /* puts colinc spaces at a time, * until at least mincol chars out */ while (length < mincol) { LispWriteChars(stream, padchar, colinc); length += colinc; } } } GC_LEAVE(); } /* assumes radix is 0 or in range 2 - 36 */ static void format_in_radix(LispObj *stream, LispObj *object, int radix, FmtArgs *args) { if (INTEGERP(object)) { int i, atsign, collon, mincol, padchar, commachar, commainterval; i = (radix == 0); atsign = args->atsign; collon = args->collon; if (radix == 0) { radix = args->arguments[0].value; if (radix < 2 || radix > 36) { args->offset = args->arguments[0].offset; generic_error(args, GENERIC_RADIX); } } mincol = args->arguments[i++].value; padchar = args->arguments[i++].value; commachar = args->arguments[i++].value; commainterval = args->arguments[i++].value; LispFormatInteger(stream, object, radix, atsign, collon, mincol, padchar, commachar, commainterval); } else format_object(stream, object); } static void format_radix_special(LispObj *stream, LispObj *object, FmtArgs *args) { if (FIXNUMP(object)) { if (args->atsign) format_roman(stream, object, args); else format_english(stream, object, args); } else format_object(stream, object); } static void format_roman(LispObj *stream, LispObj *object, FmtArgs *args) { long value = 0; int cando, new_roman = args->collon == 0; if (FIXNUMP(object)) { value = FIXNUM_VALUE(object); if (new_roman) cando = value >= 1 && value <= 3999; else cando = value >= 1 && value <= 4999; } else cando = 0; if (cando) LispFormatRomanInteger(stream, value, new_roman); else format_object(stream, object); } static void format_english(LispObj *stream, LispObj *object, FmtArgs *args) { int cando; long number = 0; if (FIXNUMP(object)) { number = FIXNUM_VALUE(object); cando = number >= -999999999 && number <= 999999999; } else cando = 0; if (cando) LispFormatEnglishInteger(stream, number, args->collon); else format_object(stream, object); } static void format_character(LispObj *stream, LispObj *object, FmtArgs *args) { if (SCHARP(object)) LispFormatCharacter(stream, object, args->atsign, args->collon); else format_object(stream, object); } static void format_fixed_float(LispObj *stream, LispObj *object, FmtArgs *args) { if (FLOATP(object)) LispFormatFixedFloat(stream, object, args->atsign, args->arguments[0].value, IF_SPECIFIED(args->arguments[1]), args->arguments[2].value, args->arguments[3].value, args->arguments[4].value); else format_object(stream, object); } static void format_exponential_float(LispObj *stream, LispObj *object, FmtArgs *args) { if (FLOATP(object)) LispFormatExponentialFloat(stream, object, args->atsign, args->arguments[0].value, IF_SPECIFIED(args->arguments[1]), args->arguments[2].value, args->arguments[3].value, args->arguments[4].value, args->arguments[5].value, args->arguments[6].value); else format_object(stream, object); } static void format_general_float(LispObj *stream, LispObj *object, FmtArgs *args) { if (FLOATP(object)) LispFormatGeneralFloat(stream, object, args->atsign, args->arguments[0].value, IF_SPECIFIED(args->arguments[1]), args->arguments[2].value, args->arguments[3].value, args->arguments[4].value, args->arguments[5].value, args->arguments[6].value); else format_object(stream, object); } static void format_dollar_float(LispObj *stream, LispObj *object, FmtArgs *args) { if (FLOATP(object)) LispFormatDollarFloat(stream, object, args->atsign, args->collon, args->arguments[0].value, args->arguments[1].value, args->arguments[2].value, args->arguments[3].value); else format_object(stream, object); } static void format_tabulate(LispObj *stream, FmtArgs *args) { int atsign = args->atsign, colnum = args->arguments[0].value, colinc = args->arguments[1].value, column; column = LispGetColumn(stream); if (atsign) { /* relative tabulation */ if (colnum > 0) { LispWriteChars(stream, ' ', colnum); column += colnum; } /* tabulate until at a multiple of colinc */ if (colinc > 0) LispWriteChars(stream, ' ', colinc - (column % colinc)); } else { /* if colinc not specified, just move to given column */ if (colinc <= 0) LispWriteChars(stream, ' ', column - colnum); else { /* always output at least colinc spaces */ do { LispWriteChars(stream, ' ', colinc); colnum -= colinc; } while (colnum > column); } } } static void format_goto(FmtInfo *info) { int count, num_arguments; LispObj *object, *arguments; /* number of arguments to ignore or goto offset */ count = info->args.arguments[0].value; if (count < 0) generic_error(&(info->args), GENERIC_NEGATIVE); if (info->args.atsign) { /* absolute goto */ /* if not specified, defaults to zero */ if (!(info->args.arguments[0].specified)) count = 0; /* if offset too large */ if (count > info->total_arguments) parse_error(&(info->args), PARSE_NOARGSLEFT); else if (count != info->total_arguments - *(info->num_arguments)) { /* calculate new parameters */ object = NIL; arguments = info->base_arguments; num_arguments = info->total_arguments - count; for (; count > 0; count--, arguments = CDR(arguments)) object = CAR(arguments); /* update format information */ *(info->object) = object; *(info->arguments) = arguments; *(info->num_arguments) = num_arguments; } } else if (count) { /* relative goto, ignore or go back count arguments */ /* prepare to update parameters */ arguments = *(info->arguments); num_arguments = *(info->num_arguments); /* go back count arguments? */ if (info->args.collon) count = -count; num_arguments -= count; if (count > 0) { if (count > *(info->num_arguments)) parse_error(&(info->args), PARSE_NOARGSLEFT); object = *(info->object); for (; count > 0; count--, arguments = CDR(arguments)) object = CAR(arguments); } else { /* count < 0 */ if (info->total_arguments + count - *(info->num_arguments) < 0) parse_error(&(info->args), PARSE_NOARGSLEFT); object = NIL; arguments = info->base_arguments; for (count = 0; count < info->total_arguments - num_arguments; count++, arguments = CDR(arguments)) object = CAR(arguments); } /* update format parameters */ *(info->object) = object; *(info->arguments) = arguments; *(info->num_arguments) = num_arguments; } } static void format_indirection(LispObj *stream, LispObj *format, FmtInfo *info) { char *string; LispObj *object; FmtInfo indirect_info; if (!STRINGP(format)) generic_error(&(info->args), GENERIC_BADSTRING); string = THESTR(format); /* most information is the same */ memcpy(&indirect_info, info, sizeof(FmtInfo)); /* set new format string */ indirect_info.args.base = indirect_info.args.format = string; indirect_info.format = &string; if (info->args.atsign) { /* use current arguments */ /* do the indirect format */ LispFormat(stream, &indirect_info); } else { /* next argument is the recursive call arguments */ int num_arguments; /* it is valid to not have a list following string, as string may * not have format directives */ if (CONSP(*(indirect_info.arguments))) object = CAR(*(indirect_info.arguments)); else object = NIL; if (!LISTP(object) || !CONSP(*(info->arguments))) generic_error(&(info->args), GENERIC_BADLIST); /* update information now */ *(info->object) = object; *(info->arguments) = CDR(*(info->arguments)); *(info->num_arguments) -= 1; /* set arguments for recursive call */ indirect_info.base_arguments = object; indirect_info.arguments = &object; for (num_arguments = 0; CONSP(object); object = CDR(object)) ++num_arguments; /* note that indirect_info.arguments is a pointer to "object", * keep it pointing to the correct object */ object = indirect_info.base_arguments; indirect_info.total_arguments = num_arguments; indirect_info.num_arguments = &num_arguments; /* do the indirect format */ LispFormat(stream, &indirect_info); } } /* update pointers to a list of format strings: * for '(' and '{' only one list is required * for '[' and '<' more than one may be returned * has_default is only meaningful for '[' and '<' * comma_width and line_width are only meaningful to '<', and * only valid if has_default set * if the string is finished prematurely, LispDestroy is called * format_ptr is updated to the correct pointer in the "main" format string */ static void list_formats(FmtInfo *info, int command, char **format_ptr, char ***format_list, int *format_count, int *has_default, int *comma_width, int *line_width) { /* instead of processing the directives recursively, just separate the * input formats in separate strings, then see if one of then need to * be used */ FmtArgs args; int counters[] = { 0, 0, 0, 0}; /* '[', '(', '{', '<' */ char *format, *next_format, *start, **formats; int num_formats, format_index, separator, add_format; /* initialize */ formats = NULL; num_formats = format_index = 0; if (has_default != NULL) *has_default = 0; if (comma_width != NULL) *comma_width = 0; if (line_width != NULL) *line_width = 0; format = start = next_format = *format_ptr; switch (command) { case '[': counters[0] = 1; format_index = 0; break; case '(': counters[1] = 1; format_index = 1; break; case '{': counters[2] = 1; format_index = 2; break; case '<': counters[3] = 1; format_index = 3; break; } #define LIST_FORMATS_ADD 1 #define LIST_FORMATS_DONE 2 /* fill list of format options to conditional */ while (*format) { if (*format == '~') { separator = add_format = 0; args.format = format + 1; next_format = parse_arguments(format + 1, &args, NULL, NULL, NULL); switch (args.command) { case '[': ++counters[0]; break; case ']': --counters[0]; break; case '(': ++counters[1]; break; case ')': --counters[1]; break; case '{': ++counters[2]; break; case '}': --counters[2]; break; case '<': ++counters[3]; break; case '>': --counters[3]; break; case ';': separator = 1; break; } /* check if a new format string must be added */ if (separator && counters[format_index] == 1 && (command == '[' || command == '<')) add_format = LIST_FORMATS_ADD; else if (counters[format_index] == 0) add_format = LIST_FORMATS_DONE; if (add_format) { int length = format - start; formats = LispRealloc(formats, (num_formats + 1) * sizeof(char*)); formats[num_formats] = LispMalloc(length + 1); strncpy(formats[num_formats], start, length); formats[num_formats][length] = '\0'; ++num_formats; /* loop finished? */ if (add_format == LIST_FORMATS_DONE) break; else if (command == '[' && has_default != NULL) /* will be set only for the last parameter, what is * expected, just don't warn about it in the incorrect * place */ *has_default = args.collon != 0; else if (command == '<' && num_formats == 1) { /* if the first parameter to '<', there may be overrides * to comma-width and line-width */ if (args.collon && has_default != NULL) { *has_default = 1; if (comma_width != NULL && args.arguments[0].specified && !args.arguments[0].achar) *comma_width = args.arguments[0].value; if (line_width != NULL && args.arguments[1].specified && !args.arguments[1].achar) *line_width = args.arguments[1].value; } } start = next_format; } format = next_format; } else ++format; } /* check if format string did not finish prematurely */ if (counters[format_index] != 0) { char error_message[64]; sprintf(error_message, "expecting ~%c", command); format_error(&(info->args), error_message); } /* update pointers */ *format_list = formats; *format_count = num_formats; *format_ptr = next_format; } static void free_formats(char **formats, int num_formats) { if (num_formats) { while (--num_formats >= 0) LispFree(formats[num_formats]); LispFree(formats); } } static void format_case_conversion(LispObj *stream, FmtInfo *info) { GC_ENTER(); LispObj *string; FmtInfo case_info; char *str, *ptr; char *format, *next_format, **formats; int atsign, collon, num_formats, length; atsign = info->args.atsign; collon = info->args.collon; /* output to a string, before case conversion */ string = LSTRINGSTREAM("", STREAM_READ | STREAM_WRITE, 0); GC_PROTECT(string); /* most information is the same */ memcpy(&case_info, info, sizeof(FmtInfo)); /* list formats */ next_format = *(info->format); list_formats(info, '(', &next_format, &formats, &num_formats, NULL, NULL, NULL); /* set new format string */ format = formats[0]; case_info.args.base = case_info.args.format = format; case_info.format = &format; /* format text to string */ LispFormat(string, &case_info); str = ptr = LispGetSstring(SSTREAMP(string), &length); /* do case conversion */ if (!atsign && !collon) { /* convert all upercase to lowercase */ for (; *ptr; ptr++) { if (isupper(*ptr)) *ptr = tolower(*ptr); } } else if (atsign && collon) { /* convert all lowercase to upercase */ for (; *ptr; ptr++) { if (islower(*ptr)) *ptr = toupper(*ptr); } } else { int upper = 1; /* skip non-alphanumeric characters */ for (; *ptr; ptr++) if (isalnum(*ptr)) break; /* capitalize words */ for (; *ptr; ptr++) { if (isalnum(*ptr)) { if (upper) { if (islower(*ptr)) *ptr = toupper(*ptr); upper = 0; } else if (isupper(*ptr)) *ptr = tolower(*ptr); } else upper = collon; /* if collon, capitalize all words, else just first word */ } } /* output case converted string */ LispWriteStr(stream, str, length); /* temporary string stream is not necessary anymore */ GC_LEAVE(); /* free temporary memory */ free_formats(formats, num_formats); /* this information always updated */ *(info->format) = next_format; } static void format_conditional(LispObj *stream, FmtInfo *info) { LispObj *object, *arguments; char *format, *next_format, **formats; int choice, num_formats, has_default, num_arguments; /* save information that may change */ object = *(info->object); arguments = *(info->arguments); num_arguments = *(info->num_arguments); /* initialize */ choice = -1; next_format = *(info->format); /* list formats */ list_formats(info, '[', &next_format, &formats, &num_formats, &has_default, NULL, NULL); /* ~:[false;true] */ if (info->args.collon) { /* one argument always consumed */ if (!CONSP(arguments)) parse_error(&(info->args), PARSE_NOARGSLEFT); object = CAR(arguments); arguments = CDR(arguments); --num_arguments; choice = object == NIL ? 0 : 1; } /* ~@[true] */ else if (info->args.atsign) { /* argument consumed only if nil, but one must be available */ if (!CONSP(arguments)) parse_error(&(info->args), PARSE_NOARGSLEFT); if (CAR(arguments) != NIL) choice = 0; else { object = CAR(arguments); arguments = CDR(arguments); --num_arguments; } } /* ~n[...~] */ else if (info->args.arguments[0].specified) /* no arguments consumed */ choice = info->args.arguments[0].value; /* ~[...~] */ else { /* one argument consumed, it is the index in the available formats */ if (!CONSP(arguments)) parse_error(&(info->args), PARSE_NOARGSLEFT); object = CAR(arguments); arguments = CDR(arguments); --num_arguments; /* no error if it isn't a number? */ if (FIXNUMP(object)) choice = FIXNUM_VALUE(object); } /* update anything that may have changed */ *(info->object) = object; *(info->arguments) = arguments; *(info->num_arguments) = num_arguments; /* if choice is out of range check if there is a default choice */ if (has_default && (choice < 0 || choice >= num_formats)) choice = num_formats - 1; /* if one of the formats must be parsed */ if (choice >= 0 && choice < num_formats) { FmtInfo conditional_info; /* most information is the same */ memcpy(&conditional_info, info, sizeof(FmtInfo)); /* set new format string */ format = formats[choice]; conditional_info.args.base = conditional_info.args.format = format; conditional_info.format = &format; /* do the conditional format */ LispFormat(stream, &conditional_info); } /* free temporary memory */ free_formats(formats, num_formats); /* this information always updated */ *(info->format) = next_format; } static void format_iterate(LispObj *stream, FmtInfo *info) { FmtInfo iterate_info; LispObj *object, *arguments, *iarguments, *iobject; char *format, *next_format, *loop_format, **formats; int num_arguments, iterate, iterate_max, has_max, has_min, inum_arguments, num_formats; /* save information that may change */ object = *(info->object); arguments = *(info->arguments); num_arguments = *(info->num_arguments); /* initialize */ iterate = has_min = 0; next_format = *(info->format); /* if has_max set, iterate at most iterate_max times */ has_max = info->args.arguments[0].specified; iterate_max = info->args.arguments[0].value; /* list formats */ list_formats(info, '{', &next_format, &formats, &num_formats, NULL, NULL, NULL); loop_format = formats[0]; /* most information is the same */ memcpy(&iterate_info, info, sizeof(FmtInfo)); /* ~{...~} */ if (!info->args.atsign && !info->args.collon) { /* next argument is the argument list for the iteration */ /* fetch argument list, must exist */ if (!CONSP(arguments)) parse_error(&(info->args), PARSE_NOARGSLEFT); iarguments = object = CAR(arguments); object = CAR(arguments); arguments = CDR(arguments); --num_arguments; inum_arguments = 0; if (CONSP(object)) { /* count arguments to format */ for (iobject = object; CONSP(iobject); iobject = CDR(iobject)) ++inum_arguments; } else if (object != NIL) generic_error(&(info->args), GENERIC_BADLIST); iobject = NIL; /* set new arguments to recursive calls */ iarguments = object; iterate_info.base_arguments = iarguments; iterate_info.total_arguments = inum_arguments; iterate_info.object = &iobject; iterate_info.arguments = &iarguments; iterate_info.num_arguments = &inum_arguments; /* iterate */ for (;; iterate++) { /* if maximum iterations done or all arguments consumed */ if (has_max && iterate > iterate_max) break; else if (inum_arguments == 0 && (!has_min || iterate > 0)) break; format = loop_format; /* set new format string */ iterate_info.args.base = iterate_info.args.format = format; iterate_info.format = &format; /* information for possible ~^, in this case ~:^ is a noop */ iterate_info.iteration = ITERATION_NORMAL; /* do the format */ LispFormat(stream, &iterate_info); /* check for forced loop break */ if (iterate_info.upandout & UPANDOUT_HASH) break; } } /* ~:@{...~} */ else if (info->args.atsign && info->args.collon) { /* every following argument is the argument list for the iteration */ /* iterate */ for (;; iterate++) { /* if maximum iterations done or all arguments consumed */ if (has_max && iterate > iterate_max) break; else if (num_arguments == 0 && (!has_min || iterate > 0)) break; /* fetch argument list, must exist */ if (!CONSP(arguments)) parse_error(&(info->args), PARSE_NOARGSLEFT); iarguments = object = CAR(arguments); object = CAR(arguments); arguments = CDR(arguments); --num_arguments; inum_arguments = 0; if (CONSP(object)) { /* count arguments to format */ for (iobject = object; CONSP(iobject); iobject = CDR(iobject)) ++inum_arguments; } else if (object != NIL) generic_error(&(info->args), GENERIC_BADLIST); iobject = NIL; /* set new arguments to recursive calls */ iarguments = object; iterate_info.base_arguments = iarguments; iterate_info.total_arguments = inum_arguments; iterate_info.object = &iobject; iterate_info.arguments = &iarguments; iterate_info.num_arguments = &inum_arguments; format = loop_format; /* set new format string */ iterate_info.args.base = iterate_info.args.format = format; iterate_info.format = &format; /* information for possible ~^ */ iterate_info.iteration = num_arguments > 0 ? ITERATION_NORMAL : ITERATION_LAST; /* do the format */ LispFormat(stream, &iterate_info); /* check for forced loop break */ if (iterate_info.upandout & UPANDOUT_HASH) break; } } /* ~:{...~} */ else if (info->args.collon) { /* next argument is a list of lists */ LispObj *sarguments, *sobject; int snum_arguments; /* fetch argument list, must exist */ if (!CONSP(arguments)) parse_error(&(info->args), PARSE_NOARGSLEFT); sarguments = object = CAR(arguments); object = CAR(arguments); arguments = CDR(arguments); --num_arguments; snum_arguments = 0; if (CONSP(object)) { /* count arguments to format */ for (sobject = object; CONSP(sobject); sobject = CDR(sobject)) ++snum_arguments; } else generic_error(&(info->args), GENERIC_BADLIST); /* iterate */ for (;; iterate++) { /* if maximum iterations done or all arguments consumed */ if (has_max && iterate > iterate_max) break; else if (snum_arguments == 0 && (!has_min || iterate > 0)) break; /* fetch argument list, must exist */ if (!CONSP(sarguments)) parse_error(&(info->args), PARSE_NOARGSLEFT); iarguments = sobject = CAR(sarguments); sobject = CAR(sarguments); sarguments = CDR(sarguments); --snum_arguments; inum_arguments = 0; if (CONSP(object)) { /* count arguments to format */ for (iobject = sobject; CONSP(iobject); iobject = CDR(iobject)) ++inum_arguments; } else if (sobject != NIL) generic_error(&(info->args), GENERIC_BADLIST); iobject = NIL; /* set new arguments to recursive calls */ iarguments = sobject; iterate_info.base_arguments = iarguments; iterate_info.total_arguments = inum_arguments; iterate_info.object = &iobject; iterate_info.arguments = &iarguments; iterate_info.num_arguments = &inum_arguments; format = loop_format; /* set new format string */ iterate_info.args.base = iterate_info.args.format = format; iterate_info.format = &format; /* information for possible ~^ */ iterate_info.iteration = snum_arguments > 0 ? ITERATION_NORMAL : ITERATION_LAST; /* do the format */ LispFormat(stream, &iterate_info); /* check for forced loop break */ if (iterate_info.upandout & UPANDOUT_HASH) break; } } /* ~@{...~} */ else if (info->args.atsign) { /* current argument list is used */ /* set new arguments to recursive calls */ iterate_info.base_arguments = info->base_arguments; iterate_info.total_arguments = info->total_arguments; iterate_info.object = &object; iterate_info.arguments = &arguments; iterate_info.num_arguments = &num_arguments; for (;; iterate++) { /* if maximum iterations done or all arguments consumed */ if (has_max && iterate > iterate_max) break; else if (num_arguments == 0 && (!has_min || iterate > 0)) break; format = loop_format; /* set new format string */ iterate_info.args.base = iterate_info.args.format = format; iterate_info.format = &format; /* information for possible ~^, in this case ~:^ is a noop */ iterate_info.iteration = ITERATION_NORMAL; /* do the format */ LispFormat(stream, &iterate_info); /* check for forced loop break */ if (iterate_info.upandout & UPANDOUT_HASH) break; } } /* free temporary memory */ free_formats(formats, num_formats); /* update anything that may have changed */ *(info->object) = object; *(info->arguments) = arguments; *(info->num_arguments) = num_arguments; /* this information always updated */ *(info->format) = next_format; } static void format_justify(LispObj *stream, FmtInfo *info) { GC_ENTER(); FmtInfo justify_info; char **formats, *format, *next_format; const char *str; LispObj *string, *strings = NIL, *cons; int atsign = info->args.atsign, collon = info->args.collon, mincol = info->args.arguments[0].value, colinc = info->args.arguments[1].value, minpad = info->args.arguments[2].value, padchar = info->args.arguments[3].value; int i, k, total_length, length, padding, num_formats, has_default, comma_width, line_width, size, extra; next_format = *(info->format); /* list formats */ list_formats(info, '<', &next_format, &formats, &num_formats, &has_default, &comma_width, &line_width); /* initialize list of strings streams */ if (num_formats) { string = LSTRINGSTREAM("", STREAM_READ | STREAM_WRITE, 0); strings = cons = CONS(string, NIL); GC_PROTECT(strings); for (i = 1; i < num_formats; i++) { string = LSTRINGSTREAM("", STREAM_READ | STREAM_WRITE, 0); RPLACD(cons, CONS(string, NIL)); cons = CDR(cons); } } /* most information is the same */ memcpy(&justify_info, info, sizeof(FmtInfo)); /* loop formating strings */ for (i = 0, cons = strings; i < num_formats; i++, cons = CDR(cons)) { /* set new format string */ format = formats[i]; justify_info.args.base = justify_info.args.format = format; justify_info.format = &format; /* format string, maybe consuming arguments */ LispFormat(CAR(cons), &justify_info); /* if format was aborted, it is discarded */ if (justify_info.upandout) RPLACA(cons, NIL); /* check if the entire "main" iteration must be aborted */ if (justify_info.upandout & UPANDOUT_COLLON) { for (cons = CDR(cons); i < num_formats; i++, cons = CDR(cons)) RPLACA(cons, NIL); break; } } /* free temporary format strings */ free_formats(formats, num_formats); /* remove aborted formats */ /* first remove leading discarded formats */ if (CAR(strings) == NIL) { while (CAR(strings) == NIL) { strings = CDR(strings); --num_formats; } /* keep strings gc protected, discarding first entries */ lisp__data.protect.objects[gc__protect] = strings; } /* now remove intermediary discarded formats */ cons = strings; while (CONSP(cons)) { if (CONSP(CDR(cons)) && CAR(CDR(cons)) == NIL) { RPLACD(cons, CDR(CDR(cons))); --num_formats; } else cons = CDR(cons); } /* calculate total length required for output */ if (has_default) cons = CDR(strings); /* if has_defaults, strings is surely a list */ else cons = strings; for (total_length = 0; CONSP(cons); cons = CDR(cons)) total_length += SSTREAMP(CAR(cons))->length; /* initialize pointer to string streams */ if (has_default) cons = CDR(strings); else cons = strings; /* check if padding will need to be printed */ extra = 0; padding = mincol - total_length; if (padding < 0) k = padding = 0; else { int num_fields = num_formats - (has_default != 0); if (num_fields > 1) { /* check if padding is distributed in num_fields or * num_fields - 1 steps */ if (!collon) --num_fields; } if (num_fields) k = padding / num_fields; else k = padding; if (k <= 0) k = colinc; else if (colinc) k = k + (k % colinc); extra = mincol - (num_fields * k + total_length); if (extra < 0) extra = 0; } if (padding && k < minpad) { k = minpad; if (colinc) k = k + (k % colinc); } /* first check for the special case of only one string being justified */ if (num_formats - has_default == 1) { if (has_default && line_width > 0 && comma_width >= 0 && total_length + comma_width > line_width) { str = LispGetSstring(SSTREAMP(CAR(strings)), &size); LispWriteStr(stream, str, size); } string = has_default ? CAR(CDR(strings)) : CAR(strings); /* check if need left padding */ if (k && !atsign) { LispWriteChars(stream, padchar, k); k = 0; } /* check for centralizing text */ else if (k && atsign && collon) { LispWriteChars(stream, padchar, k / 2 + ((k / 2) & 1)); k -= k / 2; } str = LispGetSstring(SSTREAMP(string), &size); LispWriteStr(stream, str, size); /* if any padding remaining */ if (k) LispWriteChars(stream, padchar, k); } else { LispObj *result; int last, spaces_before, padout; /* if has default, need to check output length */ if (has_default && line_width > 0 && comma_width >= 0) { result = LSTRINGSTREAM("", STREAM_READ | STREAM_WRITE, 0); GC_PROTECT(result); } /* else write directly to stream */ else result = stream; /* loop printing justified text */ /* padout controls padding for cases where padding is * is separated in n-1 chunks, where n is the number of * formatted strings. */ for (i = padout = 0; CONSP(cons); i++, cons = CDR(cons), --extra) { string = CAR(cons); last = !CONSP(CDR(cons)); spaces_before = (i != 0 || collon) && (!last || !atsign); if (!spaces_before) { /* check for special case */ if (last && atsign && collon && padding > 0) { int spaces; spaces = minpad > colinc ? minpad : colinc; LispWriteChars(result, padchar, spaces + (extra > 0)); k -= spaces; } str = LispGetSstring(SSTREAMP(string), &size); LispWriteStr(result, str, size); padout = 0; } if (!padout) LispWriteChars(result, padchar, k + (extra > 0)); padout = k; /* if not first string, or if left padding specified */ if (spaces_before) { str = LispGetSstring(SSTREAMP(string), &size); LispWriteStr(result, str, size); padout = 0; } padding -= k; } if (has_default && line_width > 0 && comma_width >= 0) { length = SSTREAMP(result)->length + LispGetColumn(stream); /* if current line is too large */ if (has_default && length + comma_width > line_width) { str = LispGetSstring(SSTREAMP(CAR(strings)), &size); LispWriteStr(stream, str, size); } /* write result to stream */ str = LispGetSstring(SSTREAMP(result), &size); LispWriteStr(stream, str, size); } } /* unprotect string streams from GC */ GC_LEAVE(); /* this information always updated */ *(info->format) = next_format; } static void LispFormat(LispObj *stream, FmtInfo *info) { FmtArgs *args; const FmtDefs *defs = NULL; LispObj *object, *arguments; char stk[256], *format, *next_format; int length, num_arguments, code, need_update, need_argument, hash, head; /* arguments that will be updated on function exit */ format = *(info->format); object = *(info->object); arguments = *(info->arguments); num_arguments = *(info->num_arguments); /* initialize */ length = 0; args = &(info->args); info->upandout = 0; while (*format) { if (*format == '~') { /* flush non formatted characters */ if (length) { LispWriteStr(stream, stk, length); length = 0; } need_argument = need_update = hash = 0; /* parse parameters */ args->format = format + 1; next_format = parse_arguments(format + 1, args, &num_arguments, &arguments, &code); if (code != NOERROR) parse_error(args, code); /* check parameters */ switch (args->command) { case 'A': case 'S': defs = &AsciiDefs; break; case 'B': case 'O': case 'D': case 'X': defs = &IntegerDefs; break; case 'R': defs = &RadixDefs; break; case 'P': case 'C': defs = &NoneDefs; break; case 'F': defs = &FixedFloatDefs; break; case 'E': case 'G': defs = &ExponentialFloatDefs; break; case '$': defs = &DollarFloatDefs; break; case '%': case '&': case '|': case '~': case '\n': defs = &OneDefs; break; case 'T': defs = &TabulateDefs; break; case '*': defs = &OneDefs; break; case '?': case '(': defs = &NoneDefs; break; case ')': /* this is never seen, processed in format_case_conversion */ format_error(args, "no match for directive ~)"); case '[': defs = &OneDefs; break; case ']': /* this is never seen, processed in format_conditional */ format_error(args, "no match for directive ~]"); case '{': defs = &OneDefs; break; case '}': /* this is never seen, processed in format_iterate */ format_error(args, "no match for directive ~}"); case '<': defs = &AsciiDefs; break; case '>': /* this is never seen, processed in format_justify */ format_error(args, "no match for directive ~>"); case ';': /* this is never seen here */ format_error(args, "misplaced directive ~;"); case '#': /* special handling for ~#^ */ if (*next_format == '^') { ++next_format; hash = 1; defs = &NoneDefs; args->command = '^'; break; } parse_error(args, PARSE_BADDIRECTIVE); case '^': defs = &NoneDefs; break; default: parse_error(args, PARSE_BADDIRECTIVE); break; } merge_arguments(args, defs, &code); if (code != NOERROR) merge_error(args, code); /* check if an argument is required by directive */ switch (args->command) { case 'A': case 'S': case 'B': case 'O': case 'D': case 'X': case 'R': need_argument = 1; break; case 'P': /* if collon specified, plural is the last print argument */ need_argument = !args->collon; break; case 'C': need_argument = 1; break; case 'F': case 'E': case 'G': case '$': need_argument = 1; break; case '%': case '&': case '|': case '~': case '\n': break; case 'T': break; case '*': /* check arguments below */ need_update = 1; break; case '?': need_argument = need_update = 1; break; case '(': case '[': case '{': case '<': need_update = 1; break; case '^': break; } if (need_argument) { if (!CONSP(arguments)) parse_error(args, PARSE_NOARGSLEFT); object = CAR(arguments); arguments = CDR(arguments); --num_arguments; } /* will do recursive calls that change info */ if (need_update) { *(info->format) = next_format; *(info->object) = object; *(info->arguments) = arguments; *(info->num_arguments) = num_arguments; } /* everything seens fine, print the format directive */ switch (args->command) { case 'A': head = lisp__data.env.length; LispAddVar(Oprint_escape, NIL); ++lisp__data.env.head; format_ascii(stream, object, args); lisp__data.env.head = lisp__data.env.length = head; break; case 'S': head = lisp__data.env.length; LispAddVar(Oprint_escape, T); ++lisp__data.env.head; format_ascii(stream, object, args); lisp__data.env.head = lisp__data.env.length = head; break; case 'B': format_in_radix(stream, object, 2, args); break; case 'O': format_in_radix(stream, object, 8, args); break; case 'D': format_in_radix(stream, object, 10, args); break; case 'X': format_in_radix(stream, object, 16, args); break; case 'R': /* if a single argument specified */ if (args->count) format_in_radix(stream, object, 0, args); else format_radix_special(stream, object, args); break; case 'P': if (args->atsign) { if (FIXNUMP(object) && FIXNUM_VALUE(object) == 1) LispWriteChar(stream, 'y'); else LispWriteStr(stream, "ies", 3); } else if (!FIXNUMP(object) || FIXNUM_VALUE(object) != 1) LispWriteChar(stream, 's'); break; case 'C': format_character(stream, object, args); break; case 'F': format_fixed_float(stream, object, args); break; case 'E': format_exponential_float(stream, object, args); break; case 'G': format_general_float(stream, object, args); break; case '$': format_dollar_float(stream, object, args); break; case '&': if (LispGetColumn(stream) == 0) --args->arguments[0].value; case '%': LispWriteChars(stream, '\n', args->arguments[0].value); break; case '|': LispWriteChars(stream, '\f', args->arguments[0].value); break; case '~': LispWriteChars(stream, '~', args->arguments[0].value); break; case '\n': if (!args->collon) { if (args->atsign) LispWriteChar(stream, '\n'); /* ignore newline and following spaces */ while (*next_format && isspace(*next_format)) ++next_format; } break; case 'T': format_tabulate(stream, args); break; case '*': format_goto(info); break; case '?': format_indirection(stream, object, info); need_update = 1; break; case '(': format_case_conversion(stream, info); /* next_format if far from what is set now */ next_format = *(info->format); break; case '[': format_conditional(stream, info); /* next_format if far from what is set now */ next_format = *(info->format); break; case '{': format_iterate(stream, info); /* next_format if far from what is set now */ next_format = *(info->format); break; case '<': format_justify(stream, info); /* next_format if far from what is set now */ next_format = *(info->format); break; case '^': if (args->collon) { if (hash && num_arguments == 0) { info->upandout = UPANDOUT_HASH; goto format_up_and_out; } if (info->iteration && info->iteration == ITERATION_NORMAL) /* not exactly an error, but in this case, * command is ignored */ break; info->upandout = UPANDOUT_COLLON; goto format_up_and_out; } else if (num_arguments == 0) { info->upandout = UPANDOUT_NORMAL; goto format_up_and_out; } break; } if (need_update) { object = *(info->object); arguments = *(info->arguments); num_arguments = *(info->num_arguments); } format = next_format; } else { if (length >= sizeof(stk)) { LispWriteStr(stream, stk, length); length = 0; } stk[length++] = *format++; } } /* flush any peding output */ if (length) LispWriteStr(stream, stk, length); format_up_and_out: /* update for recursive call */ *(info->format) = format; *(info->object) = object; *(info->arguments) = arguments; *(info->num_arguments) = num_arguments; } LispObj * Lisp_Format(LispBuiltin *builtin) /* format destination control-string &rest arguments */ { GC_ENTER(); FmtInfo info; LispObj *object; char *control_string; int num_arguments; LispObj *stream, *format, *arguments; arguments = ARGUMENT(2); format = ARGUMENT(1); stream = ARGUMENT(0); /* check format and stream */ CHECK_STRING(format); if (stream == NIL) { /* return a string */ stream = LSTRINGSTREAM("", STREAM_READ | STREAM_WRITE, 0); GC_PROTECT(stream); } else if (stream == T || /* print directly to *standard-output* */ stream == STANDARD_OUTPUT) stream = NIL; else { CHECK_STREAM(stream); if (!stream->data.stream.writable) LispDestroy("%s: stream %s is not writable", STRFUN(builtin), STROBJ(stream)); } /* count number of arguments */ for (object = arguments, num_arguments = 0; CONSP(object); object = CDR(object), num_arguments++) ; /* initialize plural/argument info */ object = NIL; /* the format string */ control_string = THESTR(format); /* arguments to recursive calls */ info.args.base = control_string; info.base_arguments = arguments; info.total_arguments = num_arguments; info.format = &control_string; info.object = &object; info.arguments = &arguments; info.num_arguments = &num_arguments; info.iteration = 0; /* format arguments */ LispFormat(stream, &info); /* if printing to stdout */ if (stream == NIL) LispFflush(Stdout); /* else if printing to string-stream, return a string */ else if (stream->data.stream.type == LispStreamString) { int length; const char *string; string = LispGetSstring(SSTREAMP(stream), &length); stream = LSTRING(string, length); } GC_LEAVE(); return (stream); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/struct.c0000664000000000000000000002346712472175711015770 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/struct.c,v 1.22tsi Exp $ */ #include "lisp/struct.h" /* * Prototypes */ static LispObj *LispStructAccessOrStore(LispBuiltin*, int); /* * Initialization */ LispObj *Omake_struct, *Ostruct_access, *Ostruct_store, *Ostruct_type; Atom_id Smake_struct, Sstruct_access, Sstruct_store, Sstruct_type; /* * Implementation */ LispObj * Lisp_Defstruct(LispBuiltin *builtin) /* defstruct name &rest description */ { int intern; LispAtom *atom; int i, size, length, slength; char *name, *strname; LispObj *list, *cons, *object, *definition, *documentation; LispObj *oname, *description; description = ARGUMENT(1); oname = ARGUMENT(0); CHECK_SYMBOL(oname); strname = ATOMID(oname)->value; length = ATOMID(oname)->length; /* MAKE- */ size = length + 6; name = LispMalloc(size); sprintf(name, "MAKE-%s", strname); atom = (object = ATOM(name))->data.atom; if (atom->a_builtin) LispDestroy("%s: %s cannot be a structure name", STRFUN(builtin), STROBJ(oname)); intern = !atom->ext; if (CONSP(description) && STRINGP(CAR(description))) { documentation = CAR(description); description = CDR(description); } else documentation = NIL; /* get structure fields and default values */ for (list = description; CONSP(list); list = CDR(list)) { object = CAR(list); cons = list; if (CONSP(object)) { if ((CONSP(CDR(object)) && CDR(CDR(object)) != NIL) || (!CONSP(CDR(object)) && CDR(object) != NIL)) LispDestroy("%s: bad initialization %s", STRFUN(builtin), STROBJ(object)); cons = object; object = CAR(object); } if (!SYMBOLP(object) || strcmp(ATOMID(object)->value, "P") == 0) /* p is invalid as a field name due to `type'-p */ LispDestroy("%s: %s cannot be a field for %s", STRFUN(builtin), STROBJ(object), ATOMID(oname)->value); if (!KEYWORDP(object)) CAR(cons) = KEYWORD(ATOMID(object)->value); /* check for repeated field names */ for (object = description; object != list; object = CDR(object)) { LispObj *left = CAR(object), *right = CAR(list); if (CONSP(left)) left = CAR(left); if (CONSP(right)) right = CAR(right); if (ATOMID(left) == ATOMID(right)) LispDestroy("%s: only one slot named %s allowed", STRFUN(builtin), STROBJ(left)); } } /* atom should not have been modified */ definition = CONS(oname, description); LispSetAtomStructProperty(atom, definition, STRUCT_CONSTRUCTOR); if (!intern) LispExportSymbol(object); atom = oname->data.atom; if (atom->a_defstruct) LispWarning("%s: structure %s is being redefined", STRFUN(builtin), strname); LispSetAtomStructProperty(atom, definition, STRUCT_NAME); sprintf(name, "%s-P", strname); atom = (object = ATOM(name))->data.atom; LispSetAtomStructProperty(atom, definition, STRUCT_CHECK); if (!intern) LispExportSymbol(object); for (i = 0, list = description; CONSP(list); i++, list = CDR(list)) { Atom_id id; if (CONSP(CAR(list))) id = ATOMID(CAR(CAR(list))); else id = ATOMID(CAR(list)); slength = id->length; if (length + slength + 2 > size) { size = length + slength + 2; name = LispRealloc(name, size); } sprintf(name, "%s-%s", strname, id->value); atom = (object = ATOM(name))->data.atom; LispSetAtomStructProperty(atom, definition, i); if (!intern) LispExportSymbol(object); } LispFree(name); if (documentation != NIL) LispAddDocumentation(oname, documentation, LispDocStructure); return (oname); } /* helper functions * DONT explicitly call them. Non standard functions. */ LispObj * Lisp_XeditMakeStruct(LispBuiltin *builtin) /* lisp::make-struct atom &rest init */ { int nfld, ncvt, length = lisp__data.protect.length; LispAtom *atom = NULL; LispObj *definition, *object, *field, *fields, *value = NIL, *cons, *list; LispObj *struc, *init; init = ARGUMENT(1); struc = ARGUMENT(0); field = cons = NIL; if (!POINTERP(struc) || !(XSYMBOLP(struc) || XFUNCTIONP(struc)) || (atom = struc->data.atom)->a_defstruct == 0 || atom->property->structure.function != STRUCT_CONSTRUCTOR) LispDestroy("%s: invalid constructor %s", STRFUN(builtin), STROBJ(struc)); definition = atom->property->structure.definition; ncvt = nfld = 0; fields = NIL; /* check for errors in argument list */ for (list = init, nfld = 0; CONSP(list); list = CDR(list)) { CHECK_KEYWORD(CAR(list)); if (!CONSP(CDR(list))) LispDestroy("%s: values must be provided as pairs", ATOMID(struc)->value); nfld++; list = CDR(list); } /* create structure, CAR(definition) is structure name */ for (list = CDR(definition); CONSP(list); list = CDR(list)) { Atom_id id; LispObj *defvalue = NIL; ++nfld; field = CAR(list); if (CONSP(field)) { /* if default value provided */ if (CONSP(CDR(field))) defvalue = CAR(CDR(field)); field = CAR(field); } id = ATOMID(field); for (object = init; CONSP(object); object = CDR(object)) { /* field is a keyword, test above checked it */ field = CAR(object); if (id == ATOMID(field)) { /* value provided */ value = CAR(CDR(object)); ncvt++; break; } object = CDR(object); } /* if no initialization given */ if (!CONSP(object)) { /* if default value in structure definition */ if (defvalue != NIL) value = EVAL(defvalue); else value = NIL; } if (fields == NIL) { fields = cons = CONS(value, NIL); if (length + 1 >= lisp__data.protect.space) LispMoreProtects(); lisp__data.protect.objects[lisp__data.protect.length++] = fields; } else { RPLACD(cons, CONS(value, NIL)); cons = CDR(cons); } } /* if not enough arguments were converted, need to check because * it is acceptable to set a field more than once, but in that case, * only the first value will be used. */ if (nfld > ncvt) { for (list = init; CONSP(list); list = CDR(list)) { Atom_id id = ATOMID(CAR(list)); for (object = CDR(definition); CONSP(object); object = CDR(object)) { field = CAR(object); if (CONSP(field)) field = CAR(field); if (ATOMID(field) == id) break; } if (!CONSP(object)) LispDestroy("%s: %s is not a field for %s", ATOMID(struc)->value, STROBJ(CAR(list)), ATOMID(CAR(definition))->value); list = CDR(list); } } lisp__data.protect.length = length; return (STRUCT(fields, definition)); } static LispObj * LispStructAccessOrStore(LispBuiltin *builtin, int store) /* lisp::struct-access atom struct lisp::struct-store atom struct value */ { long offset; LispAtom *atom; LispObj *definition, *list; LispObj *name, *struc, *value = NIL; if (store) value = ARGUMENT(2); struc = ARGUMENT(1); name = ARGUMENT(0); if (!POINTERP(name) || !(XSYMBOLP(name) || XFUNCTIONP(name)) || (atom = name->data.atom)->a_defstruct == 0 || (offset = atom->property->structure.function) < 0) { LispDestroy("%s: invalid argument %s", STRFUN(builtin), STROBJ(name)); /*NOTREACHED*/ offset = 0; atom = NULL; } definition = atom->property->structure.definition; /* check if the object is of the required type */ if (!STRUCTP(struc) || struc->data.struc.def != definition) LispDestroy("%s: %s is not a %s", ATOMID(name)->value, STROBJ(struc), ATOMID(CAR(definition))->value); for (list = struc->data.struc.fields; offset; list = CDR(list), offset--) ; return (store ? RPLACA(list, value) : CAR(list)); } LispObj * Lisp_XeditStructAccess(LispBuiltin *builtin) /* lisp::struct-access atom struct */ { return (LispStructAccessOrStore(builtin, 0)); } LispObj * Lisp_XeditStructStore(LispBuiltin *builtin) /* lisp::struct-store atom struct value */ { return (LispStructAccessOrStore(builtin, 1)); } LispObj * Lisp_XeditStructType(LispBuiltin *builtin) /* lisp::struct-type atom struct */ { LispAtom *atom = NULL; LispObj *definition, *struc, *name; struc = ARGUMENT(1); name = ARGUMENT(0); if (!POINTERP(name) || !(XSYMBOLP(name) || XFUNCTIONP(name)) || (atom = name->data.atom)->a_defstruct == 0 || (atom->property->structure.function != STRUCT_CHECK)) LispDestroy("%s: invalid argument %s", STRFUN(builtin), STROBJ(name)); definition = atom->property->structure.definition; /* check if the object is of the required type */ if (STRUCTP(struc) && struc->data.struc.def == definition) return (T); return (NIL); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/string.c0000664000000000000000000007206012472175711015743 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XdotOrg: xc/programs/xedit/lisp/string.c,v 1.2 2004/04/23 19:54:44 eich Exp $ */ /* $XFree86: xc/programs/xedit/lisp/string.c,v 1.24tsi Exp $ */ #include "lisp/helper.h" #include "lisp/read.h" #include "lisp/string.h" #include "lisp/private.h" #include #define CHAR_LESS 1 #define CHAR_LESS_EQUAL 2 #define CHAR_EQUAL 3 #define CHAR_GREATER_EQUAL 4 #define CHAR_GREATER 5 #define CHAR_NOT_EQUAL 6 #define CHAR_ALPHAP 1 #define CHAR_DOWNCASE 2 #define CHAR_UPCASE 3 #define CHAR_INT 4 #define CHAR_BOTHP 5 #define CHAR_UPPERP 6 #define CHAR_LOWERP 7 #define CHAR_GRAPHICP 8 #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif /* * Prototypes */ static LispObj *LispCharCompare(LispBuiltin*, int, int); static LispObj *LispStringCompare(LispBuiltin*, int, int); static LispObj *LispCharOp(LispBuiltin*, int); static LispObj *LispStringTrim(LispBuiltin*, int, int, int); static LispObj *LispStringUpcase(LispBuiltin*, int); static LispObj *LispStringDowncase(LispBuiltin*, int); static LispObj *LispStringCapitalize(LispBuiltin*, int); /* * Implementation */ static LispObj * LispCharCompare(LispBuiltin *builtin, int operation, int ignore_case) { LispObj *object; int cmp, value, next_value; LispObj *character, *more_characters; more_characters = ARGUMENT(1); character = ARGUMENT(0); CHECK_SCHAR(character); value = SCHAR_VALUE(character); if (ignore_case && islower(value)) value = toupper(value); if (!CONSP(more_characters)) return (T); /* First check if all parameters are characters */ for (object = more_characters; CONSP(object); object = CDR(object)) CHECK_SCHAR(CAR(object)); /* All characters in list must be different */ if (operation == CHAR_NOT_EQUAL) { /* Compare all characters */ do { for (object = more_characters; CONSP(object); object = CDR(object)) { character = CAR(object); next_value = SCHAR_VALUE(character); if (ignore_case && islower(next_value)) next_value = toupper(next_value); if (value == next_value) return (NIL); } value = SCHAR_VALUE(CAR(more_characters)); if (ignore_case && islower(value)) value = toupper(value); more_characters = CDR(more_characters); } while (CONSP(more_characters)); return (T); } /* Linearly compare characters */ for (; CONSP(more_characters); more_characters = CDR(more_characters)) { character = CAR(more_characters); next_value = SCHAR_VALUE(character); if (ignore_case && islower(next_value)) next_value = toupper(next_value); switch (operation) { case CHAR_LESS: cmp = value < next_value; break; case CHAR_LESS_EQUAL: cmp = value <= next_value; break; case CHAR_EQUAL: cmp = value == next_value; break; case CHAR_GREATER_EQUAL: cmp = value >= next_value; break; case CHAR_GREATER: cmp = value > next_value; break; default: cmp = 0; break; } if (!cmp) return (NIL); value = next_value; } return (T); } LispObj * Lisp_CharLess(LispBuiltin *builtin) /* char< character &rest more-characters */ { return (LispCharCompare(builtin, CHAR_LESS, 0)); } LispObj * Lisp_CharLessEqual(LispBuiltin *builtin) /* char<= character &rest more-characters */ { return (LispCharCompare(builtin, CHAR_LESS_EQUAL, 0)); } LispObj * Lisp_CharEqual_(LispBuiltin *builtin) /* char= character &rest more-characters */ { return (LispCharCompare(builtin, CHAR_EQUAL, 0)); } LispObj * Lisp_CharGreater(LispBuiltin *builtin) /* char> character &rest more-characters */ { return (LispCharCompare(builtin, CHAR_GREATER, 0)); } LispObj * Lisp_CharGreaterEqual(LispBuiltin *builtin) /* char>= character &rest more-characters */ { return (LispCharCompare(builtin, CHAR_GREATER_EQUAL, 0)); } LispObj * Lisp_CharNotEqual_(LispBuiltin *builtin) /* char/= character &rest more-characters */ { return (LispCharCompare(builtin, CHAR_NOT_EQUAL, 0)); } LispObj * Lisp_CharLessp(LispBuiltin *builtin) /* char-lessp character &rest more-characters */ { return (LispCharCompare(builtin, CHAR_LESS, 1)); } LispObj * Lisp_CharNotGreaterp(LispBuiltin *builtin) /* char-not-greaterp character &rest more-characters */ { return (LispCharCompare(builtin, CHAR_LESS_EQUAL, 1)); } LispObj * Lisp_CharEqual(LispBuiltin *builtin) /* char-equalp character &rest more-characters */ { return (LispCharCompare(builtin, CHAR_EQUAL, 1)); } LispObj * Lisp_CharGreaterp(LispBuiltin *builtin) /* char-greaterp character &rest more-characters */ { return (LispCharCompare(builtin, CHAR_GREATER, 1)); } LispObj * Lisp_CharNotLessp(LispBuiltin *builtin) /* char-not-lessp &rest more-characters */ { return (LispCharCompare(builtin, CHAR_GREATER_EQUAL, 1)); } LispObj * Lisp_CharNotEqual(LispBuiltin *builtin) /* char-not-equal character &rest more-characters */ { return (LispCharCompare(builtin, CHAR_NOT_EQUAL, 1)); } static LispObj * LispCharOp(LispBuiltin *builtin, int operation) { int value; LispObj *result, *character; character = ARGUMENT(0); CHECK_SCHAR(character); value = (int)SCHAR_VALUE(character); switch (operation) { case CHAR_ALPHAP: result = isalpha(value) ? T : NIL; break; case CHAR_DOWNCASE: result = SCHAR(tolower(value)); break; case CHAR_UPCASE: result = SCHAR(toupper(value)); break; case CHAR_INT: result = FIXNUM(value); break; case CHAR_BOTHP: result = isupper(value) || islower(value) ? T : NIL; break; case CHAR_UPPERP: result = isupper(value) ? T : NIL; break; case CHAR_LOWERP: result = islower(value) ? T : NIL; break; case CHAR_GRAPHICP: result = value == ' ' || isgraph(value) ? T : NIL; break; default: result = NIL; break; } return (result); } LispObj * Lisp_AlphaCharP(LispBuiltin *builtin) /* alpha-char-p char */ { return (LispCharOp(builtin, CHAR_ALPHAP)); } LispObj * Lisp_CharDowncase(LispBuiltin *builtin) /* char-downcase character */ { return (LispCharOp(builtin, CHAR_DOWNCASE)); } LispObj * Lisp_CharInt(LispBuiltin *builtin) /* char-int character char-code character */ { return (LispCharOp(builtin, CHAR_INT)); } LispObj * Lisp_CharUpcase(LispBuiltin *builtin) /* char-upcase character */ { return (LispCharOp(builtin, CHAR_UPCASE)); } LispObj * Lisp_BothCaseP(LispBuiltin *builtin) /* both-case-p character */ { return (LispCharOp(builtin, CHAR_BOTHP)); } LispObj * Lisp_UpperCaseP(LispBuiltin *builtin) /* upper-case-p character */ { return (LispCharOp(builtin, CHAR_UPPERP)); } LispObj * Lisp_LowerCaseP(LispBuiltin *builtin) /* upper-case-p character */ { return (LispCharOp(builtin, CHAR_LOWERP)); } LispObj * Lisp_GraphicCharP(LispBuiltin *builtin) /* graphic-char-p char */ { return (LispCharOp(builtin, CHAR_GRAPHICP)); } LispObj * Lisp_Char(LispBuiltin *builtin) /* char string index schar simple-string index */ { unsigned char *string; long offset, length; LispObj *ostring, *oindex; oindex = ARGUMENT(1); ostring = ARGUMENT(0); CHECK_STRING(ostring); CHECK_INDEX(oindex); offset = FIXNUM_VALUE(oindex); string = (unsigned char*)THESTR(ostring); length = STRLEN(ostring); if (offset >= length) LispDestroy("%s: index %ld too large for string length %ld", STRFUN(builtin), offset, length); return (SCHAR(string[offset])); } /* helper function for setf * DONT explicitly call. Non standard function */ LispObj * Lisp_XeditCharStore(LispBuiltin *builtin) /* xedit::char-store string index value */ { int character; long offset, length; LispObj *ostring, *oindex, *ovalue; ovalue = ARGUMENT(2); oindex = ARGUMENT(1); ostring = ARGUMENT(0); CHECK_STRING(ostring); CHECK_INDEX(oindex); length = STRLEN(ostring); offset = FIXNUM_VALUE(oindex); if (offset >= length) LispDestroy("%s: index %ld too large for string length %ld", STRFUN(builtin), offset, length); CHECK_SCHAR(ovalue); CHECK_STRING_WRITABLE(ostring); character = SCHAR_VALUE(ovalue); if (character < 0 || character > 255) LispDestroy("%s: cannot represent character %d", STRFUN(builtin), character); THESTR(ostring)[offset] = character; return (ovalue); } LispObj * Lisp_Character(LispBuiltin *builtin) /* character object */ { LispObj *object; object = ARGUMENT(0); return (LispCharacterCoerce(builtin, object)); } LispObj * Lisp_Characterp(LispBuiltin *builtin) /* characterp object */ { LispObj *object; object = ARGUMENT(0); return (SCHARP(object) ? T : NIL); } LispObj * Lisp_DigitChar(LispBuiltin *builtin) /* digit-char weight &optional radix */ { long radix = 10, weight; LispObj *oweight, *oradix, *result = NIL; oradix = ARGUMENT(1); oweight = ARGUMENT(0); CHECK_FIXNUM(oweight); weight = FIXNUM_VALUE(oweight); if (oradix != UNSPEC) { CHECK_INDEX(oradix); radix = FIXNUM_VALUE(oradix); } if (radix < 2 || radix > 36) LispDestroy("%s: radix must be >= 2 and <= 36, not %ld", STRFUN(builtin), radix); if (weight >= 0 && weight < radix) { if (weight < 9) weight += '0'; else weight += 'A' - 10; result = SCHAR(weight); } return (result); } LispObj * Lisp_DigitCharP(LispBuiltin *builtin) /* digit-char-p character &optional radix */ { long radix = 10, character; LispObj *ochar, *oradix, *result = NIL; oradix = ARGUMENT(1); ochar = ARGUMENT(0); CHECK_SCHAR(ochar); character = SCHAR_VALUE(ochar); if (oradix != UNSPEC) { CHECK_INDEX(oradix); radix = FIXNUM_VALUE(oradix); } if (radix < 2 || radix > 36) LispDestroy("%s: radix must be >= 2 and <= 36, not %ld", STRFUN(builtin), radix); if (character >= '0' && character <= '9') character -= '0'; else if (character >= 'A' && character <= 'Z') character -= 'A' - 10; else if (character >= 'a' && character <= 'z') character -= 'a' - 10; if (character < radix) result = FIXNUM(character); return (result); } LispObj * Lisp_IntChar(LispBuiltin *builtin) /* int-char integer code-char integer */ { long character = 0; LispObj *integer; integer = ARGUMENT(0); CHECK_FIXNUM(integer); character = FIXNUM_VALUE(integer); return (character >= 0 && character < 0xff ? SCHAR(character) : NIL); } /* XXX ignoring element-type */ LispObj * Lisp_MakeString(LispBuiltin *builtin) /* make-string size &key initial-element element-type */ { long length; char *string, initial; LispObj *size, *initial_element; initial_element = ARGUMENT(1); size = ARGUMENT(0); CHECK_INDEX(size); length = FIXNUM_VALUE(size); if (initial_element != UNSPEC) { CHECK_SCHAR(initial_element); initial = SCHAR_VALUE(initial_element); } else initial = 0; string = LispMalloc(length + 1); memset(string, initial, length); string[length] = '\0'; return (LSTRING2(string, length)); } LispObj * Lisp_ParseInteger(LispBuiltin *builtin) /* parse-integer string &key start end radix junk-allowed */ { GC_ENTER(); char *ptr, *string; int character, junk, sign, overflow; long i, start, end, radix, length, integer, check; LispObj *result; LispObj *ostring, *ostart, *oend, *oradix, *junk_allowed; junk_allowed = ARGUMENT(4); oradix = ARGUMENT(3); oend = ARGUMENT(2); ostart = ARGUMENT(1); ostring = ARGUMENT(0); start = end = radix = 0; result = NIL; CHECK_STRING(ostring); LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, &start, &end, &length); string = THESTR(ostring); if (oradix == UNSPEC) radix = 10; else { CHECK_INDEX(oradix); radix = FIXNUM_VALUE(oradix); } if (radix < 2 || radix > 36) LispDestroy("%s: :RADIX %ld must be in the range 2 to 36", STRFUN(builtin), radix); integer = check = 0; ptr = string + start; sign = overflow = 0; /* Skip leading white spaces */ for (i = start; i < end && *ptr && isspace(*ptr); ptr++, i++) ; /* Check for sign specification */ if (i < end && (*ptr == '-' || *ptr == '+')) { sign = *ptr == '-'; ++ptr; ++i; } for (junk = 0; i < end; i++, ptr++) { character = *ptr; if (islower(character)) character = toupper(character); if (character >= '0' && character <= '9') { if (character - '0' >= radix) junk = 1; else { check = integer; integer = integer * radix + character - '0'; } } else if (character >= 'A' && character <= 'Z') { if (character - 'A' + 10 >= radix) junk = 1; else { check = integer; integer = integer * radix + character - 'A' + 10; } } else { if (isspace(character)) break; junk = 1; } if (junk) break; if (!overflow && check > integer) overflow = 1; /* keep looping just to count read bytes */ } if (!junk) /* Skip white spaces */ for (; i < end && *ptr && isspace(*ptr); ptr++, i++) ; if ((junk || ptr == string) && (junk_allowed == UNSPEC || junk_allowed == NIL)) LispDestroy("%s: %s has a bad integer representation", STRFUN(builtin), STROBJ(ostring)); else if (ptr == string) result = NIL; else if (overflow) { mpi *bigi = LispMalloc(sizeof(mpi)); char *str; length = end - start + sign; str = LispMalloc(length + 1); strncpy(str, string - sign, length + sign); str[length + sign] = '\0'; mpi_init(bigi); mpi_setstr(bigi, str, radix); LispFree(str); result = BIGNUM(bigi); } else result = INTEGER(sign ? -integer : integer); GC_PROTECT(result); RETURN(0) = FIXNUM(i); RETURN_COUNT = 1; GC_LEAVE(); return (result); } LispObj * Lisp_String(LispBuiltin *builtin) /* string object */ { LispObj *object; object = ARGUMENT(0); return (LispStringCoerce(builtin, object)); } LispObj * Lisp_Stringp(LispBuiltin *builtin) /* stringp object */ { LispObj *object; object = ARGUMENT(0); return (STRINGP(object) ? T : NIL); } /* XXX preserve-whitespace is being ignored */ LispObj * Lisp_ReadFromString(LispBuiltin *builtin) /* read-from-string string &optional eof-error-p eof-value &key start end preserve-whitespace */ { GC_ENTER(); char *string; LispObj *stream, *result; long length, start, end, bytes_read; LispObj *ostring, *eof_error_p, *eof_value, *ostart, *oend; oend = ARGUMENT(4); ostart = ARGUMENT(3); eof_value = ARGUMENT(2); eof_error_p = ARGUMENT(1); ostring = ARGUMENT(0); CHECK_STRING(ostring); string = THESTR(ostring); LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, &start, &end, &length); if (start > 0 || end < length) length = end - start; stream = LSTRINGSTREAM(string + start, STREAM_READ, length); if (eof_value == UNSPEC) eof_value = NIL; LispPushInput(stream); result = LispRead(); /* stream->data.stream.source.string->input is * the offset of the last byte read in string */ bytes_read = stream->data.stream.source.string->input; LispPopInput(stream); if (result == NULL) { if (eof_error_p == NIL) result = eof_value; else LispDestroy("%s: unexpected end of input", STRFUN(builtin)); } GC_PROTECT(result); RETURN(0) = FIXNUM(start + bytes_read); RETURN_COUNT = 1; GC_LEAVE(); return (result); } static LispObj * LispStringTrim(LispBuiltin *builtin, int left, int right, int inplace) /* string-{,left-,right-}trim character-bag string */ { unsigned char *string; long start, end, length; LispObj *ochars, *ostring; ostring = ARGUMENT(1); ochars = ARGUMENT(0); if (!POINTERP(ochars) || !(XSTRINGP(ochars) || XCONSP(ochars))) { if (ARRAYP(ochars) && ochars->data.array.rank == 1) ochars = ochars->data.array.list; else LispDestroy("%s: %s is not a sequence", STRFUN(builtin), STROBJ(ochars)); } CHECK_STRING(ostring); string = (unsigned char*)THESTR(ostring); length = STRLEN(ostring); start = 0; end = length; if (XSTRINGP(ochars)) { unsigned char *chars = (unsigned char*)THESTR(ochars); long i, clength = STRLEN(ochars); if (left) { for (; start < end; start++) { for (i = 0; i < clength; i++) if (string[start] == chars[i]) break; if (i >= clength) break; } } if (right) { for (--end; end >= 0; end--) { for (i = 0; i < clength; i++) if (string[end] == chars[i]) break; if (i >= clength) break; } ++end; } } else { LispObj *ochar, *list; if (left) { for (; start < end; start++) { for (list = ochars; CONSP(list); list = CDR(list)) { ochar = CAR(list); if (SCHARP(ochar) && string[start] == SCHAR_VALUE(ochar)) break; } if (!CONSP(list)) break; } } if (right) { for (--end; end >= 0; end--) { for (list = ochars; CONSP(list); list = CDR(list)) { ochar = CAR(list); if (SCHARP(ochar) && string[end] == SCHAR_VALUE(ochar)) break; } if (!CONSP(list)) break; } ++end; } } if (start == 0 && end == length) return (ostring); length = end - start; if (inplace) { CHECK_STRING_WRITABLE(ostring); memmove(string, string + start, length); string[length] = '\0'; STRLEN(ostring) = length; } else { string = LispMalloc(length + 1); memcpy(string, THESTR(ostring) + start, length); string[length] = '\0'; ostring = LSTRING2((char*)string, length); } return (ostring); } LispObj * Lisp_StringTrim(LispBuiltin *builtin) /* string-trim character-bag string */ { return (LispStringTrim(builtin, 1, 1, 0)); } LispObj * Lisp_NstringTrim(LispBuiltin *builtin) /* ext::nstring-trim character-bag string */ { return (LispStringTrim(builtin, 1, 1, 1)); } LispObj * Lisp_StringLeftTrim(LispBuiltin *builtin) /* string-left-trim character-bag string */ { return (LispStringTrim(builtin, 1, 0, 0)); } LispObj * Lisp_NstringLeftTrim(LispBuiltin *builtin) /* ext::nstring-left-trim character-bag string */ { return (LispStringTrim(builtin, 1, 0, 1)); } LispObj * Lisp_StringRightTrim(LispBuiltin *builtin) /* string-right-trim character-bag string */ { return (LispStringTrim(builtin, 0, 1, 0)); } LispObj * Lisp_NstringRightTrim(LispBuiltin *builtin) /* ext::nstring-right-trim character-bag string */ { return (LispStringTrim(builtin, 0, 1, 1)); } static LispObj * LispStringCompare(LispBuiltin *builtin, int function, int ignore_case) { int cmp1, cmp2; LispObj *fixnum; unsigned char *string1, *string2; long start1, end1, start2, end2, offset, length; LispGetStringArgs(builtin, (char**)&string1, (char**)&string2, &start1, &end1, &start2, &end2); string1 += start1; string2 += start2; if (function == CHAR_EQUAL) { length = end1 - start1; if (length != (end2 - start2)) return (NIL); if (!ignore_case) return (memcmp(string1, string2, length) ? NIL : T); for (; length; length--, string1++, string2++) if (toupper(*string1) != toupper(*string2)) return (NIL); return (T); } end1 -= start1; end2 -= start2; length = MIN(end1, end2); for (offset = 0; offset < length; string1++, string2++, offset++, start1++, start2++) { cmp1 = *string1; cmp2 = *string2; if (ignore_case) { cmp1 = toupper(cmp1); cmp2 = toupper(cmp2); } if (cmp1 != cmp2) { fixnum = FIXNUM(start1); switch (function) { case CHAR_LESS: return ((cmp1 < cmp2) ? fixnum : NIL); case CHAR_LESS_EQUAL: return ((cmp1 <= cmp2) ? fixnum : NIL); case CHAR_NOT_EQUAL: return (fixnum); case CHAR_GREATER_EQUAL: return ((cmp1 >= cmp2) ? fixnum : NIL); case CHAR_GREATER: return ((cmp1 > cmp2) ? fixnum : NIL); } } } fixnum = FIXNUM(start1); switch (function) { case CHAR_LESS: return (start1 >= end1 && start2 < end2 ? fixnum : NIL); case CHAR_LESS_EQUAL: return (start1 >= end1 ? fixnum : NIL); case CHAR_NOT_EQUAL: return (start1 >= end1 && start2 >= end2 ? NIL : fixnum); case CHAR_GREATER_EQUAL: return (start2 >= end2 ? fixnum : NIL); case CHAR_GREATER: return (start2 >= end2 && start1 < end1 ? fixnum : NIL); } return (NIL); } LispObj * Lisp_StringEqual_(LispBuiltin *builtin) /* string= string1 string2 &key start1 end1 start2 end2 */ { return (LispStringCompare(builtin, CHAR_EQUAL, 0)); } LispObj * Lisp_StringLess(LispBuiltin *builtin) /* string< string1 string2 &key start1 end1 start2 end2 */ { return (LispStringCompare(builtin, CHAR_LESS, 0)); } LispObj * Lisp_StringGreater(LispBuiltin *builtin) /* string> string1 string2 &key start1 end1 start2 end2 */ { return (LispStringCompare(builtin, CHAR_GREATER, 0)); } LispObj * Lisp_StringLessEqual(LispBuiltin *builtin) /* string<= string1 string2 &key start1 end1 start2 end2 */ { return (LispStringCompare(builtin, CHAR_LESS_EQUAL, 0)); } LispObj * Lisp_StringGreaterEqual(LispBuiltin *builtin) /* string>= string1 string2 &key start1 end1 start2 end2 */ { return (LispStringCompare(builtin, CHAR_GREATER_EQUAL, 0)); } LispObj * Lisp_StringNotEqual_(LispBuiltin *builtin) /* string/= string1 string2 &key start1 end1 start2 end2 */ { return (LispStringCompare(builtin, CHAR_NOT_EQUAL, 0)); } LispObj * Lisp_StringEqual(LispBuiltin *builtin) /* string-equal string1 string2 &key start1 end1 start2 end2 */ { return (LispStringCompare(builtin, CHAR_EQUAL, 1)); } LispObj * Lisp_StringLessp(LispBuiltin *builtin) /* string-lessp string1 string2 &key start1 end1 start2 end2 */ { return (LispStringCompare(builtin, CHAR_LESS, 1)); } LispObj * Lisp_StringGreaterp(LispBuiltin *builtin) /* string-greaterp string1 string2 &key start1 end1 start2 end2 */ { return (LispStringCompare(builtin, CHAR_GREATER, 1)); } LispObj * Lisp_StringNotGreaterp(LispBuiltin *builtin) /* string-not-greaterp string1 string2 &key start1 end1 start2 end2 */ { return (LispStringCompare(builtin, CHAR_LESS_EQUAL, 1)); } LispObj * Lisp_StringNotLessp(LispBuiltin *builtin) /* string-not-lessp string1 string2 &key start1 end1 start2 end2 */ { return (LispStringCompare(builtin, CHAR_GREATER_EQUAL, 1)); } LispObj * Lisp_StringNotEqual(LispBuiltin *builtin) /* string-not-equal string1 string2 &key start1 end1 start2 end2 */ { return (LispStringCompare(builtin, CHAR_NOT_EQUAL, 1)); } LispObj * LispStringUpcase(LispBuiltin *builtin, int inplace) /* string-upcase string &key start end nstring-upcase string &key start end */ { LispObj *result; char *string, *newstring; long start, end, length, offset; LispObj *ostring, *ostart, *oend; oend = ARGUMENT(2); ostart = ARGUMENT(1); ostring = ARGUMENT(0); CHECK_STRING(ostring); LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, &start, &end, &offset); result = ostring; string = THESTR(ostring); length = STRLEN(ostring); /* first check if something need to be done */ for (offset = start; offset < end; offset++) if (string[offset] != toupper(string[offset])) break; if (offset >= end) return (result); if (inplace) { CHECK_STRING_WRITABLE(ostring); newstring = string; } else { /* upcase a copy of argument */ newstring = LispMalloc(length + 1); if (offset) memcpy(newstring, string, offset); if (length > end) memcpy(newstring + end, string + end, length - end); newstring[length] = '\0'; } for (; offset < end; offset++) newstring[offset] = toupper(string[offset]); if (!inplace) result = LSTRING2(newstring, length); return (result); } LispObj * Lisp_StringUpcase(LispBuiltin *builtin) /* string-upcase string &key start end */ { return (LispStringUpcase(builtin, 0)); } LispObj * Lisp_NstringUpcase(LispBuiltin *builtin) /* nstring-upcase string &key start end */ { return (LispStringUpcase(builtin, 1)); } LispObj * LispStringDowncase(LispBuiltin *builtin, int inplace) /* string-downcase string &key start end nstring-downcase string &key start end */ { LispObj *result; char *string, *newstring; long start, end, length, offset; LispObj *ostring, *ostart, *oend; oend = ARGUMENT(2); ostart = ARGUMENT(1); ostring = ARGUMENT(0); CHECK_STRING(ostring); LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, &start, &end, &offset); result = ostring; string = THESTR(ostring); length = STRLEN(ostring); /* first check if something need to be done */ for (offset = start; offset < end; offset++) if (string[offset] != tolower(string[offset])) break; if (offset >= end) return (result); if (inplace) { CHECK_STRING_WRITABLE(ostring); newstring = string; } else { /* downcase a copy of argument */ newstring = LispMalloc(length + 1); if (offset) memcpy(newstring, string, offset); if (length > end) memcpy(newstring + end, string + end, length - end); newstring[length] = '\0'; } for (; offset < end; offset++) newstring[offset] = tolower(string[offset]); if (!inplace) result = LSTRING2(newstring, length); return (result); } LispObj * Lisp_StringDowncase(LispBuiltin *builtin) /* string-downcase string &key start end */ { return (LispStringDowncase(builtin, 0)); } LispObj * Lisp_NstringDowncase(LispBuiltin *builtin) /* nstring-downcase string &key start end */ { return (LispStringDowncase(builtin, 1)); } LispObj * LispStringCapitalize(LispBuiltin *builtin, int inplace) /* string-capitalize string &key start end nstring-capitalize string &key start end */ { LispObj *result; char *string, *newstring; long start, end, length, offset, upcase; LispObj *ostring, *ostart, *oend; oend = ARGUMENT(2); ostart = ARGUMENT(1); ostring = ARGUMENT(0); CHECK_STRING(ostring); LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, &start, &end, &offset); result = ostring; string = THESTR(ostring); length = STRLEN(ostring); /* first check if something need to be done */ for (upcase = 1, offset = start; offset < end; offset++) { if (upcase) { if (!isalnum(string[offset])) continue; if (string[offset] != toupper(string[offset])) break; upcase = 0; } else { if (isalnum(string[offset])) { if (string[offset] != tolower(string[offset])) break; } else upcase = 1; } } if (offset >= end) return (result); if (inplace) { CHECK_STRING_WRITABLE(ostring); newstring = string; } else { /* capitalize a copy of argument */ newstring = LispMalloc(length + 1); memcpy(newstring, string, length); newstring[length] = '\0'; } for (; offset < end; offset++) { if (upcase) { if (!isalnum(string[offset])) continue; newstring[offset] = toupper(string[offset]); upcase = 0; } else { if (isalnum(newstring[offset])) newstring[offset] = tolower(string[offset]); else upcase = 1; } } if (!inplace) result = LSTRING2(newstring, length); return (result); } LispObj * Lisp_StringCapitalize(LispBuiltin *builtin) /* string-capitalize string &key start end */ { return (LispStringCapitalize(builtin, 0)); } LispObj * Lisp_NstringCapitalize(LispBuiltin *builtin) /* nstring-capitalize string &key start end */ { return (LispStringCapitalize(builtin, 1)); } LispObj * Lisp_StringConcat(LispBuiltin *builtin) /* string-concat &rest strings */ { char *buffer; long size, length; LispObj *object, *string; LispObj *strings; strings = ARGUMENT(0); if (strings == NIL) return (STRING("")); for (length = 1, object = strings; CONSP(object); object = CDR(object)) { string = CAR(object); CHECK_STRING(string); length += STRLEN(string); } buffer = LispMalloc(length); for (length = 0, object = strings; CONSP(object); object = CDR(object)) { string = CAR(object); size = STRLEN(string); memcpy(buffer + length, THESTR(string), size); length += size; } buffer[length] = '\0'; object = LSTRING2(buffer, length); return (object); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/mathimp.c0000664000000000000000000034365412472175711016106 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/mathimp.c,v 1.14tsi Exp $ */ /* * Defines */ #ifdef __GNUC__ #define CONST __attribute__ ((__const__)) #else #define CONST /**/ #endif #define N_FIXNUM 1 #define N_BIGNUM 2 #define N_FLONUM 3 #define N_FIXRATIO 4 #define N_BIGRATIO 5 #define NOP_ADD 1 #define NOP_SUB 2 #define NOP_MUL 3 #define NOP_DIV 4 #define NDIVIDE_CEIL 1 #define NDIVIDE_FLOOR 2 #define NDIVIDE_ROUND 3 #define NDIVIDE_TRUNC 4 /* real part from number */ #define NREAL(num) &((num)->real) #define NRTYPE(num) (num)->real.type #define NRFI(num) (num)->real.data.fixnum #define NRBI(num) (num)->real.data.bignum #define NRFF(num) (num)->real.data.flonum #define NRFRN(Num) (Num)->real.data.fixratio.num #define NRFRD(num) (num)->real.data.fixratio.den #define NRBR(num) (num)->real.data.bigratio #define NRBRN(num) mpr_num(NRBR(num)) #define NRBRD(num) mpr_den(NRBR(num)) #define NRCLEAR_BI(num) mpi_clear(NRBI(num)); XFREE(NRBI(num)) #define NRCLEAR_BR(num) mpr_clear(NRBR(num)); XFREE(NRBR(num)) /* imag part from number */ #define NIMAG(num) &((num)->imag) #define NITYPE(num) (num)->imag.type #define NIFI(num) (num)->imag.data.fixnum #define NIBI(num) (num)->imag.data.bignum #define NIFF(num) (num)->imag.data.flonum #define NIFRN(Num) (Num)->imag.data.fixratio.num #define NIFRD(num) (num)->imag.data.fixratio.den #define NIBR(num) (num)->imag.data.bigratio #define NIBRN(obj) mpr_num(NIBR(obj)) #define NIBRD(obj) mpr_den(NIBR(obj)) /* real number fields */ #define RTYPE(real) (real)->type #define RFI(real) (real)->data.fixnum #define RBI(real) (real)->data.bignum #define RFF(real) (real)->data.flonum #define RFRN(real) (real)->data.fixratio.num #define RFRD(real) (real)->data.fixratio.den #define RBR(real) (real)->data.bigratio #define RBRN(real) mpr_num(RBR(real)) #define RBRD(real) mpr_den(RBR(real)) #define RINTEGERP(real) \ (RTYPE(real) == N_FIXNUM || RTYPE(real) == N_BIGNUM) #define RCLEAR_BI(real) mpi_clear(RBI(real)); XFREE(RBI(real)) #define RCLEAR_BR(real) mpr_clear(RBR(real)); XFREE(RBR(real)) /* numeric value from lisp object */ #define OFI(object) FIXNUM_VALUE(object) #define OII(object) INT_VALUE(object) #define OBI(object) (object)->data.mp.integer #define ODF(object) DFLOAT_VALUE(object) #define OFRN(object) (object)->data.ratio.numerator #define OFRD(object) (object)->data.ratio.denominator #define OBR(object) (object)->data.mp.ratio #define OBRN(object) mpr_num(OBR(object)) #define OBRD(object) mpr_den(OBR(object)) #define OCXR(object) (object)->data.complex.real #define OCXI(object) (object)->data.complex.imag #define XALLOC(type) LispMalloc(sizeof(type)) #define XFREE(ptr) LispFree(ptr) /* * Types */ typedef struct _n_real { char type; union { long fixnum; mpi *bignum; double flonum; struct { long num; long den; } fixratio; mpr *bigratio; } data; } n_real; typedef struct _n_number { char complex; n_real real; n_real imag; } n_number; /* * Prototypes */ static void number_init(void); static LispObj *number_pi(void); static void set_real_real(n_real*, n_real*); static void set_real_object(n_real*, LispObj*); static void set_number_object(n_number*, LispObj*); static void clear_real(n_real*); static void clear_number(n_number*); static LispObj *make_real_object(n_real*); static LispObj *make_number_object(n_number*); static void fatal_error(int); static void fatal_object_error(LispObj*, int); static void fatal_builtin_object_error(LispBuiltin*, LispObj*, int); static double bi_getd(mpi*); static double br_getd(mpr*); /* add */ static void add_real_object(n_real*, LispObj*); static void add_number_object(n_number*, LispObj*); /* sub */ static void sub_real_object(n_real*, LispObj*); static void sub_number_object(n_number*, LispObj*); /* mul */ static void mul_real_object(n_real*, LispObj*); static void mul_number_object(n_number*, LispObj*); /* div */ static void div_real_object(n_real*, LispObj*); static void div_number_object(n_number*, LispObj*); /* compare */ static int cmp_real_real(n_real*, n_real*); static int cmp_real_object(n_real*, LispObj*); #if 0 /* not used */ static int cmp_number_object(n_number*, LispObj*); #endif static int cmp_object_object(LispObj*, LispObj*, int); /* fixnum */ static INLINE int fi_fi_add_overflow(long, long) CONST; static INLINE int fi_fi_sub_overflow(long, long) CONST; static INLINE int fi_fi_mul_overflow(long, long) CONST; /* bignum */ static void rbi_canonicalize(n_real*); /* ratio */ static void rfr_canonicalize(n_real*); static void rbr_canonicalize(n_real*); /* complex */ static void ncx_canonicalize(n_number*); /* abs */ static void abs_real(n_real*); static void abs_number(n_number*); static void nabs_cx(n_number*); static INLINE void rabs_fi(n_real*); static INLINE void rabs_bi(n_real*); static INLINE void rabs_ff(n_real*); static INLINE void rabs_fr(n_real*); static INLINE void rabs_br(n_real*); /* neg */ static void neg_real(n_real*); static void neg_number(n_number*); static void rneg_fi(n_real*); static INLINE void rneg_bi(n_real*); static INLINE void rneg_ff(n_real*); static INLINE void rneg_fr(n_real*); static INLINE void rneg_br(n_real*); /* sqrt */ static void sqrt_real(n_real*); static void sqrt_number(n_number*); static void rsqrt_xi(n_real*); static void rsqrt_xr(n_real*); static void rsqrt_ff(n_real*); static void nsqrt_cx(n_number*); static void nsqrt_xi(n_number*); static void nsqrt_ff(n_number*); static void nsqrt_xr(n_number*); /* mod */ static void mod_real_real(n_real*, n_real*); static void mod_real_object(n_real*, LispObj*); static void rmod_fi_fi(n_real*, long); static void rmod_fi_bi(n_real*, mpi*); static void rmod_bi_fi(n_real*, long); static void rmod_bi_bi(n_real*, mpi*); /* rem */ static void rem_real_object(n_real*, LispObj*); static void rrem_fi_fi(n_real*, long); static void rrem_fi_bi(n_real*, mpi*); static void rrem_bi_fi(n_real*, long); static void rrem_bi_bi(n_real*, mpi*); /* gcd */ static void gcd_real_object(n_real*, LispObj*); /* and */ static void and_real_object(n_real*, LispObj*); /* eqv */ static void eqv_real_object(n_real*, LispObj*); /* ior */ static void ior_real_object(n_real*, LispObj*); /* not */ static void not_real(n_real*); /* xor */ static void xor_real_object(n_real*, LispObj*); /* divide */ static void divide_number_object(n_number*, LispObj*, int, int); static void ndivide_xi_xi(n_number*, LispObj*, int, int); static void ndivide_flonum(n_number*, double, double, int, int); static void ndivide_xi_xr(n_number*, LispObj*, int, int); static void ndivide_xr_xi(n_number*, LispObj*, int, int); static void ndivide_xr_xr(n_number*, LispObj*, int, int); /* real complex */ static void nadd_re_cx(n_number*, LispObj*); static void nsub_re_cx(n_number*, LispObj*); static void nmul_re_cx(n_number*, LispObj*); static void ndiv_re_cx(n_number*, LispObj*); /* complex real */ static void nadd_cx_re(n_number*, LispObj*); static void nsub_cx_re(n_number*, LispObj*); static void nmul_cx_re(n_number*, LispObj*); static void ndiv_cx_re(n_number*, LispObj*); /* complex complex */ static void nadd_cx_cx(n_number*, LispObj*); static void nsub_cx_cx(n_number*, LispObj*); static void nmul_cx_cx(n_number*, LispObj*); static void ndiv_cx_cx(n_number*, LispObj*); static int cmp_cx_cx(LispObj*, LispObj*); /* flonum flonum */ static void radd_flonum(n_real*, double, double); static void rsub_flonum(n_real*, double, double); static void rmul_flonum(n_real*, double, double); static void rdiv_flonum(n_real*, double, double); static int cmp_flonum(double, double); /* fixnum fixnum */ static void rop_fi_fi_bi(n_real*, long, int); static INLINE void radd_fi_fi(n_real*, long); static INLINE void rsub_fi_fi(n_real*, long); static INLINE void rmul_fi_fi(n_real*, long); static INLINE void rdiv_fi_fi(n_real*, long); static INLINE int cmp_fi_fi(long, long); static void ndivide_fi_fi(n_number*, long, int, int); /* fixnum bignum */ static void rop_fi_bi_xi(n_real*, mpi*, int); static INLINE void radd_fi_bi(n_real*, mpi*); static INLINE void rsub_fi_bi(n_real*, mpi*); static INLINE void rmul_fi_bi(n_real*, mpi*); static void rdiv_fi_bi(n_real*, mpi*); static INLINE int cmp_fi_bi(long, mpi*); /* fixnum fixratio */ static void rop_fi_fr_as_xr(n_real*, long, long, int); static void rop_fi_fr_md_xr(n_real*, long, long, int); static INLINE void radd_fi_fr(n_real*, long, long); static INLINE void rsub_fi_fr(n_real*, long, long); static INLINE void rmul_fi_fr(n_real*, long, long); static INLINE void rdiv_fi_fr(n_real*, long, long); static INLINE int cmp_fi_fr(long, long, long); /* fixnum bigratio */ static void rop_fi_br_as_xr(n_real*, mpr*, int); static void rop_fi_br_md_xr(n_real*, mpr*, int); static INLINE void radd_fi_br(n_real*, mpr*); static INLINE void rsub_fi_br(n_real*, mpr*); static INLINE void rmul_fi_br(n_real*, mpr*); static INLINE void rdiv_fi_br(n_real*, mpr*); static INLINE int cmp_fi_br(long, mpr*); /* bignum fixnum */ static INLINE void radd_bi_fi(n_real*, long); static INLINE void rsub_bi_fi(n_real*, long); static INLINE void rmul_bi_fi(n_real*, long); static void rdiv_bi_fi(n_real*, long); static INLINE int cmp_bi_fi(mpi*, long); /* bignum bignum */ static INLINE void radd_bi_bi(n_real*, mpi*); static INLINE void rsub_bi_bi(n_real*, mpi*); static INLINE void rmul_bi_bi(n_real*, mpi*); static void rdiv_bi_bi(n_real*, mpi*); static INLINE int cmp_bi_bi(mpi*, mpi*); /* bignum fixratio */ static void rop_bi_fr_as_xr(n_real*, long, long, int); static void rop_bi_fr_md_xr(n_real*, long, long, int); static INLINE void radd_bi_fr(n_real*, long, long); static INLINE void rsub_bi_fr(n_real*, long, long); static INLINE void rmul_bi_fr(n_real*, long, long); static INLINE void rdiv_bi_fr(n_real*, long, long); static int cmp_bi_fr(mpi*, long, long); /* bignum bigratio */ static void rop_bi_br_as_xr(n_real*, mpr*, int); static void rop_bi_br_md_xr(n_real*, mpr*, int); static INLINE void radd_bi_br(n_real*, mpr*); static INLINE void rsub_bi_br(n_real*, mpr*); static INLINE void rmul_bi_br(n_real*, mpr*); static INLINE void rdiv_bi_br(n_real*, mpr*); static int cmp_bi_br(mpi*, mpr*); /* fixratio fixnum */ static void rop_fr_fi_as_xr(n_real*, long, int); static void rop_fr_fi_md_xr(n_real*, long, int); static INLINE void radd_fr_fi(n_real*, long); static INLINE void rsub_fr_fi(n_real*, long); static INLINE void rmul_fr_fi(n_real*, long); static INLINE void rdiv_fr_fi(n_real*, long); static INLINE int cmp_fr_fi(long, long, long); /* fixratio bignum */ static void rop_fr_bi_as_xr(n_real*, mpi*, int); static void rop_fr_bi_md_xr(n_real*, mpi*, int); static INLINE void radd_fr_bi(n_real*, mpi*); static INLINE void rsub_fr_bi(n_real*, mpi*); static INLINE void rmul_fr_bi(n_real*, mpi*); static INLINE void rdiv_fr_bi(n_real*, mpi*); static int cmp_fr_bi(long, long, mpi*); /* fixratio fixratio */ static void rop_fr_fr_as_xr(n_real*, long, long, int); static void rop_fr_fr_md_xr(n_real*, long, long, int); static INLINE void radd_fr_fr(n_real*, long, long); static INLINE void rsub_fr_fr(n_real*, long, long); static INLINE void rmul_fr_fr(n_real*, long, long); static INLINE void rdiv_fr_fr(n_real*, long, long); static INLINE int cmp_fr_fr(long, long, long, long); /* fixratio bigratio */ static void rop_fr_br_asmd_xr(n_real*, mpr*, int); static INLINE void radd_fr_br(n_real*, mpr*); static INLINE void rsub_fr_br(n_real*, mpr*); static INLINE void rmul_fr_br(n_real*, mpr*); static INLINE void rdiv_fr_br(n_real*, mpr*); static int cmp_fr_br(long, long, mpr*); /* bigratio fixnum */ static void rop_br_fi_asmd_xr(n_real*, long, int); static INLINE void radd_br_fi(n_real*, long); static INLINE void rsub_br_fi(n_real*, long); static INLINE void rmul_br_fi(n_real*, long); static INLINE void rdiv_br_fi(n_real*, long); static int cmp_br_fi(mpr*, long); /* bigratio bignum */ static void rop_br_bi_as_xr(n_real*, mpi*, int); static INLINE void radd_br_bi(n_real*, mpi*); static INLINE void rsub_br_bi(n_real*, mpi*); static INLINE void rmul_br_bi(n_real*, mpi*); static INLINE void rdiv_br_bi(n_real*, mpi*); static int cmp_br_bi(mpr*, mpi*); /* bigratio fixratio */ static void rop_br_fr_asmd_xr(n_real*, long, long, int); static INLINE void radd_br_fr(n_real*, long, long); static INLINE void rsub_br_fr(n_real*, long, long); static INLINE void rmul_br_fr(n_real*, long, long); static INLINE void rdiv_br_fr(n_real*, long, long); static int cmp_br_fr(mpr*, long, long); /* bigratio bigratio */ static INLINE void radd_br_br(n_real*, mpr*); static INLINE void rsub_br_br(n_real*, mpr*); static INLINE void rmul_br_br(n_real*, mpr*); static INLINE void rdiv_br_br(n_real*, mpr*); static INLINE int cmp_br_br(mpr*, mpr*); /* * Initialization */ static n_real zero, one, two; static const char *fatal_error_strings[] = { #define DIVIDE_BY_ZERO 0 "divide by zero", #define FLOATING_POINT_OVERFLOW 1 "floating point overflow", #define FLOATING_POINT_EXCEPTION 2 "floating point exception" }; static const char *fatal_object_error_strings[] = { #define NOT_A_NUMBER 0 "is not a number", #define NOT_A_REAL_NUMBER 1 "is not a real number", #define NOT_AN_INTEGER 2 "is not an integer" }; /* * Implementation */ static void fatal_error(int num) { LispDestroy("%s", fatal_error_strings[num]); } static void fatal_object_error(LispObj *obj, int num) { LispDestroy("%s %s", STROBJ(obj), fatal_object_error_strings[num]); } static void fatal_builtin_object_error(LispBuiltin *builtin, LispObj *obj, int num) { LispDestroy("%s: %s %s", STRFUN(builtin), STROBJ(obj), fatal_object_error_strings[num]); } static void number_init(void) { zero.type = one.type = two.type = N_FIXNUM; zero.data.fixnum = 0; one.data.fixnum = 1; two.data.fixnum = 2; } static double bi_getd(mpi *bignum) { double value = mpi_getd(bignum); if (!finite(value)) fatal_error(FLOATING_POINT_EXCEPTION); return (value); } static double br_getd(mpr *bigratio) { double value = mpr_getd(bigratio); if (!finite(value)) fatal_error(FLOATING_POINT_EXCEPTION); return (value); } static LispObj * number_pi(void) { LispObj *result; #ifndef M_PI #define M_PI 3.14159265358979323846 #endif result = DFLOAT(M_PI); return (result); } static void set_real_real(n_real *real, n_real *val) { switch (RTYPE(real) = RTYPE(val)) { case N_FIXNUM: RFI(real) = RFI(val); break; case N_BIGNUM: RBI(real) = XALLOC(mpi); mpi_init(RBI(real)); mpi_set(RBI(real), RBI(val)); break; case N_FLONUM: RFF(real) = RFF(val); break; case N_FIXRATIO: RFRN(real) = RFRN(val); RFRD(real) = RFRD(val); break; case N_BIGRATIO: RBR(real) = XALLOC(mpr); mpr_init(RBR(real)); mpr_set(RBR(real), RBR(val)); break; } } static void set_real_object(n_real *real, LispObj *obj) { switch (OBJECT_TYPE(obj)) { case LispFixnum_t: RTYPE(real) = N_FIXNUM; RFI(real) = OFI(obj); break; case LispInteger_t: RTYPE(real) = N_FIXNUM; RFI(real) = OII(obj); break; case LispBignum_t: RTYPE(real) = N_BIGNUM; RBI(real) = XALLOC(mpi); mpi_init(RBI(real)); mpi_set(RBI(real), OBI(obj)); break; case LispDFloat_t: RTYPE(real) = N_FLONUM; RFF(real) = ODF(obj); break; case LispRatio_t: RTYPE(real) = N_FIXRATIO; RFRN(real) = OFRN(obj); RFRD(real) = OFRD(obj); break; case LispBigratio_t: RTYPE(real) = N_BIGRATIO; RBR(real) = XALLOC(mpr); mpr_init(RBR(real)); mpr_set(RBR(real), OBR(obj)); break; default: fatal_object_error(obj, NOT_A_REAL_NUMBER); break; } } static void set_number_object(n_number *num, LispObj *obj) { switch (OBJECT_TYPE(obj)) { case LispFixnum_t: num->complex = 0; NRTYPE(num) = N_FIXNUM; NRFI(num) = OFI(obj); break; case LispInteger_t: num->complex = 0; NRTYPE(num) = N_FIXNUM; NRFI(num) = OII(obj); break; case LispBignum_t: num->complex = 0; NRTYPE(num) = N_BIGNUM; NRBI(num) = XALLOC(mpi); mpi_init(NRBI(num)); mpi_set(NRBI(num), OBI(obj)); break; case LispDFloat_t: num->complex = 0; NRTYPE(num) = N_FLONUM; NRFF(num) = ODF(obj); break; case LispRatio_t: num->complex = 0; NRTYPE(num) = N_FIXRATIO; NRFRN(num) = OFRN(obj); NRFRD(num) = OFRD(obj); break; case LispBigratio_t: num->complex = 0; NRTYPE(num) = N_BIGRATIO; NRBR(num) = XALLOC(mpr); mpr_init(NRBR(num)); mpr_set(NRBR(num), OBR(obj)); break; case LispComplex_t: num->complex = 1; set_real_object(NREAL(num), OCXR(obj)); set_real_object(NIMAG(num), OCXI(obj)); break; default: fatal_object_error(obj, NOT_A_NUMBER); break; } } static void clear_real(n_real *real) { if (RTYPE(real) == N_BIGNUM) { mpi_clear(RBI(real)); XFREE(RBI(real)); } else if (RTYPE(real) == N_BIGRATIO) { mpr_clear(RBR(real)); XFREE(RBR(real)); } } static void clear_number(n_number *num) { clear_real(NREAL(num)); if (num->complex) clear_real(NIMAG(num)); } static LispObj * make_real_object(n_real *real) { LispObj *obj; switch (RTYPE(real)) { case N_FIXNUM: if (RFI(real) > MOST_POSITIVE_FIXNUM || RFI(real) < MOST_NEGATIVE_FIXNUM) { obj = LispNew(NIL, NIL); obj->type = LispInteger_t; OII(obj) = RFI(real); } else obj = FIXNUM(RFI(real)); break; case N_BIGNUM: obj = BIGNUM(RBI(real)); break; case N_FLONUM: obj = DFLOAT(RFF(real)); break; case N_FIXRATIO: obj = LispNew(NIL, NIL); obj->type = LispRatio_t; OFRN(obj) = RFRN(real); OFRD(obj) = RFRD(real); break; case N_BIGRATIO: obj = BIGRATIO(RBR(real)); break; default: obj = NIL; break; } return (obj); } static LispObj * make_number_object(n_number *num) { LispObj *obj; if (num->complex) { GC_ENTER(); obj = LispNew(NIL, NIL); GC_PROTECT(obj); OCXI(obj) = NIL; obj->type = LispComplex_t; OCXR(obj) = make_real_object(NREAL(num)); OCXI(obj) = make_real_object(NIMAG(num)); GC_LEAVE(); } else { switch (NRTYPE(num)) { case N_FIXNUM: if (NRFI(num) > MOST_POSITIVE_FIXNUM || NRFI(num) < MOST_NEGATIVE_FIXNUM) { obj = LispNew(NIL, NIL); obj->type = LispInteger_t; OII(obj) = NRFI(num); } else obj = FIXNUM(NRFI(num)); break; case N_BIGNUM: obj = BIGNUM(NRBI(num)); break; case N_FLONUM: obj = DFLOAT(NRFF(num)); break; case N_FIXRATIO: obj = LispNew(NIL, NIL); obj->type = LispRatio_t; OFRN(obj) = NRFRN(num); OFRD(obj) = NRFRD(num); break; case N_BIGRATIO: obj = BIGRATIO(NRBR(num)); break; default: obj = NIL; break; } } return (obj); } #define DEFOP_REAL_REAL(OP) \ OP##_real_real(n_real *real, n_real *val) \ { \ switch (RTYPE(real)) { \ case N_FIXNUM: \ switch (RTYPE(val)) { \ case N_FIXNUM: \ r##OP##_fi_fi(real, RFI(val)); \ break; \ case N_BIGNUM: \ r##OP##_fi_bi(real, RBI(val)); \ break; \ case N_FLONUM: \ r##OP##_flonum(real, (double)RFI(real), RFF(val)); \ break; \ case N_FIXRATIO: \ r##OP##_fi_fr(real, RFRN(val), RFRD(val)); \ break; \ case N_BIGRATIO: \ r##OP##_fi_br(real, RBR(val)); \ break; \ } \ break; \ case N_BIGNUM: \ switch (RTYPE(val)) { \ case N_FIXNUM: \ r##OP##_bi_fi(real, RFI(val)); \ break; \ case N_BIGNUM: \ r##OP##_bi_bi(real, RBI(val)); \ break; \ case N_FLONUM: \ r##OP##_flonum(real, bi_getd(RBI(real)), RFF(val)); \ break; \ case N_FIXRATIO: \ r##OP##_bi_fr(real, RFRN(val), RFRD(val)); \ break; \ case N_BIGRATIO: \ r##OP##_bi_br(real, RBR(val)); \ break; \ } \ break; \ case N_FLONUM: \ switch (RTYPE(val)) { \ case N_FIXNUM: \ r##OP##_flonum(real, RFF(real), (double)RFI(val)); \ break; \ case N_BIGNUM: \ r##OP##_flonum(real, RFF(real), bi_getd(RBI(val))); \ break; \ case N_FLONUM: \ r##OP##_flonum(real, RFF(real), RFF(val)); \ break; \ case N_FIXRATIO: \ r##OP##_flonum(real, RFF(real), \ (double)RFRN(val) / (double)RFRD(val));\ break; \ case N_BIGRATIO: \ r##OP##_flonum(real, RFF(real), br_getd(RBR(val))); \ break; \ } \ break; \ case N_FIXRATIO: \ switch (RTYPE(val)) { \ case N_FIXNUM: \ r##OP##_fr_fi(real, RFI(val)); \ break; \ case N_BIGNUM: \ r##OP##_fr_bi(real, RBI(val)); \ break; \ case N_FLONUM: \ r##OP##_flonum(real, \ (double)RFRN(real) / (double)RFRD(real),\ RFF(val)); \ break; \ case N_FIXRATIO: \ r##OP##_fr_fr(real, RFRN(val), RFRD(val)); \ break; \ case N_BIGRATIO: \ r##OP##_fr_br(real, RBR(val)); \ break; \ } \ break; \ case N_BIGRATIO: \ switch (RTYPE(val)) { \ case N_FIXNUM: \ r##OP##_br_fi(real, RFI(val)); \ break; \ case N_BIGNUM: \ r##OP##_br_bi(real, RBI(val)); \ break; \ case N_FLONUM: \ r##OP##_flonum(real, br_getd(RBR(real)), RFF(val)); \ break; \ case N_FIXRATIO: \ r##OP##_br_fr(real, RFRN(val), RFRD(val)); \ break; \ case N_BIGRATIO: \ r##OP##_br_br(real, RBR(val)); \ break; \ } \ break; \ } \ } static void DEFOP_REAL_REAL(add) static void DEFOP_REAL_REAL(sub) static void DEFOP_REAL_REAL(div) static void DEFOP_REAL_REAL(mul) #define DEFOP_REAL_OBJECT(OP) \ OP##_real_object(n_real *real, LispObj *obj) \ { \ switch (OBJECT_TYPE(obj)) { \ case LispFixnum_t: \ switch (RTYPE(real)) { \ case N_FIXNUM: \ r##OP##_fi_fi(real, OFI(obj)); \ break; \ case N_BIGNUM: \ r##OP##_bi_fi(real, OFI(obj)); \ break; \ case N_FLONUM: \ r##OP##_flonum(real, RFF(real), (double)OFI(obj)); \ break; \ case N_FIXRATIO: \ r##OP##_fr_fi(real, OFI(obj)); \ break; \ case N_BIGRATIO: \ r##OP##_br_fi(real, OFI(obj)); \ break; \ } \ break; \ case LispInteger_t: \ switch (RTYPE(real)) { \ case N_FIXNUM: \ r##OP##_fi_fi(real, OII(obj)); \ break; \ case N_BIGNUM: \ r##OP##_bi_fi(real, OII(obj)); \ break; \ case N_FLONUM: \ r##OP##_flonum(real, RFF(real), (double)OII(obj)); \ break; \ case N_FIXRATIO: \ r##OP##_fr_fi(real, OII(obj)); \ break; \ case N_BIGRATIO: \ r##OP##_br_fi(real, OII(obj)); \ break; \ } \ break; \ case LispBignum_t: \ switch (RTYPE(real)) { \ case N_FIXNUM: \ r##OP##_fi_bi(real, OBI(obj)); \ break; \ case N_BIGNUM: \ r##OP##_bi_bi(real, OBI(obj)); \ break; \ case N_FLONUM: \ r##OP##_flonum(real, RFF(real), bi_getd(OBI(obj))); \ break; \ case N_FIXRATIO: \ r##OP##_fr_bi(real, OBI(obj)); \ break; \ case N_BIGRATIO: \ r##OP##_br_bi(real, OBI(obj)); \ break; \ } \ break; \ case LispDFloat_t: \ switch (RTYPE(real)) { \ case N_FIXNUM: \ r##OP##_flonum(real, (double)RFI(real), ODF(obj)); \ break; \ case N_BIGNUM: \ r##OP##_flonum(real, bi_getd(RBI(real)), ODF(obj)); \ break; \ case N_FLONUM: \ r##OP##_flonum(real, RFF(real), ODF(obj)); \ break; \ case N_FIXRATIO: \ r##OP##_flonum(real, \ (double)RFRN(real) / (double)RFRD(real),\ ODF(obj)); \ break; \ case N_BIGRATIO: \ r##OP##_flonum(real, br_getd(RBR(real)), ODF(obj)); \ break; \ } \ break; \ case LispRatio_t: \ switch (RTYPE(real)) { \ case N_FIXNUM: \ r##OP##_fi_fr(real, OFRN(obj), OFRD(obj)); \ break; \ case N_BIGNUM: \ r##OP##_bi_fr(real, OFRN(obj), OFRD(obj)); \ break; \ case N_FLONUM: \ r##OP##_flonum(real, RFF(real), \ (double)OFRN(obj) / (double)OFRD(obj)); \ break; \ case N_FIXRATIO: \ r##OP##_fr_fr(real, OFRN(obj), OFRD(obj)); \ break; \ case N_BIGRATIO: \ r##OP##_br_fr(real, OFRN(obj), OFRD(obj)); \ break; \ } \ break; \ case LispBigratio_t: \ switch (RTYPE(real)) { \ case N_FIXNUM: \ r##OP##_fi_br(real, OBR(obj)); \ break; \ case N_BIGNUM: \ r##OP##_bi_br(real, OBR(obj)); \ break; \ case N_FLONUM: \ r##OP##_flonum(real, RFF(real), br_getd(OBR(obj))); \ break; \ case N_FIXRATIO: \ r##OP##_fr_br(real, OBR(obj)); \ break; \ case N_BIGRATIO: \ r##OP##_br_br(real, OBR(obj)); \ break; \ } \ break; \ default: \ fatal_object_error(obj, NOT_A_REAL_NUMBER); \ break; \ } \ } static void DEFOP_REAL_OBJECT(add) static void DEFOP_REAL_OBJECT(sub) static void DEFOP_REAL_OBJECT(div) static void DEFOP_REAL_OBJECT(mul) #define DEFOP_NUMBER_OBJECT(OP) \ OP##_number_object(n_number *num, LispObj *obj) \ { \ if (num->complex) { \ switch (OBJECT_TYPE(obj)) { \ case LispFixnum_t: \ case LispInteger_t: \ case LispBignum_t: \ case LispDFloat_t: \ case LispRatio_t: \ case LispBigratio_t: \ n##OP##_cx_re(num, obj); \ break; \ case LispComplex_t: \ n##OP##_cx_cx(num, obj); \ break; \ default: \ fatal_object_error(obj, NOT_A_NUMBER); \ break; \ } \ } \ else { \ switch (OBJECT_TYPE(obj)) { \ case LispFixnum_t: \ switch (NRTYPE(num)) { \ case N_FIXNUM: \ r##OP##_fi_fi(NREAL(num), OFI(obj)); \ break; \ case N_BIGNUM: \ r##OP##_bi_fi(NREAL(num), OFI(obj)); \ break; \ case N_FLONUM: \ r##OP##_flonum(NREAL(num), NRFF(num), \ (double)OFI(obj)); \ break; \ case N_FIXRATIO: \ r##OP##_fr_fi(NREAL(num), OFI(obj)); \ break; \ case N_BIGRATIO: \ r##OP##_br_fi(NREAL(num), OFI(obj)); \ break; \ } \ break; \ case LispInteger_t: \ switch (NRTYPE(num)) { \ case N_FIXNUM: \ r##OP##_fi_fi(NREAL(num), OII(obj)); \ break; \ case N_BIGNUM: \ r##OP##_bi_fi(NREAL(num), OII(obj)); \ break; \ case N_FLONUM: \ r##OP##_flonum(NREAL(num), NRFF(num), \ (double)OII(obj)); \ break; \ case N_FIXRATIO: \ r##OP##_fr_fi(NREAL(num), OII(obj)); \ break; \ case N_BIGRATIO: \ r##OP##_br_fi(NREAL(num), OII(obj)); \ break; \ } \ break; \ case LispBignum_t: \ switch (NRTYPE(num)) { \ case N_FIXNUM: \ r##OP##_fi_bi(NREAL(num), OBI(obj)); \ break; \ case N_BIGNUM: \ r##OP##_bi_bi(NREAL(num), OBI(obj)); \ break; \ case N_FLONUM: \ r##OP##_flonum(NREAL(num), NRFF(num), \ bi_getd(OBI(obj))); \ break; \ case N_FIXRATIO: \ r##OP##_fr_bi(NREAL(num), OBI(obj)); \ break; \ case N_BIGRATIO: \ r##OP##_br_bi(NREAL(num), OBI(obj)); \ break; \ } \ break; \ case LispDFloat_t: \ switch (NRTYPE(num)) { \ case N_FIXNUM: \ r##OP##_flonum(NREAL(num), (double)NRFI(num), \ ODF(obj)); \ break; \ case N_BIGNUM: \ r##OP##_flonum(NREAL(num), bi_getd(NRBI(num)), \ ODF(obj)); \ break; \ case N_FLONUM: \ r##OP##_flonum(NREAL(num), NRFF(num), ODF(obj));\ break; \ case N_FIXRATIO: \ r##OP##_flonum(NREAL(num), \ (double)NRFRN(num) / \ (double)NRFRD(num), \ ODF(obj)); \ break; \ case N_BIGRATIO: \ r##OP##_flonum(NREAL(num), br_getd(NRBR(num)), \ ODF(obj)); \ break; \ } \ break; \ case LispRatio_t: \ switch (NRTYPE(num)) { \ case N_FIXNUM: \ r##OP##_fi_fr(NREAL(num), OFRN(obj), OFRD(obj));\ break; \ case N_BIGNUM: \ r##OP##_bi_fr(NREAL(num), OFRN(obj), OFRD(obj));\ break; \ case N_FLONUM: \ r##OP##_flonum(NREAL(num), NRFF(num), \ (double)OFRN(obj) / \ (double)OFRD(obj)); \ break; \ case N_FIXRATIO: \ r##OP##_fr_fr(NREAL(num), OFRN(obj), OFRD(obj));\ break; \ case N_BIGRATIO: \ r##OP##_br_fr(NREAL(num), OFRN(obj), OFRD(obj));\ break; \ } \ break; \ case LispBigratio_t: \ switch (NRTYPE(num)) { \ case N_FIXNUM: \ r##OP##_fi_br(NREAL(num), OBR(obj)); \ break; \ case N_BIGNUM: \ r##OP##_bi_br(NREAL(num), OBR(obj)); \ break; \ case N_FLONUM: \ r##OP##_flonum(NREAL(num), NRFF(num), \ br_getd(OBR(obj))); \ break; \ case N_FIXRATIO: \ r##OP##_fr_br(NREAL(num), OBR(obj)); \ break; \ case N_BIGRATIO: \ r##OP##_br_br(NREAL(num), OBR(obj)); \ break; \ } \ break; \ case LispComplex_t: \ n##OP##_re_cx(num, obj); \ break; \ default: \ fatal_object_error(obj, NOT_A_NUMBER); \ break; \ } \ } \ } static void DEFOP_NUMBER_OBJECT(add) static void DEFOP_NUMBER_OBJECT(sub) static void DEFOP_NUMBER_OBJECT(div) static void DEFOP_NUMBER_OBJECT(mul) /************************************************************************ * ABS ************************************************************************/ static void abs_real(n_real *real) { switch (RTYPE(real)) { case N_FIXNUM: rabs_fi(real); break; case N_BIGNUM: rabs_bi(real); break; case N_FLONUM: rabs_ff(real); break; case N_FIXRATIO: rabs_fr(real); break; case N_BIGRATIO: rabs_br(real); break; } } static void abs_number(n_number *num) { if (num->complex) nabs_cx(num); else { switch (NRTYPE(num)) { case N_FIXNUM: rabs_fi(NREAL(num)); break; case N_BIGNUM: rabs_bi(NREAL(num)); break; case N_FLONUM: rabs_ff(NREAL(num)); break; case N_FIXRATIO: rabs_fr(NREAL(num)); break; case N_BIGRATIO: rabs_br(NREAL(num)); break; } } } static void nabs_cx(n_number *num) { n_real temp; abs_real(NREAL(num)); abs_real(NIMAG(num)); if (cmp_real_real(NREAL(num), NIMAG(num)) < 0) { memcpy(&temp, NIMAG(num), sizeof(n_real)); memcpy(NIMAG(num), NREAL(num), sizeof(n_real)); memcpy(NREAL(num), &temp, sizeof(n_real)); } if (cmp_real_real(NIMAG(num), &zero) == 0) { num->complex = 0; if (NITYPE(num) == N_FLONUM) { /* change number type */ temp.type = N_FLONUM; temp.data.flonum = 1.0; mul_real_real(NREAL(num), &temp); } else clear_real(NIMAG(num)); } else { div_real_real(NIMAG(num), NREAL(num)); set_real_real(&temp, NIMAG(num)); mul_real_real(NIMAG(num), &temp); clear_real(&temp); add_real_real(NIMAG(num), &one); sqrt_real(NIMAG(num)); mul_real_real(NIMAG(num), NREAL(num)); clear_real(NREAL(num)); memcpy(NREAL(num), NIMAG(num), sizeof(n_real)); num->complex = 0; } } static INLINE void rabs_fi(n_real *real) { if (RFI(real) < 0) rneg_fi(real); } static INLINE void rabs_bi(n_real *real) { if (mpi_cmpi(RBI(real), 0) < 0) mpi_neg(RBI(real), RBI(real)); } static INLINE void rabs_ff(n_real *real) { if (RFF(real) < 0.0) RFF(real) = -RFF(real); } static INLINE void rabs_fr(n_real *real) { if (RFRN(real) < 0) rneg_fr(real); } static INLINE void rabs_br(n_real *real) { if (mpi_cmpi(RBRN(real), 0) < 0) mpi_neg(RBRN(real), RBRN(real)); } /************************************************************************ * NEG ************************************************************************/ static void neg_real(n_real *real) { switch (RTYPE(real)) { case N_FIXNUM: rneg_fi(real); break; case N_BIGNUM: rneg_bi(real); break; case N_FLONUM: rneg_ff(real); break; case N_FIXRATIO: rneg_fr(real); break; case N_BIGRATIO: rneg_br(real); break; } } static void neg_number(n_number *num) { if (num->complex) { neg_real(NREAL(num)); neg_real(NIMAG(num)); } else { switch (NRTYPE(num)) { case N_FIXNUM: rneg_fi(NREAL(num)); break; case N_BIGNUM: rneg_bi(NREAL(num)); break; case N_FLONUM: rneg_ff(NREAL(num)); break; case N_FIXRATIO: rneg_fr(NREAL(num)); break; case N_BIGRATIO: rneg_br(NREAL(num)); break; } } } static void rneg_fi(n_real *real) { if (RFI(real) == MINSLONG) { mpi *bigi = XALLOC(mpi); mpi_init(bigi); mpi_seti(bigi, RFI(real)); mpi_neg(bigi, bigi); RTYPE(real) = N_BIGNUM; RBI(real) = bigi; } else RFI(real) = -RFI(real); } static INLINE void rneg_bi(n_real *real) { mpi_neg(RBI(real), RBI(real)); } static INLINE void rneg_ff(n_real *real) { RFF(real) = -RFF(real); } static void rneg_fr(n_real *real) { if (RFRN(real) == MINSLONG) { mpr *bigr = XALLOC(mpr); mpr_init(bigr); mpr_seti(bigr, RFRN(real), RFRD(real)); mpi_neg(mpr_num(bigr), mpr_num(bigr)); RTYPE(real) = N_BIGRATIO; RBR(real) = bigr; } else RFRN(real) = -RFRN(real); } static INLINE void rneg_br(n_real *real) { mpi_neg(RBRN(real), RBRN(real)); } /************************************************************************ * SQRT ************************************************************************/ static void sqrt_real(n_real *real) { switch (RTYPE(real)) { case N_FIXNUM: case N_BIGNUM: rsqrt_xi(real); break; case N_FLONUM: rsqrt_ff(real); break; case N_FIXRATIO: case N_BIGRATIO: rsqrt_xr(real); break; } } static void sqrt_number(n_number *num) { if (num->complex) nsqrt_cx(num); else { switch (NRTYPE(num)) { case N_FIXNUM: case N_BIGNUM: nsqrt_xi(num); break; case N_FLONUM: nsqrt_ff(num); break; case N_FIXRATIO: case N_BIGRATIO: nsqrt_xr(num); break; } } } static void rsqrt_xi(n_real *real) { int exact; mpi bignum; if (cmp_real_real(real, &zero) < 0) fatal_error(FLOATING_POINT_EXCEPTION); mpi_init(&bignum); if (RTYPE(real) == N_BIGNUM) exact = mpi_sqrt(&bignum, RBI(real)); else { mpi tmp; mpi_init(&tmp); mpi_seti(&tmp, RFI(real)); exact = mpi_sqrt(&bignum, &tmp); mpi_clear(&tmp); } if (exact) { if (RTYPE(real) == N_BIGNUM) { mpi_set(RBI(real), &bignum); rbi_canonicalize(real); } else RFI(real) = mpi_geti(&bignum); } else { double value; if (RTYPE(real) == N_BIGNUM) { value = bi_getd(RBI(real)); RCLEAR_BI(real); } else value = (double)RFI(real); value = sqrt(value); RTYPE(real) = N_FLONUM; RFF(real) = value; } mpi_clear(&bignum); } static void rsqrt_xr(n_real *real) { n_real num, den; if (cmp_real_real(real, &zero) < 0) fatal_error(FLOATING_POINT_EXCEPTION); if (RTYPE(real) == N_FIXRATIO) { num.type = den.type = N_FIXNUM; num.data.fixnum = RFRN(real); den.data.fixnum = RFRD(real); } else { mpi *bignum; if (mpi_fiti(RBRN(real))) { num.type = N_FIXNUM; num.data.fixnum = mpi_geti(RBRN(real)); } else { bignum = XALLOC(mpi); mpi_init(bignum); mpi_set(bignum, RBRN(real)); num.type = N_BIGNUM; num.data.bignum = bignum; } if (mpi_fiti(RBRD(real))) { den.type = N_FIXNUM; den.data.fixnum = mpi_geti(RBRD(real)); } else { bignum = XALLOC(mpi); mpi_init(bignum); mpi_set(bignum, RBRD(real)); den.type = N_BIGNUM; den.data.bignum = bignum; } } rsqrt_xi(&num); rsqrt_xi(&den); clear_real(real); memcpy(real, &num, sizeof(n_real)); div_real_real(real, &den); clear_real(&den); } static void rsqrt_ff(n_real *real) { if (RFF(real) < 0.0) fatal_error(FLOATING_POINT_EXCEPTION); RFF(real) = sqrt(RFF(real)); } static void nsqrt_cx(n_number *num) { n_number mag; n_real *real, *imag; real = &(mag.real); imag = &(mag.imag); set_real_real(real, NREAL(num)); set_real_real(imag, NIMAG(num)); mag.complex = 1; nabs_cx(&mag); /* this will free the imag part data */ if (cmp_real_real(real, &zero) == 0) { clear_number(num); memcpy(NREAL(num), real, sizeof(n_real)); clear_real(real); num->complex = 0; return; } else if (cmp_real_real(NREAL(num), &zero) > 0) { /* R = sqrt((mag + Ra) / 2) */ add_real_real(NREAL(num), real); clear_real(real); div_real_real(NREAL(num), &two); sqrt_real(NREAL(num)); /* I = Ia / R / 2 */ div_real_real(NIMAG(num), NREAL(num)); div_real_real(NIMAG(num), &two); } else { /* remember old imag part */ memcpy(imag, NIMAG(num), sizeof(n_real)); /* I = sqrt((mag - Ra) / 2) */ memcpy(NIMAG(num), real, sizeof(n_real)); sub_real_real(NIMAG(num), NREAL(num)); div_real_real(NIMAG(num), &two); sqrt_real(NIMAG(num)); if (cmp_real_real(imag, &zero) < 0) neg_real(NIMAG(num)); /* R = Ia / I / 2 */ clear_real(NREAL(num)); /* start with old imag part */ memcpy(NREAL(num), imag, sizeof(n_real)); div_real_real(NREAL(num), NIMAG(num)); div_real_real(NREAL(num), &two); } ncx_canonicalize(num); } static void nsqrt_xi(n_number *num) { if (cmp_real_real(NREAL(num), &zero) < 0) { memcpy(NIMAG(num), NREAL(num), sizeof(n_real)); neg_real(NIMAG(num)); rsqrt_xi(NIMAG(num)); NRTYPE(num) = N_FIXNUM; NRFI(num) = 0; num->complex = 1; } else rsqrt_xi(NREAL(num)); } static void nsqrt_ff(n_number *num) { double value; if (NRFF(num) < 0.0) { value = sqrt(-NRFF(num)); NITYPE(num) = N_FLONUM; NIFF(num) = value; NRTYPE(num) = N_FIXNUM; NRFI(num) = 0; num->complex = 1; } else { value = sqrt(NRFF(num)); NRFF(num) = value; } } static void nsqrt_xr(n_number *num) { if (cmp_real_real(NREAL(num), &zero) < 0) { memcpy(NIMAG(num), NREAL(num), sizeof(n_real)); neg_real(NIMAG(num)); rsqrt_xr(NIMAG(num)); NRTYPE(num) = N_FIXNUM; NRFI(num) = 0; num->complex = 1; } else rsqrt_xr(NREAL(num)); } /************************************************************************ * MOD ************************************************************************/ static void mod_real_real(n_real *real, n_real *val) { /* Assume both operands are integers */ switch (RTYPE(real)) { case N_FIXNUM: switch (RTYPE(val)) { case N_FIXNUM: rmod_fi_fi(real, RFI(val)); break; case N_BIGNUM: rmod_fi_bi(real, RBI(val)); break; } break; case N_BIGNUM: switch (RTYPE(val)) { case N_FIXNUM: rmod_bi_fi(real, RFI(val)); break; case N_BIGNUM: rmod_bi_bi(real, RBI(val)); break; } break; } } static void mod_real_object(n_real *real, LispObj *obj) { switch (RTYPE(real)) { case N_FIXNUM: switch (OBJECT_TYPE(obj)) { case LispFixnum_t: rmod_fi_fi(real, OFI(obj)); return; case LispInteger_t: rmod_fi_fi(real, OII(obj)); return; case LispBignum_t: rmod_fi_bi(real, OBI(obj)); return; default: break; } break; case N_BIGNUM: switch (OBJECT_TYPE(obj)) { case LispFixnum_t: rmod_bi_fi(real, OFI(obj)); return; case LispInteger_t: rmod_bi_fi(real, OII(obj)); return; case LispBignum_t: rmod_bi_bi(real, OBI(obj)); return; default: break; } break; /* Assume the n_real object is an integer */ } fatal_object_error(obj, NOT_AN_INTEGER); } static void rmod_fi_fi(n_real *real, long fi) { if (fi == 0) fatal_error(DIVIDE_BY_ZERO); if ((RFI(real) < 0) ^ (fi < 0)) RFI(real) = (RFI(real) % fi) + fi; else if (RFI(real) == MINSLONG || fi == MINSLONG) { mpi bignum; mpi_init(&bignum); mpi_seti(&bignum, RFI(real)); RFI(real) = mpi_modi(&bignum, fi); mpi_clear(&bignum); } else RFI(real) = RFI(real) % fi; } static void rmod_fi_bi(n_real *real, mpi *bignum) { mpi *bigi; if (mpi_cmpi(bignum, 0) == 0) fatal_error(DIVIDE_BY_ZERO); bigi = XALLOC(mpi); mpi_init(bigi); mpi_seti(bigi, RFI(real)); mpi_mod(bigi, bigi, bignum); RTYPE(real) = N_BIGNUM; RBI(real) = bigi; rbi_canonicalize(real); } static void rmod_bi_fi(n_real *real, long fi) { mpi iop; if (fi == 0) fatal_error(DIVIDE_BY_ZERO); mpi_init(&iop); mpi_seti(&iop, fi); mpi_mod(RBI(real), RBI(real), &iop); mpi_clear(&iop); rbi_canonicalize(real); } static void rmod_bi_bi(n_real *real, mpi *bignum) { if (mpi_cmpi(bignum, 0) == 0) fatal_error(DIVIDE_BY_ZERO); mpi_mod(RBI(real), RBI(real), bignum); rbi_canonicalize(real); } /************************************************************************ * REM ************************************************************************/ static void rem_real_object(n_real *real, LispObj *obj) { switch (RTYPE(real)) { case N_FIXNUM: switch (OBJECT_TYPE(obj)) { case LispFixnum_t: rrem_fi_fi(real, OFI(obj)); return; case LispInteger_t: rrem_fi_fi(real, OII(obj)); return; case LispBignum_t: rrem_fi_bi(real, OBI(obj)); return; default: break; } break; case N_BIGNUM: switch (OBJECT_TYPE(obj)) { case LispFixnum_t: rrem_bi_fi(real, OFI(obj)); return; case LispInteger_t: rrem_bi_fi(real, OII(obj)); return; case LispBignum_t: rrem_bi_bi(real, OBI(obj)); return; default: break; } break; /* Assume the n_real object is an integer */ } fatal_object_error(obj, NOT_AN_INTEGER); } static void rrem_fi_fi(n_real *real, long fi) { if (fi == 0) fatal_error(DIVIDE_BY_ZERO); if (RFI(real) == MINSLONG || fi == MINSLONG) { mpi bignum; mpi_init(&bignum); mpi_seti(&bignum, RFI(real)); RFI(real) = mpi_remi(&bignum, fi); mpi_clear(&bignum); } else RFI(real) = RFI(real) % fi; } static void rrem_fi_bi(n_real *real, mpi *bignum) { mpi *bigi; if (mpi_cmpi(bignum, 0) == 0) fatal_error(DIVIDE_BY_ZERO); bigi = XALLOC(mpi); mpi_init(bigi); mpi_seti(bigi, RFI(real)); mpi_rem(bigi, bigi, bignum); RTYPE(real) = N_BIGNUM; RBI(real) = bigi; rbi_canonicalize(real); } static void rrem_bi_fi(n_real *real, long fi) { mpi iop; if (fi == 0) fatal_error(DIVIDE_BY_ZERO); mpi_init(&iop); mpi_seti(&iop, fi); mpi_rem(RBI(real), RBI(real), &iop); mpi_clear(&iop); rbi_canonicalize(real); } static void rrem_bi_bi(n_real *real, mpi *bignum) { if (mpi_cmpi(bignum, 0) == 0) fatal_error(DIVIDE_BY_ZERO); mpi_rem(RBI(real), RBI(real), bignum); rbi_canonicalize(real); } /************************************************************************ * GCD ************************************************************************/ static void gcd_real_object(n_real *real, LispObj *obj) { if (!INTEGERP(obj)) fatal_object_error(obj, NOT_AN_INTEGER); /* check for zero operand */ if (cmp_real_real(real, &zero) == 0) set_real_object(real, obj); else if (cmp_real_object(&zero, obj) != 0) { n_real rest, temp; set_real_object(&rest, obj); for (;;) { mod_real_real(&rest, real); if (cmp_real_real(&rest, &zero) == 0) break; memcpy(&temp, real, sizeof(n_real)); memcpy(real, &rest, sizeof(n_real)); memcpy(&rest, &temp, sizeof(n_real)); } clear_real(&rest); } } /************************************************************************ * AND ************************************************************************/ static void and_real_object(n_real *real, LispObj *obj) { mpi *bigi, iop; switch (OBJECT_TYPE(obj)) { case LispFixnum_t: switch (RTYPE(real)) { case N_FIXNUM: RFI(real) &= OFI(obj); break; case N_BIGNUM: mpi_init(&iop); mpi_seti(&iop, OFI(obj)); mpi_and(RBI(real), RBI(real), &iop); mpi_clear(&iop); rbi_canonicalize(real); break; } break; case LispInteger_t: switch (RTYPE(real)) { case N_FIXNUM: RFI(real) &= OII(obj); break; case N_BIGNUM: mpi_init(&iop); mpi_seti(&iop, OII(obj)); mpi_and(RBI(real), RBI(real), &iop); mpi_clear(&iop); rbi_canonicalize(real); break; } break; case LispBignum_t: switch (RTYPE(real)) { case N_FIXNUM: bigi = XALLOC(mpi); mpi_init(bigi); mpi_seti(bigi, RFI(real)); mpi_and(bigi, bigi, OBI(obj)); RTYPE(real) = N_BIGNUM; RBI(real) = bigi; rbi_canonicalize(real); break; case N_BIGNUM: mpi_and(RBI(real), RBI(real), OBI(obj)); rbi_canonicalize(real); break; } break; default: fatal_object_error(obj, NOT_AN_INTEGER); break; } } /************************************************************************ * EQV ************************************************************************/ static void eqv_real_object(n_real *real, LispObj *obj) { mpi *bigi, iop; switch (OBJECT_TYPE(obj)) { case LispFixnum_t: switch (RTYPE(real)) { case N_FIXNUM: RFI(real) ^= ~OFI(obj); break; case N_BIGNUM: mpi_init(&iop); mpi_seti(&iop, OFI(obj)); mpi_com(&iop, &iop); mpi_xor(RBI(real), RBI(real), &iop); mpi_clear(&iop); rbi_canonicalize(real); break; } break; case LispInteger_t: switch (RTYPE(real)) { case N_FIXNUM: RFI(real) ^= ~OII(obj); break; case N_BIGNUM: mpi_init(&iop); mpi_seti(&iop, OII(obj)); mpi_com(&iop, &iop); mpi_xor(RBI(real), RBI(real), &iop); mpi_clear(&iop); rbi_canonicalize(real); break; } break; case LispBignum_t: switch (RTYPE(real)) { case N_FIXNUM: bigi = XALLOC(mpi); mpi_init(bigi); mpi_seti(bigi, RFI(real)); mpi_com(bigi, bigi); mpi_xor(bigi, bigi, OBI(obj)); RTYPE(real) = N_BIGNUM; RBI(real) = bigi; rbi_canonicalize(real); break; case N_BIGNUM: mpi_com(RBI(real), RBI(real)); mpi_xor(RBI(real), RBI(real), OBI(obj)); rbi_canonicalize(real); break; } break; default: fatal_object_error(obj, NOT_AN_INTEGER); break; } } /************************************************************************ * IOR ************************************************************************/ static void ior_real_object(n_real *real, LispObj *obj) { mpi *bigi, iop; switch (OBJECT_TYPE(obj)) { case LispFixnum_t: switch (RTYPE(real)) { case N_FIXNUM: RFI(real) |= OFI(obj); break; case N_BIGNUM: mpi_init(&iop); mpi_seti(&iop, OFI(obj)); mpi_ior(RBI(real), RBI(real), &iop); mpi_clear(&iop); rbi_canonicalize(real); break; } break; case LispInteger_t: switch (RTYPE(real)) { case N_FIXNUM: RFI(real) |= OII(obj); break; case N_BIGNUM: mpi_init(&iop); mpi_seti(&iop, OII(obj)); mpi_ior(RBI(real), RBI(real), &iop); mpi_clear(&iop); rbi_canonicalize(real); break; } break; case LispBignum_t: switch (RTYPE(real)) { case N_FIXNUM: bigi = XALLOC(mpi); mpi_init(bigi); mpi_seti(bigi, RFI(real)); mpi_ior(bigi, bigi, OBI(obj)); RTYPE(real) = N_BIGNUM; RBI(real) = bigi; rbi_canonicalize(real); break; case N_BIGNUM: mpi_ior(RBI(real), RBI(real), OBI(obj)); rbi_canonicalize(real); break; } break; default: fatal_object_error(obj, NOT_AN_INTEGER); break; } } /************************************************************************ * NOT ************************************************************************/ static void not_real(n_real *real) { if (RTYPE(real) == N_FIXNUM) RFI(real) = ~RFI(real); else { mpi_com(RBI(real), RBI(real)); rbi_canonicalize(real); } } /************************************************************************ * XOR ************************************************************************/ static void xor_real_object(n_real *real, LispObj *obj) { mpi *bigi, iop; switch (OBJECT_TYPE(obj)) { case LispFixnum_t: switch (RTYPE(real)) { case N_FIXNUM: RFI(real) ^= OFI(obj); break; case N_BIGNUM: mpi_init(&iop); mpi_seti(&iop, OFI(obj)); mpi_xor(RBI(real), RBI(real), &iop); mpi_clear(&iop); rbi_canonicalize(real); break; } break; case LispInteger_t: switch (RTYPE(real)) { case N_FIXNUM: RFI(real) ^= OII(obj); break; case N_BIGNUM: mpi_init(&iop); mpi_seti(&iop, OII(obj)); mpi_xor(RBI(real), RBI(real), &iop); mpi_clear(&iop); rbi_canonicalize(real); break; } break; case LispBignum_t: switch (RTYPE(real)) { case N_FIXNUM: bigi = XALLOC(mpi); mpi_init(bigi); mpi_seti(bigi, RFI(real)); mpi_xor(bigi, bigi, OBI(obj)); RTYPE(real) = N_BIGNUM; RBI(real) = bigi; rbi_canonicalize(real); break; case N_BIGNUM: mpi_xor(RBI(real), RBI(real), OBI(obj)); rbi_canonicalize(real); break; } break; default: fatal_object_error(obj, NOT_AN_INTEGER); break; } } /************************************************************************ * DIVIDE ************************************************************************/ static void divide_number_object(n_number *num, LispObj *obj, int fun, int flo) { switch (OBJECT_TYPE(obj)) { case LispFixnum_t: switch (NRTYPE(num)) { case N_FIXNUM: ndivide_fi_fi(num, OFI(obj), fun, flo); break; case N_BIGNUM: ndivide_xi_xi(num, obj, fun, flo); break; case N_FLONUM: ndivide_flonum(num, NRFF(num), (double)OFI(obj), fun, flo); break; case N_FIXRATIO: case N_BIGRATIO: ndivide_xr_xi(num, obj, fun, flo); break; } break; case LispInteger_t: switch (NRTYPE(num)) { case N_FIXNUM: ndivide_fi_fi(num, OII(obj), fun, flo); break; case N_BIGNUM: ndivide_xi_xi(num, obj, fun, flo); break; case N_FLONUM: ndivide_flonum(num, NRFF(num), (double)OII(obj), fun, flo); break; case N_FIXRATIO: case N_BIGRATIO: ndivide_xr_xi(num, obj, fun, flo); break; } break; case LispBignum_t: switch (NRTYPE(num)) { case N_FIXNUM: case N_BIGNUM: ndivide_xi_xi(num, obj, fun, flo); break; case N_FLONUM: ndivide_flonum(num, NRFF(num), bi_getd(OBI(obj)), fun, flo); break; case N_FIXRATIO: case N_BIGRATIO: ndivide_xr_xi(num, obj, fun, flo); break; } break; case LispDFloat_t: switch (NRTYPE(num)) { case N_FIXNUM: ndivide_flonum(num, (double)NRFI(num), ODF(obj), fun, flo); break; case N_BIGNUM: ndivide_flonum(num, bi_getd(NRBI(num)), ODF(obj), fun, flo); break; case N_FLONUM: ndivide_flonum(num, NRFF(num), ODF(obj), fun, flo); break; case N_FIXRATIO: ndivide_flonum(num, (double)NRFRN(num) / (double)NRFRD(num), ODF(obj), fun, flo); break; case N_BIGRATIO: ndivide_flonum(num, br_getd(NRBR(num)), ODF(obj), fun, flo); break; } break; case LispRatio_t: switch (NRTYPE(num)) { case N_FIXNUM: case N_BIGNUM: ndivide_xi_xr(num, obj, fun, flo); break; case N_FLONUM: ndivide_flonum(num, NRFF(num), (double)OFRN(obj) / (double)OFRD(obj), fun, flo); break; case N_FIXRATIO: case N_BIGRATIO: ndivide_xr_xr(num, obj, fun, flo); break; } break; case LispBigratio_t: switch (NRTYPE(num)) { case N_FIXNUM: case N_BIGNUM: ndivide_xi_xr(num, obj, fun, flo); break; case N_FLONUM: ndivide_flonum(num, NRFF(num), br_getd(OBR(obj)), fun, flo); break; case N_FIXRATIO: case N_BIGRATIO: ndivide_xr_xr(num, obj, fun, flo); break; } break; default: fatal_object_error(obj, NOT_A_REAL_NUMBER); break; } } /************************************************************************ * COMPARE ************************************************************************/ static int cmp_real_real(n_real *op1, n_real *op2) { switch (RTYPE(op1)) { case N_FIXNUM: switch (RTYPE(op2)) { case N_FIXNUM: return (cmp_fi_fi(RFI(op1), RFI(op2))); case N_BIGNUM: return (cmp_fi_bi(RFI(op1), RBI(op2))); case N_FLONUM: return (cmp_flonum((double)RFI(op1), RFF(op2))); case N_FIXRATIO: return (cmp_fi_fr(RFI(op1), RFRN(op2), RFRD(op2))); case N_BIGRATIO: return (cmp_fi_br(RFI(op1), RBR(op2))); } break; case N_BIGNUM: switch (RTYPE(op2)) { case N_FIXNUM: return (cmp_bi_fi(RBI(op1), RFI(op2))); case N_BIGNUM: return (cmp_bi_bi(RBI(op1), RBI(op2))); case N_FLONUM: return (cmp_flonum(bi_getd(RBI(op1)), RFF(op2))); case N_FIXRATIO: return (cmp_bi_fr(RBI(op1), RFRN(op2), RFRD(op2))); case N_BIGRATIO: return (cmp_bi_br(RBI(op1), RBR(op2))); } break; case N_FLONUM: switch (RTYPE(op2)) { case N_FIXNUM: return (cmp_flonum(RFF(op1), (double)RFI(op2))); case N_BIGNUM: return (cmp_flonum(RFF(op1), bi_getd(RBI(op2)))); case N_FLONUM: return (cmp_flonum(RFF(op1), RFF(op2))); case N_FIXRATIO: return (cmp_flonum(RFF(op1), (double)RFRN(op2) / (double)RFRD(op2))); case N_BIGRATIO: return (cmp_flonum(RFF(op1), br_getd(RBR(op2)))); } break; case N_FIXRATIO: switch (RTYPE(op2)) { case N_FIXNUM: return (cmp_fr_fi(RFRN(op1), RFRD(op1), RFI(op2))); case N_BIGNUM: return (cmp_fr_bi(RFRN(op1), RFRD(op1), RBI(op2))); case N_FLONUM: return (cmp_flonum((double)RFRN(op1) / (double)RFRD(op1), RFF(op2))); case N_FIXRATIO: return (cmp_fr_fr(RFRN(op1), RFRD(op1), RFRN(op2), RFRD(op2))); case N_BIGRATIO: return (cmp_fr_br(RFRN(op1), RFRD(op1), RBR(op2))); } break; case N_BIGRATIO: switch (RTYPE(op2)) { case N_FIXNUM: return (cmp_br_fi(RBR(op1), RFI(op2))); case N_BIGNUM: return (cmp_br_bi(RBR(op1), RBI(op2))); case N_FLONUM: return (cmp_flonum(br_getd(RBR(op1)), RFF(op2))); case N_FIXRATIO: return (cmp_br_fr(RBR(op1), RFRN(op2), RFRD(op2))); case N_BIGRATIO: return (cmp_br_br(RBR(op1), RBR(op2))); } } return (0); } static int cmp_real_object(n_real *op1, LispObj *op2) { switch (OBJECT_TYPE(op2)) { case LispFixnum_t: switch (RTYPE(op1)) { case N_FIXNUM: return (cmp_fi_fi(RFI(op1), OFI(op2))); case N_BIGNUM: return (cmp_bi_fi(RBI(op1), OFI(op2))); case N_FLONUM: return (cmp_flonum(RFF(op1), (double)OFI(op2))); case N_FIXRATIO: return (cmp_fr_fi(RFRD(op1), RFRN(op1), OFI(op2))); case N_BIGRATIO: return (cmp_br_fi(RBR(op1), OFI(op2))); } break; case LispInteger_t: switch (RTYPE(op1)) { case N_FIXNUM: return (cmp_fi_fi(RFI(op1), OII(op2))); case N_BIGNUM: return (cmp_bi_fi(RBI(op1), OII(op2))); case N_FLONUM: return (cmp_flonum(RFF(op1), (double)OII(op2))); case N_FIXRATIO: return (cmp_fr_fi(RFRD(op1), RFRN(op1), OII(op2))); case N_BIGRATIO: return (cmp_br_fi(RBR(op1), OII(op2))); } break; case LispBignum_t: switch (RTYPE(op1)) { case N_FIXNUM: return (cmp_fi_bi(RFI(op1), OBI(op2))); case N_BIGNUM: return (cmp_bi_bi(RBI(op1), OBI(op2))); case N_FLONUM: return (cmp_flonum(RFF(op1), bi_getd(OBI(op2)))); case N_FIXRATIO: return (cmp_fr_bi(RFRD(op1), RFRN(op1), OBI(op2))); case N_BIGRATIO: return (cmp_br_bi(RBR(op1), OBI(op2))); } break; case LispDFloat_t: switch (RTYPE(op1)) { case N_FIXNUM: return (cmp_flonum((double)RFI(op1), ODF(op2))); case N_BIGNUM: return (cmp_flonum(bi_getd(RBI(op1)), ODF(op2))); case N_FLONUM: return (cmp_flonum(RFF(op1), ODF(op2))); case N_FIXRATIO: return (cmp_flonum((double)RFRN(op1) / (double)RFRD(op1), ODF(op2))); case N_BIGRATIO: return (cmp_flonum(br_getd(RBR(op1)), ODF(op2))); } break; case LispRatio_t: switch (RTYPE(op1)) { case N_FIXNUM: return (cmp_fi_fr(RFI(op1), OFRN(op2), OFRD(op2))); case N_BIGNUM: return (cmp_bi_fr(RBI(op1), OFRN(op2), OFRD(op2))); case N_FLONUM: return (cmp_flonum(RFF(op1), (double)OFRN(op2) / (double)OFRD(op2))); case N_FIXRATIO: return (cmp_fr_fr(RFRN(op1), RFRD(op1), OFRN(op2), OFRD(op2))); case N_BIGRATIO: return (cmp_br_fr(RBR(op1), OFRN(op2), OFRD(op2))); } break; case LispBigratio_t: switch (RTYPE(op1)) { case N_FIXNUM: return (cmp_fi_br(RFI(op1), OBR(op2))); case N_BIGNUM: return (cmp_bi_br(RBI(op1), OBR(op2))); case N_FLONUM: return (cmp_flonum(RFF(op1), br_getd(OBR(op2)))); case N_FIXRATIO: return (cmp_fr_br(RFRN(op1), RFRD(op1), OBR(op2))); case N_BIGRATIO: return (cmp_br_br(RBR(op1), OBR(op2))); } break; default: fatal_object_error(op2, NOT_A_REAL_NUMBER); break; } return (0); } #if 0 /* not used */ static int cmp_number_object(n_number *op1, LispObj *op2) { if (op1->complex) { if (OBJECT_TYPE(op2) == LispComplex_t) { if (cmp_real_object(NREAL(op1), OCXR(op2)) == 0) return (cmp_real_object(NIMAG(op1), OCXI(op2))); return (1); } else if (cmp_real_real(NIMAG(op1), &zero) == 0) return (cmp_real_object(NREAL(op1), op2)); else return (1); } else { switch (OBJECT_TYPE(op2)) { case LispFixnum_t: switch (NRTYPE(op1)) { case N_FIXNUM: return (cmp_fi_fi(NRFI(op1), OFI(op2))); case N_BIGNUM: return (cmp_bi_fi(NRBI(op1), OFI(op2))); case N_FLONUM: return (cmp_flonum(NRFF(op1), (double)OFI(op2))); case N_FIXRATIO: return (cmp_fr_fi(NRFRD(op1), NRFRN(op1), OFI(op2))); case N_BIGRATIO: return (cmp_br_fi(NRBR(op1), OFI(op2))); } break; case LispInteger_t: switch (NRTYPE(op1)) { case N_FIXNUM: return (cmp_fi_fi(NRFI(op1), OII(op2))); case N_BIGNUM: return (cmp_bi_fi(NRBI(op1), OII(op2))); case N_FLONUM: return (cmp_flonum(NRFF(op1), (double)OII(op2))); case N_FIXRATIO: return (cmp_fr_fi(NRFRD(op1), NRFRN(op1), OII(op2))); case N_BIGRATIO: return (cmp_br_fi(NRBR(op1), OII(op2))); } break; case LispBignum_t: switch (NRTYPE(op1)) { case N_FIXNUM: return (cmp_fi_bi(NRFI(op1), OBI(op2))); case N_BIGNUM: return (cmp_bi_bi(NRBI(op1), OBI(op2))); case N_FLONUM: return (cmp_flonum(NRFF(op1), bi_getd(OBI(op2)))); case N_FIXRATIO: return (cmp_fr_bi(NRFRD(op1), NRFRN(op1), OBI(op2))); case N_BIGRATIO: return (cmp_br_bi(NRBR(op1), OBI(op2))); } break; case LispDFloat_t: switch (NRTYPE(op1)) { case N_FIXNUM: return (cmp_flonum((double)NRFI(op1), ODF(op2))); case N_BIGNUM: return (cmp_flonum(bi_getd(NRBI(op1)), ODF(op2))); case N_FLONUM: return (cmp_flonum(NRFF(op1), ODF(op2))); case N_FIXRATIO: return (cmp_flonum((double)NRFRN(op1) / (double)NRFRD(op1), ODF(op2))); case N_BIGRATIO: return (cmp_flonum(br_getd(NRBR(op1)), ODF(op2))); } break; case LispRatio_t: switch (NRTYPE(op1)) { case N_FIXNUM: return (cmp_fi_fr(NRFI(op1), OFRN(op2), OFRD(op2))); case N_BIGNUM: return (cmp_bi_fr(NRBI(op1), OFRN(op2), OFRD(op2))); case N_FLONUM: return (cmp_flonum(NRFF(op1), (double)OFRN(op2) / (double)OFRD(op2))); case N_FIXRATIO: return (cmp_fr_fr(NRFRN(op1), NRFRD(op1), OFRN(op2), OFRD(op2))); case N_BIGRATIO: return (cmp_br_fr(NRBR(op1), OFRN(op2), OFRD(op2))); } break; case LispBigratio_t: switch (NRTYPE(op1)) { case N_FIXNUM: return (cmp_fi_br(NRFI(op1), OBR(op2))); case N_BIGNUM: return (cmp_bi_br(NRBI(op1), OBR(op2))); case N_FLONUM: return (cmp_flonum(NRFF(op1), br_getd(OBR(op2)))); case N_FIXRATIO: return (cmp_fr_br(NRFRN(op1), NRFRD(op1), OBR(op2))); case N_BIGRATIO: return (cmp_br_br(NRBR(op1), OBR(op2))); } break; case LispComplex_t: if (cmp_real_object(&zero, OCXI(op2)) == 0) return (cmp_real_object(NREAL(op1), OCXR(op2))); return (1); default: fatal_object_error(op2, NOT_A_NUMBER); break; } } return (0); } #endif static int cmp_object_object(LispObj *op1, LispObj *op2, int real) { if (OBJECT_TYPE(op1) == LispComplex_t) { if (real) fatal_object_error(op1, NOT_A_REAL_NUMBER); if (OBJECT_TYPE(op2) == LispComplex_t) return (cmp_cx_cx(op1, op2)); else if (cmp_real_object(&zero, OCXI(op1)) == 0) return (cmp_object_object(OCXR(op1), op2, real)); return (1); } else if (OBJECT_TYPE(op2) == LispComplex_t) { if (real) fatal_object_error(op1, NOT_A_REAL_NUMBER); if (cmp_real_object(&zero, OCXI(op2)) == 0) return (cmp_object_object(op1, OCXR(op2), real)); return (1); } else { switch (OBJECT_TYPE(op1)) { case LispFixnum_t: switch (OBJECT_TYPE(op2)) { case LispFixnum_t: return (cmp_fi_fi(OFI(op1), OFI(op2))); case LispInteger_t: return (cmp_fi_fi(OFI(op1), OII(op2))); case LispBignum_t: return (cmp_fi_bi(OFI(op1), OBI(op2))); case LispDFloat_t: return (cmp_flonum((double)OFI(op1), ODF(op2))); case LispRatio_t: return (cmp_fi_fr(OFI(op1), OFRN(op2), OFRD(op2))); case LispBigratio_t: return (cmp_fi_br(OFI(op1), OBR(op2))); default: break; } break; case LispInteger_t: switch (OBJECT_TYPE(op2)) { case LispFixnum_t: return (cmp_fi_fi(OII(op1), OFI(op2))); case LispInteger_t: return (cmp_fi_fi(OII(op1), OII(op2))); case LispBignum_t: return (cmp_fi_bi(OII(op1), OBI(op2))); case LispDFloat_t: return (cmp_flonum((double)OII(op1), ODF(op2))); case LispRatio_t: return (cmp_fi_fr(OII(op1), OFRN(op2), OFRD(op2))); case LispBigratio_t: return (cmp_fi_br(OII(op1), OBR(op2))); default: break; } break; case LispBignum_t: switch (OBJECT_TYPE(op2)) { case LispFixnum_t: return (cmp_bi_fi(OBI(op1), OFI(op2))); case LispInteger_t: return (cmp_bi_fi(OBI(op1), OII(op2))); case LispBignum_t: return (cmp_bi_bi(OBI(op1), OBI(op2))); case LispDFloat_t: return (cmp_flonum(bi_getd(OBI(op1)), ODF(op2))); case LispRatio_t: return (cmp_bi_fr(OBI(op1), OFRN(op2), OFRD(op2))); case LispBigratio_t: return (cmp_bi_br(OBI(op1), OBR(op2))); default: break; } break; case LispDFloat_t: switch (OBJECT_TYPE(op2)) { case LispFixnum_t: return (cmp_flonum(ODF(op1), (double)OFI(op2))); case LispInteger_t: return (cmp_flonum(ODF(op1), (double)OII(op2))); case LispBignum_t: return (cmp_flonum(ODF(op1), bi_getd(OBI(op2)))); case LispDFloat_t: return (cmp_flonum(ODF(op1), ODF(op2))); break; case LispRatio_t: return (cmp_flonum(ODF(op1), (double)OFRN(op2) / (double)OFRD(op2))); case LispBigratio_t: return (cmp_flonum(ODF(op1), br_getd(OBR(op2)))); default: break; } break; case LispRatio_t: switch (OBJECT_TYPE(op2)) { case LispFixnum_t: return (cmp_fr_fi(OFRN(op1), OFRD(op1), OFI(op2))); case LispInteger_t: return (cmp_fr_fi(OFRN(op1), OFRD(op1), OII(op2))); case LispBignum_t: return (cmp_fr_bi(OFRN(op1), OFRD(op1), OBI(op2))); case LispDFloat_t: return (cmp_flonum((double)OFRN(op1) / (double)OFRD(op1), ODF(op2))); case LispRatio_t: return (cmp_fr_fr(OFRN(op1), OFRD(op1), OFRN(op2), OFRD(op2))); case LispBigratio_t: return (cmp_fr_br(OFRN(op1), OFRD(op1), OBR(op2))); default: break; } break; case LispBigratio_t: switch (OBJECT_TYPE(op2)) { case LispFixnum_t: return (cmp_br_fi(OBR(op1), OFI(op2))); case LispInteger_t: return (cmp_br_fi(OBR(op1), OII(op2))); case LispBignum_t: return (cmp_br_bi(OBR(op1), OBI(op2))); case LispDFloat_t: return (cmp_flonum(br_getd(OBR(op1)), ODF(op2))); case LispRatio_t: return (cmp_br_fr(OBR(op1), OFRN(op2), OFRD(op2))); case LispBigratio_t: return (cmp_br_br(OBR(op1), OBR(op2))); default: break; } break; default: fatal_object_error(op1, NOT_A_NUMBER); break; } } fatal_object_error(op2, NOT_A_NUMBER); return (0); } /************************************************************************ * FIXNUM ************************************************************************/ /* * check if op1 + op2 will overflow */ static INLINE int fi_fi_add_overflow(long op1, long op2) { long op = op1 + op2; return (op2 >= 0 ? op < op1 : op > op1); } /* * check if op1 - op2 will overflow */ static INLINE int fi_fi_sub_overflow(long op1, long op2) { long op = op1 - op2; return (op2 >= 0 ? op > op1 : op < op1); } /* * check if op1 * op2 will overflow */ static INLINE int fi_fi_mul_overflow(long op1, long op2) { if (op1 == 0 || op1 == 1 || op2 == 0 || op2 == 1) return (0); if (op1 == MINSLONG || op2 == MINSLONG) return (1); if (op1 < 0) op1 = -op1; if (op2 < 0) op2 = -op2; return (op1 > MAXSLONG / op2); } /************************************************************************ * BIGNUM ************************************************************************/ static void rbi_canonicalize(n_real *real) { if (mpi_fiti(RBI(real))) { long fi = mpi_geti(RBI(real)); RTYPE(real) = N_FIXNUM; mpi_clear(RBI(real)); XFREE(RBI(real)); RFI(real) = fi; } } /************************************************************************ * RATIO ************************************************************************/ static void rfr_canonicalize(n_real *real) { long num, numerator, den, denominator, rest; num = numerator = RFRN(real); den = denominator = RFRD(real); if (denominator == 0) fatal_error(DIVIDE_BY_ZERO); if (num == MINSLONG || den == MINSLONG) { mpr *bigratio = XALLOC(mpr); mpr_init(bigratio); mpr_seti(bigratio, num, den); RTYPE(real) = N_BIGRATIO; RBR(real) = bigratio; rbr_canonicalize(real); return; } if (num < 0) num = -num; else if (num == 0) { RFI(real) = 0; RTYPE(real) = N_FIXNUM; return; } for (;;) { if ((rest = den % num) == 0) break; den = num; num = rest; } if (den != 1) { denominator /= num; numerator /= num; } if (denominator < 0) { numerator = -numerator; denominator = -denominator; } if (denominator == 1) { RTYPE(real) = N_FIXNUM; RFI(real) = numerator; } else { RFRN(real) = numerator; RFRD(real) = denominator; } } static void rbr_canonicalize(n_real *real) { int fitnum, fitden; long numerator, denominator; mpr_canonicalize(RBR(real)); fitnum = mpi_fiti(RBRN(real)); fitden = mpi_fiti(RBRD(real)); if (fitnum && fitden) { numerator = mpi_geti(RBRN(real)); denominator = mpi_geti(RBRD(real)); mpr_clear(RBR(real)); XFREE(RBR(real)); if (numerator == 0) { RFI(real) = 0; RTYPE(real) = N_FIXNUM; } else if (denominator == 1) { RTYPE(real) = N_FIXNUM; RFI(real) = numerator; } else { RTYPE(real) = N_FIXRATIO; RFRN(real) = numerator; RFRD(real) = denominator; } } else if (fitden) { denominator = mpi_geti(RBRD(real)); if (denominator == 1) { mpi *bigi = XALLOC(mpi); mpi_init(bigi); mpi_set(bigi, RBRN(real)); mpr_clear(RBR(real)); XFREE(RBR(real)); RTYPE(real) = N_BIGNUM; RBI(real) = bigi; } else if (denominator == 0) fatal_error(DIVIDE_BY_ZERO); } } /************************************************************************ * COMPLEX ************************************************************************/ static void ncx_canonicalize(n_number *num) { if (NITYPE(num) == N_FIXNUM && NIFI(num) == 0) num->complex = 0; } /************************************************************************ * DIVIDE ************************************************************************/ #define NDIVIDE_NOP 0 #define NDIVIDE_ADD 1 #define NDIVIDE_SUB 2 static void ndivide_fi_fi(n_number *num, long div, int fun, int flo) { long quo, rem; if (NRFI(num) == MINSLONG || div == MINSLONG) { LispObj integer; mpi *bignum = XALLOC(mpi); mpi_init(bignum); mpi_seti(bignum, NRFI(num)); NRBI(num) = bignum; NRTYPE(num) = N_BIGNUM; integer.type = LispInteger_t; integer.data.integer = div; ndivide_xi_xi(num, &integer, fun, flo); return; } else { quo = NRFI(num) / div; rem = NRFI(num) % div; } switch (fun) { case NDIVIDE_CEIL: if ((rem < 0 && div < 0) || (rem > 0 && div > 0)) { ++quo; rem -= div; } break; case NDIVIDE_FLOOR: if ((rem < 0 && div > 0) || (rem > 0 && div < 0)) { --quo; rem += div; } break; case NDIVIDE_ROUND: if (div > 0) { if (rem > 0) { if (rem >= (div + 1) / 2) { ++quo; rem -= div; } } else { if (rem <= (-div - 1) / 2) { --quo; rem += div; } } } else { if (rem > 0) { if (rem >= (-div + 1) / 2) { --quo; rem += div; } } else { if (rem <= (div - 1) / 2) { ++quo; rem -= div; } } } break; } NITYPE(num) = N_FIXNUM; NIFI(num) = rem; if (flo) { NRTYPE(num) = N_FLONUM; NRFF(num) = (double)quo; } else NRFI(num) = quo; } static void ndivide_xi_xi(n_number *num, LispObj *div, int fun, int flo) { LispType type = OBJECT_TYPE(div); int state = NDIVIDE_NOP, dsign, rsign; mpi *quo, *rem; quo = XALLOC(mpi); mpi_init(quo); if (NRTYPE(num) == N_FIXNUM) mpi_seti(quo, NRFI(num)); else mpi_set(quo, NRBI(num)); rem = XALLOC(mpi); mpi_init(rem); switch (type) { case LispFixnum_t: mpi_seti(rem, OFI(div)); break; case LispInteger_t: mpi_seti(rem, OII(div)); break; default: mpi_set(rem, OBI(div)); } dsign = mpi_sgn(rem); mpi_divqr(quo, rem, quo, rem); rsign = mpi_sgn(rem); switch (fun) { case NDIVIDE_CEIL: if ((rsign < 0 && dsign < 0) || (rsign > 0 && dsign > 0)) state = NDIVIDE_ADD; break; case NDIVIDE_FLOOR: if ((rsign < 0 && dsign > 0) || (rsign > 0 && dsign < 0)) state = NDIVIDE_SUB; break; case NDIVIDE_ROUND: { mpi test; mpi_init(&test); switch (type) { case LispFixnum_t: mpi_seti(&test, OFI(div)); break; case LispInteger_t: mpi_seti(&test, OII(div)); break; default: mpi_set(&test, OBI(div)); } if (dsign > 0) { if (rsign > 0) { mpi_addi(&test, &test, 1); mpi_divi(&test, &test, 2); if (mpi_cmp(rem, &test) >= 0) state = NDIVIDE_ADD; } else { mpi_neg(&test, &test); mpi_subi(&test, &test, 1); mpi_divi(&test, &test, 2); if (mpi_cmp(rem, &test) <= 0) state = NDIVIDE_SUB; } } else { if (rsign > 0) { mpi_neg(&test, &test); mpi_addi(&test, &test, 1); mpi_divi(&test, &test, 2); if (mpi_cmp(rem, &test) >= 0) state = NDIVIDE_SUB; } else { mpi_subi(&test, &test, 1); mpi_divi(&test, &test, 2); if (mpi_cmp(rem, &test) <= 0) state = NDIVIDE_ADD; } } mpi_clear(&test); } break; } if (state == NDIVIDE_ADD) { mpi_addi(quo, quo, 1); switch (type) { case LispFixnum_t: mpi_subi(rem, rem, OFI(div)); break; case LispInteger_t: mpi_subi(rem, rem, OII(div)); break; default: mpi_sub(rem, rem, OBI(div)); } } else if (state == NDIVIDE_SUB) { mpi_subi(quo, quo, 1); switch (type) { case LispFixnum_t: mpi_addi(rem, rem, OFI(div)); break; case LispInteger_t: mpi_addi(rem, rem, OII(div)); break; default: mpi_add(rem, rem, OBI(div)); } } if (mpi_fiti(rem)) { NITYPE(num) = N_FIXNUM; NIFI(num) = mpi_geti(rem); mpi_clear(rem); XFREE(rem); } else { NITYPE(num) = N_BIGNUM; NIBI(num) = rem; } clear_real(NREAL(num)); if (flo) { double dval = bi_getd(quo); mpi_clear(quo); XFREE(quo); NRTYPE(num) = N_FLONUM; NRFF(num) = dval; } else { NRTYPE(num) = N_BIGNUM; NRBI(num) = quo; rbi_canonicalize(NREAL(num)); } } static void ndivide_flonum(n_number *number, double num, double div, int fun, int flo) { double quo, rem, modp, tmp; modp = modf(num / div, &quo); rem = num - quo * div; switch (fun) { case NDIVIDE_CEIL: if ((rem < 0.0 && div < 0.0) || (rem > 0.0 && div > 0.0)) { quo += 1.0; rem -= div; } break; case NDIVIDE_FLOOR: if ((rem < 0.0 && div > 0.0) || (rem > 0.0 && div < 0.0)) { quo -= 1.0; rem += div; } break; case NDIVIDE_ROUND: if (fabs(modp) != 0.5 || modf(quo * 0.5, &tmp) != 0.0) { if (div > 0.0) { if (rem > 0.0) { if (rem >= div * 0.5) { quo += 1.0; rem -= div; } } else { if (rem <= div * -0.5) { quo -= 1.0; rem += div; } } } else { if (rem > 0.0) { if (rem >= div * -0.5) { quo -= 1.0; rem += div; } } else { if (rem <= div * 0.5) { quo += 1.0; rem -= div; } } } } break; } if (!finite(quo) || !finite(rem)) fatal_error(FLOATING_POINT_OVERFLOW); NITYPE(number) = N_FLONUM; NIFF(number) = rem; clear_real(NREAL(number)); if (flo) { NRTYPE(number) = N_FLONUM; NRFF(number) = quo; } else { if ((long)quo == quo) { NRTYPE(number) = N_FIXNUM; NRFI(number) = (long)quo; } else { mpi *bigi = XALLOC(mpi); mpi_init(bigi); mpi_setd(bigi, quo); NRBI(number) = bigi; NRTYPE(number) = N_BIGNUM; } } } static void ndivide_xi_xr(n_number *num, LispObj *div, int fun, int flo) { int state = NDIVIDE_NOP, dsign, rsign; mpi *quo; mpr *rem; quo = XALLOC(mpi); mpi_init(quo); if (NRTYPE(num) == N_FIXNUM) mpi_seti(quo, NRFI(num)); else mpi_set(quo, NRBI(num)); rem = XALLOC(mpr); mpr_init(rem); if (XOBJECT_TYPE(div) == LispRatio_t) mpr_seti(rem, OFRN(div), OFRD(div)); else mpr_set(rem, OBR(div)); dsign = mpi_sgn(mpr_num(rem)); mpi_mul(quo, quo, mpr_den(rem)); mpi_divqr(quo, mpr_num(rem), quo, mpr_num(rem)); mpr_canonicalize(rem); rsign = mpi_sgn(mpr_num(rem)); if (mpr_fiti(rem)) { if (mpi_geti(mpr_den(rem)) == 1) { NITYPE(num) = N_FIXNUM; NIFI(num) = mpi_geti(mpr_num(rem)); } else { NITYPE(num) = N_FIXRATIO; NIFRN(num) = mpi_geti(mpr_num(rem)); NIFRD(num) = mpi_geti(mpr_den(rem)); } mpr_clear(rem); XFREE(rem); } else { if (mpi_fiti(mpr_den(rem)) && mpi_geti(mpr_den(rem)) == 1) { NITYPE(num) = N_BIGNUM; NIBI(num) = mpr_num(rem); mpi_clear(mpr_den(rem)); XFREE(rem); } else { NITYPE(num) = N_BIGRATIO; NIBR(num) = rem; } } switch (fun) { case NDIVIDE_CEIL: if ((rsign < 0 && dsign < 0) || (rsign > 0 && dsign > 0)) state = NDIVIDE_ADD; break; case NDIVIDE_FLOOR: if ((rsign < 0 && dsign > 0) || (rsign > 0 && dsign < 0)) state = NDIVIDE_SUB; break; case NDIVIDE_ROUND: { n_real cmp; set_real_object(&cmp, div); div_real_real(&cmp, &two); if (dsign > 0) { if (rsign > 0) { if (cmp_real_real(NIMAG(num), &cmp) >= 0) state = NDIVIDE_ADD; } else { neg_real(&cmp); if (cmp_real_real(NIMAG(num), &cmp) <= 0) state = NDIVIDE_SUB; } } else { if (rsign > 0) { neg_real(&cmp); if (cmp_real_real(NIMAG(num), &cmp) >= 0) state = NDIVIDE_SUB; } else { if (cmp_real_real(NIMAG(num), &cmp) <= 0) state = NDIVIDE_ADD; } } clear_real(&cmp); } break; } if (state == NDIVIDE_ADD) { mpi_addi(quo, quo, 1); sub_real_object(NIMAG(num), div); } else if (state == NDIVIDE_SUB) { mpi_subi(quo, quo, 1); add_real_object(NIMAG(num), div); } clear_real(NREAL(num)); if (flo) { double dval = bi_getd(quo); mpi_clear(quo); XFREE(quo); NRTYPE(num) = N_FLONUM; NRFF(num) = dval; } else { NRBI(num) = quo; NRTYPE(num) = N_BIGNUM; rbi_canonicalize(NREAL(num)); } } static void ndivide_xr_xi(n_number *num, LispObj *div, int fun, int flo) { LispType type = OBJECT_TYPE(div); int state = NDIVIDE_NOP, dsign, rsign; mpi *quo; mpr *rem; quo = XALLOC(mpi); mpi_init(quo); switch (type) { case LispFixnum_t: dsign = OFI(div) < 0 ? -1 : OFI(div) > 0 ? 1 : 0; mpi_seti(quo, OFI(div)); break; case LispInteger_t: dsign = OII(div) < 0 ? -1 : OII(div) > 0 ? 1 : 0; mpi_seti(quo, OII(div)); break; default: dsign = mpi_sgn(OBI(div)); mpi_set(quo, OBI(div)); break; } rem = XALLOC(mpr); mpr_init(rem); if (NRTYPE(num) == N_FIXRATIO) { mpr_seti(rem, NRFRN(num), NRFRD(num)); mpi_muli(quo, quo, NRFRD(num)); } else { mpr_set(rem, NRBR(num)); mpi_mul(quo, quo, NRBRD(num)); } mpi_divqr(quo, mpr_num(rem), mpr_num(rem), quo); mpr_canonicalize(rem); rsign = mpi_sgn(mpr_num(rem)); if (mpr_fiti(rem)) { NITYPE(num) = N_FIXRATIO; NIFRN(num) = mpi_geti(mpr_num(rem)); NIFRD(num) = mpi_geti(mpr_den(rem)); mpr_clear(rem); XFREE(rem); } else { NITYPE(num) = N_BIGRATIO; NIBR(num) = rem; } switch (fun) { case NDIVIDE_CEIL: if ((rsign < 0 && dsign < 0) || (rsign > 0 && dsign > 0)) state = NDIVIDE_ADD; break; case NDIVIDE_FLOOR: if ((rsign < 0 && dsign > 0) || (rsign > 0 && dsign < 0)) state = NDIVIDE_SUB; break; case NDIVIDE_ROUND: { n_real cmp; set_real_object(&cmp, div); div_real_real(&cmp, &two); if (dsign > 0) { if (rsign > 0) { if (cmp_real_real(NIMAG(num), &cmp) >= 0) state = NDIVIDE_ADD; } else { neg_real(&cmp); if (cmp_real_real(NIMAG(num), &cmp) <= 0) state = NDIVIDE_SUB; } } else { if (rsign > 0) { neg_real(&cmp); if (cmp_real_real(NIMAG(num), &cmp) >= 0) state = NDIVIDE_SUB; } else { if (cmp_real_real(NIMAG(num), &cmp) <= 0) state = NDIVIDE_ADD; } } clear_real(&cmp); } break; } if (state == NDIVIDE_ADD) { mpi_addi(quo, quo, 1); sub_real_object(NIMAG(num), div); } else if (state == NDIVIDE_SUB) { mpi_subi(quo, quo, 1); add_real_object(NIMAG(num), div); } clear_real(NREAL(num)); if (flo) { double dval = bi_getd(quo); mpi_clear(quo); XFREE(quo); NRTYPE(num) = N_FLONUM; NRFF(num) = dval; } else { NRBI(num) = quo; NRTYPE(num) = N_BIGNUM; rbi_canonicalize(NREAL(num)); } } static void ndivide_xr_xr(n_number *num, LispObj *div, int fun, int flo) { int state = NDIVIDE_NOP, dsign, rsign, modp; mpr *bigr; mpi *bigi; bigr = XALLOC(mpr); mpr_init(bigr); if (NRTYPE(num) == N_FIXRATIO) mpr_seti(bigr, NRFRN(num), NRFRD(num)); else mpr_set(bigr, NRBR(num)); NITYPE(num) = N_BIGRATIO; NIBR(num) = bigr; if (OBJECT_TYPE(div) == LispRatio_t) { dsign = OFRN(div) < 0 ? -1 : OFRN(div) > 0 ? 1 : 0; mpi_muli(mpr_num(bigr), mpr_num(bigr), OFRD(div)); mpi_muli(mpr_den(bigr), mpr_den(bigr), OFRN(div)); } else { dsign = mpi_sgn(OBRN(div)); mpr_div(bigr, bigr, OBR(div)); } modp = mpi_fiti(mpr_den(bigr)) && mpi_geti(mpr_den(bigr)) == 2; bigi = XALLOC(mpi); mpi_init(bigi); mpi_divqr(bigi, mpr_num(bigr), mpr_num(bigr), mpr_den(bigr)); if (OBJECT_TYPE(div) == LispRatio_t) mpi_seti(mpr_den(bigr), OFRD(div)); else mpi_set(mpr_den(bigr), OBRD(div)); if (NRTYPE(num) == N_FIXRATIO) mpi_muli(mpr_den(bigr), mpr_den(bigr), NRFRD(num)); else mpi_mul(mpr_den(bigr), mpr_den(bigr), NRBRD(num)); clear_real(NREAL(num)); NRTYPE(num) = N_BIGNUM; NRBI(num) = bigi; rbr_canonicalize(NIMAG(num)); rsign = cmp_real_real(NIMAG(num), &zero); switch (fun) { case NDIVIDE_CEIL: if ((rsign < 0 && dsign < 0) || (rsign > 0 && dsign > 0)) state = NDIVIDE_ADD; break; case NDIVIDE_FLOOR: if ((rsign < 0 && dsign > 0) || (rsign > 0 && dsign < 0)) state = NDIVIDE_SUB; break; case NDIVIDE_ROUND: if (!modp || (bigi->digs[0] & 1) == 1) { n_real cmp; set_real_object(&cmp, div); div_real_real(&cmp, &two); if (dsign > 0) { if (rsign > 0) { if (cmp_real_real(NIMAG(num), &cmp) >= 0) state = NDIVIDE_ADD; } else { neg_real(&cmp); if (cmp_real_real(NIMAG(num), &cmp) <= 0) state = NDIVIDE_SUB; } } else { if (rsign > 0) { neg_real(&cmp); if (cmp_real_real(NIMAG(num), &cmp) >= 0) state = NDIVIDE_SUB; } else { if (cmp_real_real(NIMAG(num), &cmp) <= 0) state = NDIVIDE_ADD; } } clear_real(&cmp); } break; } if (state == NDIVIDE_ADD) { add_real_real(NREAL(num), &one); sub_real_object(NIMAG(num), div); } else if (state == NDIVIDE_SUB) { sub_real_real(NREAL(num), &one); add_real_object(NIMAG(num), div); } if (NRTYPE(num) == N_BIGNUM) { if (flo) { double dval = bi_getd(bigi); mpi_clear(bigi); XFREE(bigi); NRTYPE(num) = N_FLONUM; NRFF(num) = dval; } else rbi_canonicalize(NREAL(num)); } else if (flo) { NRTYPE(num) = N_FLONUM; NRFF(num) = (double)NRFI(num); } } /************************************************************************ * REAL COMPLEX ************************************************************************/ static void nadd_re_cx(n_number *num, LispObj *comp) { /* Ra+Rb Ib */ /* Ra+Rb */ add_real_object(NREAL(num), OCXR(comp)); /* Ib */ set_real_object(NIMAG(num), OCXI(comp)); num->complex = 1; ncx_canonicalize(num); } static void nsub_re_cx(n_number *num, LispObj *comp) { /* Ra-Rb -Ib */ /* Ra-Rb */ sub_real_object(NREAL(num), OCXR(comp)); /* -Ib */ NITYPE(num) = N_FIXNUM; NIFI(num) = -1; mul_real_object(NIMAG(num), OCXI(comp)); num->complex = 1; ncx_canonicalize(num); } static void nmul_re_cx(n_number *num, LispObj *comp) { /* Ra*Rb Ra*Ib */ /* copy before change */ set_real_real(NIMAG(num), NREAL(num)); /* Ra*Rb */ mul_real_object(NREAL(num), OCXR(comp)); /* Ra*Ib */ mul_real_object(NIMAG(num), OCXI(comp)); num->complex = 1; ncx_canonicalize(num); } static void ndiv_re_cx(n_number *num, LispObj *comp) { /* Ra*Rb -Ib*Ra ----------- ----------- Rb*Rb+Ib*Ib Rb*Rb+Ib*Ib */ n_real div, temp; /* Rb*Rb */ set_real_object(&div, OCXR(comp)); mul_real_object(&div, OCXR(comp)); /* Ib*Ib */ set_real_object(&temp, OCXI(comp)); mul_real_object(&temp, OCXI(comp)); /* Rb*Rb+Ib*Ib */ add_real_real(&div, &temp); clear_real(&temp); /* -Ib*Ra */ NITYPE(num) = N_FIXNUM; NIFI(num) = -1; mul_real_object(NIMAG(num), OCXI(comp)); mul_real_real(NIMAG(num), NREAL(num)); /* Ra*Rb */ mul_real_object(NREAL(num), OCXR(comp)); div_real_real(NREAL(num), &div); div_real_real(NIMAG(num), &div); clear_real(&div); num->complex = 1; ncx_canonicalize(num); } /************************************************************************ * COMPLEX REAL ************************************************************************/ static void nadd_cx_re(n_number *num, LispObj *re) { /* Ra+Rb Ia */ add_real_object(NREAL(num), re); ncx_canonicalize(num); } static void nsub_cx_re(n_number *num, LispObj *re) { /* Ra-Rb Ia */ sub_real_object(NREAL(num), re); ncx_canonicalize(num); } static void nmul_cx_re(n_number *num, LispObj *re) { /* Ra*Rb Ia*Rb */ mul_real_object(NREAL(num), re); mul_real_object(NIMAG(num), re); ncx_canonicalize(num); } static void ndiv_cx_re(n_number *num, LispObj *re) { /* Ra/Rb Ia/Rb */ div_real_object(NREAL(num), re); div_real_object(NIMAG(num), re); ncx_canonicalize(num); } /************************************************************************ * COMPLEX COMPLEX ************************************************************************/ static void nadd_cx_cx(n_number *num, LispObj *comp) { /* Ra+Rb Ia+Ib */ add_real_object(NREAL(num), OCXR(comp)); add_real_object(NIMAG(num), OCXI(comp)); ncx_canonicalize(num); } static void nsub_cx_cx(n_number *num, LispObj *comp) { /* Ra-Rb Ia-Ib */ sub_real_object(NREAL(num), OCXR(comp)); sub_real_object(NIMAG(num), OCXI(comp)); ncx_canonicalize(num); } static void nmul_cx_cx(n_number *num, LispObj *comp) { /* Ra*Rb-Ia*Ib Ra*Ib+Ia*Rb */ n_real IaIb, RaIb; set_real_real(&IaIb, NIMAG(num)); mul_real_object(&IaIb, OCXI(comp)); set_real_real(&RaIb, NREAL(num)); mul_real_object(&RaIb, OCXI(comp)); /* Ra*Rb-Ia*Ib */ mul_real_object(NREAL(num), OCXR(comp)); sub_real_real(NREAL(num), &IaIb); clear_real(&IaIb); /* Ra*Ib+Ia*Rb */ mul_real_object(NIMAG(num), OCXR(comp)); add_real_real(NIMAG(num), &RaIb); clear_real(&RaIb); ncx_canonicalize(num); } static void ndiv_cx_cx(n_number *num, LispObj *comp) { /* Ra*Rb+Ia*Ib Ia*Rb-Ib*Ra ----------- ----------- Rb*Rb+Ib*Ib Rb*Rb+Ib*Ib */ n_real temp1, temp2; /* IaIb */ set_real_real(&temp1, NIMAG(num)); mul_real_object(&temp1, OCXI(comp)); /* IbRa */ set_real_real(&temp2, NREAL(num)); mul_real_object(&temp2, OCXI(comp)); /* Ra*Rb+Ia*Ib */ mul_real_object(NREAL(num), OCXR(comp)); add_real_real(NREAL(num), &temp1); clear_real(&temp1); /* Ia*Rb-Ib*Ra */ mul_real_object(NIMAG(num), OCXR(comp)); sub_real_real(NIMAG(num), &temp2); clear_real(&temp2); /* Rb*Rb */ set_real_object(&temp1, OCXR(comp)); mul_real_object(&temp1, OCXR(comp)); /* Ib*Ib */ set_real_object(&temp2, OCXI(comp)); mul_real_object(&temp2, OCXI(comp)); /* Rb*Rb+Ib*Ib */ add_real_real(&temp1, &temp2); clear_real(&temp2); div_real_real(NREAL(num), &temp1); div_real_real(NIMAG(num), &temp1); clear_real(&temp1); ncx_canonicalize(num); } static int cmp_cx_cx(LispObj *op1, LispObj *op2) { int cmp; cmp = cmp_object_object(OCXR(op1), OCXR(op2), 1); if (cmp == 0) cmp = cmp_object_object(OCXI(op1), OCXI(op2), 1); return (cmp); } /************************************************************************ * FLONUM FLONUM ************************************************************************/ static void radd_flonum(n_real *real, double op1, double op2) { double value = op1 + op2; if (!finite(value)) fatal_error(FLOATING_POINT_OVERFLOW); switch (RTYPE(real)) { case N_FIXNUM: case N_FIXRATIO: RTYPE(real) = N_FLONUM; break; case N_BIGNUM: RCLEAR_BI(real); RTYPE(real) = N_FLONUM; break; case N_BIGRATIO: RCLEAR_BR(real); RTYPE(real) = N_FLONUM; break; } RFF(real) = value; } static void rsub_flonum(n_real *real, double op1, double op2) { double value = op1 - op2; if (!finite(value)) fatal_error(FLOATING_POINT_OVERFLOW); switch (RTYPE(real)) { case N_FIXNUM: case N_FIXRATIO: RTYPE(real) = N_FLONUM; break; case N_BIGNUM: RCLEAR_BI(real); RTYPE(real) = N_FLONUM; break; case N_BIGRATIO: RCLEAR_BR(real); RTYPE(real) = N_FLONUM; break; } RFF(real) = value; } static void rmul_flonum(n_real *real, double op1, double op2) { double value = op1 * op2; if (!finite(value)) fatal_error(FLOATING_POINT_OVERFLOW); switch (RTYPE(real)) { case N_FIXNUM: case N_FIXRATIO: RTYPE(real) = N_FLONUM; break; case N_BIGNUM: RCLEAR_BI(real); RTYPE(real) = N_FLONUM; break; case N_BIGRATIO: RCLEAR_BR(real); RTYPE(real) = N_FLONUM; break; } RFF(real) = value; } static void rdiv_flonum(n_real *real, double op1, double op2) { double value; if (op2 == 0.0) fatal_error(DIVIDE_BY_ZERO); value = op1 / op2; if (!finite(value)) fatal_error(FLOATING_POINT_OVERFLOW); switch (RTYPE(real)) { case N_FIXNUM: case N_FIXRATIO: RTYPE(real) = N_FLONUM; break; case N_BIGNUM: RCLEAR_BI(real); RTYPE(real) = N_FLONUM; break; case N_BIGRATIO: RCLEAR_BR(real); RTYPE(real) = N_FLONUM; break; } RFF(real) = value; } static int cmp_flonum(double op1, double op2) { double value = op1 - op2; if (!finite(value)) fatal_error(FLOATING_POINT_OVERFLOW); return (value > 0.0 ? 1 : value < 0.0 ? -1 : 0); } /************************************************************************ * FIXNUM FIXNUM ************************************************************************/ static void rop_fi_fi_bi(n_real *real, long fi, int op) { mpi *bigi = XALLOC(mpi); mpi_init(bigi); mpi_seti(bigi, RFI(real)); if (op == NOP_ADD) mpi_addi(bigi, bigi, fi); else if (op == NOP_SUB) mpi_subi(bigi, bigi, fi); else mpi_muli(bigi, bigi, fi); RBI(real) = bigi; RTYPE(real) = N_BIGNUM; } static INLINE void radd_fi_fi(n_real *real, long fi) { if (!fi_fi_add_overflow(RFI(real), fi)) RFI(real) += fi; else rop_fi_fi_bi(real, fi, NOP_ADD); } static INLINE void rsub_fi_fi(n_real *real, long fi) { if (!fi_fi_sub_overflow(RFI(real), fi)) RFI(real) -= fi; else rop_fi_fi_bi(real, fi, NOP_SUB); } static INLINE void rmul_fi_fi(n_real *real, long fi) { if (!fi_fi_mul_overflow(RFI(real), fi)) RFI(real) *= fi; else rop_fi_fi_bi(real, fi, NOP_MUL); } static INLINE void rdiv_fi_fi(n_real *real, long fi) { RTYPE(real) = N_FIXRATIO; RFRN(real) = RFI(real); RFRD(real) = fi; rfr_canonicalize(real); } static INLINE int cmp_fi_fi(long op1, long op2) { if (op1 > op2) return (1); else if (op1 < op2) return (-1); return (0); } /************************************************************************ * FIXNUM BIGNUM ************************************************************************/ static void rop_fi_bi_xi(n_real *real, mpi *bi, int nop) { mpi *bigi = XALLOC(mpi); mpi_init(bigi); mpi_seti(bigi, RFI(real)); if (nop == NOP_ADD) mpi_add(bigi, bigi, bi); else if (nop == NOP_SUB) mpi_sub(bigi, bigi, bi); else mpi_mul(bigi, bigi, bi); if (mpi_fiti(bigi)) { RFI(real) = mpi_geti(bigi); mpi_clear(bigi); XFREE(bigi); } else { RBI(real) = bigi; RTYPE(real) = N_BIGNUM; } } static INLINE void radd_fi_bi(n_real *real, mpi *bi) { rop_fi_bi_xi(real, bi, NOP_ADD); } static INLINE void rsub_fi_bi(n_real *real, mpi *bi) { rop_fi_bi_xi(real, bi, NOP_SUB); } static INLINE void rmul_fi_bi(n_real *real, mpi *bi) { rop_fi_bi_xi(real, bi, NOP_MUL); } static void rdiv_fi_bi(n_real *real, mpi *bi) { mpr *bigr; if (mpi_cmpi(bi, 0) == 0) fatal_error(DIVIDE_BY_ZERO); bigr = XALLOC(mpr); mpr_init(bigr); mpi_seti(mpr_num(bigr), RFI(real)); mpi_set(mpr_den(bigr), bi); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } static INLINE int cmp_fi_bi(long fixnum, mpi *bignum) { return (-mpi_cmpi(bignum, fixnum)); } /************************************************************************ * FIXNUM FIXRATIO ************************************************************************/ static void rop_fi_fr_as_xr(n_real *real, long num, long den, int nop) { int fit; long value = 0, op = RFI(real); fit = !fi_fi_mul_overflow(op, den); if (fit) { value = op * den; if (nop == NOP_ADD) fit = !fi_fi_add_overflow(value, num); else fit = !fi_fi_sub_overflow(value, num); } if (fit) { if (nop == NOP_ADD) RFRN(real) = value + num; else RFRN(real) = value - num; RFRD(real) = den; RTYPE(real) = N_FIXRATIO; rfr_canonicalize(real); } else { mpi iop; mpr *bigr = XALLOC(mpr); mpi_init(&iop); mpi_seti(&iop, op); mpi_muli(&iop, &iop, den); mpr_init(bigr); mpr_seti(bigr, num, den); if (nop == NOP_ADD) mpi_add(mpr_num(bigr), &iop, mpr_num(bigr)); else mpi_sub(mpr_num(bigr), &iop, mpr_num(bigr)); mpi_clear(&iop); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } } static void rop_fi_fr_md_xr(n_real *real, long num, long den, int nop) { int fit; long op = RFI(real); if (nop == NOP_MUL) fit = !fi_fi_mul_overflow(op, num); else fit = !fi_fi_mul_overflow(op, den); if (fit) { if (nop == NOP_MUL) { RFRN(real) = op * num; RFRD(real) = den; } else { RFRN(real) = op * den; RFRD(real) = num; } RTYPE(real) = N_FIXRATIO; rfr_canonicalize(real); } else { mpi iop; mpr *bigr = XALLOC(mpr); mpi_init(&iop); mpi_seti(&iop, op); mpr_init(bigr); if (nop == NOP_MUL) mpr_seti(bigr, num, den); else mpr_seti(bigr, den, num); mpi_mul(mpr_num(bigr), mpr_num(bigr), &iop); mpi_clear(&iop); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } } static INLINE void radd_fi_fr(n_real *real, long num, long den) { rop_fi_fr_as_xr(real, num, den, NOP_ADD); } static INLINE void rsub_fi_fr(n_real *real, long num, long den) { rop_fi_fr_as_xr(real, num, den, NOP_SUB); } static INLINE void rmul_fi_fr(n_real *real, long num, long den) { rop_fi_fr_md_xr(real, num, den, NOP_MUL); } static INLINE void rdiv_fi_fr(n_real *real, long num, long den) { rop_fi_fr_md_xr(real, num, den, NOP_DIV); } static INLINE int cmp_fi_fr(long fi, long num, long den) { return (cmp_flonum((double)fi, (double)num / (double)den)); } /************************************************************************ * FIXNUM BIGRATIO ************************************************************************/ static void rop_fi_br_as_xr(n_real *real, mpr *ratio, int nop) { mpi iop; mpr *bigr = XALLOC(mpr); mpi_init(&iop); mpi_seti(&iop, RFI(real)); mpr_init(bigr); mpr_set(bigr, ratio); mpi_mul(&iop, &iop, mpr_den(ratio)); if (nop == NOP_ADD) mpi_add(mpr_num(bigr), &iop, mpr_num(bigr)); else mpi_sub(mpr_num(bigr), &iop, mpr_num(bigr)); mpi_clear(&iop); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } static void rop_fi_br_md_xr(n_real *real, mpr *ratio, int nop) { mpi iop; mpr *bigr = XALLOC(mpr); mpi_init(&iop); mpi_seti(&iop, RFI(real)); mpr_init(bigr); if (nop == NOP_MUL) mpr_set(bigr, ratio); else mpr_inv(bigr, ratio); mpi_mul(mpr_num(bigr), &iop, mpr_num(bigr)); mpi_clear(&iop); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } static INLINE void radd_fi_br(n_real *real, mpr *ratio) { rop_fi_br_as_xr(real, ratio, NOP_ADD); } static INLINE void rsub_fi_br(n_real *real, mpr *ratio) { rop_fi_br_as_xr(real, ratio, NOP_SUB); } static INLINE void rmul_fi_br(n_real *real, mpr *ratio) { rop_fi_br_md_xr(real, ratio, NOP_MUL); } static INLINE void rdiv_fi_br(n_real *real, mpr *ratio) { rop_fi_br_md_xr(real, ratio, NOP_DIV); } static INLINE int cmp_fi_br(long op1, mpr *op2) { return (-mpr_cmpi(op2, op1)); } /************************************************************************ * BIGNUM FIXNUM ************************************************************************/ static INLINE void radd_bi_fi(n_real *real, long fi) { mpi_addi(RBI(real), RBI(real), fi); rbi_canonicalize(real); } static INLINE void rsub_bi_fi(n_real *real, long fi) { mpi_subi(RBI(real), RBI(real), fi); rbi_canonicalize(real); } static INLINE void rmul_bi_fi(n_real *real, long fi) { mpi_muli(RBI(real), RBI(real), fi); rbi_canonicalize(real); } static void rdiv_bi_fi(n_real *real, long fi) { mpr *bigr; if (RFI(real) == 0) fatal_error(DIVIDE_BY_ZERO); bigr = XALLOC(mpr); mpr_init(bigr); mpi_set(mpr_num(bigr), RBI(real)); mpi_seti(mpr_den(bigr), fi); RCLEAR_BI(real); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } static INLINE int cmp_bi_fi(mpi *bignum, long fi) { return (mpi_cmpi(bignum, fi)); } /************************************************************************ * BIGNUM BIGNUM ************************************************************************/ static INLINE void radd_bi_bi(n_real *real, mpi *bignum) { mpi_add(RBI(real), RBI(real), bignum); rbi_canonicalize(real); } static INLINE void rsub_bi_bi(n_real *real, mpi *bignum) { mpi_sub(RBI(real), RBI(real), bignum); rbi_canonicalize(real); } static INLINE void rmul_bi_bi(n_real *real, mpi *bignum) { mpi_mul(RBI(real), RBI(real), bignum); rbi_canonicalize(real); } static void rdiv_bi_bi(n_real *real, mpi *bignum) { mpr *bigr; if (mpi_cmpi(bignum, 0) == 0) fatal_error(DIVIDE_BY_ZERO); bigr = XALLOC(mpr); mpr_init(bigr); mpi_set(mpr_num(bigr), RBI(real)); mpi_set(mpr_den(bigr), bignum); RCLEAR_BI(real); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } static INLINE int cmp_bi_bi(mpi *op1, mpi *op2) { return (mpi_cmp(op1, op2)); } /************************************************************************ * BIGNUM FIXRATIO ************************************************************************/ static void rop_bi_fr_as_xr(n_real *real, long num, long den, int nop) { mpi iop; mpr *bigr = XALLOC(mpr); mpi_init(&iop); mpi_set(&iop, RBI(real)); mpi_muli(&iop, &iop, den); mpr_init(bigr); mpr_seti(bigr, num, den); if (nop == NOP_ADD) mpi_add(mpr_num(bigr), &iop, mpr_num(bigr)); else mpi_sub(mpr_num(bigr), &iop, mpr_num(bigr)); mpi_clear(&iop); RCLEAR_BI(real); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } static INLINE void rop_bi_fr_md_xr(n_real *real, long num, long den, int nop) { mpr *bigr = XALLOC(mpr); mpr_init(bigr); mpr_seti(bigr, num, den); if (nop == NOP_MUL) mpi_mul(mpr_num(bigr), RBI(real), mpr_num(bigr)); else { mpi_mul(mpr_den(bigr), RBI(real), mpr_den(bigr)); mpr_inv(bigr, bigr); } RCLEAR_BI(real); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } static INLINE void radd_bi_fr(n_real *real, long num, long den) { rop_bi_fr_as_xr(real, num, den, NOP_ADD); } static INLINE void rsub_bi_fr(n_real *real, long num, long den) { rop_bi_fr_as_xr(real, num, den, NOP_SUB); } static INLINE void rmul_bi_fr(n_real *real, long num, long den) { rop_bi_fr_md_xr(real, num, den, NOP_MUL); } static INLINE void rdiv_bi_fr(n_real *real, long num, long den) { rop_bi_fr_md_xr(real, num, den, NOP_DIV); } static int cmp_bi_fr(mpi *bignum, long num, long den) { int cmp; mpr cmp1, cmp2; mpr_init(&cmp1); mpi_set(mpr_num(&cmp1), bignum); mpi_seti(mpr_den(&cmp1), 1); mpr_init(&cmp2); mpr_seti(&cmp2, num, den); cmp = mpr_cmp(&cmp1, &cmp2); mpr_clear(&cmp1); mpr_clear(&cmp2); return (cmp); } /************************************************************************ * BIGNUM BIGRATIO ************************************************************************/ static void rop_bi_br_as_xr(n_real *real, mpr *bigratio, int nop) { mpi iop; mpr *bigr = XALLOC(mpr); mpi_init(&iop); mpi_set(&iop, RBI(real)); mpr_init(bigr); mpr_set(bigr, bigratio); mpi_mul(&iop, &iop, mpr_den(bigratio)); if (nop == NOP_ADD) mpi_add(mpr_num(bigr), &iop, mpr_num(bigr)); else mpi_sub(mpr_num(bigr), &iop, mpr_num(bigr)); mpi_clear(&iop); RCLEAR_BI(real); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } static void rop_bi_br_md_xr(n_real *real, mpr *bigratio, int nop) { mpr *bigr = XALLOC(mpr); mpr_init(bigr); if (nop == NOP_MUL) mpr_set(bigr, bigratio); else mpr_inv(bigr, bigratio); mpi_mul(mpr_num(bigr), RBI(real), mpr_num(bigr)); RCLEAR_BI(real); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } static INLINE void radd_bi_br(n_real *real, mpr *bigratio) { rop_bi_br_as_xr(real, bigratio, NOP_ADD); } static INLINE void rsub_bi_br(n_real *real, mpr *bigratio) { rop_bi_br_as_xr(real, bigratio, NOP_SUB); } static INLINE void rmul_bi_br(n_real *real, mpr *bigratio) { rop_bi_br_md_xr(real, bigratio, NOP_MUL); } static INLINE void rdiv_bi_br(n_real *real, mpr *bigratio) { rop_bi_br_md_xr(real, bigratio, NOP_DIV); } static int cmp_bi_br(mpi *bignum, mpr *bigratio) { int cmp; mpr cmp1; mpr_init(&cmp1); mpi_set(mpr_num(&cmp1), bignum); mpi_seti(mpr_den(&cmp1), 1); cmp = mpr_cmp(&cmp1, bigratio); mpr_clear(&cmp1); return (cmp); } /************************************************************************ * FIXRATIO FIXNUM ************************************************************************/ static void rop_fr_fi_as_xr(n_real *real, long op, int nop) { int fit; long value = 0, num = RFRN(real), den = RFRD(real); fit = !fi_fi_mul_overflow(op, den); if (fit) { value = op * den; if (nop == NOP_ADD) fit = !fi_fi_add_overflow(value, num); else fit = !fi_fi_sub_overflow(value, num); } if (fit) { if (nop == NOP_ADD) RFRN(real) = num + value; else RFRN(real) = num - value; rfr_canonicalize(real); } else { mpi iop; mpr *bigr = XALLOC(mpr); mpr_init(bigr); mpr_seti(bigr, num, den); mpi_init(&iop); mpi_seti(&iop, op); mpi_muli(&iop, &iop, den); if (nop == NOP_ADD) mpi_add(mpr_num(bigr), mpr_num(bigr), &iop); else mpi_sub(mpr_num(bigr), mpr_num(bigr), &iop); mpi_clear(&iop); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } } static void rop_fr_fi_md_xr(n_real *real, long op, int nop) { long num = RFRN(real), den = RFRD(real); if (nop == NOP_MUL) { if (!fi_fi_mul_overflow(op, num)) { RFRN(real) = op * num; rfr_canonicalize(real); return; } } else if (!fi_fi_mul_overflow(op, den)) { RFRD(real) = op * den; rfr_canonicalize(real); return; } { mpr *bigr = XALLOC(mpr); mpr_init(bigr); mpr_seti(bigr, num, den); if (nop == NOP_MUL) mpr_muli(bigr, bigr, op); else mpr_divi(bigr, bigr, op); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } } static INLINE void radd_fr_fi(n_real *real, long op) { rop_fr_fi_as_xr(real, op, NOP_ADD); } static INLINE void rsub_fr_fi(n_real *real, long op) { rop_fr_fi_as_xr(real, op, NOP_SUB); } static INLINE void rmul_fr_fi(n_real *real, long op) { rop_fr_fi_md_xr(real, op, NOP_MUL); } static INLINE void rdiv_fr_fi(n_real *real, long op) { rop_fr_fi_md_xr(real, op, NOP_DIV); } static INLINE int cmp_fr_fi(long num, long den, long fixnum) { return (cmp_flonum((double)num / (double)den, (double)fixnum)); } /************************************************************************ * FIXRATIO BIGNUM ************************************************************************/ static void rop_fr_bi_as_xr(n_real *real, mpi *bignum, int nop) { mpi iop; mpr *bigr = XALLOC(mpr); mpr_init(bigr); mpr_seti(bigr, RFRN(real), RFRD(real)); mpi_init(&iop); mpi_set(&iop, bignum); mpi_muli(&iop, &iop, RFRD(real)); if (nop == NOP_ADD) mpi_add(mpr_num(bigr), mpr_num(bigr), &iop); else mpi_sub(mpr_num(bigr), mpr_num(bigr), &iop); mpi_clear(&iop); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } static void rop_fr_bi_md_xr(n_real *real, mpi *bignum, int nop) { mpr *bigr = XALLOC(mpr); mpr_init(bigr); mpr_seti(bigr, RFRN(real), RFRD(real)); if (nop == NOP_MUL) mpi_mul(mpr_num(bigr), mpr_num(bigr), bignum); else mpi_mul(mpr_den(bigr), mpr_den(bigr), bignum); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } static INLINE void radd_fr_bi(n_real *real, mpi *bignum) { rop_fr_bi_as_xr(real, bignum, NOP_ADD); } static INLINE void rsub_fr_bi(n_real *real, mpi *bignum) { rop_fr_bi_as_xr(real, bignum, NOP_SUB); } static INLINE void rmul_fr_bi(n_real *real, mpi *bignum) { rop_fr_bi_md_xr(real, bignum, NOP_MUL); } static INLINE void rdiv_fr_bi(n_real *real, mpi *bignum) { rop_fr_bi_md_xr(real, bignum, NOP_DIV); } static int cmp_fr_bi(long num, long den, mpi *bignum) { int cmp; mpr cmp1, cmp2; mpr_init(&cmp1); mpr_seti(&cmp1, num, den); mpr_init(&cmp2); mpi_set(mpr_num(&cmp2), bignum); mpi_seti(mpr_den(&cmp2), 1); cmp = mpr_cmp(&cmp1, &cmp2); mpr_clear(&cmp1); mpr_clear(&cmp2); return (cmp); } /************************************************************************ * FIXRATIO FIXRATIO ************************************************************************/ static void rop_fr_fr_as_xr(n_real *real, long num2, long den2, int nop) { int fit; long num1 = RFRN(real), den1 = RFRD(real), num = 0, den = 0; fit = !fi_fi_mul_overflow(num1, den2); if (fit) { num = num1 * den2; fit = !fi_fi_mul_overflow(num2, den1); if (fit) { den = num2 * den1; if (nop == NOP_ADD) { if ((fit = !fi_fi_add_overflow(num, den)) != 0) num += den; } else if ((fit = !fi_fi_sub_overflow(num, den)) != 0) num -= den; if (fit) { fit = !fi_fi_mul_overflow(den1, den2); if (fit) den = den1 * den2; } } } if (fit) { RFRN(real) = num; RFRD(real) = den; rfr_canonicalize(real); } else { mpi iop; mpr *bigr = XALLOC(mpr); mpr_init(bigr); mpr_seti(bigr, num1, den1); mpi_muli(mpr_den(bigr), mpr_den(bigr), den2); mpi_init(&iop); mpi_seti(&iop, num2); mpi_muli(&iop, &iop, den1); mpi_muli(mpr_num(bigr), mpr_num(bigr), den2); if (nop == NOP_ADD) mpi_add(mpr_num(bigr), mpr_num(bigr), &iop); else mpi_sub(mpr_num(bigr), mpr_num(bigr), &iop); mpi_clear(&iop); RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } } static void rop_fr_fr_md_xr(n_real *real, long num2, long den2, int nop) { int fit; long num1 = RFRN(real), den1 = RFRD(real), num = 0, den = 0; if (nop == NOP_MUL) { fit = !fi_fi_mul_overflow(num1, num2) && !fi_fi_mul_overflow(den1, den2); if (fit) { num = num1 * num2; den = den1 * den2; } } else { fit = !fi_fi_mul_overflow(num1, den2) && !fi_fi_mul_overflow(den1, num2); if (fit) { num = num1 * den2; den = den1 * num2; } } if (fit) { RFRN(real) = num; RFRD(real) = den; rfr_canonicalize(real); } else { mpr *bigr = XALLOC(mpr); mpr_init(bigr); if (nop == NOP_MUL) { mpr_seti(bigr, num1, den1); mpi_muli(mpr_num(bigr), mpr_num(bigr), num2); mpi_muli(mpr_den(bigr), mpr_den(bigr), den2); } else { mpr_seti(bigr, num1, num2); mpi_muli(mpr_num(bigr), mpr_num(bigr), den2); mpi_muli(mpr_den(bigr), mpr_den(bigr), den1); } RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } } static INLINE void radd_fr_fr(n_real *real, long num, long den) { rop_fr_fr_as_xr(real, num, den, NOP_ADD); } static INLINE void rsub_fr_fr(n_real *real, long num, long den) { rop_fr_fr_as_xr(real, num, den, NOP_SUB); } static INLINE void rmul_fr_fr(n_real *real, long num, long den) { rop_fr_fr_md_xr(real, num, den, NOP_MUL); } static INLINE void rdiv_fr_fr(n_real *real, long num, long den) { rop_fr_fr_md_xr(real, num, den, NOP_DIV); } static INLINE int cmp_fr_fr(long num1, long den1, long num2, long den2) { return (cmp_flonum((double)num1 / (double)den1, (double)num2 / (double)den2)); } /************************************************************************ * FIXRATIO BIGRATIO ************************************************************************/ static void rop_fr_br_asmd_xr(n_real *real, mpr *bigratio, int nop) { mpr *bigr = XALLOC(mpr); mpr_init(bigr); mpr_seti(bigr, RFRN(real), RFRD(real)); switch (nop) { case NOP_ADD: mpr_add(bigr, bigr, bigratio); break; case NOP_SUB: mpr_sub(bigr, bigr, bigratio); break; case NOP_MUL: mpr_mul(bigr, bigr, bigratio); break; default: mpr_div(bigr, bigr, bigratio); break; } RBR(real) = bigr; RTYPE(real) = N_BIGRATIO; rbr_canonicalize(real); } static INLINE void radd_fr_br(n_real *real, mpr *bigratio) { rop_fr_br_asmd_xr(real, bigratio, NOP_ADD); } static INLINE void rsub_fr_br(n_real *real, mpr *bigratio) { rop_fr_br_asmd_xr(real, bigratio, NOP_SUB); } static INLINE void rmul_fr_br(n_real *real, mpr *bigratio) { rop_fr_br_asmd_xr(real, bigratio, NOP_MUL); } static INLINE void rdiv_fr_br(n_real *real, mpr *bigratio) { rop_fr_br_asmd_xr(real, bigratio, NOP_DIV); } static int cmp_fr_br(long num, long den, mpr *bigratio) { int cmp; mpr cmp1; mpr_init(&cmp1); mpr_seti(&cmp1, num, den); cmp = mpr_cmp(&cmp1, bigratio); mpr_clear(&cmp1); return (cmp); } /************************************************************************ * BIGRATIO FIXNUM ************************************************************************/ static void rop_br_fi_asmd_xr(n_real *real, long fixnum, int nop) { mpr *bigratio = RBR(real); switch (nop) { case NOP_ADD: mpr_addi(bigratio, bigratio, fixnum); break; case NOP_SUB: mpr_subi(bigratio, bigratio, fixnum); break; case NOP_MUL: mpr_muli(bigratio, bigratio, fixnum); break; default: if (fixnum == 0) fatal_error(DIVIDE_BY_ZERO); mpr_divi(bigratio, bigratio, fixnum); break; } rbr_canonicalize(real); } static INLINE void radd_br_fi(n_real *real, long fixnum) { rop_br_fi_asmd_xr(real, fixnum, NOP_ADD); } static INLINE void rsub_br_fi(n_real *real, long fixnum) { rop_br_fi_asmd_xr(real, fixnum, NOP_SUB); } static INLINE void rmul_br_fi(n_real *real, long fixnum) { rop_br_fi_asmd_xr(real, fixnum, NOP_MUL); } static INLINE void rdiv_br_fi(n_real *real, long fixnum) { rop_br_fi_asmd_xr(real, fixnum, NOP_DIV); } static int cmp_br_fi(mpr *bigratio, long fixnum) { int cmp; mpr cmp2; mpr_init(&cmp2); mpr_seti(&cmp2, fixnum, 1); cmp = mpr_cmp(bigratio, &cmp2); mpr_clear(&cmp2); return (cmp); } /************************************************************************ * BIGRATIO BIGNUM ************************************************************************/ static void rop_br_bi_as_xr(n_real *real, mpi *bignum, int nop) { mpi iop; mpi_init(&iop); mpi_set(&iop, bignum); mpi_mul(&iop, &iop, RBRD(real)); if (nop == NOP_ADD) mpi_add(RBRN(real), RBRN(real), &iop); else mpi_sub(RBRN(real), RBRN(real), &iop); mpi_clear(&iop); rbr_canonicalize(real); } static INLINE void radd_br_bi(n_real *real, mpi *bignum) { rop_br_bi_as_xr(real, bignum, NOP_ADD); } static INLINE void rsub_br_bi(n_real *real, mpi *bignum) { rop_br_bi_as_xr(real, bignum, NOP_SUB); } static INLINE void rmul_br_bi(n_real *real, mpi *bignum) { mpi_mul(RBRN(real), RBRN(real), bignum); rbr_canonicalize(real); } static INLINE void rdiv_br_bi(n_real *real, mpi *bignum) { mpi_mul(RBRD(real), RBRD(real), bignum); rbr_canonicalize(real); } static int cmp_br_bi(mpr *bigratio, mpi *bignum) { int cmp; mpr cmp1; mpr_init(&cmp1); mpi_set(mpr_num(&cmp1), bignum); mpi_seti(mpr_den(&cmp1), 1); cmp = mpr_cmp(bigratio, &cmp1); mpr_clear(&cmp1); return (cmp); } /************************************************************************ * BIGRATIO FIXRATIO ************************************************************************/ static void rop_br_fr_asmd_xr(n_real *real, long num, long den, int nop) { mpr *bigratio = RBR(real), rop; mpr_init(&rop); mpr_seti(&rop, num, den); switch (nop) { case NOP_ADD: mpr_add(bigratio, bigratio, &rop); break; case NOP_SUB: mpr_sub(bigratio, bigratio, &rop); break; case NOP_MUL: mpr_mul(bigratio, bigratio, &rop); break; default: mpr_div(bigratio, bigratio, &rop); break; } mpr_clear(&rop); rbr_canonicalize(real); } static INLINE void radd_br_fr(n_real *real, long num, long den) { rop_br_fr_asmd_xr(real, num, den, NOP_ADD); } static INLINE void rsub_br_fr(n_real *real, long num, long den) { rop_br_fr_asmd_xr(real, num, den, NOP_SUB); } static INLINE void rmul_br_fr(n_real *real, long num, long den) { rop_br_fr_asmd_xr(real, num, den, NOP_MUL); } static INLINE void rdiv_br_fr(n_real *real, long num, long den) { rop_br_fr_asmd_xr(real, num, den, NOP_DIV); } static int cmp_br_fr(mpr *bigratio, long num, long den) { int cmp; mpr cmp2; mpr_init(&cmp2); mpr_seti(&cmp2, num, den); cmp = mpr_cmp(bigratio, &cmp2); mpr_clear(&cmp2); return (cmp); } /************************************************************************ * BIGRATIO BIGRATIO ************************************************************************/ static INLINE void radd_br_br(n_real *real, mpr *bigratio) { mpr_add(RBR(real), RBR(real), bigratio); rbr_canonicalize(real); } static INLINE void rsub_br_br(n_real *real, mpr *bigratio) { mpr_sub(RBR(real), RBR(real), bigratio); rbr_canonicalize(real); } static INLINE void rmul_br_br(n_real *real, mpr *bigratio) { mpr_mul(RBR(real), RBR(real), bigratio); rbr_canonicalize(real); } static INLINE void rdiv_br_br(n_real *real, mpr *bigratio) { mpr_div(RBR(real), RBR(real), bigratio); rbr_canonicalize(real); } static INLINE int cmp_br_br(mpr *op1, mpr *op2) { return (mpr_cmp(op1, op2)); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/stream.h0000664000000000000000000000446612472175711015742 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/stream.h,v 1.8tsi Exp $ */ #ifndef Lisp_stream_h #define Lisp_stream_h #include "lisp/io.h" #include "lisp/internal.h" void LispStreamInit(void); LispObj *Lisp_DeleteFile(LispBuiltin*); LispObj *Lisp_RenameFile(LispBuiltin*); LispObj *Lisp_InputStreamP(LispBuiltin*); LispObj *Lisp_OpenStreamP(LispBuiltin*); LispObj *Lisp_OutputStreamP(LispBuiltin*); LispObj *Lisp_Open(LispBuiltin*); LispObj *Lisp_MakePipe(LispBuiltin*); LispObj *Lisp_PipeBroken(LispBuiltin*); LispObj *Lisp_PipeErrorStream(LispBuiltin*); LispObj *Lisp_PipeInputDescriptor(LispBuiltin*); LispObj *Lisp_PipeErrorDescriptor(LispBuiltin*); LispObj *Lisp_Close(LispBuiltin*); LispObj *Lisp_Listen(LispBuiltin*); LispObj *Lisp_Streamp(LispBuiltin*); LispObj *Lisp_MakeStringInputStream(LispBuiltin*); LispObj *Lisp_MakeStringOutputStream(LispBuiltin*); LispObj *Lisp_GetOutputStreamString(LispBuiltin*); #endif /* Lisp_stream_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/helper.h0000664000000000000000000000734612472175711015726 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/helper.h,v 1.15tsi Exp $ */ #ifndef Lisp_helper_h #define Lisp_helper_h #include "lisp/private.h" /* * Prototypes */ void LispCheckSequenceStartEnd(LispBuiltin*, LispObj*, LispObj*, LispObj*, long*, long*, long*); long LispLength(LispObj*); LispObj *LispCharacterCoerce(LispBuiltin*, LispObj*); LispObj *LispStringCoerce(LispBuiltin*, LispObj*); LispObj *LispCoerce(LispBuiltin*, LispObj*, LispObj*); /* do init test &rest body do* init test &rest body */ LispObj *LispDo(LispBuiltin*, int); /* dolist init &rest body dotimes init &rest body */ LispObj *LispDoListTimes(LispBuiltin*, int); #define FEQ 1 #define FEQL 2 #define FEQUAL 3 #define FEQUALP 4 LispObj *LispObjectCompare(LispObj*, LispObj*, int); #define XEQ(x, y) LispObjectCompare(x, y, FEQ) #define XEQL(x, y) LispObjectCompare(x, y, FEQL) #define XEQUAL(x, y) LispObjectCompare(x, y, FEQUAL) #define XEQUALP(x, y) LispObjectCompare(x, y, FEQUALP) LispObj *LispLoadFile(LispObj*, int, int, int); /* string= string1 string2 &key start1 end1 start2 end2 string< string1 string2 &key start1 end1 start2 end2 string> string1 string2 &key start1 end1 start2 end2 string<= string1 string2 &key start1 end1 start2 end2 string>= string1 string2 &key start1 end1 start2 end2 string/= string1 string2 &key start1 end1 start2 end2 string-equal string1 string2 &key start1 end1 start2 end2 string-lessp string1 string2 &key start1 end1 start2 end2 string-greaterp string1 string2 &key start1 end1 start2 end2 string-not-lessp string1 string2 &key start1 end1 start2 end2 string-not-greaterp string1 string2 &key start1 end1 start2 end2 string-not-equal string1 string2 &key start1 end1 start2 end2 */ void LispGetStringArgs(LispBuiltin*, char**, /* string1 */ char**, /* string2 */ long*, /* start1 */ long*, /* end1 */ long*, /* start2 */ long*); /* end2 */ /* pathname-host pathname pathname-device pathname pathname-directory pathname pathname-name pathname pathname-type pathname pathname-version pathname */ LispObj *LispPathnameField(int, int); /* truename pathname probe-file pathname */ LispObj *LispProbeFile(LispBuiltin*, int); /* write-string string &optional output-stream &key start end write-line string &optional output-stream &key start end */ LispObj *LispWriteString_(LispBuiltin*, int); #endif /* Lisp_helper_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/time.c0000664000000000000000000001011612472175711015365 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/time.c,v 1.9tsi Exp $ */ #include "lisp/time.h" #include "lisp/bytecode.h" /* * Implementation */ LispObj * Lisp_Time(LispBuiltin *builtin) /* time form */ { #ifndef __UNIXOS2__ struct itimerval real, virt, prof; unsigned long count; long sec, usec; LispObj *result; #define MONTH 60 * 60 * 31 LispObj *form; form = ARGUMENT(0); real.it_value.tv_sec = virt.it_value.tv_sec = prof.it_value.tv_sec = real.it_interval.tv_sec = virt.it_interval.tv_sec = prof.it_interval.tv_sec = MONTH; real.it_value.tv_usec = virt.it_value.tv_usec = prof.it_value.tv_usec = real.it_interval.tv_usec = virt.it_interval.tv_usec = prof.it_interval.tv_usec = 0; setitimer(ITIMER_REAL, &real, NULL); setitimer(ITIMER_VIRTUAL, &virt, NULL); setitimer(ITIMER_PROF, &prof, NULL); getitimer(ITIMER_REAL, &real); getitimer(ITIMER_VIRTUAL, &virt); getitimer(ITIMER_PROF, &prof); lisp__data.gc.gctime = 0; lisp__data.gc.timebits = 1; count = lisp__data.gc.count; #if 0 form = CONS(form, NIL); COD = CONS(form, COD); result = LispExecuteBytecode(LispCompileForm(form)); #else result = EVAL(form); #endif getitimer(ITIMER_REAL, &real); getitimer(ITIMER_VIRTUAL, &virt); getitimer(ITIMER_PROF, &prof); sec = real.it_interval.tv_sec - real.it_value.tv_sec; usec = real.it_interval.tv_usec - real.it_value.tv_usec; if (usec < 0) { --sec; usec += 1000000; } LispMessage("Real time : %g sec", sec + usec / 1000000.0); sec = virt.it_interval.tv_sec - virt.it_value.tv_sec; usec = virt.it_interval.tv_usec - virt.it_value.tv_usec + 10000; if (usec < 0) { --sec; usec += 1000000; } LispMessage("Virtual time: %g sec", sec + usec / 1000000.0); sec = prof.it_interval.tv_sec - prof.it_value.tv_sec; usec = prof.it_interval.tv_usec - prof.it_value.tv_usec + 10000; if (usec < 0) { --sec; usec += 1000000; } LispMessage("Profile time: %g sec", sec + usec / 1000000.0); real.it_value.tv_sec = virt.it_value.tv_sec = prof.it_value.tv_sec = real.it_interval.tv_sec = virt.it_interval.tv_sec = prof.it_interval.tv_sec = real.it_value.tv_usec = virt.it_value.tv_usec = prof.it_value.tv_usec = real.it_interval.tv_usec = virt.it_interval.tv_usec = prof.it_interval.tv_usec = 0; setitimer(ITIMER_REAL, &real, NULL); setitimer(ITIMER_VIRTUAL, &virt, NULL); setitimer(ITIMER_PROF, &prof, NULL); LispMessage("GC: %ld times, %g sec", lisp__data.gc.count - count, lisp__data.gc.gctime / 1000000.0); lisp__data.gc.timebits = 0; return (result); #else LispMessage("\"Lisp_Time\" not implemented under OS/2"); return (NIL); #endif } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/private.h0000664000000000000000000003640612472175711016120 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XdotOrg: xc/programs/xedit/lisp/private.h,v 1.2 2004/04/23 19:54:44 eich Exp $ */ /* $XFree86: xc/programs/xedit/lisp/private.h,v 1.41 2003/05/27 22:27:04 tsi Exp $ */ #ifndef Lisp_private_h #define Lisp_private_h #include #include #include #include #if defined(X_POSIX_C_SOURCE) #define _POSIX_C_SOURCE X_POSIX_C_SOURCE #include #undef _POSIX_C_SOURCE #else #include #endif #include #include #include "lisp/internal.h" #include "lisp/core.h" #ifdef DEBUGGER #include "lisp/debugger.h" #endif #include "lisp/helper.h" #include "lisp/string.h" #include "lisp/struct.h" /* * Defines */ #define STRTBLSZ 23 #define MULTIPLE_VALUES_LIMIT 127 #define MAX_STACK_DEPTH 16384 #define FEATURES \ (lisp__data.features->data.atom->a_object ? \ (LispObj *)lisp__data.features->data.atom->property->value : \ NIL) #define PACK lisp__data.packlist #undef PACKAGE /* avoid conflicts with autoconf's #define in config.h */ #define PACKAGE lisp__data.package->data.atom->property->value #define MOD lisp__data.modlist #define COD lisp__data.codlist #define RUN lisp__data.runlist #define RES lisp__data.reslist #define DBG lisp__data.dbglist #define BRK lisp__data.brklist #define PRO lisp__data.prolist #define SINPUT lisp__data.input #define SOUTPUT lisp__data.output #define STANDARD_INPUT \ lisp__data.standard_input->data.atom->property->value #define STANDARD_OUTPUT \ lisp__data.standard_output->data.atom->property->value #define STANDARDSTREAM(file, desc, flags) \ LispNewStandardStream(file, desc, flags) /* * Types */ typedef struct _LispStream LispStream; typedef struct _LispBlock LispBlock; typedef struct _LispOpaque LispOpaque; typedef struct _LispModule LispModule; typedef struct _LispProperty LispProperty; typedef struct _LispObjList LispObjList; typedef struct _LispStringHash LispStringHash; typedef struct _LispCharInfo LispCharInfo; /* Normal function/macro arguments */ typedef struct _LispNormalArgs { int num_symbols; LispObj **symbols; /* symbol names */ } LispNormalArgs; /* &optional function/macro arguments */ typedef struct _LispOptionalArgs { int num_symbols; LispObj **symbols; /* symbol names */ LispObj **defaults; /* default values, when unspecifed */ LispObj **sforms; /* T if variable specified, NIL otherwise */ } LispOptionalArgs; /* &key function/macro arguments */ typedef struct _LispKeyArgs { int num_symbols; LispObj **symbols; /* symbol names */ LispObj **defaults; /* default values */ LispObj **sforms; /* T if variable specified, NIL otherwise */ LispObj **keys; /* key names, for special keywords */ } LispKeyArgs; /* &aux function/macro arguments */ typedef struct _LispAuxArgs { int num_symbols; LispObj **symbols; /* symbol names */ LispObj **initials; /* initial values */ } LispAuxArgs; /* characters in the field description have the format: * '.' normals has a list of normal arguments * 'o' optionals has a list of &optional arguments * 'k' keys has a list of &key arguments * 'r' rest is a valid pointer to a &rest symbol * 'a' auxs has a list of &aux arguments */ typedef struct _LispArgList { LispNormalArgs normals; LispOptionalArgs optionals; LispKeyArgs keys; LispObj *rest; LispAuxArgs auxs; int num_arguments; char *description; } LispArgList; typedef enum _LispDocType_t { LispDocVariable, LispDocFunction, LispDocStructure, LispDocType, LispDocSetf } LispDocType_t; struct _LispProperty { /* may be used by multiple packages */ unsigned int refcount; /* package where the property was created */ LispPackage *package; /* value of variable attached to symbol */ LispObj *value; union { /* function attached to symbol */ LispObj *function; /* builtin function attached to symbol*/ LispBuiltin *builtin; } fun; /* function/macro argument list description */ LispArgList *alist; /* symbol properties list */ LispObj *properties; /* setf method */ LispObj *setf; /* setf argument list description */ LispArgList *salist; /* structure information */ struct { LispObj *definition; #define STRUCT_NAME -3 #define STRUCT_CHECK -2 #define STRUCT_CONSTRUCTOR -1 int function; /* if >= 0, it is a structure field index */ } structure; }; struct _LispAtom { hash_key *key; struct _LispAtom *next; /* hint: dynamically binded variable */ unsigned int dyn : 1; /* Property has useful data in value field */ unsigned int a_object : 1; /* Property has useful data in fun.function field */ unsigned int a_function : 1; /* Property has useful data in fun.builtin field */ unsigned int a_builtin : 1; /* Property has useful data in fun.function field */ unsigned int a_compiled : 1; /* Property has useful data in properties field */ unsigned int a_property : 1; /* Property has useful data in setf field */ unsigned int a_defsetf : 1; /* Property has useful data in defstruct field */ unsigned int a_defstruct : 1; /* Symbol is extern */ unsigned int ext : 1; /* Symbol must be quoted with '|' to be allow reading back */ unsigned int unreadable : 1; /* Symbol value may need special handling when changed */ unsigned int watch : 1; /* Symbol value is constant, cannot be changed */ unsigned int constant : 1; LispObj *object; /* backpointer to object ATOM */ int offset; /* in the environment list */ LispObj *package; /* package home of symbol */ LispObj *function; /* symbol function */ LispObj *name; /* symbol string */ LispProperty *property; LispObj *documentation[5]; }; struct _LispObjList { LispObj **pairs; /* name0 ... nameN */ int length; /* number of objects */ int space; /* space allocated in field pairs */ }; struct _LispPackage { LispObjList glb; /* global symbols in package */ LispObjList use; /* inherited packages */ hash_table *atoms; /* atoms in this package */ }; struct _LispOpaque { hash_key *desc; LispOpaque *next; int type; }; typedef enum _LispBlockType { LispBlockNone, /* no block */ LispBlockTag, /* may become "invisible" */ LispBlockCatch, /* can be used to jump across function calls */ LispBlockClosure, /* hides blocks of type LispBlockTag bellow it */ LispBlockProtect, /* used by unwind-protect */ LispBlockBody /* used by tagbody and go */ } LispBlockType; struct _LispBlock { LispBlockType type; LispObj *tag; jmp_buf jmp; int stack; int protect; int block_level; #ifdef DEBUGGER int debug_level; int debug_step; #endif }; struct _LispModule { LispModule *next; void *handle; LispModuleData *data; }; typedef struct _LispUngetInfo { char buffer[16]; int offset; } LispUngetInfo; struct _LispMac { /* stack for builtin function arguments */ struct { LispObj **values; int base; /* base of arguments to function */ int length; int space; } stack; /* environment */ struct { LispObj **values; Atom_id *names; int lex; /* until where variables are visible */ int head; /* top of environment */ int length; /* number of used pairs */ int space; /* number of objects in pairs */ } env; struct { LispObj **values; int count; } returns; struct { LispObj **objects; int length; int space; } protect; LispObj *package; /* package object */ LispPackage *pack; /* pointer to lisp__data.package->data.package.package */ /* fast access to the KEYWORD package */ LispObj *keyword; LispPackage *key; /* the LISP package */ LispObj *lisp; /* only used if the package was changed, but an error generated * before returning to the toplevel */ LispObj *savepackage; LispPackage *savepack; struct { int block_level; int block_size; LispObj *block_ret; LispBlock **block; } block; sigjmp_buf jmp; struct { unsigned int expandbits : 3; /* code doesn't look like reusing cells * so try to have a larger number of * free cells */ unsigned int immutablebits : 1; /* need to reset immutable bits */ unsigned int timebits : 1; /* update gctime counter */ unsigned int count; long gctime; int average; /* of cells freed after gc calls */ } gc; hash_table *strings; hash_table *opqs; int opaque; LispObj *standard_input, *input, *input_list; LispObj *standard_output, *output, *output_list; LispObj *error_stream; LispUngetInfo **unget; int iunget, nunget; int eof; int interactive; int errexit; struct { int index; int level; int space; void **mem; } mem; /* memory from Lisp*Alloc, to be release in error */ LispModule *module; LispObj *modules; const char *prompt; LispObj *features; LispObj *modlist; /* module list */ LispObj *packlist; /* list of packages */ LispObj *codlist; /* current code */ LispObj *runlist[3]; /* +, ++, and +++ */ LispObj *reslist[3]; /* *, **, and *** */ #ifdef DEBUGGER LispObj *dbglist; /* debug information */ LispObj *brklist; /* breakpoints information */ #endif LispObj *prolist; /* protect objects list */ void (*sigint)(int); void (*sigfpe)(int); int destroyed; /* reached LispDestroy, used by unwind-protect */ int running; /* there is somewhere to siglongjmp */ int ignore_errors; /* inside a ignore-errors block */ LispObj *error_condition; /* actually, a string */ int debugging; /* debugger enabled? */ #ifdef DEBUGGER int debug_level; /* almost always the same as lisp__data.level */ int debug_step; /* control for stoping and printing output */ int debug_break; /* next breakpoint number */ LispDebugState debug; #endif }; struct _LispCharInfo { const char * const *names; }; /* * Prototypes */ void LispUseArgList(LispArgList*); void LispFreeArgList(LispArgList*); LispArgList *LispCheckArguments(LispFunType, LispObj*, const char*, int); LispObj *LispListProtectedArguments(LispArgList*); LispObj *LispGetDoc(LispObj*); LispObj *LispGetVar(LispObj*); #ifdef DEBUGGER void *LispGetVarAddr(LispObj*); /* used by debugger */ #endif LispObj *LispAddVar(LispObj*, LispObj*); LispObj *LispSetVar(LispObj*, LispObj*); void LispUnsetVar(LispObj*); /* only used at initialization time */ LispObj *LispNewStandardStream(LispFile*, LispObj*, int); /* create a new package */ LispObj *LispNewPackage(LispObj*, LispObj*); /* add package to use-list of current, and imports all extern symbols */ void LispUsePackage(LispObj*); /* make symbol extern in the current package */ void LispExportSymbol(LispObj*); /* imports symbol to current package */ void LispImportSymbol(LispObj*); /* always returns the same string */ hash_key *LispGetAtomKey(const char*, int); /* destructive fast reverse, note that don't receive a LispMac* argument */ LispObj *LispReverse(LispObj *list); char *LispIntToOpaqueType(int); /* (print) */ void LispPrint(LispObj*, LispObj*, int); LispBlock *LispBeginBlock(LispObj*, LispBlockType); #define BLOCKJUMP(block) \ lisp__data.stack.length = (block)->stack; \ lisp__data.protect.length = (block)->protect; \ longjmp((block)->jmp, 1) void LispEndBlock(LispBlock*); /* if unwind-protect active, jump to cleanup code, else do nothing */ void LispBlockUnwind(LispBlock*); void LispUpdateResults(LispObj*, LispObj*); void LispTopLevel(void); LispAtom *LispDoGetAtom(const char *str, int); /* get value from atom's property list */ LispObj *LispGetAtomProperty(LispAtom*, LispObj*); /* put value in atom's property list */ LispObj *LispPutAtomProperty(LispAtom*, LispObj*, LispObj*); /* remove value from atom's property list */ LispObj *LispRemAtomProperty(LispAtom*, LispObj*); /* replace atom's property list */ LispObj *LispReplaceAtomPropertyList(LispAtom*, LispObj*); /* returns function associated with symbol */ LispObj *LispSymbolFunction(LispObj*); /* returns symbol string name */ LispObj *LispSymbolName(LispObj*); /* define byte compiled function, or replace definition */ void LispSetAtomCompiledProperty(LispAtom*, LispObj*); /* remove byte compiled function property */ void LispRemAtomCompiledProperty(LispAtom*); /* define function, or replace function definition */ void LispSetAtomFunctionProperty(LispAtom*, LispObj*, LispArgList*); /* remove function property */ void LispRemAtomFunctionProperty(LispAtom*); /* define builtin, or replace builtin definition */ void LispSetAtomBuiltinProperty(LispAtom*, LispBuiltin*, LispArgList*); /* remove builtin property */ void LispRemAtomBuiltinProperty(LispAtom*); /* define setf macro, or replace current definition */ void LispSetAtomSetfProperty(LispAtom*, LispObj*, LispArgList*); /* remove setf macro */ void LispRemAtomSetfProperty(LispAtom*); /* create or change structure property */ void LispSetAtomStructProperty(LispAtom*, LispObj*, int); /* remove structure property */ void LispRemAtomStructProperty(LispAtom*); void LispProclaimSpecial(LispObj*, LispObj*, LispObj*); void LispDefconstant(LispObj*, LispObj*, LispObj*); void LispAddDocumentation(LispObj*, LispObj*, LispDocType_t); void LispRemDocumentation(LispObj*, LispDocType_t); LispObj *LispGetDocumentation(LispObj*, LispDocType_t); /* increases storage for functions returning multiple values */ void LispMoreReturns(void); /* increases storage for temporarily protected data */ void LispMoreProtects(void); /* Initialization */ extern int LispArgList_t; extern const LispCharInfo LispChars[256]; /* This function will return if the interpreter cannot be stopped */ extern void LispSignal(int); void LispDisableInterrupts(void); void LispEnableInterrupts(void); #define DISABLE_INTERRUPTS() LispDisableInterrupts() #define ENABLE_INTERRUPTS() LispEnableInterrupts() /* Value returned by LispBegin, used everywhere in the code. * Only one interpreter instance allowed. */ extern LispMac lisp__data; #endif /* Lisp_private_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/bytecode.c0000664000000000000000000027363612472175711016247 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/bytecode.c,v 1.17 2003/05/27 22:27:01 tsi Exp $ */ /* somethings TODO: o Write code for allowing storing the bytecode on disk. Basically write a section of the bytecode with the package name of the symbol pointers, and after that, the symbols used. At load time just put the pointers in the bytecode. Constants can be stored as the string representation. Probably just storing the gc protected code as a string is enough to rebuild it. o Write code to store tags of BLOCK/CATCH and setjump buffer stacks, and, only keep track of this if non byte-compiled code is called, as after byte-compilation RETURN and THROW are just jumps. o Remove not reliable "optmization code" code from Com_XXX functions and do it later, removing dead code, tests with a constant argument, etc, in the "link time". Frequently joining sequential opcodes to a compound version. o Write an optimizer to do code transformation. o Write code to know when variables can be changed in place, this can save a huge time in loop counters. o Write code for fast garbage collection of objects that can be safely collected. o Cleanup of interpreted code. Having bytecode mean that the interpreter now is better having a clean and small code. If speed is important, it should be byte compiled. o Limit the stacks length. So that instead of using an index, use the pointer where an object value should be read/stored as the stack address would not change during the program execution. o Optimize jump to jump. Common in code like: (IF test (GO somewhere) (GO elsewhere) ) (GO there) that generates a bytecode like: JUMPNIL :NIL-RESULT :T-RESULT JUMP :SOMEWHERE JUMP :END-OF-IF ;; <- this is not required, or even :NIL-RESULT ;; better, notice the jump after JUMP :ELSEWHERE ;; the if and transform it into :END-OF-IF ;; a JUMP :THERE (assuming there JUMP :THERE ;; (was no jump in the T code). o Optimize variables that are known to not change it's value, i.e. pseudo constants. Loading the value of a constant should be faster than loading the current value of a variable; the constant table could fit in the processor cache line and needs less calculation to find the object address. o Fix some known problems, like when calling return or return-from while building the argument list to a builtin function, or inline of recursive functions. */ #include "lisp/bytecode.h" #include "lisp/write.h" #define SYMBOL_KEYWORD -1 /* A keyword, load as constant */ #define SYMBOL_CONSTANT -2 /* Defined as constant at compile time */ #define SYMBOL_UNBOUND -3 /* Not a local variable */ #define NEW_TREE(type) CompileNewTree(com, type) /* If in tagbody, ignore anything that is not code */ #define IN_TAGBODY() (com->block->type == LispBlockBody && \ com->level == com->tagbody) #define FORM_ENTER() ++com->level #define FORM_LEAVE() --com->level #define COMPILE_FAILURE(message) \ LispMessage("COMPILE: %s", message); \ longjmp(com->jmp, 1) /* * Types */ typedef struct _CodeTree CodeTree; typedef struct _CodeBlock CodeBlock; typedef enum { CodeTreeBytecode, CodeTreeLabel, CodeTreeGo, CodeTreeJump, CodeTreeJumpIf, CodeTreeCond, CodeTreeBlock, CodeTreeReturn } CodeTreeType; struct _CodeTree { CodeTreeType type; /* Resolved when linking, may be adjusted while optimizing */ long offset; LispByteOpcode code; union { signed char signed_char; signed short signed_short; signed int signed_int; LispAtom *atom; LispObj *object; CodeTree *tree; CodeBlock *block; struct { unsigned char num_arguments; LispBuiltin *builtin; signed short offset; /* Used if opcode is XBC_CALL_SET */ } builtin; struct { unsigned char num_arguments; LispObj *name; LispObj *lambda; } call; struct { unsigned char num_arguments; LispObj *code; } bytecall; struct { short offset; LispAtom *name; } let; struct { LispAtom *symbol; LispAtom *name; } let_sym; struct { LispObj *object; LispAtom *name; } let_con; struct { signed short load; signed short set; } load_set; struct { LispObj *object; signed short offset; } load_con_set; struct { LispObj *car; LispObj *cdr; } cons; struct { short offset; LispObj *definition; } struc; } data; CodeTree *next; CodeTree *group; CodeBlock *block; }; struct _CodeBlock { LispBlockType type; LispObj *tag; struct { LispObj **labels; CodeTree **codes; /* Filled at link time */ int length; int space; } tagbody; struct { LispAtom **symbols; /* Identifiers of variables in a block */ int *flags; /* Information about usage of the variable */ int length; } variables; int bind; /* Used in case of RETURN from LET */ int level; /* Nesting level block was created */ CodeTree *tree, *tail; CodeBlock *prev; /* Linked list as a stack */ CodeTree *parent; /* Back reference */ }; struct _LispCom { unsigned char *bytecode; /* Bytecode generated so far */ long length; CodeBlock *block, *toplevel; int tagbody; /* Inside a tagbody block? */ int level; /* Nesting level */ int macro; /* Expanding a macro? */ int lex; int warnings; LispObj *form, *plist; jmp_buf jmp; /* Used if compilation cannot be finished */ struct { int cstack; /* Current number of objects in forms evaluation */ int cbstack; int cpstack; int stack; /* max number of objects will be loaded in stack */ int bstack; int pstack; } stack; struct { /* Constant table */ LispObj **constants; int num_constants; /* Symbol table */ LispAtom **symbols; int num_symbols; /* Builtin table */ LispBuiltin **builtins; int num_builtins; /* Bytecode table */ LispObj **bytecodes; int num_bytecodes; } table; }; /* * Prototypes */ static LispObj *MakeBytecodeObject(LispCom*, LispObj*, LispObj*); static CodeTree *CompileNewTree(LispCom*, CodeTreeType); static void CompileFreeState(LispCom*); static void CompileFreeBlock(CodeBlock*); static void CompileFreeTree(CodeTree*); static void CompileIniBlock(LispCom*, LispBlockType, LispObj*); static void CompileFiniBlock(LispCom*); static void com_BytecodeChar(LispCom*, LispByteOpcode, char); static void com_BytecodeShort(LispCom*, LispByteOpcode, short); static void com_BytecodeObject(LispCom*, LispByteOpcode, LispObj*); static void com_BytecodeCons(LispCom*, LispByteOpcode, LispObj*, LispObj*); static void com_BytecodeAtom(LispCom*, LispByteOpcode, LispAtom*); static void com_Bytecode(LispCom*, LispByteOpcode); static void com_Load(LispCom*, short); static void com_LoadLet(LispCom*, short, LispAtom*); static void com_LoadPush(LispCom*, short); static void com_Let(LispCom*, LispAtom*); static void com_Bind(LispCom*, short); static void com_Unbind(LispCom*, short); static void com_LoadSym(LispCom*, LispAtom*); static void com_LoadSymLet(LispCom*, LispAtom*, LispAtom*); static void com_LoadSymPush(LispCom*, LispAtom*); static void com_LoadCon(LispCom*, LispObj*); static void com_LoadConLet(LispCom*, LispObj*, LispAtom*); static void com_LoadConPush(LispCom*, LispObj*); static void com_Set(LispCom*, short); static void com_SetSym(LispCom*, LispAtom*); static void com_Struct(LispCom*, short, LispObj*); static void com_Structp(LispCom*, LispObj*); static void com_Call(LispCom*, unsigned char, LispBuiltin*); static void com_Bytecall(LispCom*, unsigned char, LispObj*); static void com_Funcall(LispCom*, LispObj*, LispObj*); static void CompileStackEnter(LispCom*, int, int); static void CompileStackLeave(LispCom*, int, int); static void LinkBytecode(LispCom*); static LispObj *ExecuteBytecode(unsigned char*); /* Defined in lisp.c */ void LispMoreStack(void); void LispMoreEnvironment(void); void LispMoreGlobals(LispPackage*); LispObj *LispEvalBackquote(LispObj*, int); void LispSetAtomObjectProperty(LispAtom*, LispObj*); /* * Initialization */ extern int pagesize; LispObj x_cons[8]; static LispObj *cons, *cons1, *cons2, *cons3, *cons4, *cons5, *cons6, *cons7; /* * Implementation */ #include "lisp/compile.c" void LispBytecodeInit(void) { cons = &x_cons[7]; cons->type = LispCons_t; CDR(cons) = NIL; cons1 = &x_cons[6]; cons1->type = LispCons_t; CDR(cons1) = cons; cons2 = &x_cons[5]; cons2->type = LispCons_t; CDR(cons2) = cons1; cons3 = &x_cons[4]; cons3->type = LispCons_t; CDR(cons3) = cons2; cons4 = &x_cons[3]; cons4->type = LispCons_t; CDR(cons4) = cons3; cons5 = &x_cons[2]; cons5->type = LispCons_t; CDR(cons5) = cons4; cons6 = &x_cons[1]; cons6->type = LispCons_t; CDR(cons6) = cons5; cons7 = &x_cons[0]; cons7->type = LispCons_t; CDR(cons7) = cons6; } LispObj * Lisp_Compile(LispBuiltin *builtin) /* compile name &optional definition */ { GC_ENTER(); LispObj *result, *warnings_p, *failure_p; LispObj *name, *definition; definition = ARGUMENT(1); name = ARGUMENT(0); result = name; warnings_p = NIL; failure_p = T; if (name != NIL) { LispAtom *atom; CHECK_SYMBOL(name); atom = name->data.atom; if (atom->a_builtin || atom->a_compiled) goto finished_compilation; else if (atom->a_function) { LispCom com; int failed; int lex = 0, base; LispArgList *alist; LispObj *lambda, *form, *arguments; lambda = atom->property->fun.function; if (definition != UNSPEC || lambda->funtype != LispFunction) /* XXX TODO replace definition etc. */ goto finished_compilation; alist = atom->property->alist; memset(&com, 0, sizeof(LispCom)); com.toplevel = com.block = LispCalloc(1, sizeof(CodeBlock)); com.block->type = LispBlockClosure; com.block->tag = name; /* Create a fake argument list to avoid yet another flag * for ComCall. The value does not matter, just the fact * that the symbol will be bound or not in the implicit * PROGN of the function body. */ base = alist->num_arguments - alist->auxs.num_symbols; if (base) { LispObj *argument; int i, sforms; for (i = sforms = 0; i < alist->optionals.num_symbols; i++) if (alist->optionals.sforms[i]) ++sforms; arguments = form = NIL; i = sforms + alist->normals.num_symbols + alist->optionals.num_symbols; if (i) { arguments = form = CONS(NIL, NIL); GC_PROTECT(arguments); for (--i; i > 0; i--) { RPLACD(form, CONS(NIL, NIL)); form = CDR(form); } } for (i = 0; i < alist->keys.num_symbols; i++) { /* key symbol */ if (alist->keys.keys[i]) argument = QUOTE(alist->keys.keys[i]); else argument = alist->keys.symbols[i]; /* add key */ if (arguments == NIL) { arguments = form = CONS(argument, NIL); GC_PROTECT(arguments); } else { RPLACD(form, CONS(argument, NIL)); form = CDR(form); } /* add value */ RPLACD(form, CONS(NIL, NIL)); form = CDR(form); if (alist->keys.sforms[i]) { RPLACD(form, CONS(NIL, NIL)); form = CDR(form); } } if (alist->rest) { if (arguments == NIL) { arguments = form = CONS(NIL, NIL); GC_PROTECT(arguments); } else { RPLACD(form, CONS(NIL, NIL)); form = CDR(form); } } } else arguments = NIL; form = CONS(lambda->data.lambda.code, NIL); GC_PROTECT(form); com.form = form; com.plist = CONS(NIL, NIL); GC_PROTECT(com.plist); failed = 1; if (setjmp(com.jmp) == 0) { /* Save interpreter state */ lex = com.lex = lisp__data.env.lex; base = ComCall(&com, alist, name, arguments, 1, 0, 1); /* Generate code tree */ lisp__data.env.lex = base; ComProgn(&com, CAR(form)); failed = 0; } /* Restore interpreter state */ lisp__data.env.lex = lex; lisp__data.env.head = lisp__data.env.length = base; if (!failed) { failure_p = NIL; result = MakeBytecodeObject(&com, name, lambda->data.lambda.data); LispSetAtomCompiledProperty(atom, result); result = name; } if (com.warnings) warnings_p = FIXNUM(com.warnings); goto finished_compilation; } else goto undefined_function; } undefined_function: LispDestroy("%s: the function %s is undefined", STRFUN(builtin), STROBJ(name)); finished_compilation: RETURN(0) = warnings_p; RETURN(1) = failure_p; RETURN_COUNT = 2; GC_LEAVE(); return (result); } LispObj * Lisp_Disassemble(LispBuiltin *builtin) /* disassemble function */ { int macro; char buffer[128]; LispAtom *atom; LispArgList *alist; LispBuiltin *xbuiltin; LispObj *name, *lambda, *bytecode; LispObj *function; function = ARGUMENT(0); macro = 0; alist = NULL; xbuiltin = NULL; name = bytecode = NULL; switch (OBJECT_TYPE(function)) { case LispFunction_t: function = function->data.atom->object; case LispAtom_t: name = function; atom = function->data.atom; alist = atom->property->alist; if (atom->a_builtin) { xbuiltin = atom->property->fun.builtin; macro = xbuiltin->type == LispMacro; } else if (atom->a_compiled) bytecode = atom->property->fun.function; else if (atom->a_function) { lambda = atom->property->fun.function; macro = lambda->funtype == LispMacro; } else if (atom->a_defstruct && atom->property->structure.function != STRUCT_NAME) { if (atom->property->structure.function == STRUCT_CONSTRUCTOR) atom = Omake_struct->data.atom; else if (atom->property->structure.function == STRUCT_CHECK) atom = Ostruct_type->data.atom; else atom = Ostruct_access->data.atom; xbuiltin = atom->property->fun.builtin; } else LispDestroy("%s: the function %s is not defined", STRFUN(builtin), STROBJ(function)); break; case LispBytecode_t: name = Olambda; bytecode = function; break; case LispLambda_t: name = Olambda; alist = (LispArgList*)function->data.lambda.name->data.opaque.data; break; case LispCons_t: if (CAR(function) == Olambda) { function = EVAL(function); if (OBJECT_TYPE(function) == LispLambda_t) { name = Olambda; alist = (LispArgList*) function->data.lambda.name->data.opaque.data; break; } } default: LispDestroy("%s: %s is not a function", STRFUN(builtin), STROBJ(function)); break; } if (xbuiltin) { LispWriteStr(NIL, "Builtin ", 8); if (macro) LispWriteStr(NIL, "macro ", 6); else LispWriteStr(NIL, "function ", 9); } else if (macro) LispWriteStr(NIL, "Macro ", 6); else LispWriteStr(NIL, "Function ", 9); LispWriteObject(NIL, name); LispWriteStr(NIL, ":\n", 2); if (alist) { int i; sprintf(buffer, "%d required argument%s", alist->normals.num_symbols, alist->normals.num_symbols != 1 ? "s" : ""); LispWriteStr(NIL, buffer, strlen(buffer)); for (i = 0; i < alist->normals.num_symbols; i++) { LispWriteChar(NIL, i ? ',' : ':'); LispWriteChar(NIL, ' '); LispWriteStr(NIL, ATOMID(alist->normals.symbols[i])->value, ATOMID(alist->normals.symbols[i])->length); } LispWriteChar(NIL, '\n'); sprintf(buffer, "%d optional argument%s", alist->optionals.num_symbols, alist->optionals.num_symbols != 1 ? "s" : ""); LispWriteStr(NIL, buffer, strlen(buffer)); for (i = 0; i < alist->optionals.num_symbols; i++) { LispWriteChar(NIL, i ? ',' : ':'); LispWriteChar(NIL, ' '); LispWriteStr(NIL, ATOMID(alist->optionals.symbols[i])->value, ATOMID(alist->optionals.symbols[i])->length); } LispWriteChar(NIL, '\n'); sprintf(buffer, "%d keyword parameter%s", alist->keys.num_symbols, alist->keys.num_symbols != 1 ? "s" : ""); LispWriteStr(NIL, buffer, strlen(buffer)); for (i = 0; i < alist->keys.num_symbols; i++) { LispWriteChar(NIL, i ? ',' : ':'); LispWriteChar(NIL, ' '); LispWriteObject(NIL, alist->keys.symbols[i]); } LispWriteChar(NIL, '\n'); if (alist->rest) { LispWriteStr(NIL, "Rest argument: ", 15); LispWriteStr(NIL, ATOMID(alist->rest)->value, ATOMID(alist->rest)->length); LispWriteChar(NIL, '\n'); } else LispWriteStr(NIL, "No rest argument\n", 17); } if (bytecode) { Atom_id id; char *ptr; int *offsets[4]; int i, done, j, sym0, sym1, con0, con1, bui0, byt0, strd, strf; LispObj **constants; LispAtom **symbols; LispBuiltin **builtins; LispObj **names; short stack, num_constants, num_symbols, num_builtins, num_bytecodes; unsigned char *base, *stream = bytecode->data.bytecode.bytecode->code; LispWriteStr(NIL, "\nBytecode header:\n", 18); /* Header information */ stack = *(short*)stream; stream += sizeof(short); sprintf(buffer, "%d element%s used in the stack\n", stack, stack != 1 ? "s" : ""); LispWriteStr(NIL, buffer, strlen(buffer)); stack = *(short*)stream; stream += sizeof(short); sprintf(buffer, "%d element%s used in the builtin stack\n", stack, stack != 1 ? "s" : ""); LispWriteStr(NIL, buffer, strlen(buffer)); stack = *(short*)stream; stream += sizeof(short); sprintf(buffer, "%d element%s used in the protected stack\n", stack, stack != 1 ? "s" : ""); LispWriteStr(NIL, buffer, strlen(buffer)); num_constants = *(short*)stream; stream += sizeof(short); num_symbols = *(short*)stream; stream += sizeof(short); num_builtins = *(short*)stream; stream += sizeof(short); num_bytecodes = *(short*)stream; stream += sizeof(short); constants = (LispObj**)stream; stream += num_constants * sizeof(LispObj*); symbols = (LispAtom**)stream; stream += num_symbols * sizeof(LispAtom*); builtins = (LispBuiltin**)stream; stream += num_builtins * sizeof(LispBuiltin*); stream += num_bytecodes * sizeof(unsigned char*); names = (LispObj**)stream; stream += num_bytecodes * sizeof(LispObj*); for (i = 0; i < num_constants; i++) { sprintf(buffer, "Constant %d = %s\n", i, STROBJ(constants[i])); LispWriteStr(NIL, buffer, strlen(buffer)); } /* Macro XSTRING avoids some noisy in the output, if it were defined as * #define XSTRING(object) object ? STROBJ(object) : # * and called as XSTRING(atom->object) * it would also print the package name were the symbol was first defined, * but for local variables, only the symbol string is important. */ #define XSTRING(key) key ? key->value : "#" for (i = 0; i < num_symbols; i++) { sprintf(buffer, "Symbol %d = %s\n", i, XSTRING(symbols[i]->key)); LispWriteStr(NIL, buffer, strlen(buffer)); } for (i = 0; i < num_builtins; i++) { sprintf(buffer, "Builtin %d = %s\n", i, STROBJ(builtins[i]->symbol)); LispWriteStr(NIL, buffer, strlen(buffer)); } for (i = 0; i < num_bytecodes; i++) { sprintf(buffer, "Bytecode %d = %s\n", i, STROBJ(names[i])); LispWriteStr(NIL, buffer, strlen(buffer)); } /* Make readability slightly easier printing the names of local * variables where it's offset is known, i.e. function arguments. */ if (alist) { if (alist->num_arguments == 0) LispWriteStr(NIL, "\nNo initial stack\n", 18); else { int len1, len2; j = 0; LispWriteStr(NIL, "\nInitial stack:\n", 16); for (i = 0; i < alist->normals.num_symbols; i++, j++) { sprintf(buffer, "%d = ", j); LispWriteStr(NIL, buffer, strlen(buffer)); id = alist->normals.symbols[i]->data.atom->key; LispWriteStr(NIL, id->value, id->length); LispWriteChar(NIL, '\n'); } for (i = 0; i < alist->optionals.num_symbols; i++, j++) { sprintf(buffer, "%d = ", j); LispWriteStr(NIL, buffer, strlen(buffer)); id = alist->optionals.symbols[i]->data.atom->key; LispWriteStr(NIL, id->value, id->length); LispWriteChar(NIL, '\n'); if (alist->optionals.sforms[i]) { sprintf(buffer, "%d = ", j); len1 = strlen(buffer); LispWriteStr(NIL, buffer, len1); id = alist->optionals.sforms[i]->data.atom->key; len2 = id->length; LispWriteStr(NIL, id->value, len2); LispWriteChars(NIL, ' ', 28 - (len1 + len2)); LispWriteStr(NIL, "; sform\n", 9); j++; } } for (i = 0; i < alist->keys.num_symbols; i++, j++) { sprintf(buffer, "%d = ", j); len1 = strlen(buffer); LispWriteStr(NIL, buffer, len1); if (alist->keys.keys[i]) { id = alist->keys.keys[i]->data.atom->key; len2 = id->length; LispWriteStr(NIL, id->value, id->length); LispWriteChars(NIL, ' ', 28 - (len1 + len2)); LispWriteStr(NIL, "; special key", 14); } else { id = alist->keys.symbols[i]->data.atom->key; LispWriteStr(NIL, id->value, id->length); } LispWriteChar(NIL, '\n'); if (alist->keys.sforms[i]) { sprintf(buffer, "%d = ", j); len1 = strlen(buffer); LispWriteStr(NIL, buffer, len1); id = alist->keys.sforms[i]->data.atom->key; len2 = id->length; LispWriteStr(NIL, id->value, len2); LispWriteChars(NIL, ' ', 28 - (len1 + len2)); LispWriteStr(NIL, "; sform\n", 9); j++; } } if (alist->rest) { sprintf(buffer, "%d = ", j); len1 = strlen(buffer); LispWriteStr(NIL, buffer, len1); id = alist->rest->data.atom->key; len2 = id->length; LispWriteStr(NIL, id->value, len2); LispWriteChar(NIL, '\n'); j++; } for (i = 0; i < alist->auxs.num_symbols; i++, j++) { sprintf(buffer, "%d = ", j); len1 = strlen(buffer); LispWriteStr(NIL, buffer, len1); id = alist->auxs.symbols[i]->data.atom->key; len2 = id->length; LispWriteStr(NIL, id->value, len2); LispWriteChars(NIL, ' ', 28 - (len1 + len2)); LispWriteStr(NIL, "; aux\n", 7); } } } LispWriteStr(NIL, "\nBytecode stream:\n", 18); base = stream; for (done = j = 0; !done; j = 0) { sym0 = sym1 = con0 = con1 = bui0 = byt0 = strd = strf = -1; sprintf(buffer, "%4ld ", (long)(stream - base)); ptr = buffer + strlen(buffer); switch (*stream++) { case XBC_NOOP: strcpy(ptr, "NOOP"); break; case XBC_PRED: strcpy(ptr, "PRED:"); ptr += strlen(ptr); goto predicate; case XBC_INV: strcpy(ptr, "INV"); break; case XBC_NIL: strcpy(ptr, "NIL"); break; case XBC_T: strcpy(ptr, "T"); break; case XBC_CAR: strcpy(ptr, "CAR"); break; case XBC_CDR: strcpy(ptr, "CDR"); break; case XBC_RPLACA:strcpy(ptr, "RPLACA"); break; case XBC_RPLACD:strcpy(ptr, "RPLACD"); break; case XBC_EQ: strcpy(ptr, "EQ"); break; case XBC_EQL: strcpy(ptr, "EQL"); break; case XBC_EQUAL: strcpy(ptr, "EQUAL"); break; case XBC_EQUALP:strcpy(ptr, "EQUALP"); break; case XBC_LENGTH:strcpy(ptr, "LENGTH"); break; case XBC_LAST: strcpy(ptr, "LAST"); break; case XBC_NTHCDR:strcpy(ptr, "NTHCDR"); break; case XBC_PUSH: strcpy(ptr, "PUSH"); break; case XBC_CAR_PUSH: strcpy(ptr, "CAR&PUSH"); break; case XBC_CDR_PUSH: strcpy(ptr, "CDR&PUSH"); break; case XBC_PUSH_NIL: strcpy(ptr, "PUSH NIL"); break; case XBC_PUSH_UNSPEC: strcpy(ptr, "PUSH #"); break; case XBC_PUSH_T: strcpy(ptr, "PUSH T"); break; case XBC_PUSH_NIL_N: strcpy(ptr, "PUSH NIL "); ptr += strlen(ptr); sprintf(ptr, "%d", (int)(*stream++)); break; case XBC_PUSH_UNSPEC_N: strcpy(ptr, "PUSH # "); ptr += strlen(ptr); sprintf(ptr, "%d", (int)(*stream++)); break; case XBC_LET: strcpy(ptr, "LET"); /* update sym0 */ symbol: offsets[j++] = &sym0; /* update - print [byte] */ offset: ptr += strlen(ptr); i = *stream++; *(offsets[j - 1]) = i; sprintf(ptr, " [%d]", i); break; case XBC_LETX: strcpy(ptr, "LET*"); goto symbol; case XBC_LET_NIL: strcpy(ptr, "LET NIL"); goto symbol; case XBC_LETX_NIL: strcpy(ptr, "LET* NIL"); goto symbol; case XBC_LETBIND: strcpy(ptr, "LETBIND"); /* print byte */ value: ptr += strlen(ptr); sprintf(ptr, " %d", (int)(*stream++)); break; case XBC_UNLET:strcpy(ptr, "UNLET"); goto value; case XBC_LOAD: strcpy(ptr, "LOAD"); /* print (byte) */ reference: ptr += strlen(ptr); i = *stream++; sprintf(ptr, " (%d)", i); break; case XBC_LOAD_CAR: strcpy(ptr, "LOAD&CAR"); goto reference; case XBC_LOAD_CDR: strcpy(ptr, "LOAD&CDR"); goto reference; case XBC_LOAD_CAR_STORE: strcpy(ptr, "LOAD&CAR&STORE"); goto reference; case XBC_LOAD_CDR_STORE: strcpy(ptr, "LOAD&CDR&STORE"); goto reference; case XBC_LOAD_LET: strcpy(ptr, "LOAD&LET"); load_let: offsets[j++] = &sym0; i = *stream++; ptr += strlen(ptr); sprintf(ptr, " (%d)", i); goto offset; case XBC_LOAD_LETX: strcpy(ptr, "LOAD&LET*"); goto load_let; case XBC_STRUCT: strcpy(ptr, "STRUCT"); offsets[j++] = &strf; offsets[j++] = &strd; /* update - print [byte] - update - print [byte] */ offset_offset: ptr += strlen(ptr); i = *stream++; *(offsets[j - 2]) = i; sprintf(ptr, " [%d]", i); goto offset; case XBC_LOAD_PUSH: strcpy(ptr, "LOAD&PUSH"); goto reference; case XBC_LOADCON: strcpy(ptr, "LOADCON"); constant: offsets[j++] = &con0; goto offset; case XBC_LOADCON_SET: strcpy(ptr, "LOADCON&SET"); offsets[j++] = &con0; /* update - print [byte] - print (byte) */ offset_reference: i = *stream++; *(offsets[j - 1]) = i; ptr += strlen(ptr); sprintf(ptr, " [%d]", i); goto reference; case XBC_STRUCTP: strcpy(ptr, "STRUCTP"); offsets[j++] = &strd; goto offset; case XBC_LOADCON_LET: strcpy(ptr, "LOADCON&LET"); loadcon_let: offsets[j++] = &con0; offsets[j++] = &sym0; goto offset_offset; case XBC_LOADCON_LETX: strcpy(ptr, "LOADCON&LET*"); goto loadcon_let; case XBC_LOADCON_PUSH: strcpy(ptr, "LOADCON&PUSH"); goto constant; case XBC_LOADSYM: strcpy(ptr, "LOADSYM"); goto symbol; case XBC_LOADSYM_LET: strcpy(ptr, "LOADSYM&LET"); loadsym_let: offsets[j++] = &sym0; offsets[j++] = &sym1; goto offset_offset; case XBC_LOADSYM_LETX: strcpy(ptr, "LOADSYM&LET*"); goto loadsym_let; case XBC_LOADSYM_PUSH: strcpy(ptr, "LOADSYM&PUSH"); goto symbol; case XBC_LOAD_SET: strcpy(ptr, "LOAD&SET"); /* print (byte) - print (byte) */ reference_reference: ptr += strlen(ptr); i = *stream++; sprintf(ptr, " (%d)", i); goto reference; case XBC_LOAD_CAR_SET: strcpy(ptr, "LOAD&CAR&SET"); goto reference_reference; case XBC_LOAD_CDR_SET: strcpy(ptr, "LOAD&CDR&SET"); goto reference_reference; case XBC_CAR_SET: strcpy(ptr, "CAR&SET"); goto reference; case XBC_CDR_SET: strcpy(ptr, "CDR&SET"); goto reference; case XBC_SET: strcpy(ptr, "SET"); goto reference; case XBC_SETSYM: strcpy(ptr, "SETSYM"); goto symbol; case XBC_SET_NIL: strcpy(ptr, "SET NIL"); goto reference; case XBC_CALL: strcpy(ptr, "CALL"); ptr += strlen(ptr); sprintf(ptr, " %d", (int)(*stream++)); offsets[j++] = &bui0; goto offset; case XBC_CALL_SET: strcpy(ptr, "CALL&SET"); ptr += strlen(ptr); sprintf(ptr, " %d", (int)(*stream++)); offsets[j++] = &bui0; goto offset_reference; case XBC_BYTECALL: strcpy(ptr, "BYTECALL"); ptr += strlen(ptr); sprintf(ptr, " %d", (int)(*stream++)); offsets[j++] = &byt0; goto offset; case XBC_FUNCALL: strcpy(ptr, "FUNCALL"); constant_constant: offsets[j++] = &con0; offsets[j++] = &con1; goto offset_offset; case XBC_CCONS: strcpy(ptr, "CCONS"); goto constant_constant; case XBC_CSTAR: strcpy(ptr, "CSTAR"); break; case XBC_CFINI: strcpy(ptr, "CFINI"); break; case XBC_LSTAR: strcpy(ptr, "LSTAR"); break; case XBC_LCONS: strcpy(ptr, "LCONS"); break; case XBC_LFINI: strcpy(ptr, "LFINI"); break; case XBC_BCONS: strcpy(ptr, "BCONS"); break; case XBC_BCONS1: case XBC_BCONS2: case XBC_BCONS3: case XBC_BCONS4: case XBC_BCONS5: case XBC_BCONS6: case XBC_BCONS7: strcpy(ptr, "BCONS"); ptr += strlen(ptr); sprintf(ptr, "%d", (int)(stream[-1] - XBC_BCONS)); break; case XBC_JUMP: strcpy(ptr, "JUMP"); integer: ptr += strlen(ptr); sprintf(ptr, " %d", *(signed short*)stream); stream += sizeof(short); break; case XBC_JUMPT: strcpy(ptr, "JUMPT"); goto integer; case XBC_JUMPNIL: strcpy(ptr, "JUMPNIL"); goto integer; case XBC_LETREC: strcpy(ptr, "LETREC"); ptr += strlen(ptr); sprintf(ptr, " %d", (int)*stream++); break; case XBC_RETURN: strcpy(ptr, "RETURN"); done = 1; break; } i = ptr - buffer + strlen(ptr); LispWriteStr(NIL, buffer, i); if (j) { /* Pad */ LispWriteChars(NIL, ' ', 28 - i); LispWriteChar(NIL, ';'); ptr = buffer; /* Structure */ if (strf >= 0) { /* strd is valid if strf set */ LispObj *fields = constants[strd]; for (; strf >= 0; strf--) fields = CDR(fields); strcpy(ptr, " "); ptr += 2; strcpy(ptr, CAR(fields)->data.atom->key->value); ptr += strlen(ptr); } if (strd >= 0) { strcpy(ptr, " "); ptr += 2; strcpy(ptr, STROBJ(CAR(constants[strd]))); ptr += strlen(ptr); } /* Constants */ if (con0 >= 0) { strcpy(ptr, " "); ptr += 2; strcpy(ptr, STROBJ(constants[con0])); ptr += strlen(ptr); if (con1 >= 0) { strcpy(ptr, " "); ptr += 2; strcpy(ptr, STROBJ(constants[con1])); ptr += strlen(ptr); } } /* Builtin */ if (bui0 >= 0) { strcpy(ptr, " "); ptr += 2; strcpy(ptr, STROBJ(builtins[bui0]->symbol)); ptr += strlen(ptr); } /* Bytecode */ if (byt0 >= 0) { strcpy(ptr, " "); ptr += 2; strcpy(ptr, STROBJ(names[byt0])); ptr += strlen(ptr); } /* Symbols */ if (sym0 >= 0) { strcpy(ptr, " "); ptr += 2; strcpy(ptr, XSTRING(symbols[sym0]->key)); ptr += strlen(ptr); if (sym1 >= 0) { strcpy(ptr, " "); ptr += 2; strcpy(ptr, XSTRING(symbols[sym1]->key)); ptr += strlen(ptr); } } i = ptr - buffer; LispWriteStr(NIL, buffer, i); } LispWriteChar(NIL, '\n'); continue; predicate: switch (*stream++) { case XBP_CONSP: strcpy(ptr, "CONSP"); break; case XBP_LISTP: strcpy(ptr, "LISTP"); break; case XBP_NUMBERP: strcpy(ptr, "NUMBERP"); break; } LispWriteStr(NIL, buffer, ptr - buffer + strlen(ptr)); LispWriteChar(NIL, '\n'); } #undef XSTRING } return (function); } LispObj * LispCompileForm(LispObj *form) { GC_ENTER(); int failed; LispCom com; if (!CONSP(form)) /* Incorrect call or NIL */ return (form); memset(&com, 0, sizeof(LispCom)); com.toplevel = com.block = LispCalloc(1, sizeof(CodeBlock)); com.block->type = LispBlockNone; com.lex = lisp__data.env.lex; com.plist = CONS(NIL, NIL); GC_PROTECT(com.plist); failed = 1; if (setjmp(com.jmp) == 0) { for (; CONSP(form); form = CDR(form)) { com.form = form; ComEval(&com, CAR(form)); } failed = 0; } GC_LEAVE(); return (failed ? NIL : MakeBytecodeObject(&com, NIL, NIL)); } LispObj * LispExecuteBytecode(LispObj *object) { if (!BYTECODEP(object)) return (EVAL(object)); return (ExecuteBytecode(object->data.bytecode.bytecode->code)); } static LispObj * MakeBytecodeObject(LispCom *com, LispObj *name, LispObj *plist) { LispObj *object; LispBytecode *bytecode; GC_ENTER(); unsigned char *stream; short i, num_constants; LispObj **constants, *code, *cons, *prev; /* Resolve dependencies, optimize and create byte stream */ LinkBytecode(com); object = LispNew(NIL, NIL); GC_PROTECT(object); bytecode = LispMalloc(sizeof(LispBytecode)); bytecode->code = com->bytecode; bytecode->length = com->length; stream = bytecode->code; /* Skip stack information */ stream += sizeof(short) * 3; /* Get information */ num_constants = *(short*)stream; stream += sizeof(short) * 4; constants = (LispObj**)stream; GC_PROTECT(plist); code = cons = prev = NIL; for (i = 0; i < num_constants; i++) { if (POINTERP(constants[i]) && !XSYMBOLP(constants[i])) { if (code == NIL) { code = cons = prev = CONS(constants[i], NIL); GC_PROTECT(code); } else { RPLACD(cons, CONS(constants[i], NIL)); prev = cons; cons = CDR(cons); } } } /* Protect this in case the function is redefined */ for (i = 0; i < com->table.num_bytecodes; i++) { if (code == NIL) { code = cons = prev = CONS(com->table.bytecodes[i], NIL); GC_PROTECT(code); } else { RPLACD(cons, CONS(com->table.bytecodes[i], NIL)); prev = cons; cons = CDR(cons); } } /* Free everything, but the LispCom structure and the generated bytecode */ CompileFreeState(com); /* Allocate the minimum required number of cons cells to protect objects */ if (!CONSP(code)) code = plist; else if (CONSP(plist)) { if (code == cons) RPLACD(code, plist); else RPLACD(cons, plist); } else { if (code == cons) code = CAR(code); else CDR(prev) = CAR(cons); } object->data.bytecode.bytecode = bytecode; /* Byte code references this object, so it cannot be garbage collected */ object->data.bytecode.code = code; object->data.bytecode.name = name; object->type = LispBytecode_t; LispMused(bytecode); LispMused(bytecode->code); GC_LEAVE(); return (object); } static void CompileFreeTree(CodeTree *tree) { if (tree->type == CodeTreeBlock) CompileFreeBlock(tree->data.block); LispFree(tree); } static void CompileFreeBlock(CodeBlock *block) { CodeTree *tree = block->tree, *next; while (tree) { next = tree->next; CompileFreeTree(tree); tree = next; } if (block->type == LispBlockBody) { LispFree(block->tagbody.labels); LispFree(block->tagbody.codes); } LispFree(block->variables.symbols); LispFree(block->variables.flags); LispFree(block); } static void CompileFreeState(LispCom *com) { CompileFreeBlock(com->block); LispFree(com->table.constants); LispFree(com->table.symbols); LispFree(com->table.builtins); LispFree(com->table.bytecodes); } /* XXX Put a breakpoint here when changing the macro expansion code. * No opcodes should be generated during macro expansion. */ static CodeTree * CompileNewTree(LispCom *com, CodeTreeType type) { CodeTree *tree = LispMalloc(sizeof(CodeTree)); tree->type = type; tree->next = NULL; tree->block = com->block; if (com->block->tree == NULL) com->block->tree = tree; else com->block->tail->next = tree; com->block->tail = tree; return (tree); } static void CompileIniBlock(LispCom *com, LispBlockType type, LispObj *tag) { CodeTree *tree = NEW_TREE(CodeTreeBlock); CodeBlock *block = LispCalloc(1, sizeof(CodeBlock)); tree->data.block = block; block->type = type; block->tag = tag; block->prev = com->block; block->parent = tree; block->level = com->level; com->block = block; if (type == LispBlockBody) com->tagbody = com->level; } static void CompileFiniBlock(LispCom *com) { com->block = com->block->prev; if (com->block && com->block->type == LispBlockBody) com->tagbody = com->block->level; } static void com_BytecodeChar(LispCom *com, LispByteOpcode code, char value) { CodeTree *tree = NEW_TREE(CodeTreeBytecode); tree->code = code; tree->data.signed_char = value; } static void com_BytecodeShort(LispCom *com, LispByteOpcode code, short value) { CodeTree *tree = NEW_TREE(CodeTreeBytecode); tree->code = code; tree->data.signed_short = value; } static void com_BytecodeAtom(LispCom *com, LispByteOpcode code, LispAtom *atom) { CodeTree *tree = NEW_TREE(CodeTreeBytecode); tree->code = code; tree->data.atom = atom; } static void com_BytecodeObject(LispCom *com, LispByteOpcode code, LispObj *object) { CodeTree *tree = NEW_TREE(CodeTreeBytecode); tree->code = code; tree->data.object = object; } static void com_BytecodeCons(LispCom *com, LispByteOpcode code, LispObj *car, LispObj *cdr) { CodeTree *tree = NEW_TREE(CodeTreeBytecode); tree->code = code; tree->data.cons.car = car; tree->data.cons.cdr = cdr; } static void com_Bytecode(LispCom *com, LispByteOpcode code) { CodeTree *tree = NEW_TREE(CodeTreeBytecode); tree->code = code; } static void com_Load(LispCom *com, short offset) { com_BytecodeShort(com, XBC_LOAD, offset); } static void com_LoadLet(LispCom *com, short offset, LispAtom *name) { CodeTree *tree = NEW_TREE(CodeTreeBytecode); tree->code = XBC_LOAD_LET; tree->data.let.offset = offset; tree->data.let.name = name; } static void com_LoadPush(LispCom *com, short offset) { com_BytecodeShort(com, XBC_LOAD_PUSH, offset); } static void com_Let(LispCom *com, LispAtom *name) { com_BytecodeAtom(com, XBC_LET, name); } static void com_Bind(LispCom *com, short count) { if (count) com_BytecodeShort(com, XBC_LETBIND, count); } static void com_Unbind(LispCom *com, short count) { if (count) com_BytecodeShort(com, XBC_UNLET, count); } static void com_LoadSym(LispCom *com, LispAtom *atom) { com_BytecodeAtom(com, XBC_LOADSYM, atom); } static void com_LoadSymLet(LispCom *com, LispAtom *symbol, LispAtom *name) { CodeTree *tree = NEW_TREE(CodeTreeBytecode); tree->code = XBC_LOADSYM_LET; tree->data.let_sym.symbol = symbol; tree->data.let_sym.name = name; } static void com_LoadSymPush(LispCom *com, LispAtom *name) { com_BytecodeAtom(com, XBC_LOADSYM_PUSH, name); } static void com_LoadCon(LispCom *com, LispObj *constant) { if (constant == NIL) com_Bytecode(com, XBC_NIL); else if (constant == T) com_Bytecode(com, XBC_T); else if (constant == UNSPEC) { COMPILE_FAILURE("internal error: loading #"); } else com_BytecodeObject(com, XBC_LOADCON, constant); } static void com_LoadConLet(LispCom *com, LispObj *constant, LispAtom *name) { if (constant == NIL) com_BytecodeAtom(com, XBC_LET_NIL, name); else { CodeTree *tree = NEW_TREE(CodeTreeBytecode); tree->code = XBC_LOADCON_LET; tree->data.let_con.object = constant; tree->data.let_con.name = name; } } static void com_LoadConPush(LispCom *com, LispObj *constant) { if (constant == NIL) com_Bytecode(com, XBC_PUSH_NIL); else if (constant == T) com_Bytecode(com, XBC_PUSH_T); else if (constant == UNSPEC) com_Bytecode(com, XBC_PUSH_UNSPEC); else com_BytecodeObject(com, XBC_LOADCON_PUSH, constant); } static void com_Set(LispCom *com, short offset) { com_BytecodeShort(com, XBC_SET, offset); } static void com_SetSym(LispCom *com, LispAtom *symbol) { com_BytecodeAtom(com, XBC_SETSYM, symbol); } static void com_Struct(LispCom *com, short offset, LispObj *definition) { CodeTree *tree = NEW_TREE(CodeTreeBytecode); tree->code = XBC_STRUCT; tree->data.struc.offset = offset; tree->data.struc.definition = definition; } static void com_Structp(LispCom *com, LispObj *definition) { com_BytecodeObject(com, XBC_STRUCTP, definition); } static void com_Call(LispCom *com, unsigned char num_arguments, LispBuiltin *builtin) { CodeTree *tree = NEW_TREE(CodeTreeBytecode); tree->code = XBC_CALL; tree->data.builtin.num_arguments = num_arguments; tree->data.builtin.builtin = builtin; } static void com_Bytecall(LispCom *com, unsigned char num_arguments, LispObj *code) { CodeTree *tree = NEW_TREE(CodeTreeBytecode); tree->code = XBC_BYTECALL; tree->data.bytecall.num_arguments = num_arguments; tree->data.bytecall.code = code; } static void com_Funcall(LispCom *com, LispObj *function, LispObj *arguments) { com_BytecodeCons(com, XBC_FUNCALL, function, arguments); } static void CompileStackEnter(LispCom *com, int count, int builtin) { if (!com->macro) { if (builtin) { com->stack.cbstack += count; if (com->stack.bstack < com->stack.cbstack) com->stack.bstack = com->stack.cbstack; } else { com->stack.cstack += count; if (com->stack.stack < com->stack.cstack) com->stack.stack = com->stack.cstack; } } } static void CompileStackLeave(LispCom *com, int count, int builtin) { if (!com->macro) { if (builtin) com->stack.cbstack -= count; else com->stack.cstack -= count; } } static void LinkWarnUnused(LispCom *com, CodeBlock *block) { int i; CodeTree *tree; for (tree = block->tree; tree; tree = tree->next) { if (tree->type == CodeTreeBlock) LinkWarnUnused(com, tree->data.block); } for (i = 0; i < block->variables.length; i++) if (!(block->variables.flags[i] & (VARIABLE_USED | VARIABLE_ARGUMENT))) { ++com->warnings; LispWarning("the variable %s is unused", block->variables.symbols[i]->key->value); } } #define INTERNAL_ERROR_STRING "COMPILE: internal error #%d" #define INTERNAL_ERROR(value) LispDestroy(INTERNAL_ERROR_STRING, value) static long LinkBuildOffsets(LispCom *com, CodeTree *tree, long offset) { for (; tree; tree = tree->next) { tree->offset = offset; switch (tree->type) { case CodeTreeBytecode: switch (tree->code) { case XBC_NOOP: INTERNAL_ERROR(__LINE__); break; /* byte */ case XBC_BCONS: case XBC_BCONS1: case XBC_BCONS2: case XBC_BCONS3: case XBC_BCONS4: case XBC_BCONS5: case XBC_BCONS6: case XBC_BCONS7: case XBC_INV: case XBC_NIL: case XBC_T: case XBC_PUSH: case XBC_CAR_PUSH: case XBC_CDR_PUSH: case XBC_PUSH_NIL: case XBC_PUSH_UNSPEC: case XBC_PUSH_T: case XBC_LSTAR: case XBC_LCONS: case XBC_LFINI: case XBC_RETURN: case XBC_CSTAR: case XBC_CFINI: case XBC_CAR: case XBC_CDR: case XBC_RPLACA: case XBC_RPLACD: case XBC_EQ: case XBC_EQL: case XBC_EQUAL: case XBC_EQUALP: case XBC_LENGTH: case XBC_LAST: case XBC_NTHCDR: ++offset; break; /* byte + byte */ case XBC_PUSH_NIL_N: case XBC_PUSH_UNSPEC_N: case XBC_PRED: case XBC_LETREC: case XBC_LOAD_PUSH: case XBC_CAR_SET: case XBC_CDR_SET: case XBC_SET: case XBC_SET_NIL: case XBC_LETBIND: case XBC_UNLET: case XBC_LOAD: case XBC_LOAD_CAR: case XBC_LOAD_CDR: case XBC_LOAD_CAR_STORE: case XBC_LOAD_CDR_STORE: case XBC_LET: case XBC_LETX: case XBC_LET_NIL: case XBC_LETX_NIL: case XBC_STRUCTP: case XBC_SETSYM: case XBC_LOADCON_PUSH: case XBC_LOADSYM_PUSH: case XBC_LOADCON: case XBC_LOADSYM: offset += 2; break; /* byte + byte + byte */ case XBC_CALL: case XBC_BYTECALL: case XBC_LOAD_SET: case XBC_LOAD_CAR_SET: case XBC_LOAD_CDR_SET: case XBC_LOADCON_SET: case XBC_LOAD_LET: case XBC_LOAD_LETX: case XBC_STRUCT: case XBC_LOADCON_LET: case XBC_LOADCON_LETX: case XBC_LOADSYM_LET: case XBC_LOADSYM_LETX: case XBC_CCONS: case XBC_FUNCALL: offset += 3; break; /* byte + short */ case XBC_JUMP: case XBC_JUMPT: case XBC_JUMPNIL: /* XXX this is likely a jump to random address here */ INTERNAL_ERROR(__LINE__); offset += sizeof(short) + 1; break; /* byte + byte + byte + byte */ case XBC_CALL_SET: offset += 4; break; } break; case CodeTreeLabel: /* Labels are not loaded */ break; case CodeTreeJump: case CodeTreeJumpIf: case CodeTreeCond: /* If not the point where the conditional block finishes */ if (tree->code != XBC_NOOP) /* Reserve space for the jump opcode */ offset += sizeof(short) + 1; break; case CodeTreeGo: case CodeTreeReturn: /* Reserve space for the jump opcode */ offset += sizeof(short) + 1; break; case CodeTreeBlock: offset = LinkBuildOffsets(com, tree->data.block->tree, offset); break; } } return (offset); } static void LinkDoOptimize_0(LispCom *com, CodeBlock *block) { CodeTree *tree, *prev, *next; /* Remove redundant or join opcodes that can be joined. Do it here * because some of these are hard to detect earlier, and/or would * require a lot of duplicated code or more time. */ tree = prev = block->tree; while (tree) { next = tree->next; /* LET -> LET* */ if (next && next->type == CodeTreeBytecode && next->code == XBC_LETBIND && next->data.signed_short == 1) { switch (tree->code) { case XBC_LET: tree->code = XBC_LETX; goto remove_next_label; case XBC_LET_NIL: tree->code = XBC_LETX_NIL; goto remove_next_label; case XBC_LOAD_LET: tree->code = XBC_LOAD_LETX; goto remove_next_label; case XBC_LOADCON_LET: tree->code = XBC_LOADCON_LETX; goto remove_next_label; case XBC_LOADSYM_LET: tree->code = XBC_LOADSYM_LETX; goto remove_next_label; default: break; } } switch (tree->type) { case CodeTreeBytecode: switch (tree->code) { case XBC_LOADCON: if (next && next->type == CodeTreeBytecode) { switch (next->code) { case XBC_LET: next->code = XBC_LOADCON_LET; next->data.let_con.name = next->data.atom; next->data.let_con.object = tree->data.object; goto remove_label; case XBC_PUSH: next->code = XBC_LOADCON_PUSH; next->data.object = tree->data.object; goto remove_label; case XBC_CAR: if (tree->data.object != NIL) { if (!CONSP(tree->data.object)) LispDestroy("CAR: %s is not a list", STROBJ( tree->data.object)); next->code = XBC_LOADCON; next->data.object = CAR(tree->data.object); } goto remove_label; case XBC_CDR: if (tree->data.object != NIL) { if (!CONSP(tree->data.object)) LispDestroy("CAR: %s is not a list", STROBJ( tree->data.object)); next->code = XBC_LOADCON; next->data.object = CDR(tree->data.object); } goto remove_label; case XBC_SET: next->code = XBC_LOADCON_SET; next->data.load_con_set.offset = next->data.signed_short; next->data.load_con_set.object = tree->data.object; goto remove_label; default: break; } } break; case XBC_LOADSYM: if (next && next->type == CodeTreeBytecode) { switch (next->code) { case XBC_LET: next->code = XBC_LOADSYM_LET; next->data.let_sym.name = next->data.atom; next->data.let_sym.symbol = tree->data.atom; goto remove_label; case XBC_PUSH: next->code = XBC_LOADSYM_PUSH; next->data.atom = tree->data.atom; goto remove_label; default: break; } } break; case XBC_LOAD: if (next && next->type == CodeTreeBytecode) { switch (next->code) { case XBC_SET: next->code = XBC_LOAD_SET; next->data.load_set.set = next->data.signed_short; next->data.load_set.load = tree->data.signed_short; goto remove_label; /* TODO add XBC_LOAD_SETSYM */ case XBC_CAR: next->code = XBC_LOAD_CAR; next->data.signed_short = tree->data.signed_short; goto remove_label; case XBC_CDR: next->code = XBC_LOAD_CDR; next->data.signed_short = tree->data.signed_short; goto remove_label; case XBC_PUSH: tree->code = XBC_LOAD_PUSH; goto remove_next_label; case XBC_LET: next->code = XBC_LOAD_LET; next->data.let.name = next->data.atom; next->data.let.offset = tree->data.signed_short; goto remove_label; default: break; } } break; case XBC_LOAD_CAR: if (next && next->type == CodeTreeBytecode && next->code == XBC_SET) { if (next->data.signed_short == tree->data.signed_short) next->code = XBC_LOAD_CAR_STORE; else { next->code = XBC_LOAD_CAR_SET; next->data.load_set.set = next->data.signed_short; next->data.load_set.load = tree->data.signed_short; } goto remove_label; } break; case XBC_LOAD_CDR: if (next && next->type == CodeTreeBytecode && next->code == XBC_SET) { if (next->data.signed_short == tree->data.signed_short) next->code = XBC_LOAD_CDR_STORE; else { next->code = XBC_LOAD_CDR_SET; next->data.load_set.set = next->data.signed_short; next->data.load_set.load = tree->data.signed_short; } goto remove_label; } break; case XBC_CALL: if (next && next->type == CodeTreeBytecode) { switch (next->code) { case XBC_SET: next->code = XBC_CALL_SET; next->data.builtin.offset = next->data.signed_short; next->data.builtin.num_arguments = tree->data.builtin.num_arguments; next->data.builtin.builtin = tree->data.builtin.builtin; goto remove_label; /* TODO add XBC_CALL_SETSYM */ default: break; } } break; case XBC_CAR: if (next && next->type == CodeTreeBytecode) { switch (next->code) { case XBC_SET: next->code = XBC_CAR_SET; goto remove_label; /* TODO add XBC_CAR_SETSYM */ case XBC_PUSH: next->code = XBC_CAR_PUSH; goto remove_label; default: break; } } break; case XBC_CDR: if (next && next->type == CodeTreeBytecode) { switch (next->code) { case XBC_SET: next->code = XBC_CDR_SET; goto remove_label; /* TODO add XBC_CDR_SETSYM */ case XBC_PUSH: next->code = XBC_CDR_PUSH; goto remove_label; default: break; } } break; case XBC_NIL: if (next && next->type == CodeTreeBytecode) { switch (next->code) { case XBC_SET: next->code = XBC_SET_NIL; goto remove_label; /* TODO add XBC_SETSYM_NIL */ default: break; } } break; case XBC_PUSH_NIL: if (next && next->type == CodeTreeBytecode && next->code == XBC_PUSH_NIL) { next->code = XBC_PUSH_NIL_N; next->data.signed_char = 2; goto remove_label; } break; case XBC_PUSH_NIL_N: if (next && next->type == CodeTreeBytecode && next->code == XBC_PUSH_NIL) { next->code = XBC_PUSH_NIL_N; next->data.signed_char = tree->data.signed_char + 1; goto remove_label; } break; case XBC_PUSH_UNSPEC: if (next && next->type == CodeTreeBytecode && next->code == XBC_PUSH_UNSPEC) { next->code = XBC_PUSH_UNSPEC_N; next->data.signed_char = 2; goto remove_label; } break; case XBC_PUSH_UNSPEC_N: if (next && next->type == CodeTreeBytecode && next->code == XBC_PUSH_UNSPEC) { next->code = XBC_PUSH_UNSPEC_N; next->data.signed_char = tree->data.signed_char + 1; goto remove_label; } break; default: break; } break; case CodeTreeBlock: LinkDoOptimize_0(com, tree->data.block); break; default: break; } goto update_label; remove_label: if (tree == block->tree) { block->tree = prev = next; if (tree == block->tail) block->tail = tree; } else prev->next = next; CompileFreeTree(tree); tree = next; continue; remove_next_label: tree->next = next->next; CompileFreeTree(next); continue; update_label: prev = tree; tree = tree->next; } } static void LinkOptimize_0(LispCom *com) { /* Recursive */ LinkDoOptimize_0(com, com->block); } static void LinkResolveLabels(LispCom *com, CodeBlock *block) { int i; CodeTree *tree = block->tree; for (; tree; tree = tree->next) { if (tree->type == CodeTreeBlock) LinkResolveLabels(com, tree->data.block); else if (tree->type == CodeTreeLabel) { for (i = 0; i < block->tagbody.length; i++) if (tree->data.object == block->tagbody.labels[i]) { block->tagbody.codes[i] = tree; break; } } } } static void LinkResolveJumps(LispCom *com, CodeBlock *block) { int i; CodeBlock *body = block; CodeTree *ptr, *tree = block->tree; /* Check if there is a tagbody. Error checking already done */ while (body && body->type != LispBlockBody) body = body->prev; for (; tree; tree = tree->next) { switch (tree->type) { case CodeTreeBytecode: case CodeTreeLabel: break; case CodeTreeBlock: LinkResolveJumps(com, tree->data.block); break; case CodeTreeGo: for (i = 0; i < body->tagbody.length; i++) if (tree->data.object == body->tagbody.labels[i]) break; if (i == body->tagbody.length) LispDestroy("COMPILE: no visible tag %s to GO", STROBJ(tree->data.object)); /* Now the jump code is known */ tree->data.tree = body->tagbody.codes[i]; break; case CodeTreeCond: if (tree->code == XBC_JUMPNIL) /* If test is NIL, go to next test */ tree->data.tree = tree->group->next; else if (tree->code == XBC_JUMPT) { /* After executing code, test was T */ for (ptr = tree->group; ptr->code != XBC_NOOP; ptr = ptr->group) ; tree->data.tree = ptr; } break; case CodeTreeJumpIf: if (tree->code != XBC_NOOP) { for (ptr = tree->group; ptr->code != XBC_NOOP; ptr = ptr->group) { if (ptr->type == CodeTreeJump) { /* ELSE code of IF */ ptr = ptr->next; /* Skip inconditional jump node */ break; } } tree->data.tree = ptr; } break; case CodeTreeJump: if (tree->code != XBC_NOOP) tree->data.tree = tree->group; break; case CodeTreeReturn: /* One bytecode is guaranteed to exist in the code tree */ if (tree->data.block->parent == NULL) /* Returning from the function or toplevel form */ tree->data.tree = tree->data.block->tail; else { for (;;) { ptr = tree->data.block->parent->next; if (ptr) { tree->data.tree = ptr; break; } else /* Move one BLOCK up */ tree->data.block = tree->data.block->prev; } } break; } } } static long LinkPad(long offset, long adjust, int preffix, int datalen) { /* If byte or aligned data */ if (datalen <= preffix || ((offset + adjust + preffix) % datalen) == 0) return (adjust); return (adjust + (datalen - ((offset + adjust + preffix) % datalen))); } static long LinkFixupOffsets(LispCom *com, CodeTree *tree, long adjust) { for (; tree; tree = tree->next) { switch (tree->type) { case CodeTreeBytecode: switch (tree->code) { /* byte + short */ case XBC_JUMP: case XBC_JUMPT: case XBC_JUMPNIL: adjust = LinkPad(tree->offset, adjust, 1, sizeof(short)); /*FALLTROUGH*/ default: tree->offset += adjust; break; } break; case CodeTreeLabel: /* Labels are not loaded, just adjust offset */ tree->offset += adjust; break; case CodeTreeJump: case CodeTreeCond: case CodeTreeJumpIf: /* If an opcode will be generated. */ if (tree->code != XBC_NOOP) adjust = LinkPad(tree->offset, adjust, 1, sizeof(short)); tree->offset += adjust; break; case CodeTreeGo: case CodeTreeReturn: adjust = LinkPad(tree->offset, adjust, 1, sizeof(short)); tree->offset += adjust; break; case CodeTreeBlock: adjust = LinkFixupOffsets(com, tree->data.block->tree, adjust); break; } } return (adjust); } static void LinkSkipPadding(LispCom *com, CodeTree *tree) { int found; CodeTree *ptr; /* Recurse to adjust forward jumps or jumps to the start of the block */ for (ptr = tree; ptr; ptr = ptr->next) { if (ptr->type == CodeTreeBlock) { LinkSkipPadding(com, ptr->data.block->tree); ptr->offset = ptr->data.block->tree->offset; } } /* Adjust the nodes offsets */ for (; tree; tree = tree->next) { switch (tree->type) { case CodeTreeBytecode: case CodeTreeBlock: case CodeTreeGo: case CodeTreeReturn: break; case CodeTreeJump: case CodeTreeCond: case CodeTreeJumpIf: if (tree->code != XBC_NOOP) /* If code will be generated */ break; case CodeTreeLabel: /* This should be done in reversed order, but to avoid * the requirement of a prev pointer, do the job in a * harder way here. */ for (found = 0, ptr = tree->next; ptr; ptr = ptr->next) { switch (ptr->type) { case CodeTreeBytecode: case CodeTreeBlock: case CodeTreeGo: case CodeTreeReturn: found = 1; break; case CodeTreeJump: case CodeTreeCond: case CodeTreeJumpIf: if (ptr->code != XBC_NOOP) found = 1; break; case CodeTreeLabel: break; } if (found) break; } if (found) tree->offset = ptr->offset; break; } } } static void LinkCalculateJump(LispCom *com, CodeTree *tree, LispByteOpcode code) { long jumpto, offset, distance; tree->type = CodeTreeBytecode; /* After the opcode */ offset = tree->offset + 1; jumpto = tree->data.tree->offset; /* Effective distance */ distance = jumpto - offset; tree->code = code; if (distance < -32768 || distance > 32767) { COMPILE_FAILURE("jump too long"); } tree->data.signed_int = distance; } static void LinkFixupJumps(LispCom *com, CodeTree *tree) { for (; tree; tree = tree->next) { switch (tree->type) { case CodeTreeBytecode: case CodeTreeLabel: break; case CodeTreeCond: if (tree->code == XBC_JUMPNIL) /* Go to next test if NIL */ LinkCalculateJump(com, tree, XBC_JUMPNIL); else if (tree->code == XBC_JUMPT) /* After executing T code */ LinkCalculateJump(com, tree, XBC_JUMP); break; case CodeTreeJumpIf: if (tree->code != XBC_NOOP) LinkCalculateJump(com, tree, tree->code); break; case CodeTreeGo: /* Inconditional jump */ LinkCalculateJump(com, tree, XBC_JUMP); break; case CodeTreeReturn: /* Inconditional jump */ if (tree->data.tree != tree) /* If need to skip something */ LinkCalculateJump(com, tree, XBC_JUMP); break; case CodeTreeBlock: LinkFixupJumps(com, tree->data.block->tree); break; case CodeTreeJump: if (tree->code != XBC_NOOP) LinkCalculateJump(com, tree, tree->code); } } } static void LinkBuildTableSymbol(LispCom *com, LispAtom *symbol) { if (BuildTablePointer(symbol, (void***)&com->table.symbols, &com->table.num_symbols) > 0xff) { COMPILE_FAILURE("more than 256 symbols"); } } static void LinkBuildTableConstant(LispCom *com, LispObj *constant) { if (BuildTablePointer(constant, (void***)&com->table.constants, &com->table.num_constants) > 0xff) { COMPILE_FAILURE("more than 256 constants"); } } static void LinkBuildTableBuiltin(LispCom *com, LispBuiltin *builtin) { if (BuildTablePointer(builtin, (void***)&com->table.builtins, &com->table.num_builtins) > 0xff) { COMPILE_FAILURE("more than 256 functions"); } } static void LinkBuildTableBytecode(LispCom *com, LispObj *bytecode) { if (BuildTablePointer(bytecode, (void***)&com->table.bytecodes, &com->table.num_bytecodes) > 0xff) { COMPILE_FAILURE("more than 256 bytecode functions"); } } static void LinkBuildTables(LispCom *com, CodeBlock *block) { CodeTree *tree; for (tree = block->tree; tree; tree = tree->next) { switch (tree->type) { case CodeTreeBytecode: switch (tree->code) { case XBC_LET: case XBC_LETX: case XBC_LET_NIL: case XBC_LETX_NIL: case XBC_SETSYM: case XBC_LOADSYM: case XBC_LOADSYM_PUSH: LinkBuildTableSymbol(com, tree->data.atom); break; case XBC_STRUCTP: case XBC_LOADCON: case XBC_LOADCON_PUSH: LinkBuildTableConstant(com, tree->data.object); break; case XBC_LOADCON_SET: LinkBuildTableConstant(com, tree->data.load_con_set.object); break; case XBC_CALL: case XBC_CALL_SET: LinkBuildTableBuiltin(com, tree->data.builtin.builtin); break; case XBC_BYTECALL: LinkBuildTableBytecode(com, tree->data.bytecall.code); break; case XBC_LOAD_LET: case XBC_LOAD_LETX: LinkBuildTableSymbol(com, tree->data.let.name); break; case XBC_STRUCT: LinkBuildTableConstant(com, tree->data.struc.definition); break; case XBC_LOADSYM_LET: case XBC_LOADSYM_LETX: LinkBuildTableSymbol(com, tree->data.let_sym.symbol); LinkBuildTableSymbol(com, tree->data.let_sym.name); break; case XBC_LOADCON_LET: case XBC_LOADCON_LETX: LinkBuildTableConstant(com, tree->data.let_con.object); LinkBuildTableSymbol(com, tree->data.let_con.name); break; case XBC_CCONS: case XBC_FUNCALL: LinkBuildTableConstant(com, tree->data.cons.car); LinkBuildTableConstant(com, tree->data.cons.cdr); break; default: break; } break; case CodeTreeBlock: LinkBuildTables(com, tree->data.block); break; default: break; } } } static long LinkEmmitBytecode(LispCom *com, CodeTree *tree, unsigned char *bytecode, long offset) { short i; for (; tree; tree = tree->next) { /* Fill padding */ while (offset < tree->offset) bytecode[offset++] = XBC_NOOP; switch (tree->type) { case CodeTreeBytecode: bytecode[offset++] = tree->code; switch (tree->code) { /* Noop should not enter the CodeTree */ case XBC_NOOP: INTERNAL_ERROR(__LINE__); break; /* byte */ case XBC_BCONS: case XBC_BCONS1: case XBC_BCONS2: case XBC_BCONS3: case XBC_BCONS4: case XBC_BCONS5: case XBC_BCONS6: case XBC_BCONS7: case XBC_INV: case XBC_NIL: case XBC_T: case XBC_PUSH_NIL: case XBC_PUSH_UNSPEC: case XBC_PUSH_T: case XBC_CAR_PUSH: case XBC_CDR_PUSH: case XBC_PUSH: case XBC_LSTAR: case XBC_LCONS: case XBC_LFINI: case XBC_RETURN: case XBC_CSTAR: case XBC_CFINI: case XBC_CAR: case XBC_CDR: case XBC_RPLACA: case XBC_RPLACD: case XBC_EQ: case XBC_EQL: case XBC_EQUAL: case XBC_EQUALP: case XBC_LENGTH: case XBC_LAST: case XBC_NTHCDR: break; /* byte + byte */ case XBC_LETREC: case XBC_PRED: case XBC_PUSH_NIL_N: case XBC_PUSH_UNSPEC_N: bytecode[offset++] = tree->data.signed_char; break; /* byte + byte */ case XBC_CAR_SET: case XBC_CDR_SET: case XBC_SET: case XBC_SET_NIL: case XBC_LETBIND: case XBC_UNLET: case XBC_LOAD_PUSH: case XBC_LOAD: case XBC_LOAD_CAR: case XBC_LOAD_CDR: case XBC_LOAD_CAR_STORE: case XBC_LOAD_CDR_STORE: bytecode[offset++] = tree->data.signed_short; break; /* byte + byte + byte */ case XBC_LOAD_SET: case XBC_LOAD_CAR_SET: case XBC_LOAD_CDR_SET: bytecode[offset++] = tree->data.load_set.load; bytecode[offset++] = tree->data.load_set.set; break; /* byte + short */ case XBC_JUMP: case XBC_JUMPT: case XBC_JUMPNIL: *(short*)(bytecode + offset) = tree->data.signed_int; offset += sizeof(short); break; /* byte + byte */ case XBC_LET: case XBC_LETX: case XBC_LET_NIL: case XBC_LETX_NIL: case XBC_SETSYM: case XBC_LOADSYM: case XBC_LOADSYM_PUSH: i = FindIndex(tree->data.atom, (void**)com->table.symbols, com->table.num_symbols); bytecode[offset++] = i; break; /* byte + byte */ case XBC_STRUCTP: case XBC_LOADCON: case XBC_LOADCON_PUSH: i = FindIndex(tree->data.object, (void**)com->table.constants, com->table.num_constants); bytecode[offset++] = i; break; /* byte + byte + byte */ case XBC_LOADCON_SET: i = FindIndex(tree->data.load_con_set.object, (void**)com->table.constants, com->table.num_constants); bytecode[offset++] = i; bytecode[offset++] = tree->data.load_con_set.offset; break; /* byte + byte + byte */ case XBC_CALL: bytecode[offset++] = tree->data.builtin.num_arguments; i = FindIndex(tree->data.builtin.builtin, (void**)com->table.builtins, com->table.num_builtins); bytecode[offset++] = i; break; /* byte + byte + byte */ case XBC_BYTECALL: bytecode[offset++] = tree->data.bytecall.num_arguments; i = FindIndex(tree->data.bytecall.code, (void**)com->table.bytecodes, com->table.num_bytecodes); bytecode[offset++] = i; break; /* byte + byte + byte + byte */ case XBC_CALL_SET: bytecode[offset++] = tree->data.builtin.num_arguments; i = FindIndex(tree->data.builtin.builtin, (void**)com->table.builtins, com->table.num_builtins); bytecode[offset++] = i; bytecode[offset++] = tree->data.builtin.offset; break; /* byte + byte + byte */ case XBC_LOAD_LET: case XBC_LOAD_LETX: bytecode[offset++] = tree->data.let.offset; i = FindIndex(tree->data.let.name, (void**)com->table.symbols, com->table.num_symbols); bytecode[offset++] = i; break; /* byte + byte + byte */ case XBC_STRUCT: bytecode[offset++] = tree->data.struc.offset; i = FindIndex(tree->data.struc.definition, (void**)com->table.constants, com->table.num_constants); bytecode[offset++] = i; break; /* byte + byte + byte */ case XBC_LOADSYM_LET: case XBC_LOADSYM_LETX: i = FindIndex(tree->data.let_sym.symbol, (void**)com->table.symbols, com->table.num_symbols); bytecode[offset++] = i; i = FindIndex(tree->data.let_sym.name, (void**)com->table.symbols, com->table.num_symbols); bytecode[offset++] = i; break; /* byte + byte + byte */ case XBC_LOADCON_LET: case XBC_LOADCON_LETX: i = FindIndex(tree->data.let_con.object, (void**)com->table.constants, com->table.num_constants); bytecode[offset++] = i; i = FindIndex(tree->data.let_con.name, (void**)com->table.symbols, com->table.num_symbols); bytecode[offset++] = i; break; /* byte + byte + byte */ case XBC_CCONS: case XBC_FUNCALL: i = FindIndex(tree->data.cons.car, (void**)com->table.constants, com->table.num_constants); bytecode[offset++] = i; i = FindIndex(tree->data.cons.cdr, (void**)com->table.constants, com->table.num_constants); bytecode[offset++] = i; break; } break; case CodeTreeLabel: /* Labels are not loaded */ break; case CodeTreeCond: case CodeTreeJump: case CodeTreeJumpIf: if (tree->code != XBC_NOOP) INTERNAL_ERROR(__LINE__); break; case CodeTreeGo: INTERNAL_ERROR(__LINE__); break; case CodeTreeReturn: if (tree->data.tree != tree) INTERNAL_ERROR(__LINE__); break; case CodeTreeBlock: offset = LinkEmmitBytecode(com, tree->data.block->tree, bytecode, offset); break; } } return (offset); } static void LinkBytecode(LispCom *com) { long offset, count; unsigned char **codes; LispObj **names; /* Close bytecode */ com_Bytecode(com, XBC_RETURN); /* The only usage of this information for now, and still may generate * false positives because arguments to unamed functions are not being * parsed as well as arguments to yet undefined function/maros. * XXX should also add declaim/declare to let the code specify that * the argument is unused */ LinkWarnUnused(com, com->block); /* First level optimization */ LinkOptimize_0(com); /* Resolve tagbody labels */ LinkResolveLabels(com, com->block); /* Resolve any pending jumps */ LinkResolveJumps(com, com->block); /* Calculate unpadded offsets */ LinkBuildOffsets(com, com->block->tree, 0); /* Do padding for aligned memory reads */ LinkFixupOffsets(com, com->block->tree, 0); /* Jumps normally are to a node that does not generate code, * and due to padding, the jump may go to a address with a * XBC_NOOP, so adjust the jump to the next useful opcode. */ LinkSkipPadding(com, com->block->tree); /* Now addresses are known */ LinkFixupJumps(com, com->block->tree); /* Build symbol, constant and builtin tables */ LinkBuildTables(com, com->block); /* Stack info */ com->length = sizeof(short) * 3; /* Tables info */ com->length += sizeof(short) * 4; com->length += com->table.num_constants * sizeof(LispObj*); com->length += com->table.num_symbols * sizeof(LispAtom*); com->length += com->table.num_builtins * sizeof(LispBuiltin*); com->length += com->table.num_bytecodes * sizeof(unsigned char*); com->length += com->table.num_bytecodes * sizeof(LispObj*); /* Allocate space for the bytecode stream */ com->length += com->block->tail->offset + 1; com->bytecode = LispMalloc(com->length); /* Add header */ offset = 0; *(short*)(com->bytecode + offset) = com->stack.stack; offset += sizeof(short); *(short*)(com->bytecode + offset) = com->stack.bstack; offset += sizeof(short); *(short*)(com->bytecode + offset) = com->stack.pstack; offset += sizeof(short); *(short*)(com->bytecode + offset) = com->table.num_constants; offset += sizeof(short); *(short*)(com->bytecode + offset) = com->table.num_symbols; offset += sizeof(short); *(short*)(com->bytecode + offset) = com->table.num_builtins; offset += sizeof(short); *(short*)(com->bytecode + offset) = com->table.num_bytecodes; offset += sizeof(short); count = sizeof(LispObj*) * com->table.num_constants; memcpy(com->bytecode + offset, com->table.constants, count); offset += count; count = sizeof(LispAtom*) * com->table.num_symbols; memcpy(com->bytecode + offset, com->table.symbols, count); offset += count; count = sizeof(LispBuiltin*) * com->table.num_builtins; memcpy(com->bytecode + offset, com->table.builtins, count); offset += count; /* Store bytecode information */ for (count = 0, codes = (unsigned char**)(com->bytecode + offset); count < com->table.num_bytecodes; count++, codes++) *codes = com->table.bytecodes[count]->data.bytecode.bytecode->code; offset += com->table.num_bytecodes * sizeof(unsigned char*); /* Store names, only useful for disassemble but may also be used * to check if a function was redefined, and the bytecode is referencing * the older version, the current version can be checked looking at * ->data.atom */ for (count = 0, names = (LispObj**)(com->bytecode + offset); count < com->table.num_bytecodes; count++, names++) *names = com->table.bytecodes[count]->data.bytecode.name; offset += com->table.num_bytecodes * sizeof(LispObj*); /* Generate it */ LinkEmmitBytecode(com, com->block->tree, com->bytecode + offset, 0); } static LispObj * ExecuteBytecode(register unsigned char *stream) { register LispObj *reg0; register LispAtom *atom; register short offset; LispObj *reg1; LispBuiltin *builtin; LispObj *lambda; LispObj *arguments; unsigned char *bytecode; LispObj **constants; LispAtom **symbols; LispBuiltin **builtins; unsigned char **codes; short num_constants, num_symbols, num_builtins, num_codes; int lex, len; /* To control gc protected slots */ int phead, pbase; long fixnum = 0; #if defined(__GNUC__) && !defined(ANSI_SOURCE) #define ALLOW_GOTO_ADDRESS #endif #ifdef ALLOW_GOTO_ADDRESS #define JUMP_ADDRESS(label) &&label static const void *opcode_labels[] = { JUMP_ADDRESS(XBC_NOOP), JUMP_ADDRESS(XBC_INV), JUMP_ADDRESS(XBC_NIL), JUMP_ADDRESS(XBC_T), JUMP_ADDRESS(XBC_PRED), JUMP_ADDRESS(XBC_CAR), JUMP_ADDRESS(XBC_CDR), JUMP_ADDRESS(XBC_CAR_SET), JUMP_ADDRESS(XBC_CDR_SET), JUMP_ADDRESS(XBC_RPLACA), JUMP_ADDRESS(XBC_RPLACD), JUMP_ADDRESS(XBC_EQ), JUMP_ADDRESS(XBC_EQL), JUMP_ADDRESS(XBC_EQUAL), JUMP_ADDRESS(XBC_EQUALP), JUMP_ADDRESS(XBC_LENGTH), JUMP_ADDRESS(XBC_LAST), JUMP_ADDRESS(XBC_NTHCDR), JUMP_ADDRESS(XBC_CAR_PUSH), JUMP_ADDRESS(XBC_CDR_PUSH), JUMP_ADDRESS(XBC_PUSH), JUMP_ADDRESS(XBC_PUSH_NIL), JUMP_ADDRESS(XBC_PUSH_UNSPEC), JUMP_ADDRESS(XBC_PUSH_T), JUMP_ADDRESS(XBC_PUSH_NIL_N), JUMP_ADDRESS(XBC_PUSH_UNSPEC_N), JUMP_ADDRESS(XBC_LET), JUMP_ADDRESS(XBC_LETX), JUMP_ADDRESS(XBC_LET_NIL), JUMP_ADDRESS(XBC_LETX_NIL), JUMP_ADDRESS(XBC_LETBIND), JUMP_ADDRESS(XBC_UNLET), JUMP_ADDRESS(XBC_LOAD), JUMP_ADDRESS(XBC_LOAD_LET), JUMP_ADDRESS(XBC_LOAD_LETX), JUMP_ADDRESS(XBC_LOAD_PUSH), JUMP_ADDRESS(XBC_LOADCON), JUMP_ADDRESS(XBC_LOADCON_LET), JUMP_ADDRESS(XBC_LOADCON_LETX), JUMP_ADDRESS(XBC_LOADCON_PUSH), JUMP_ADDRESS(XBC_LOAD_CAR), JUMP_ADDRESS(XBC_LOAD_CDR), JUMP_ADDRESS(XBC_LOAD_CAR_STORE), JUMP_ADDRESS(XBC_LOAD_CDR_STORE), JUMP_ADDRESS(XBC_LOADCON_SET), JUMP_ADDRESS(XBC_LOADSYM), JUMP_ADDRESS(XBC_LOADSYM_LET), JUMP_ADDRESS(XBC_LOADSYM_LETX), JUMP_ADDRESS(XBC_LOADSYM_PUSH), JUMP_ADDRESS(XBC_LOAD_SET), JUMP_ADDRESS(XBC_LOAD_CAR_SET), JUMP_ADDRESS(XBC_LOAD_CDR_SET), JUMP_ADDRESS(XBC_SET), JUMP_ADDRESS(XBC_SETSYM), JUMP_ADDRESS(XBC_SET_NIL), JUMP_ADDRESS(XBC_CALL), JUMP_ADDRESS(XBC_CALL_SET), JUMP_ADDRESS(XBC_BYTECALL), JUMP_ADDRESS(XBC_FUNCALL), JUMP_ADDRESS(XBC_LETREC), JUMP_ADDRESS(XBC_BCONS), JUMP_ADDRESS(XBC_BCONS1), JUMP_ADDRESS(XBC_BCONS2), JUMP_ADDRESS(XBC_BCONS3), JUMP_ADDRESS(XBC_BCONS4), JUMP_ADDRESS(XBC_BCONS5), JUMP_ADDRESS(XBC_BCONS6), JUMP_ADDRESS(XBC_BCONS7), JUMP_ADDRESS(XBC_CCONS), JUMP_ADDRESS(XBC_CSTAR), JUMP_ADDRESS(XBC_CFINI), JUMP_ADDRESS(XBC_LSTAR), JUMP_ADDRESS(XBC_LCONS), JUMP_ADDRESS(XBC_LFINI), JUMP_ADDRESS(XBC_JUMP), JUMP_ADDRESS(XBC_JUMPT), JUMP_ADDRESS(XBC_JUMPNIL), JUMP_ADDRESS(XBC_STRUCT), JUMP_ADDRESS(XBC_STRUCTP), JUMP_ADDRESS(XBC_RETURN) }; static const void *predicate_opcode_labels[] = { JUMP_ADDRESS(XBP_CONSP), JUMP_ADDRESS(XBP_LISTP), JUMP_ADDRESS(XBP_NUMBERP) }; #endif reg0 = NIL; bytecode = stream; pbase = lisp__data.protect.length; /* stack */ offset = *(short*)stream; stream += sizeof(short); if (lisp__data.env.length + offset > lisp__data.env.space) { do LispMoreEnvironment(); while (lisp__data.env.length + offset >= lisp__data.env.space); } /* builtin stack */ offset = *(short*)stream; stream += sizeof(short); if (lisp__data.stack.length + offset >= lisp__data.stack.space) { do LispMoreStack(); while (lisp__data.stack.length + offset >= lisp__data.stack.space); } /* protect stack */ phead = *(short*)stream; stream += sizeof(short); if (lisp__data.protect.length + phead > lisp__data.protect.space) { do LispMoreProtects(); while (lisp__data.protect.length + phead >= lisp__data.protect.space); } num_constants = *(short*)stream; stream += sizeof(short); num_symbols = *(short*)stream; stream += sizeof(short); num_builtins = *(short*)stream; stream += sizeof(short); num_codes = *(short*)stream; stream += sizeof(short); constants = (LispObj**)stream; stream += num_constants * sizeof(LispObj*); symbols = (LispAtom**)stream; stream += num_symbols * sizeof(LispAtom*); builtins = (LispBuiltin**)stream; stream += num_builtins * sizeof(LispBuiltin*); codes = (unsigned char**)stream; stream += num_codes * (sizeof(unsigned char*) + sizeof(LispObj*)); for (; phead > 0; phead--) lisp__data.protect.objects[lisp__data.protect.length++] = NIL; phead = pbase; #ifdef ALLOW_GOTO_ADDRESS #define OPCODE_LABEL(label) label #define NEXT_OPCODE() goto *opcode_labels[*stream++] #define GOTO_PREDICATE() goto *predicate_opcode_labels[*stream++] #else #define OPCODE_LABEL(label) case label #define NEXT_OPCODE() goto next_opcode #define GOTO_PREDICATE() goto predicate_label for (;;) { next_opcode: switch (*stream++) { #endif /* ALLOW_GOTO_ADDRESS */ OPCODE_LABEL(XBC_NOOP): NEXT_OPCODE(); OPCODE_LABEL(XBC_PRED): GOTO_PREDICATE(); OPCODE_LABEL(XBC_INV): reg0 = reg0 == NIL ? T : NIL; NEXT_OPCODE(); OPCODE_LABEL(XBC_NIL): reg0 = NIL; NEXT_OPCODE(); OPCODE_LABEL(XBC_T): reg0 = T; NEXT_OPCODE(); OPCODE_LABEL(XBC_CAR): car: if (reg0 != NIL) { if (!CONSP(reg0)) LispDestroy("CAR: %s is not a list", STROBJ(reg0)); reg0 = CAR(reg0); } NEXT_OPCODE(); OPCODE_LABEL(XBC_CDR): cdr: if (reg0 != NIL) { if (!CONSP(reg0)) LispDestroy("CDR: %s is not a list", STROBJ(reg0)); reg0 = CDR(reg0); } NEXT_OPCODE(); OPCODE_LABEL(XBC_RPLACA): reg1 = lisp__data.stack.values[--lisp__data.stack.length]; if (!CONSP(reg1)) LispDestroy("RPLACA: %s is not a cons", STROBJ(reg1)); RPLACA(reg1, reg0); reg0 = reg1; NEXT_OPCODE(); OPCODE_LABEL(XBC_RPLACD): reg1 = lisp__data.stack.values[--lisp__data.stack.length]; if (!CONSP(reg1)) LispDestroy("RPLACD: %s is not a cons", STROBJ(reg1)); RPLACD(reg1, reg0); reg0 = reg1; NEXT_OPCODE(); OPCODE_LABEL(XBC_BCONS): CAR(cons) = reg0; lisp__data.stack.values[lisp__data.stack.length++] = cons; NEXT_OPCODE(); OPCODE_LABEL(XBC_BCONS1): offset = lisp__data.stack.length - 1; CAR(cons) = reg0; CAR(cons1) = lisp__data.stack.values[offset]; lisp__data.stack.values[offset] = cons1; NEXT_OPCODE(); OPCODE_LABEL(XBC_BCONS2): offset = lisp__data.stack.length; CAR(cons) = reg0; CAR(cons1) = lisp__data.stack.values[--offset]; CAR(cons2) = lisp__data.stack.values[--offset]; lisp__data.stack.values[offset] = cons2; lisp__data.stack.length = offset + 1; NEXT_OPCODE(); OPCODE_LABEL(XBC_BCONS3): offset = lisp__data.stack.length; CAR(cons) = reg0; CAR(cons1) = lisp__data.stack.values[--offset]; CAR(cons2) = lisp__data.stack.values[--offset]; CAR(cons3) = lisp__data.stack.values[--offset]; lisp__data.stack.values[offset] = cons3; lisp__data.stack.length = offset + 1; NEXT_OPCODE(); OPCODE_LABEL(XBC_BCONS4): offset = lisp__data.stack.length; CAR(cons) = reg0; CAR(cons1) = lisp__data.stack.values[--offset]; CAR(cons2) = lisp__data.stack.values[--offset]; CAR(cons3) = lisp__data.stack.values[--offset]; CAR(cons4) = lisp__data.stack.values[--offset]; lisp__data.stack.values[offset] = cons4; lisp__data.stack.length = offset + 1; NEXT_OPCODE(); OPCODE_LABEL(XBC_BCONS5): offset = lisp__data.stack.length; CAR(cons) = reg0; CAR(cons1) = lisp__data.stack.values[--offset]; CAR(cons2) = lisp__data.stack.values[--offset]; CAR(cons3) = lisp__data.stack.values[--offset]; CAR(cons4) = lisp__data.stack.values[--offset]; CAR(cons5) = lisp__data.stack.values[--offset]; lisp__data.stack.values[offset] = cons5; lisp__data.stack.length = offset + 1; NEXT_OPCODE(); OPCODE_LABEL(XBC_BCONS6): offset = lisp__data.stack.length; CAR(cons) = reg0; CAR(cons1) = lisp__data.stack.values[--offset]; CAR(cons2) = lisp__data.stack.values[--offset]; CAR(cons3) = lisp__data.stack.values[--offset]; CAR(cons4) = lisp__data.stack.values[--offset]; CAR(cons5) = lisp__data.stack.values[--offset]; CAR(cons6) = lisp__data.stack.values[--offset]; lisp__data.stack.values[offset] = cons6; lisp__data.stack.length = offset + 1; NEXT_OPCODE(); OPCODE_LABEL(XBC_BCONS7): offset = lisp__data.stack.length; CAR(cons) = reg0; CAR(cons1) = lisp__data.stack.values[--offset]; CAR(cons2) = lisp__data.stack.values[--offset]; CAR(cons3) = lisp__data.stack.values[--offset]; CAR(cons4) = lisp__data.stack.values[--offset]; CAR(cons5) = lisp__data.stack.values[--offset]; CAR(cons6) = lisp__data.stack.values[--offset]; CAR(cons7) = lisp__data.stack.values[--offset]; lisp__data.stack.values[offset] = cons7; lisp__data.stack.length = offset + 1; NEXT_OPCODE(); OPCODE_LABEL(XBC_EQ): reg0 = reg0 == lisp__data.stack.values[--lisp__data.stack.length] ? T : NIL; NEXT_OPCODE(); OPCODE_LABEL(XBC_EQL): reg1 = lisp__data.stack.values[--lisp__data.stack.length]; reg0 = XEQL(reg1, reg0); NEXT_OPCODE(); OPCODE_LABEL(XBC_EQUAL): reg1 = lisp__data.stack.values[--lisp__data.stack.length]; reg0 = XEQUAL(reg1, reg0); NEXT_OPCODE(); OPCODE_LABEL(XBC_EQUALP): reg1 = lisp__data.stack.values[--lisp__data.stack.length]; reg0 = XEQUALP(reg1, reg0); NEXT_OPCODE(); OPCODE_LABEL(XBC_LENGTH): reg0 = FIXNUM(LispLength(reg0)); NEXT_OPCODE(); OPCODE_LABEL(XBC_LAST): { long length; reg1 = lisp__data.stack.values[--lisp__data.stack.length]; if (CONSP(reg1)) { if (reg0 != NIL) { if (!FIXNUMP(reg0) || (fixnum = FIXNUM_VALUE(reg0)) < 0) LispDestroy("LAST: %s is not a positive fixnum", STROBJ(reg0)); } else fixnum = 1; reg0 = reg1; for (reg0 = reg1, length = 0; CONSP(reg0); reg0 = CDR(reg0), length++) ; for (length -= fixnum, reg0 = reg1; length > 0; length--) reg0 = CDR(reg0); } else reg0 = reg1; } NEXT_OPCODE(); OPCODE_LABEL(XBC_NTHCDR): reg1 = lisp__data.stack.values[--lisp__data.stack.length]; if (!FIXNUMP(reg1) || (fixnum = FIXNUM_VALUE(reg1)) < 0) LispDestroy("NTHCDR: %s is not a positive fixnum", STROBJ(reg1)); if (reg0 != NIL) { if (!CONSP(reg0)) LispDestroy("NTHCDR: %s is not a list", STROBJ(reg0)); for (; fixnum > 0; fixnum--) { if (!CONSP(reg0)) break; reg0 = CDR(reg0); } } NEXT_OPCODE(); /* Push to builtin stack */ OPCODE_LABEL(XBC_CAR_PUSH): if (reg0 != NIL) { if (!CONSP(reg0)) LispDestroy("CAR: %s is not a list", STROBJ(reg0)); reg0 = CAR(reg0); } goto push_builtin; OPCODE_LABEL(XBC_CDR_PUSH): if (reg0 != NIL) { if (!CONSP(reg0)) LispDestroy("CDR: %s is not a list", STROBJ(reg0)); reg0 = CDR(reg0); } /*FALLTROUGH*/ OPCODE_LABEL(XBC_PUSH): push_builtin: lisp__data.stack.values[lisp__data.stack.length++] = reg0; NEXT_OPCODE(); OPCODE_LABEL(XBC_PUSH_NIL): lisp__data.stack.values[lisp__data.stack.length++] = NIL; NEXT_OPCODE(); OPCODE_LABEL(XBC_PUSH_UNSPEC): lisp__data.stack.values[lisp__data.stack.length++] = UNSPEC; NEXT_OPCODE(); OPCODE_LABEL(XBC_PUSH_T): lisp__data.stack.values[lisp__data.stack.length++] = T; NEXT_OPCODE(); OPCODE_LABEL(XBC_PUSH_NIL_N): for (offset = *stream++; offset > 0; offset--) lisp__data.stack.values[lisp__data.stack.length++] = NIL; NEXT_OPCODE(); OPCODE_LABEL(XBC_PUSH_UNSPEC_N): for (offset = *stream++; offset > 0; offset--) lisp__data.stack.values[lisp__data.stack.length++] = UNSPEC; NEXT_OPCODE(); OPCODE_LABEL(XBC_LET): let_argument: /* The global object value is not changed, so it does not * matter if it is a constant symbol. An error would be * generated if it was declared as constant at the time of * bytecode generation. Check can be done looking at the * atom->constant field. */ atom = symbols[*stream++]; atom->offset = lisp__data.env.length; lisp__data.env.names[lisp__data.env.length] = atom->key; lisp__data.env.values[lisp__data.env.length++] = reg0; NEXT_OPCODE(); OPCODE_LABEL(XBC_LETX): letx_argument: atom = symbols[*stream++]; atom->offset = lisp__data.env.length; lisp__data.env.names[lisp__data.env.length] = atom->key; lisp__data.env.values[lisp__data.env.length++] = reg0; lisp__data.env.head++; NEXT_OPCODE(); OPCODE_LABEL(XBC_LET_NIL): atom = symbols[*stream++]; atom->offset = lisp__data.env.length; lisp__data.env.names[lisp__data.env.length] = atom->key; lisp__data.env.values[lisp__data.env.length++] = NIL; NEXT_OPCODE(); OPCODE_LABEL(XBC_LETX_NIL): atom = symbols[*stream++]; atom->offset = lisp__data.env.length; lisp__data.env.names[lisp__data.env.length] = atom->key; lisp__data.env.values[lisp__data.env.length++] = NIL; lisp__data.env.head++; NEXT_OPCODE(); /* Bind locally added variables to a block */ OPCODE_LABEL(XBC_LETBIND): offset = *stream++; lisp__data.env.head += offset; NEXT_OPCODE(); /* Unbind locally added variables to a block */ OPCODE_LABEL(XBC_UNLET): offset = *stream++; lisp__data.env.head -= offset; lisp__data.env.length -= offset; NEXT_OPCODE(); /* Load value from stack */ OPCODE_LABEL(XBC_LOAD): offset = *stream++; reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; NEXT_OPCODE(); OPCODE_LABEL(XBC_LOAD_CAR): offset = *stream++; reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; goto car; OPCODE_LABEL(XBC_LOAD_CDR): offset = *stream++; reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; goto cdr; OPCODE_LABEL(XBC_LOAD_CAR_STORE): offset = *stream++; reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; if (reg0 != NIL) { if (!CONSP(reg0)) LispDestroy("CAR: %s is not a list", STROBJ(reg0)); reg0 = CAR(reg0); lisp__data.env.values[lisp__data.env.lex + offset] = reg0; } NEXT_OPCODE(); OPCODE_LABEL(XBC_LOAD_CDR_STORE): offset = *stream++; reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; if (reg0 != NIL) { if (!CONSP(reg0)) LispDestroy("CDR: %s is not a list", STROBJ(reg0)); reg0 = CDR(reg0); lisp__data.env.values[lisp__data.env.lex + offset] = reg0; } NEXT_OPCODE(); OPCODE_LABEL(XBC_LOAD_LET): offset = *stream++; reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; goto let_argument; OPCODE_LABEL(XBC_LOAD_LETX): offset = *stream++; reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; goto letx_argument; OPCODE_LABEL(XBC_LOAD_PUSH): offset = *stream++; reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; lisp__data.stack.values[lisp__data.stack.length++] = reg0; NEXT_OPCODE(); /* Load pointer to constant */ OPCODE_LABEL(XBC_LOADCON): reg0 = constants[*stream++]; NEXT_OPCODE(); OPCODE_LABEL(XBC_LOADCON_LET): reg0 = constants[*stream++]; goto let_argument; OPCODE_LABEL(XBC_LOADCON_LETX): reg0 = constants[*stream++]; goto letx_argument; OPCODE_LABEL(XBC_LOADCON_PUSH): reg0 = constants[*stream++]; lisp__data.stack.values[lisp__data.stack.length++] = reg0; NEXT_OPCODE(); OPCODE_LABEL(XBC_LOADCON_SET): reg0 = constants[*stream++]; offset = *stream++; lisp__data.env.values[lisp__data.env.lex + offset] = reg0; NEXT_OPCODE(); /* Change value of local variable */ OPCODE_LABEL(XBC_CAR_SET): car_set: if (reg0 != NIL) { if (!CONSP(reg0)) LispDestroy("CAR: %s is not a list", STROBJ(reg0)); reg0 = CAR(reg0); } goto set_local_variable; OPCODE_LABEL(XBC_CDR_SET): cdr_set: if (reg0 != NIL) { if (!CONSP(reg0)) LispDestroy("CDR: %s is not a list", STROBJ(reg0)); reg0 = CDR(reg0); } goto set_local_variable; OPCODE_LABEL(XBC_LOAD_CAR_SET): offset = *stream++; reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; goto car_set; OPCODE_LABEL(XBC_LOAD_CDR_SET): offset = *stream++; reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; goto cdr_set; OPCODE_LABEL(XBC_LOAD_SET): offset = *stream++; reg0 = lisp__data.env.values[lisp__data.env.lex + offset]; /*FALLTROUGH*/ OPCODE_LABEL(XBC_SET): set_local_variable: offset = *stream++; lisp__data.env.values[lisp__data.env.lex + offset] = reg0; NEXT_OPCODE(); OPCODE_LABEL(XBC_SET_NIL): offset = *stream++; lisp__data.env.values[lisp__data.env.lex + offset] = NIL; NEXT_OPCODE(); /* Change value of a global/special variable */ OPCODE_LABEL(XBC_SETSYM): atom = symbols[*stream++]; if (atom->dyn) { /* atom->dyn and atom->constant are exclusive, no * need to check if variable declared as constant. */ if (atom->offset < lisp__data.env.head && lisp__data.env.names[atom->offset] == atom->key) lisp__data.env.values[atom->offset] = reg0; else { if (atom->watch) LispSetAtomObjectProperty(atom, reg0); else SETVALUE(atom, reg0); } } else if (atom->a_object) { if (atom->constant) LispDestroy("EVAL: %s is a constant", STROBJ(atom->object)); else if (atom->watch) LispSetAtomObjectProperty(atom, reg0); else SETVALUE(atom, reg0); } else { /* Create new global variable */ LispPackage *pack; LispWarning("the variable %s was not declared", atom->key->value); LispSetAtomObjectProperty(atom, reg0); pack = atom->package->data.package.package; if (pack->glb.length >= pack->glb.space) LispMoreGlobals(pack); pack->glb.pairs[pack->glb.length++] = atom->object; } NEXT_OPCODE(); /* Resolve symbol value at runtime */ #define LOAD_SYMBOL_VALUE() \ atom = symbols[*stream++]; \ if (atom->dyn) { \ if (atom->offset < lisp__data.env.head && \ lisp__data.env.names[atom->offset] == atom->key) \ reg0 = lisp__data.env.values[atom->offset]; \ else { \ reg0 = atom->property->value; \ if (reg0 == UNBOUND) \ LispDestroy("EVAL: the symbol %s is unbound", \ STROBJ(atom->object)); \ } \ } \ else { \ if (atom->a_object) \ reg0 = atom->property->value; \ else \ LispDestroy("EVAL: the symbol %s is unbound", \ STROBJ(atom->object)); \ } OPCODE_LABEL(XBC_LOADSYM): LOAD_SYMBOL_VALUE(); NEXT_OPCODE(); OPCODE_LABEL(XBC_LOADSYM_LET): LOAD_SYMBOL_VALUE(); goto let_argument; OPCODE_LABEL(XBC_LOADSYM_LETX): LOAD_SYMBOL_VALUE(); goto letx_argument; OPCODE_LABEL(XBC_LOADSYM_PUSH): LOAD_SYMBOL_VALUE(); lisp__data.stack.values[lisp__data.stack.length++] = reg0; NEXT_OPCODE(); /* Builtin function */ OPCODE_LABEL(XBC_CALL): offset = *stream++; lisp__data.stack.base = lisp__data.stack.length - offset; builtin = builtins[*stream++]; if (builtin->multiple_values) { RETURN_COUNT = 0; reg0 = builtin->function(builtin); } else { reg0 = builtin->function(builtin); RETURN_COUNT = 0; } lisp__data.stack.length -= offset; NEXT_OPCODE(); OPCODE_LABEL(XBC_CALL_SET): offset = *stream++; lisp__data.stack.base = lisp__data.stack.length - offset; builtin = builtins[*stream++]; if (builtin->multiple_values) { RETURN_COUNT = 0; reg0 = builtin->function(builtin); } else { reg0 = builtin->function(builtin); RETURN_COUNT = 0; } lisp__data.stack.length -= offset; offset = *stream++; lisp__data.env.values[lisp__data.env.lex + offset] = reg0; NEXT_OPCODE(); /* Bytecode call */ OPCODE_LABEL(XBC_BYTECALL): lex = lisp__data.env.lex; offset = *stream++; lisp__data.env.head = lisp__data.env.length; len = lisp__data.env.lex = lisp__data.env.length - offset; reg0 = ExecuteBytecode(codes[*stream++]); lisp__data.env.length = lisp__data.env.head = len; lisp__data.env.lex = lex; NEXT_OPCODE(); /* Unimplemented function/macro call */ OPCODE_LABEL(XBC_FUNCALL): lambda = constants[*stream++]; arguments = constants[*stream++]; reg0 = LispFuncall(lambda, arguments, 1); NEXT_OPCODE(); OPCODE_LABEL(XBC_JUMP): stream += *(signed short*)stream; NEXT_OPCODE(); OPCODE_LABEL(XBC_JUMPT): if (reg0 != NIL) stream += *(signed short*)stream; else /* skip jump relative offset */ stream += sizeof(signed short); NEXT_OPCODE(); OPCODE_LABEL(XBC_JUMPNIL): if (reg0 == NIL) stream += *(signed short*)stream; else /* skip jump relative offset */ stream += sizeof(signed short); NEXT_OPCODE(); /* Build CONS of two constant arguments */ OPCODE_LABEL(XBC_CCONS): reg0 = constants[*stream++]; reg1 = constants[*stream++]; reg0 = CONS(reg0, reg1); NEXT_OPCODE(); /* Start CONS */ OPCODE_LABEL(XBC_CSTAR): /* This the CAR of the CONS */ lisp__data.protect.objects[phead++] = reg0; NEXT_OPCODE(); /* Finish CONS */ OPCODE_LABEL(XBC_CFINI): reg0 = CONS(lisp__data.protect.objects[--phead], reg0); NEXT_OPCODE(); /* Start building list */ OPCODE_LABEL(XBC_LSTAR): reg1 = CONS(reg0, NIL); /* Start of list stored here */ lisp__data.protect.objects[phead++] = reg1; /* Tail of list stored here */ lisp__data.protect.objects[phead++] = reg1; NEXT_OPCODE(); /* Add to list */ OPCODE_LABEL(XBC_LCONS): reg1 = lisp__data.protect.objects[phead - 2]; RPLACD(reg1, CONS(reg0, NIL)); lisp__data.protect.objects[phead - 2] = CDR(reg1); NEXT_OPCODE(); /* Finish list */ OPCODE_LABEL(XBC_LFINI): phead -= 2; reg0 = lisp__data.protect.objects[phead + 1]; NEXT_OPCODE(); OPCODE_LABEL(XBC_STRUCT): offset = *stream++; reg1 = constants[*stream++]; if (!STRUCTP(reg0) || reg0->data.struc.def != reg1) { char *name = ATOMID(CAR(reg1))->value; for (reg1 = CDR(reg1); offset; offset--) reg1 = CDR(reg1); LispDestroy("%s-%s: %s is not a %s", name, ATOMID(CAR(reg1))->value, STROBJ(reg0), name); } for (reg0 = reg0->data.struc.fields; offset; offset--) reg0 = CDR(reg0); reg0 = CAR(reg0); NEXT_OPCODE(); OPCODE_LABEL(XBC_STRUCTP): reg1 = constants[*stream++]; reg0 = STRUCTP(reg0) && reg0->data.struc.def == reg1 ? T : NIL; NEXT_OPCODE(); OPCODE_LABEL(XBC_LETREC): /* XXX could/should optimize, shouldn't need to parse * the bytecode header again */ lex = lisp__data.env.lex; offset = *stream++; lisp__data.env.head = lisp__data.env.length; len = lisp__data.env.lex = lisp__data.env.length - offset; reg0 = ExecuteBytecode(bytecode); lisp__data.env.length = lisp__data.env.head = len; lisp__data.env.lex = lex; NEXT_OPCODE(); OPCODE_LABEL(XBC_RETURN): lisp__data.protect.length = pbase; return (reg0); #ifndef ALLOW_GOTO_ADDRESS } /* end of switch */ predicate_label: switch (*stream++) { #endif OPCODE_LABEL(XBP_CONSP): reg0 = CONSP(reg0) ? T : NIL; NEXT_OPCODE(); OPCODE_LABEL(XBP_LISTP): reg0 = LISTP(reg0) ? T : NIL; NEXT_OPCODE(); OPCODE_LABEL(XBP_NUMBERP): reg0 = NUMBERP(reg0) ? T : NIL; NEXT_OPCODE(); #ifndef ALLOW_GOTO_ADDRESS } /* end of switch */ } #endif /*NOTREACHED*/ return (reg0); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/pathname.h0000664000000000000000000000520612472175711016235 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/pathname.h,v 1.4tsi Exp $ */ #ifndef Lisp_pathname_h #define Lisp_pathname_h #include "lisp/internal.h" #define PATH_SEP '/' #define PATH_TYPESEP '.' #ifndef PATH_MAX #define PATH_MAX 4096 #endif #ifndef NAME_MAX #define NAME_MAX 256 #endif #define PATH_STRING 0 #define PATH_HOST 1 #define PATH_DEVICE 2 #define PATH_DIRECTORY 3 #define PATH_NAME 4 #define PATH_TYPE 5 #define PATH_VERSION 6 void LispPathnameInit(void); LispObj *Lisp_Directory(LispBuiltin*); LispObj *Lisp_Namestring(LispBuiltin*); LispObj *Lisp_FileNamestring(LispBuiltin*); LispObj *Lisp_DirectoryNamestring(LispBuiltin*); LispObj *Lisp_EnoughNamestring(LispBuiltin*); LispObj *Lisp_HostNamestring(LispBuiltin*); LispObj *Lisp_MakePathname(LispBuiltin*); LispObj *Lisp_Pathnamep(LispBuiltin*); LispObj *Lisp_ParseNamestring(LispBuiltin*); LispObj *Lisp_PathnameHost(LispBuiltin*); LispObj *Lisp_PathnameDevice(LispBuiltin*); LispObj *Lisp_PathnameDirectory(LispBuiltin*); LispObj *Lisp_PathnameName(LispBuiltin*); LispObj *Lisp_PathnameType(LispBuiltin*); LispObj *Lisp_PathnameVersion(LispBuiltin*); LispObj *Lisp_Truename(LispBuiltin*); LispObj *Lisp_ProbeFile(LispBuiltin*); LispObj *Lisp_UserHomedirPathname(LispBuiltin*); #endif /* Lisp_pathname_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/write.h0000664000000000000000000000600212472175711015565 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/write.h,v 1.9tsi Exp $ */ #ifndef Lisp_write_h #define Lisp_write_h #include "lisp/io.h" /* * Prototypes */ void LispWriteInit(void); LispObj *Lisp_FreshLine(LispBuiltin*); LispObj *Lisp_Prin1(LispBuiltin*); LispObj *Lisp_Princ(LispBuiltin*); LispObj *Lisp_Print(LispBuiltin*); LispObj *Lisp_Terpri(LispBuiltin*); LispObj *Lisp_Write(LispBuiltin*); LispObj *Lisp_WriteChar(LispBuiltin*); LispObj *Lisp_WriteLine(LispBuiltin*); LispObj *Lisp_WriteString(LispBuiltin*); int LispGetColumn(LispObj*); int LispWriteChar(LispObj*, int); int LispWriteChars(LispObj*, int, int); int LispWriteStr(LispObj*, const char*, long); /* write any lisp object to stream */ int LispWriteObject(LispObj*, LispObj*); /* formatted output */ /* object must be an integer */ int LispFormatInteger(LispObj*, LispObj*, int, int, int, int, int, int, int); /* must be in range 1 to 3999 for new roman, 1 to 4999 for old roman */ int LispFormatRomanInteger(LispObj*, long, int); /* must be in range -9999999 to 9999999 */ int LispFormatEnglishInteger(LispObj*, long, int); /* object must be a character */ int LispFormatCharacter(LispObj*, LispObj*, int, int); /* object must be a float */ int LispFormatFixedFloat(LispObj*, LispObj*, int, int, int*, int, int, int); /* object must be a float */ int LispFormatExponentialFloat(LispObj*, LispObj*, int, int, int*, int, int, int, int, int); /* object must be a float */ int LispFormatGeneralFloat(LispObj*, LispObj*, int, int, int*, int, int, int, int, int); int LispFormatDollarFloat(LispObj*, LispObj*, int, int, int, int, int, int); #endif /* Lisp_write_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/regex.c0000664000000000000000000001261312472175711015545 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/regex.c,v 1.10tsi Exp $ */ #include "lisp/regex.h" #include "lisp/private.h" #include "lisp/helper.h" /* * Prototypes */ static re_cod *LispRecomp(LispBuiltin*, char*, int); /* * Initialization */ LispObj *Knomatch; /* * Implementation */ static re_cod * LispRecomp(LispBuiltin *builtin, char *pattern, int cflags) { int code; re_cod *regex = LispMalloc(sizeof(re_cod)); if ((code = recomp(regex, pattern, cflags)) != 0) { char buffer[256]; reerror(code, regex, buffer, sizeof(buffer)); refree(regex); LispFree(regex); LispDestroy("%s: recomp(\"%s\"): %s", STRFUN(builtin), pattern, buffer); } return (regex); } void LispRegexInit(void) { Knomatch = KEYWORD("NOMATCH"); } LispObj * Lisp_Recomp(LispBuiltin *builtin) /* re-comp pattern &key nospec icase nosub newline */ { re_cod *regex; int cflags = 0; LispObj *result; LispObj *pattern, *nospec, *icase, *nosub, *newline; newline = ARGUMENT(4); nosub = ARGUMENT(3); icase = ARGUMENT(2); nospec = ARGUMENT(1); pattern = ARGUMENT(0); /* Don't generate an error if it is already a compiled regex. */ if (REGEXP(pattern)) return (pattern); CHECK_STRING(pattern); if (nospec != UNSPEC && nospec != NIL) cflags |= RE_NOSPEC; if (icase != UNSPEC && icase != NIL) cflags |= RE_ICASE; if (nosub != UNSPEC && nosub != NIL) cflags |= RE_NOSUB; if (newline != UNSPEC && newline != NIL) cflags |= RE_NEWLINE; regex = LispRecomp(builtin, THESTR(pattern), cflags); result = LispNew(pattern, NIL); result->type = LispRegex_t; result->data.regex.regex = regex; result->data.regex.pattern = pattern; result->data.regex.options = cflags; LispMused(regex); return (result); } LispObj * Lisp_Reexec(LispBuiltin *builtin) /* re-exec regex string &key count start end notbol noteol */ { size_t nmatch; re_mat match[10]; long start, end, length; int code, cflags, eflags; char *string; LispObj *result; re_cod *regexp; LispObj *regex, *ostring, *count, *ostart, *oend, *notbol, *noteol; noteol = ARGUMENT(6); notbol = ARGUMENT(5); oend = ARGUMENT(4); ostart = ARGUMENT(3); count = ARGUMENT(2); ostring = ARGUMENT(1); regex = ARGUMENT(0); if (STRINGP(regex)) regexp = LispRecomp(builtin, THESTR(regex), cflags = 0); else { CHECK_REGEX(regex); regexp = regex->data.regex.regex; cflags = regex->data.regex.options; } CHECK_STRING(ostring); if (count == UNSPEC) nmatch = 1; else { CHECK_INDEX(count); nmatch = FIXNUM_VALUE(count); if (nmatch > 10) LispDestroy("%s: COUNT cannot be larger than 10", STRFUN(builtin)); } if (nmatch && (cflags & RE_NOSUB)) nmatch = 1; eflags = RE_STARTEND; if (notbol != UNSPEC && notbol != NIL) eflags |= RE_NOTBOL; if (noteol != UNSPEC && noteol != NIL) eflags |= RE_NOTEOL; string = THESTR(ostring); LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, &start, &end, &length); match[0].rm_so = start; match[0].rm_eo = end; code = reexec(regexp, string, nmatch, &match[0], eflags); if (code == 0) { if (nmatch && match[0].rm_eo >= match[0].rm_so) { result = CONS(CONS(FIXNUM(match[0].rm_so), FIXNUM(match[0].rm_eo)), NIL); if (nmatch > 1 && match[1].rm_eo >= match[1].rm_so) { int i; GC_ENTER(); LispObj *cons = result; GC_PROTECT(result); for (i = 1; i < nmatch && match[i].rm_eo >= match[i].rm_so; i++) { RPLACD(cons, CONS(CONS(FIXNUM(match[i].rm_so), FIXNUM(match[i].rm_eo)), NIL)); cons = CDR(cons); } GC_LEAVE(); } } else result = NIL; } else result = Knomatch; /* Maybe shoud cache compiled regex, but better the caller do it */ if (!XREGEXP(regex)) { refree(regexp); LispFree(regexp); } return (result); } LispObj * Lisp_Rep(LispBuiltin *builtin) /* re-p object */ { LispObj *object; object = ARGUMENT(0); return (REGEXP(object) ? T : NIL); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/xedit.c0000664000000000000000000012311012472175711015543 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/xedit.c,v 1.25 2003/04/27 18:17:35 tsi Exp $ */ #include "../xedit.h" #include /* Needs some private definitions */ #include /* Also needs private definitions... */ #include #define XEDIT_LISP_PRIVATE #include "xedit.h" #include /* Initialize to enter lisp */ #define LISP_SETUP() \ int lisp__running = lisp__data.running /* XXX Maybe should use ualarm or better, setitimer, but one * second seens good enough to check for interrupts */ #define ENABLE_SIGALRM() \ old_sigalrm = signal(SIGALRM, SigalrmHandler); \ alarm(1) #define DISABLE_SIGALRM() \ alarm(0); \ signal(SIGALRM, old_sigalrm) /* Enter lisp */ #define LISP_ENTER() \ if (!lisp__running) { \ lisp__data.running = 1; \ XFlush(XtDisplay(textwindow)); \ ENABLE_SIGALRM(); \ if (sigsetjmp(lisp__data.jmp, 1) != 0) { \ DISABLE_SIGALRM(); \ lisp__data.running = 0; \ return; \ } \ } /* Leave lisp */ #define LISP_LEAVE() \ if (!lisp__running) { \ DISABLE_SIGALRM(); \ LispTopLevel(); \ lisp__data.running = 0; \ } /* * Types */ typedef struct { XawTextPosition left, right; XrmQuark property; } EntityInfo; /* * Prototypes */ static Bool ControlGPredicate(Display*, XEvent*, XPointer); static ssize_t WriteToStdout(int, const void*, size_t); static ssize_t WriteToStderr(int, const void*, size_t); static ssize_t WrapWrite(Widget, const void*, size_t); static void XeditUpdateModeInfos(void); static void XeditPrint(Widget, LispObj*, int); static void XeditInteractiveCallback(Widget, XtPointer, XtPointer); static void XeditIndentationCallback(Widget, XtPointer, XtPointer); static LispObj *XeditCharAt(LispBuiltin*, int); static LispObj *XeditSearch(LispBuiltin*, XawTextScanDirection); /* * Initialization */ static void (*old_sigalrm)(int); EditModeInfo *mode_infos; Cardinal num_mode_infos; static LispObj *Oauto_modes, *Oauto_mode, *Osyntax_highlight, *Osyntable_indent; /* Just to make calling interactive reparse easier */ static LispObj interactive_arguments[4]; static LispObj *justify_modes[4]; static LispObj *wrap_modes[3]; static LispObj *scan_types[6]; static LispObj *scan_directions[2]; static LispObj execute_stream; static LispString execute_string; static LispObj result_stream; static LispString result_string; static XawTextPropertyList **property_lists; static Cardinal num_property_lists; /* Some hacks to (at lest try to) avoid problems reentering Xlib while * testing for user interrupts */ static volatile int disable_timeout, request_timeout; extern int pagesize; static LispBuiltin xeditbuiltins[] = { {LispFunction, Xedit_AddEntity, "add-entity offset length identifier"}, {LispFunction, Xedit_AutoFill, "auto-fill &optional value"}, {LispFunction, Xedit_Background, "background &optional color"}, {LispFunction, Xedit_CharAfter, "char-after &optional offset"}, {LispFunction, Xedit_CharBefore, "char-before &optional offset"}, {LispFunction, Xedit_ClearEntities, "clear-entities left right"}, {LispFunction, Xedit_ConvertPropertyList, "convert-property-list name definition"}, {LispFunction, Xedit_Font, "font &optional font"}, {LispFunction, Xedit_Foreground, "foreground &optional color"}, {LispFunction, Xedit_GotoChar, "goto-char offset"}, {LispFunction, Xedit_HorizontalScrollbar, "horizontal-scrollbar &optional state"}, {LispFunction, Xedit_Insert, "insert text"}, {LispFunction, Xedit_Justification, "justification &optional value"}, {LispFunction, Xedit_LeftColumn, "left-column &optional left"}, {LispFunction, Xedit_Point, "point"}, {LispFunction, Xedit_PointMax, "point-max"}, {LispFunction, Xedit_PointMin, "point-min"}, {LispFunction, Xedit_PropertyList, "property-list &optional value"}, {LispFunction, Xedit_ReadText, "read-text offset length"}, {LispFunction, Xedit_ReplaceText, "replace-text left right text"}, {LispFunction, Xedit_RightColumn, "right-column &optional right"}, {LispFunction, Xedit_Scan, "scan offset type direction &key count include"}, {LispFunction, Xedit_SearchBackward, "search-backward string &optional offset ignore-case"}, {LispFunction, Xedit_SearchForward, "search-forward string &optional offset ignore-case"}, {LispFunction, Xedit_VerticalScrollbar, "vertical-scrollbar &optional state"}, {LispFunction, Xedit_WrapMode, "wrap-mode &optional value"}, /* This should be available from elsewhere at some time... */ {LispFunction, Xedit_XrmStringToQuark, "xrm-string-to-quark string"}, }; /* * Implementation */ /*ARGUSED*/ static Bool ControlGPredicate(Display *display, XEvent *event, XPointer arguments) { char buffer[2]; return ((event->type == KeyPress || event->type == KeyRelease) && (event->xkey.state & ControlMask) && XLookupString(&(event->xkey), buffer, sizeof(buffer), NULL, NULL) && buffer[0] == '\a'); } /*ARGSUSED*/ static void SigalrmHandler(int signum) { XEvent event; if (disable_timeout) { request_timeout = 1; return; } /* Check if user pressed C-g */ if (XCheckIfEvent(XtDisplay(textwindow), &event, ControlGPredicate, NULL)) { XPutBackEvent(XtDisplay(textwindow), &event); alarm(0); /* Tell a signal was received, print message for SIGINT */ LispSignal(SIGINT); } else alarm(1); } static ssize_t WrapWrite(Widget output, const void *buffer, size_t nbytes) { XawTextBlock block; XawTextPosition position; disable_timeout = 1; position = XawTextGetInsertionPoint(output); block.firstPos = 0; block.format = FMT8BIT; block.length = nbytes; block.ptr = (String)buffer; XawTextReplace(output, position, position, &block); XawTextSetInsertionPoint(output, position + block.length); disable_timeout = 0; if (request_timeout) { XFlush(XtDisplay(output)); request_timeout = 0; SigalrmHandler(SIGALRM); } return ((ssize_t)nbytes); } static ssize_t WriteToStdout(int fd, const void *buffer, size_t nbytes) { return (WrapWrite(textwindow, buffer, nbytes)); } static ssize_t WriteToStderr(int fd, const void *buffer, size_t nbytes) { return (WrapWrite(messwidget, buffer, nbytes)); } void LispXeditInitialize(void) { int i; char *string; LispObj *xedit, *list, *savepackage; LispSetFileWrite(Stdout, WriteToStdout); LispSetFileWrite(Stderr, WriteToStderr); justify_modes[0] = KEYWORD("LEFT"); justify_modes[1] = KEYWORD("RIGHT"); justify_modes[2] = KEYWORD("CENTER"); justify_modes[3] = KEYWORD("FULL"); wrap_modes[0] = KEYWORD("NEVER"); wrap_modes[1] = KEYWORD("LINE"); wrap_modes[2] = KEYWORD("WORD"); scan_types[0] = KEYWORD("POSITIONS"); scan_types[1] = KEYWORD("WHITE-SPACE"); scan_types[2] = KEYWORD("EOL"); scan_types[3] = KEYWORD("PARAGRAPH"); scan_types[4] = KEYWORD("ALL"); scan_types[5] = KEYWORD("ALPHA-NUMERIC"); scan_directions[0] = justify_modes[0]; scan_directions[1] = justify_modes[1]; /* Remember value of current package */ savepackage = PACKAGE; /* Create the XEDIT package */ xedit = LispNewPackage(STRING("XEDIT"), NIL); /* Update list of packages */ PACK = CONS(xedit, PACK); /* Temporarily switch to the XEDIT package */ lisp__data.pack = lisp__data.savepack = xedit->data.package.package; PACKAGE = xedit; /* Add XEDIT builtin functions */ for (i = 0; i < sizeof(xeditbuiltins) / sizeof(xeditbuiltins[0]); i++) LispAddBuiltinFunction(&xeditbuiltins[i]); /* Create these objects in the xedit package */ Oauto_modes = STATIC_ATOM("*AUTO-MODES*"); Oauto_mode = STATIC_ATOM("AUTO-MODE"); Osyntax_highlight = STATIC_ATOM("SYNTAX-HIGHLIGHT"); Osyntable_indent = STATIC_ATOM("SYNTABLE-INDENT"); /* Import symbols from the LISP and EXT packages */ for (list = PACK; CONSP(list); list = CDR(list)) { string = THESTR(CAR(list)->data.package.name); if (strcmp(string, "LISP") == 0 || strcmp(string, "EXT") == 0) LispUsePackage(CAR(list)); } /* Restore previous package */ lisp__data.pack = savepackage->data.package.package; PACKAGE = savepackage; /* Initialize helper static objects used when executing expressions */ execute_stream.type = LispStream_t; execute_stream.data.stream.source.string = &execute_string; execute_stream.data.stream.pathname = NIL; execute_stream.data.stream.type = LispStreamString; execute_stream.data.stream.readable = 1; execute_stream.data.stream.writable = 0; execute_string.output = 0; result_stream.type = LispStream_t; result_stream.data.stream.source.string = &result_string; result_stream.data.stream.pathname = NIL; result_stream.data.stream.type = LispStreamString; result_stream.data.stream.readable = 0; result_stream.data.stream.writable = 1; result_string.string = XtMalloc(pagesize); result_string.space = pagesize; /* Initialize interactive edition function arguments */ /* first argument is syntax table */ interactive_arguments[0].type = LispCons_t; interactive_arguments[0].data.cons.cdr = &interactive_arguments[1]; /* second argument is where to start reparsing */ interactive_arguments[1].type = LispCons_t; interactive_arguments[1].data.cons.cdr = &interactive_arguments[2]; /* third argument is where to stop reparsing */ interactive_arguments[2].type = LispCons_t; interactive_arguments[2].data.cons.cdr = &interactive_arguments[3]; /* fourth argument is interactive flag */ interactive_arguments[3].type = LispCons_t; interactive_arguments[3].data.cons.car = T; interactive_arguments[3].data.cons.cdr = NIL; /* Load extra functions and data type definitions */ EXECUTE("(require \"xedit\")"); /* * This assumes that the *auto-modes* variable is a list where every * item has the format: * (regexp string-desc load-file-desc . symbol-name) * Minimal error checking is done. */ if (Oauto_modes->data.atom->a_object) { LispObj *desc, *modes = Oauto_modes->data.atom->property->value; for (; CONSP(modes); modes = CDR(modes)) { list = CAR(modes); desc = NIL; for (i = 0; i < 3 && CONSP(list); i++, list = CDR(list)) { if (i == 1) desc = CAR(list); } if (i == 3 && STRINGP(desc)) { mode_infos = (EditModeInfo*) XtRealloc((XtPointer)mode_infos, sizeof(EditModeInfo) * (num_mode_infos + 1)); mode_infos[num_mode_infos].desc = XtNewString(THESTR(desc)); mode_infos[num_mode_infos].symbol = list; mode_infos[num_mode_infos].syntax = NULL; ++num_mode_infos; } } } } static void XeditUpdateModeInfos(void) { int i; for (i = 0; i < num_mode_infos; i++) { if (mode_infos[i].symbol && mode_infos[i].syntax == NULL && XSYMBOLP(mode_infos[i].symbol) && mode_infos[i].symbol->data.atom->a_object) mode_infos[i].syntax = mode_infos[i].symbol->data.atom->property->value; } } void XeditLispExecute(Widget output, XawTextPosition left, XawTextPosition right) { GC_ENTER(); LISP_SETUP(); int alloced, return_count; XawTextBlock block; XawTextPosition position; char *string, *ptr; LispObj *result, *code, *_cod, *returns; LISP_ENTER(); position = left; XawTextSourceRead(XawTextGetSource(textwindow), left, &block, right - left); if (block.length < right - left) { alloced = 1; string = ptr = LispMalloc(right - left); memcpy(ptr, block.ptr, block.length); position = left + block.length; ptr += block.length; for (; position < right;) { XawTextSourceRead(XawTextGetSource(textwindow), position, &block, right - position); memcpy(ptr, block.ptr, block.length); position += block.length; ptr += block.length; } } else { alloced = 0; string = block.ptr; } execute_string.string = string; execute_string.length = right - left; execute_string.input = 0; LispPushInput(&execute_stream); _cod = COD; result = NIL; if ((code = LispRead()) != NULL) result = EVAL(code); COD = _cod; LispPopInput(&execute_stream); returns = NIL; if (RETURN_COUNT > 0) { GC_PROTECT(result); returns = _cod = CONS(RETURN(0), NIL); GC_PROTECT(returns); for (return_count = 1; return_count < RETURN_COUNT; return_count++) { RPLACD(_cod, CONS(RETURN(return_count), NIL)); _cod = CDR(_cod); } } LispFflush(Stdout); LispUpdateResults(code, result); if (RETURN_COUNT >= 0) { XeditPrint(output, result, 1); for (; CONSP(returns); returns = CDR(returns)) XeditPrint(output, CAR(returns), 0); } if (alloced) LispFree(string); GC_LEAVE(); LISP_LEAVE(); } static void XeditPrint(Widget output, LispObj *object, int newline) { XawTextBlock block; XawTextPosition position; result_string.length = result_string.output = 0; if (newline) { position = XawTextGetInsertionPoint(output); if (position != XawTextSourceScan(XawTextGetSource(output), position, XawstEOL, XawsdLeft, 1, False)) LispSputc(&result_string, '\n'); } LispWriteObject(&result_stream, object); LispSputc(&result_string, '\n'); position = XawTextGetInsertionPoint(output); block.firstPos = 0; block.format = FMT8BIT; block.length = result_string.length; block.ptr = result_string.string; XawTextReplace(output, position, position, &block); XawTextSetInsertionPoint(output, position + block.length); } /* * This function is defined here to avoid exporting all the lisp interfaces * to the core xedit code. */ void XeditLispSetEditMode(xedit_flist_item *item, LispObj *symbol) { GC_ENTER(); LISP_SETUP(); LispObj *syntax, *name; item->xldata = (XeditLispData*)XtCalloc(1, sizeof(XeditLispData)); LISP_ENTER(); /* Create an object that represents the buffer filename. * Note that the entire path is passed to the auto-mode * function, so that directory names may be also be used * when determining a file type. */ name = STRING(item->filename); GC_PROTECT(name); /* Call the AUTO-MODE function to check if there is a * syntax definition for the file being loaded */ if (symbol == NULL) syntax = APPLY1(Oauto_mode, name); else syntax = APPLY2(Oauto_mode, name, symbol); /* Don't need the name object anymore */ GC_LEAVE(); if (syntax != NIL) { Arg arg[1]; LispObj arguments; XawTextPropertyList *property_list; item->xldata->syntax = syntax; /* Apply the syntax highlight to the current buffer */ arguments.type = LispCons_t; arguments.data.cons.car = syntax; arguments.data.cons.cdr = NIL; LispFuncall(Osyntax_highlight, &arguments, 1); /* The previous call added the property list to the widget, * remember it when switching sources. */ XtSetArg(arg[0], XawNtextProperties, &property_list); XtGetValues(XawTextGetSink(textwindow), arg, 1); item->properties = property_list; /* Add callback for interactive changes */ XtAddCallback(item->source, XtNpropertyCallback, XeditInteractiveCallback, item->xldata); /* Update information as a new file may have been loaded */ XeditUpdateModeInfos(); } else item->properties = NULL; LISP_LEAVE(); } void XeditLispUnsetEditMode(xedit_flist_item *item) { if (item->xldata) { XtRemoveCallback(item->source, XtNpropertyCallback, XeditInteractiveCallback, item->xldata); XtFree((XtPointer)item->xldata); item->xldata = NULL; } } #define MAX_INFOS 32 /* * This callback tries to do it's best in generating correct output while * also doing minimal work/redrawing of the screen. It probably will fail * for some syntax-definitions, or will just not properly repaint the * screen. In the later case, just press Ctrl+L. * There isn't yet any command to force reparsing of some regions, and if * the parser becomes confused, you may need to go to a line, press a space * and undo, just to force it to reparse the line, and possibly some extra * lines until the parser thinks the display is in sync. * Sometimes it will repaint a lot more of text than what is being requested * by this callback, this should be fixed at some time, as for certain cases * it is also required some redesign in the Xaw interface. */ static void XeditInteractiveCallback(Widget w, XtPointer client_data, XtPointer call_data) { LISP_SETUP(); XeditLispData *data = (XeditLispData*)client_data; LispObj *syntax = data->syntax; XawTextPropertyInfo *info = (XawTextPropertyInfo*)call_data; LispObj *result, *syntable; XawTextAnchor *anchor; XawTextEntity *entity; XawTextPosition first, last, left, right, begin, next, tmp, position; int i, j, indent; TextSrcObject src = (TextSrcObject)w; EntityInfo oinfo[MAX_INFOS], ninfo[MAX_INFOS]; XrmQuark props[MAX_INFOS]; int num_oinfo, num_ninfo, num_props; XmuScanline *clip, *oclip, *nclip; XmuSegment segment, *seg; if (data->disable_highlight) return; LISP_ENTER(); first = XawTextSourceScan(w, 0, XawstAll, XawsdLeft, 1, True); last = XawTextSourceScan(w, 0, XawstAll, XawsdRight, 1, True); left = info->left; right = left + info->block->length; /* For now, only call the indent hook if a single character was typed */ indent = (info->right == left) && (right == left + 1); /* Always reparse full lines */ left = begin = XawTextSourceScan(w, left, XawstEOL, XawsdLeft, 1, False); right = next = XawTextSourceScan(w, right, XawstEOL, XawsdRight, 1, False); /* Check properties in the modified text. If a complex nested syntax * table was parsed, the newline has it's default property, so, while * the newline has a property, backup a line to make sure everything is * properly parsed. * Maybe should limit the number of backuped lines, but if the parsing * becomes noticeable slow, better to rethink the syntax definition. */ while (left > first) { position = XawTextSourceScan(w, left, XawstEOL, XawsdLeft, 1, True); if (XawTextSourceAnchorAndEntity(w, position, &anchor, &entity)) left = XawTextSourceScan(w, left, XawstEOL, XawsdLeft, 2, False); else break; } /* While the newline after the right position has a "hidden" property, * keep incrementing a line to be reparsed. */ while (right < last) { if (XawTextSourceAnchorAndEntity(w, right, &anchor, &entity)) right = XawTextSourceScan(w, right, XawstEOL, XawsdRight, 2, False); else break; } #ifndef MAX #define MAX(a, b) ((a) > (b) ? (a) : (b)) #endif #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif #define STORE_STATE(count, info, from, to) \ (count) = 0; \ if ((anchor = XawTextSourceFindAnchor(w, (from))) != NULL) { \ entity = anchor->entities; \ /* Find first entity in the region to parse */ \ while (entity && \ anchor->position + entity->offset + entity->length <= \ (from)) \ entity = entity->next; \ /* Loop storing information */ \ while (entity && \ (position = anchor->position + entity->offset) < (to)) { \ (info)[(count)].left = MAX(position, (from)); \ position += entity->length; \ (info)[(count)].right = MIN(position, (to)); \ (info)[(count)].property = entity->property; \ /* If the changes are so complex, user need press Ctrl+L */ \ if (++(count) >= MAX_INFOS) \ break; \ if ((entity = entity->next) == NULL && \ (anchor = XawTextSourceNextAnchor(w, anchor)) != NULL) \ entity = anchor->entities; \ } \ } /* Remember old state */ STORE_STATE(num_oinfo, oinfo, begin, right); /* Reparse the lines in the modified/edited range of text */ interactive_arguments[0].data.cons.car = syntax; interactive_arguments[1].data.cons.car = FIXNUM(left); interactive_arguments[2].data.cons.car = FIXNUM(right); result = APPLY(Osyntax_highlight, &interactive_arguments[0]); /* Indent table is the second return value */ if (RETURN_COUNT) syntable = RETURN(0); else syntable = NIL; /* This normally is the same value as right, but the parser may have * continued when the syntax table stack did not finish. */ if (FIXNUMP(result)) right = FIXNUM_VALUE(result); LISP_LEAVE(); /* Check what have changed */ STORE_STATE(num_ninfo, ninfo, begin, right); /* Initialize to redraw everything. */ clip = XmuNewScanline(0, begin, right); #define CLIP_MASK(mask, from, to) \ if ((from) < (to)) { \ segment.x1 = (from); \ segment.x2 = (to); \ XmuScanlineOrSegment((mask), &segment); \ } oclip = XmuNewScanline(0, 0, 0); nclip = XmuNewScanline(0, 0, 0); #define CLIP_DEFAULT(mask, from, info, num_info) \ for (tmp = (from), i = 0; i < (num_info); i++) { \ CLIP_MASK((mask), tmp, (info)[i].left); \ tmp = (info)[i].right; \ } /* First generate masks of regions with the default property */ CLIP_DEFAULT(oclip, begin, oinfo, num_oinfo); CLIP_DEFAULT(nclip, begin, ninfo, num_ninfo); /* Store unchanged region in oclip */ XmuScanlineAnd(oclip, nclip); /* Don't need to redraw the region in oclip */ XmuScanlineXor(clip, oclip); #define LIST_PROPERTIES(prop, num_prop, info, num_info) \ (num_prop) = 0; \ for (i = 0; i < (num_info); i++) { \ for (j = 0; j < (num_prop); j++) \ if ((prop)[j] == (info)[i].property) \ break; \ if (j == (num_prop)) \ (prop)[(num_prop)++] = (info)[i].property; \ } /* Prepare to generate masks of regions of text with defined properties */ LIST_PROPERTIES(props, num_props, oinfo, num_oinfo); #define CLIP_PROPERTY(mask, prop, info, num_info) \ for (j = 0; j < (num_info); j++) { \ if ((info)[j].property == (prop)) { \ CLIP_MASK((mask), (info)[j].left, (info)[j].right); \ } \ } /* Only care about the old properties, new ones need to be redrawn */ for (i = 0; i < num_props; i++) { XrmQuark property = props[i]; /* Reset oclip and nclip */ XmuScanlineXor(oclip, oclip); XmuScanlineXor(nclip, nclip); /* Generate masks */ CLIP_PROPERTY(oclip, property, oinfo, num_oinfo); CLIP_PROPERTY(nclip, property, ninfo, num_ninfo); /* Store unchanged region in oclip */ XmuScanlineAnd(oclip, nclip); /* Don't need to redraw the region in oclip */ XmuScanlineXor(clip, oclip); XmuOptimizeScanline(clip); } XmuDestroyScanline(oclip); XmuDestroyScanline(nclip); /* Tell Xaw that need update some regions */ for (seg = clip->segment; seg; seg = seg->next) { for (i = 0; i < src->textSrc.num_text; i++) /* This really should have an exported interface... */ _XawTextNeedsUpdating((TextWidget)(src->textSrc.text[i]), seg->x1, seg->x2 + (seg->x2 > next)); } XmuDestroyScanline(clip); data->syntable = syntable; /* XXX check lisp__running to know if at the toplevel parsing state */ if (indent && syntable != NIL && !lisp__running && /* Doing an undo, probably will need an exported interface for this * case. Should not change the text now. */ (!src->textSrc.enable_undo || !src->textSrc.undo_state)) XtAddCallback(textwindow, XtNpositionCallback, XeditIndentationCallback, data); } /* * This callback is called if the syntax table where the cursor is located * defines an indentation function. */ static void XeditIndentationCallback(Widget w, XtPointer client_data, XtPointer call_data) { LISP_SETUP(); LispObj *indentp; XeditLispData *data = (XeditLispData*)client_data; data->disable_highlight = True; XtRemoveCallback(w, XtNpositionCallback, XeditIndentationCallback, data); LISP_ENTER(); /* Get pointer to indentation function */ indentp = APPLY1(Osyntable_indent, data->syntable); /* Execute indentation function */ if (indentp != NIL) APPLY2(indentp, data->syntax, data->syntable); data->disable_highlight = False; LISP_LEAVE(); } /************************************************************************ * Builtin functions ************************************************************************/ LispObj * Xedit_AddEntity(LispBuiltin *builtin) /* add-entity offset length identifier */ { LispObj *offset, *length, *identifier; identifier = ARGUMENT(2); length = ARGUMENT(1); offset = ARGUMENT(0); CHECK_INDEX(offset); CHECK_INDEX(length); CHECK_LONGINT(identifier); return (XawTextSourceAddEntity(XawTextGetSource(textwindow), 0, 0, NULL, FIXNUM_VALUE(offset), FIXNUM_VALUE(length), LONGINT_VALUE(identifier)) ? T : NIL); } LispObj * Xedit_AutoFill(LispBuiltin *builtin) /* auto-fill &optional value */ { Arg arg[1]; Boolean state; LispObj *value; value = ARGUMENT(0); if (value != UNSPEC) { XtSetArg(arg[0], XtNautoFill, value == NIL ? False : True); XtSetValues(textwindow, arg, 1); } else { XtSetArg(arg[0], XtNautoFill, &state); XtGetValues(textwindow, arg, 1); value = state ? T : NIL; } return (value); } LispObj * Xedit_Background(LispBuiltin *builtin) /* background &optional color */ { Pixel pixel; Arg arg[1]; XrmValue from, to; LispObj *color; color = ARGUMENT(0); if (color != UNSPEC) { CHECK_STRING(color); from.size = STRLEN(color); from.addr = (XtPointer)THESTR(color); to.size = sizeof(Pixel); to.addr = (XtPointer)&pixel; if (!XtConvertAndStore(XawTextGetSink(textwindow), XtRString, &from, XtRPixel, &to)) LispDestroy("cannot convert %s to Pixel", STROBJ(color)); XtSetArg(arg[0], XtNbackground, pixel); XtSetValues(textwindow, arg, 1); } else { from.size = sizeof(Pixel); from.addr = (XtPointer)&pixel; to.size = 0; to.addr = NULL; XtSetArg(arg[0], XtNbackground, &pixel); XtGetValues(XawTextGetSink(textwindow), arg, 1); /* This cannot fail */ XtConvertAndStore(textwindow, XtRPixel, &from, XtRString, &to); color = STRING(to.addr); } return (color); } static LispObj * XeditCharAt(LispBuiltin *builtin, int before) { Widget source = XawTextGetSource(textwindow); XawTextPosition first, point, last; XawTextBlock block; LispObj *offset; offset = ARGUMENT(0); if (offset != UNSPEC) { CHECK_INDEX(offset); } first = XawTextSourceScan(source, 0, XawstAll, XawsdLeft, 1, True); if (FIXNUMP(offset)) point = FIXNUM_VALUE(offset); else point = XawTextGetInsertionPoint(textwindow); if (before && point > first) { XawTextPosition position = XawTextSourceScan(source, point, XawstPositions, XawsdLeft, 1, True); if (position < point) point = position; else return (NIL); } last = XawTextSourceScan(source, 0, XawstAll, XawsdRight, 1, True); if (point < first || point > last) return (NIL); XawTextSourceRead(source, point, &block, 1); return (block.length ? SCHAR(*(unsigned char*)block.ptr) : NIL); } LispObj * Xedit_CharAfter(LispBuiltin *builtin) /* char-after &optional offset */ { return (XeditCharAt(builtin, 0)); } LispObj * Xedit_CharBefore(LispBuiltin *builtin) /* char-before &optional offset */ { return (XeditCharAt(builtin, 1)); } LispObj * Xedit_ClearEntities(LispBuiltin *builtin) /* clear-entities left right */ { LispObj *left, *right; right = ARGUMENT(1); left = ARGUMENT(0); CHECK_INDEX(left); CHECK_INDEX(right); XawTextSourceClearEntities(XawTextGetSource(textwindow), FIXNUM_VALUE(left), FIXNUM_VALUE(right)); return (T); } LispObj * Xedit_ConvertPropertyList(LispBuiltin *builtin) /* convert-property-list name definition */ { LispObj *result; XawTextPropertyList *property_list; LispObj *name, *definition; definition = ARGUMENT(1); name = ARGUMENT(0); CHECK_STRING(name); CHECK_STRING(definition); result = NIL; property_list = XawTextSinkConvertPropertyList(THESTR(name), THESTR(definition), topwindow->core.screen, topwindow->core.colormap, topwindow->core.depth); if (property_list) { Cardinal i; for (i = 0; i < num_property_lists; i++) /* Check if a new property list was created */ if (property_lists[i]->identifier == property_list->identifier) break; /* Remember this pointer when asked back for it */ if (i == num_property_lists) { property_lists = (XawTextPropertyList**) XtRealloc((XtPointer)property_lists, sizeof(XawTextPropertyList) * (num_property_lists + 1)); property_lists[num_property_lists++] = property_list; } result = INTEGER(property_list->identifier); } return (result); } LispObj * Xedit_Font(LispBuiltin *builtin) /* font &optional font */ { XFontStruct *font_struct; Arg arg[1]; XrmValue from, to; LispObj *font; font = ARGUMENT(0); if (font != UNSPEC) { CHECK_STRING(font); from.size = STRLEN(font); from.addr = (XtPointer)THESTR(font); to.size = sizeof(XFontStruct*); to.addr = (XtPointer)&font_struct; if (!XtConvertAndStore(textwindow, XtRString, &from, XtRFontStruct, &to)) LispDestroy("cannot convert %s to FontStruct", STROBJ(font)); XtSetArg(arg[0], XtNfont, font_struct); XtSetValues(textwindow, arg, 1); } else { from.size = sizeof(XFontStruct*); from.addr = (XtPointer)&font_struct; to.size = 0; to.addr = NULL; XtSetArg(arg[0], XtNfont, &font_struct); XtGetValues(XawTextGetSink(textwindow), arg, 1); /* This cannot fail */ XtConvertAndStore(textwindow, XtRFontStruct, &from, XtRString, &to); font = STRING(to.addr); } return (font); } LispObj * Xedit_Foreground(LispBuiltin *builtin) /* foreground &optional color */ { Pixel pixel; Arg arg[1]; XrmValue from, to; LispObj *color; color = ARGUMENT(0); if (color != UNSPEC) { CHECK_STRING(color); from.size = STRLEN(color); from.addr = (XtPointer)THESTR(color); to.size = sizeof(Pixel); to.addr = (XtPointer)&pixel; if (!XtConvertAndStore(XawTextGetSink(textwindow), XtRString, &from, XtRPixel, &to)) LispDestroy("cannot convert %s to Pixel", STROBJ(color)); XtSetArg(arg[0], XtNforeground, pixel); XtSetValues(textwindow, arg, 1); } else { from.size = sizeof(Pixel); from.addr = (XtPointer)&pixel; to.size = 0; to.addr = NULL; XtSetArg(arg[0], XtNforeground, &pixel); XtGetValues(XawTextGetSink(textwindow), arg, 1); /* This cannot fail */ XtConvertAndStore(textwindow, XtRPixel, &from, XtRString, &to); color = STRING(to.addr); } return (color); } LispObj * Xedit_GotoChar(LispBuiltin *builtin) /* goto-char offset */ { LispObj *offset; XawTextPosition point; offset = ARGUMENT(0); CHECK_INDEX(offset); XawTextSetInsertionPoint(textwindow, FIXNUM_VALUE(offset)); point = XawTextGetInsertionPoint(textwindow); if (point != FIXNUM_VALUE(offset)) offset = FIXNUM(point); return (offset); } LispObj * Xedit_HorizontalScrollbar(LispBuiltin *builtin) /* horizontal-scrollbar &optional state */ { Arg arg[1]; XawTextScrollMode scroll; LispObj *state; state = ARGUMENT(0); if (state != UNSPEC) { scroll = state == NIL ? XawtextScrollNever : XawtextScrollAlways; XtSetArg(arg[0], XtNscrollHorizontal, scroll); XtSetValues(textwindow, arg, 1); } else { XtSetArg(arg[0], XtNscrollHorizontal, &scroll); XtGetValues(textwindow, arg, 1); state = scroll == XawtextScrollAlways ? T : NIL; } return (state); } LispObj * Xedit_Insert(LispBuiltin *builtin) /* insert text */ { XawTextPosition point = XawTextGetInsertionPoint(textwindow); XawTextBlock block; LispObj *text; text = ARGUMENT(0); CHECK_STRING(text); block.firstPos = 0; block.format = FMT8BIT; block.length = STRLEN(text); block.ptr = THESTR(text); XawTextReplace(textwindow, point, point, &block); XawTextSetInsertionPoint(textwindow, point + block.length); return (text); } LispObj * Xedit_Justification(LispBuiltin *builtin) /* justification &optional value */ { int i; Arg arg[1]; XawTextJustifyMode justify; LispObj *value; value = ARGUMENT(0); if (value != UNSPEC) { for (i = 0; i < 4; i++) if (value == justify_modes[i]) break; if (i >= 4) LispDestroy("%s: argument must be " ":LEFT, :RIGHT, :CENTER, or :FULL, not %s", STRFUN(builtin), STROBJ(value)); XtSetArg(arg[0], XtNjustifyMode, (XawTextJustifyMode)i); XtSetValues(textwindow, arg, 1); } else { XtSetArg(arg[0], XtNjustifyMode, &justify); XtGetValues(textwindow, arg, 1); i = (int)justify; if (i <= 0 || i >= 4) i = 0; value = justify_modes[i]; } return (value); } LispObj * Xedit_LeftColumn(LispBuiltin *builtin) /* left-column &optional left */ { short left; Arg arg[1]; LispObj *oleft; oleft = ARGUMENT(0); if (oleft != UNSPEC) { CHECK_INDEX(oleft); if (FIXNUM_VALUE(oleft) >= 32767) left = 32767; else left = FIXNUM_VALUE(oleft); XtSetArg(arg[0], XtNleftColumn, left); XtSetValues(textwindow, arg, 1); } else { XtSetArg(arg[0], XtNleftColumn, &left); XtGetValues(textwindow, arg, 1); oleft = FIXNUM((long)left); } return (oleft); } LispObj * Xedit_Point(LispBuiltin *builtin) /* point */ { return (FIXNUM(XawTextGetInsertionPoint(textwindow))); } LispObj * Xedit_PointMax(LispBuiltin *builtin) /* point-max */ { return (FIXNUM(XawTextSourceScan(XawTextGetSource(textwindow), 0, XawstAll, XawsdRight, 1, True))); } LispObj * Xedit_PointMin(LispBuiltin *builtin) /* point-min */ { return (FIXNUM(XawTextSourceScan(XawTextGetSource(textwindow), 0, XawstAll, XawsdLeft, 1, True))); } LispObj * Xedit_PropertyList(LispBuiltin *builtin) /* property-list &optional value */ { Arg arg[1]; XawTextPropertyList *property_list; LispObj *value; value = ARGUMENT(0); if (value != UNSPEC) { Cardinal i; XrmQuark quark; CHECK_LONGINT(value); property_list = NULL; quark = LONGINT_VALUE(value); for (i = 0; i < num_property_lists; i++) if (property_lists[i]->identifier == quark) { property_list = property_lists[i]; break; } if (property_list) { XtSetArg(arg[0], XawNtextProperties, property_list); XtSetValues(XawTextGetSink(textwindow), arg, 1); } else /* Maybe should generate an error here */ value = NIL; } else { XtSetArg(arg[0], XawNtextProperties, &property_list); XtGetValues(XawTextGetSink(textwindow), arg, 1); if (property_list) value = INTEGER(property_list->identifier); } return (value); } LispObj * Xedit_ReadText(LispBuiltin *builtin) /* read-text offset length */ { XawTextPosition last = XawTextSourceScan(XawTextGetSource(textwindow), 0, XawstAll, XawsdRight, 1, True); XawTextPosition from, to, len; XawTextBlock block; char *string, *ptr; LispObj *offset, *length; length = ARGUMENT(1); offset = ARGUMENT(0); CHECK_INDEX(offset); CHECK_INDEX(length); from = FIXNUM_VALUE(offset); to = from + FIXNUM_VALUE(length); if (from > last) from = last; if (to > last) to = last; if (from == to) return (STRING("")); len = to - from; string = LispMalloc(len); for (ptr = string; from < to;) { XawTextSourceRead(XawTextGetSource(textwindow), from, &block, to - from); memcpy(ptr, block.ptr, block.length); ptr += block.length; from += block.length; } return (LSTRING2(string, len)); } LispObj * Xedit_ReplaceText(LispBuiltin *builtin) /* replace-text left right text */ { XawTextPosition last = XawTextSourceScan(XawTextGetSource(textwindow), 0, XawstAll, XawsdRight, 1, True); XawTextPosition left, right; XawTextBlock block; LispObj *oleft, *oright, *text; text = ARGUMENT(2); oright = ARGUMENT(1); oleft = ARGUMENT(0); CHECK_INDEX(oleft); CHECK_INDEX(oright); CHECK_STRING(text); left = FIXNUM_VALUE(oleft); right = FIXNUM_VALUE(oright); if (left > last) left = last; if (left > right) right = left; else if (right > last) right = last; block.firstPos = 0; block.format = FMT8BIT; block.length = STRLEN(text); block.ptr = THESTR(text); XawTextReplace(textwindow, left, right, &block); return (text); } LispObj * Xedit_RightColumn(LispBuiltin *builtin) /* right-column &optional right */ { short right; Arg arg[1]; LispObj *oright; oright = ARGUMENT(0); if (oright != UNSPEC) { CHECK_INDEX(oright); if (FIXNUM_VALUE(oright) >= 32767) right = 32767; else right = FIXNUM_VALUE(oright); XtSetArg(arg[0], XtNrightColumn, right); XtSetValues(textwindow, arg, 1); } else { XtSetArg(arg[0], XtNrightColumn, &right); XtGetValues(textwindow, arg, 1); oright = FIXNUM(right); } return (oright); } LispObj * Xedit_Scan(LispBuiltin *builtin) /* scan offset type direction &key count include */ { int i; XawTextPosition offset; XawTextScanType type; XawTextScanDirection direction; int count; LispObj *ooffset, *otype, *odirection, *ocount, *include; include = ARGUMENT(4); if (include == UNSPEC) include = NIL; ocount = ARGUMENT(3); odirection = ARGUMENT(2); otype = ARGUMENT(1); ooffset = ARGUMENT(0); CHECK_INDEX(ooffset); offset = FIXNUM_VALUE(ooffset); for (i = 0; i < 2; i++) if (odirection == scan_directions[i]) break; if (i >= 2) LispDestroy("%s: direction must be " ":LEFT or :RIGHT, not %s", STRFUN(builtin), STROBJ(odirection)); direction = (XawTextScanDirection)i; for (i = 0; i < 6; i++) if (otype == scan_types[i]) break; if (i >= 6) LispDestroy("%s: direction must be " ":POSITIONS, :WHITE-SPACE, :EOL, " ":PARAGRAPH, :ALL, or :ALPHA-NUMERIC, not %s", STRFUN(builtin), STROBJ(otype)); type = (XawTextScanType)i; if (ocount == UNSPEC) count = 1; else { CHECK_INDEX(ocount); count = FIXNUM_VALUE(ocount); } offset = XawTextSourceScan(XawTextGetSource(textwindow), offset, type, direction, count, include != NIL); return (FIXNUM(offset)); } static LispObj * XeditSearch(LispBuiltin *builtin, XawTextScanDirection direction) { XawTextBlock block; XawTextPosition position; LispObj *string, *offset, *ignore_case; ignore_case = ARGUMENT(2); offset = ARGUMENT(1); string = ARGUMENT(0); CHECK_STRING(string); if (offset != UNSPEC) { CHECK_INDEX(offset); position = FIXNUM_VALUE(offset); } else position = XawTextGetInsertionPoint(textwindow); block.firstPos = (ignore_case != UNSPEC && ignore_case != NIL) ? 1 : 0; block.format = FMT8BIT; block.length = STRLEN(string); block.ptr = THESTR(string); position = XawTextSourceSearch(XawTextGetSource(textwindow), position, direction, &block); return (position != XawTextSearchError ? FIXNUM(position) : NIL); } LispObj * Xedit_SearchBackward(LispBuiltin *builtin) /* search-backward string &optional offset ignore-case */ { return (XeditSearch(builtin, XawsdLeft)); } LispObj * Xedit_SearchForward(LispBuiltin *builtin) /* search-forward string &optional offset ignore-case */ { return (XeditSearch(builtin, XawsdRight)); } LispObj * Xedit_VerticalScrollbar(LispBuiltin *builtin) /* vertical-scrollbar &optional state */ { Arg arg[1]; XawTextScrollMode scroll; LispObj *state; state = ARGUMENT(0); if (state != UNSPEC) { scroll = state == NIL ? XawtextScrollNever : XawtextScrollAlways; XtSetArg(arg[0], XtNscrollVertical, scroll); XtSetValues(textwindow, arg, 1); } else { XtSetArg(arg[0], XtNscrollVertical, &scroll); XtGetValues(textwindow, arg, 1); state = scroll == XawtextScrollAlways ? T : NIL; } return (state); } LispObj * Xedit_WrapMode(LispBuiltin *builtin) /* wrap-mode &optional value */ { int i; Arg arg[1]; XawTextWrapMode wrap; LispObj *value; value = ARGUMENT(0); if (value != UNSPEC) { for (i = 0; i < 3; i++) if (value == wrap_modes[i]) break; if (i >= 3) LispDestroy("%s: argument must be " ":NEVER, :LINE, or :WORD, not %s", STRFUN(builtin), STROBJ(value)); XtSetArg(arg[0], XtNwrap, (XawTextWrapMode)i); XtSetValues(textwindow, arg, 1); } else { XtSetArg(arg[0], XtNwrap, &wrap); XtGetValues(textwindow, arg, 1); i = (int)wrap; if (i <= 0 || i >= 3) i = 0; value = wrap_modes[i]; } return (value); } LispObj * Xedit_XrmStringToQuark(LispBuiltin *builtin) /* xrm-string-to-quark string */ { LispObj *string; string = ARGUMENT(0); CHECK_STRING(string); return (INTEGER(XrmStringToQuark(THESTR(string)))); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/require.c0000664000000000000000000001057712472175711016116 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/require.c,v 1.17tsi Exp $ */ #include "lisp/require.h" /* * Implementation */ LispObj * Lisp_Load(LispBuiltin *builtin) /* load filename &key verbose print if-does-not-exist */ { LispObj *filename, *verbose, *print, *if_does_not_exist; if_does_not_exist = ARGUMENT(3); print = ARGUMENT(2); verbose = ARGUMENT(1); filename = ARGUMENT(0); if (PATHNAMEP(filename)) filename = CAR(filename->data.pathname); else { CHECK_STRING(filename); } return (LispLoadFile(filename, verbose != UNSPEC && verbose != NIL, print != UNSPEC && print != NIL, if_does_not_exist != UNSPEC && if_does_not_exist != NIL)); } LispObj * Lisp_Require(LispBuiltin *builtin) /* require module &optional pathname */ { char filename[1024], *ext; int len; LispObj *obj, *module, *pathname; pathname = ARGUMENT(1); module = ARGUMENT(0); CHECK_STRING(module); if (pathname != UNSPEC) { if (PATHNAMEP(pathname)) pathname = CAR(pathname->data.pathname); else { CHECK_STRING(pathname); } } else pathname = module; for (obj = MOD; CONSP(obj); obj = CDR(obj)) { if (strcmp(THESTR(CAR(obj)), THESTR(module)) == 0) return (module); } if (THESTR(pathname)[0] != '/') { #ifdef LISPDIR snprintf(filename, sizeof(filename), "%s", LISPDIR); #else getcwd(filename, sizeof(filename)); #endif } else filename[0] = '\0'; *(filename + sizeof(filename) - 5) = '\0'; /* make sure there is place for ext */ len = strlen(filename); if (!len || filename[len - 1] != '/') { strcat(filename, "/"); ++len; } snprintf(filename + len, sizeof(filename) - len - 5, "%s", THESTR(pathname)); ext = filename + strlen(filename); #ifdef SHARED_MODULES strcpy(ext, ".so"); if (access(filename, R_OK) == 0) { LispModule *lisp_module; char data[64]; int len; if (lisp__data.module == NULL) { /* export our own symbols */ if (dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL) == NULL) LispDestroy("%s: ", STRFUN(builtin), dlerror()); } lisp_module = (LispModule*)LispMalloc(sizeof(LispModule)); if ((lisp_module->handle = dlopen(filename, RTLD_LAZY | RTLD_GLOBAL)) == NULL) LispDestroy("%s: dlopen: %s", STRFUN(builtin), dlerror()); snprintf(data, sizeof(data), "%sLispModuleData", THESTR(module)); if ((lisp_module->data = (LispModuleData*)dlsym(lisp_module->handle, data)) == NULL) { dlclose(lisp_module->handle); LispDestroy("%s: cannot find LispModuleData for %s", STRFUN(builtin), STROBJ(module)); } LispMused(lisp_module); lisp_module->next = lisp__data.module; lisp__data.module = lisp_module; if (lisp_module->data->load) (lisp_module->data->load)(); if (MOD == NIL) MOD = CONS(module, NIL); else { RPLACD(MOD, CONS(CAR(MOD), CDR(MOD))); RPLACA(MOD, module); } LispSetVar(lisp__data.modules, MOD); return (module); } #endif strcpy(ext, ".lsp"); (void)LispLoadFile(STRING(filename), 0, 0, 0); return (module); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/TODO0000664000000000000000000001102712472175711014755 0ustar $XFree86: xc/programs/xedit/lisp/TODO,v 1.8 2002/11/23 08:26:47 paulo Exp $ LAST UPDATED: $Date$ Small todo list o Change function/macro body to know if a &key or &optional argument was not provided, and initialize to the default value in the function, for interpreted and builtin functions it is better done before the function is called, but for bytecode it is better in the function. o Following the previous idea, change function definitions in the format: (defun afun (a &aux b (c (some-code))) ...) to (defun afun (a) (let* ((b (c (some-code)))) ...)) This can significatively reduce bytecode size, and also simplify function calls. o Optimize text redisplay in Xaw, instead of allocating a copy of the buffer for the paint-list, should use the text in place, and only allocate small buffers when required, i.e. displaying control characters, etc. o Add an interface to create new object types dinamically. o Add a special string object to simplify and avoid too many copies of portions of the text buffers. This special string should be read-only and not gc-collected. o Make the bytecode compiler smarter to detect some constructs like: (builtin-or-bytecode-function-call arg1 arg2 (return)) this will not properly restore the internal stacks. o When an Init function is present in every file, call LispAddBuiltin from that initialization function. o Cleanup the code, make it optional to build some uncommon features (as well as the entire interpreter?). Implement more functions directly in lisp. o Finish an "specification" for loadable modules. Write a FFI interface. Without the possibility of using already existing libraries, the interpreter won't be too much useful due to a poor library. It is very desirable to "auto-generate" directly from C header files the interface to the lisp code, and from that, dlload a shared library. In some cases, it is required to link statically with a new interpreter binary, make it easy. o Implement a better string type. That should support characters larger than 8 bits, and that should allow embeded nuls. o Implement a richer set of math functions. This, if properly done can be made a loadable module. o Optmize mathimp.c, comparing a double with a bignum should never cause an error. Implement mp?_initsetXXX functions? o Finish missing features in read.c, and simplify it. o (close) probably should not send a signal when closing a pipe. o Implement "real" vectors, they exist to make access to field elements at constant time, implementing vectors as lists may be very slow. o Use float and double as floating points formats. o Implement support for vectors of "atomic" types. Vectors of floats would be useful for example if a OpenGL binding is done. o Implement a multiple precision floating point format. Either a 128 bits (or configurable length?) IEEE 754 like number, or some format using ratios, a epsilon for rouding, rounding modes, exact/inexact flag, a good amount of guard digits, etc. o Write more functions and optimization for bignums. Try to make the code as reusable as possible, either by other software or at least by the different number types. o Instead of using mathimp.c for a large amount of functions, implement a "generic number" type and implement the calculations directly in the mp library. o Add more missing Common Lisp features, like &allow-other-keys for function definitions, the missing structure features, CLOS etc. o Fix the Postgresql module, make it compile everywhere. o Add support for multi-threaded applications? o Make it possible to know if a object has only one reference, this is required to make "inplace" changes of variables. Very useful for things like (incf) and (decf), and also when dealing with bignums. o Maybe have a freelist for objects depending on the type. Bignums can be reused, and having some large ones expecting to be freed by the gc can consume a lot of memory. o Internationalization. Support ',' in floats? Correctly treat characters for {up,down}-casing. o Synch the Xaw text code for supporting tables, text alignment/paragraphs, etc, and add bindings to the interpreter. Add support for incremental changes of those properties, currently it is "read-only". o Write some type of "hyperlinks", this is the only feature missing to even allow writting a web browser inside xedit. o Write some "demos" (maybe a file manager or a simple mail reader) using the Xt/Xaw bindings (needs modules working in all systems). o Remove all calls to the macros GCDisable and GCEnable. This is unsafe and should be removed. x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/helper.c0000664000000000000000000006353112472175711015717 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/helper.c,v 1.50 2003/05/27 22:27:03 tsi Exp $ */ #include "lisp/helper.h" #include "lisp/pathname.h" #include "lisp/package.h" #include "lisp/read.h" #include "lisp/stream.h" #include "lisp/write.h" #include "lisp/hash.h" #include #include #include #include #include /* * Prototypes */ static LispObj *LispReallyDo(LispBuiltin*, int); static LispObj *LispReallyDoListTimes(LispBuiltin*, int); /* in math.c */ extern LispObj *LispFloatCoerce(LispBuiltin*, LispObj*); /* * Implementation */ LispObj * LispObjectCompare(LispObj *left, LispObj *right, int function) { LispType ltype, rtype; LispObj *result = left == right ? T : NIL; /* If left and right are the same object, or if function is EQ */ if (result == T || function == FEQ) return (result); ltype = OBJECT_TYPE(left); rtype = OBJECT_TYPE(right); /* Equalp requires that numeric objects be compared by value, and * strings or characters comparison be case insenstive */ if (function == FEQUALP) { switch (ltype) { case LispFixnum_t: case LispInteger_t: case LispBignum_t: case LispDFloat_t: case LispRatio_t: case LispBigratio_t: case LispComplex_t: switch (rtype) { case LispFixnum_t: case LispInteger_t: case LispBignum_t: case LispDFloat_t: case LispRatio_t: case LispBigratio_t: case LispComplex_t: result = APPLY2(Oequal_, left, right); break; default: break; } goto compare_done; case LispSChar_t: if (rtype == LispSChar_t && toupper(SCHAR_VALUE(left)) == toupper(SCHAR_VALUE(right))) result = T; goto compare_done; case LispString_t: if (rtype == LispString_t && STRLEN(left) == STRLEN(right)) { long i = STRLEN(left); char *sl = THESTR(left), *sr = THESTR(right); for (--i; i >= 0; i--) if (toupper(sl[i]) != toupper(sr[i])) break; if (i < 0) result = T; } goto compare_done; case LispArray_t: if (rtype == LispArray_t && left->data.array.type == right->data.array.type && left->data.array.rank == right->data.array.rank && LispObjectCompare(left->data.array.dim, right->data.array.dim, FEQUAL) != NIL) { LispObj *llist = left->data.array.list, *rlist = right->data.array.list; for (; CONSP(llist); llist = CDR(llist), rlist = CDR(rlist)) if (LispObjectCompare(CAR(llist), CAR(rlist), FEQUALP) == NIL) break; if (!CONSP(llist)) result = T; } goto compare_done; case LispStruct_t: if (rtype == LispStruct_t && left->data.struc.def == right->data.struc.def) { LispObj *lfield = left->data.struc.fields, *rfield = right->data.struc.fields; for (; CONSP(lfield); lfield = CDR(lfield), rfield = CDR(rfield)) { if (LispObjectCompare(CAR(lfield), CAR(rfield), FEQUALP) != T) break; } if (!CONSP(lfield)) result = T; } goto compare_done; case LispHashTable_t: if (rtype == LispHashTable_t && left->data.hash.table->count == right->data.hash.table->count && left->data.hash.test == right->data.hash.test) { unsigned long i; LispObj *test = left->data.hash.test; LispHashEntry *lentry = left->data.hash.table->entries, *llast = lentry + left->data.hash.table->num_entries, *rentry = right->data.hash.table->entries; for (; lentry < llast; lentry++, rentry++) { if (lentry->count != rentry->count) break; for (i = 0; i < lentry->count; i++) { if (APPLY2(test, lentry->keys[i], rentry->keys[i]) == NIL || LispObjectCompare(lentry->values[i], rentry->values[i], FEQUALP) == NIL) break; } if (i < lentry->count) break; } if (lentry == llast) result = T; } goto compare_done; default: break; } } /* Function is EQL or EQUAL, or EQUALP on arguments with the same rules */ if (ltype == rtype) { switch (ltype) { case LispFixnum_t: case LispSChar_t: if (FIXNUM_VALUE(left) == FIXNUM_VALUE(right)) result = T; break; case LispInteger_t: if (INT_VALUE(left) == INT_VALUE(right)) result = T; break; case LispDFloat_t: if (DFLOAT_VALUE(left) == DFLOAT_VALUE(right)) result = T; break; case LispRatio_t: if (left->data.ratio.numerator == right->data.ratio.numerator && left->data.ratio.denominator == right->data.ratio.denominator) result = T; break; case LispComplex_t: if (LispObjectCompare(left->data.complex.real, right->data.complex.real, function) == T && LispObjectCompare(left->data.complex.imag, right->data.complex.imag, function) == T) result = T; break; case LispBignum_t: if (mpi_cmp(left->data.mp.integer, right->data.mp.integer) == 0) result = T; break; case LispBigratio_t: if (mpr_cmp(left->data.mp.ratio, right->data.mp.ratio) == 0) result = T; break; default: break; } /* Next types must be the same object for EQL */ if (function == FEQL) goto compare_done; switch (ltype) { case LispString_t: if (STRLEN(left) == STRLEN(right) && memcmp(THESTR(left), THESTR(right), STRLEN(left)) == 0) result = T; break; case LispCons_t: if (LispObjectCompare(CAR(left), CAR(right), function) == T && LispObjectCompare(CDR(left), CDR(right), function) == T) result = T; break; case LispQuote_t: case LispBackquote_t: case LispPathname_t: result = LispObjectCompare(left->data.pathname, right->data.pathname, function); break; case LispLambda_t: result = LispObjectCompare(left->data.lambda.name, right->data.lambda.name, function); break; case LispOpaque_t: if (left->data.opaque.data == right->data.opaque.data) result = T; break; case LispRegex_t: /* If the regexs are guaranteed to generate the same matches */ if (left->data.regex.options == right->data.regex.options) result = LispObjectCompare(left->data.regex.pattern, right->data.regex.pattern, function); break; default: break; } } compare_done: return (result); } void LispCheckSequenceStartEnd(LispBuiltin *builtin, LispObj *sequence, LispObj *start, LispObj *end, long *pstart, long *pend, long *plength) { /* Calculate length of sequence and check it's type */ *plength = LispLength(sequence); /* Check start argument */ if (start == UNSPEC || start == NIL) *pstart = 0; else { CHECK_INDEX(start); *pstart = FIXNUM_VALUE(start); } /* Check end argument */ if (end == UNSPEC || end == NIL) *pend = *plength; else { CHECK_INDEX(end); *pend = FIXNUM_VALUE(end); } /* Check start argument */ if (*pstart > *pend) LispDestroy("%s: :START %ld is larger than :END %ld", STRFUN(builtin), *pstart, *pend); /* Check end argument */ if (*pend > *plength) LispDestroy("%s: :END %ld is larger then sequence length %ld", STRFUN(builtin), *pend, *plength); } long LispLength(LispObj *sequence) { long length; if (sequence == NIL) return (0); switch (OBJECT_TYPE(sequence)) { case LispString_t: length = STRLEN(sequence); break; case LispArray_t: if (sequence->data.array.rank != 1) goto not_a_sequence; sequence = sequence->data.array.list; /*FALLTROUGH*/ case LispCons_t: for (length = 0; CONSP(sequence); length++, sequence = CDR(sequence)) ; break; default: not_a_sequence: LispDestroy("LENGTH: %s is not a sequence", STROBJ(sequence)); /*NOTREACHED*/ length = 0; } return (length); } LispObj * LispCharacterCoerce(LispBuiltin *builtin, LispObj *object) { if (SCHARP(object)) return (object); else if (STRINGP(object) && STRLEN(object) == 1) return (SCHAR(THESTR(object)[0])); else if (SYMBOLP(object) && ATOMID(object)->value[1] == '\0') return (SCHAR(ATOMID(object)->value[0])); else if (INDEXP(object)) { int c = FIXNUM_VALUE(object); if (c <= 0xff) return (SCHAR(c)); } else if (object == T) return (SCHAR('T')); LispDestroy("%s: cannot convert %s to character", STRFUN(builtin), STROBJ(object)); /*NOTREACHED*/ return (NIL); } LispObj * LispStringCoerce(LispBuiltin *builtin, LispObj *object) { if (STRINGP(object)) return (object); else if (SYMBOLP(object)) return (LispSymbolName(object)); else if (SCHARP(object)) { char string[1]; string[0] = SCHAR_VALUE(object); return (LSTRING(string, 1)); } else if (object == NIL) return (LSTRING(Snil->value, 3)); else if (object == T) return (LSTRING(St->value, 1)); else LispDestroy("%s: cannot convert %s to string", STRFUN(builtin), STROBJ(object)); /*NOTREACHED*/ return (NIL); } LispObj * LispCoerce(LispBuiltin *builtin, LispObj *object, LispObj *result_type) { LispObj *result = NIL; LispType type = LispNil_t; if (result_type == NIL) /* not even NIL can be converted to NIL? */ LispDestroy("%s: cannot convert %s to NIL", STRFUN(builtin), STROBJ(object)); else if (result_type == T) /* no conversion */ return (object); else if (!SYMBOLP(result_type)) /* only know about simple types */ LispDestroy("%s: bad argument %s", STRFUN(builtin), STROBJ(result_type)); else { /* check all known types */ Atom_id atom = ATOMID(result_type); if (atom == Satom) { if (CONSP(object)) goto coerce_fail; return (object); } /* only convert ATOM to SYMBOL */ if (atom == Sfloat) type = LispDFloat_t; else if (atom == Sinteger) type = LispInteger_t; else if (atom == Scons || atom == Slist) { if (object == NIL) return (object); type = LispCons_t; } else if (atom == Sstring) type = LispString_t; else if (atom == Scharacter) type = LispSChar_t; else if (atom == Scomplex) type = LispComplex_t; else if (atom == Svector || atom == Sarray) type = LispArray_t; else if (atom == Sopaque) type = LispOpaque_t; else if (atom == Srational) type = LispRatio_t; else if (atom == Spathname) type = LispPathname_t; else LispDestroy("%s: invalid type specification %s", STRFUN(builtin), ATOMID(result_type)->value); } if (OBJECT_TYPE(object) == LispOpaque_t) { switch (type) { case LispAtom_t: result = ATOM(object->data.opaque.data); break; case LispString_t: result = STRING(object->data.opaque.data); break; case LispSChar_t: result = SCHAR((unsigned long)object->data.opaque.data); break; case LispDFloat_t: result = DFLOAT((double)((long)object->data.opaque.data)); break; case LispInteger_t: result = INTEGER(((long)object->data.opaque.data)); break; case LispOpaque_t: result = OPAQUE(object->data.opaque.data, 0); break; default: goto coerce_fail; break; } } else if (OBJECT_TYPE(object) != type) { switch (type) { case LispInteger_t: if (INTEGERP(object)) result = object; else if (DFLOATP(object)) { if ((long)DFLOAT_VALUE(object) == DFLOAT_VALUE(object)) result = INTEGER((long)DFLOAT_VALUE(object)); else { mpi *integer = LispMalloc(sizeof(mpi)); mpi_init(integer); mpi_setd(integer, DFLOAT_VALUE(object)); if (mpi_getd(integer) != DFLOAT_VALUE(object)) { mpi_clear(integer); LispFree(integer); goto coerce_fail; } result = BIGNUM(integer); } } else goto coerce_fail; break; case LispRatio_t: if (DFLOATP(object)) { mpr *ratio = LispMalloc(sizeof(mpr)); mpr_init(ratio); mpr_setd(ratio, DFLOAT_VALUE(object)); if (mpr_fiti(ratio)) { result = RATIO(mpi_geti(mpr_num(ratio)), mpi_geti(mpr_den(ratio))); mpr_clear(ratio); LispFree(ratio); } else result = BIGRATIO(ratio); } else if (RATIONALP(object)) result = object; else goto coerce_fail; break; case LispDFloat_t: result = LispFloatCoerce(builtin, object); break; case LispComplex_t: if (NUMBERP(object)) result = object; else goto coerce_fail; break; case LispString_t: if (object == NIL) result = STRING(""); else result = LispStringCoerce(builtin, object); break; case LispSChar_t: result = LispCharacterCoerce(builtin, object); break; case LispArray_t: if (LISTP(object)) result = VECTOR(object); else goto coerce_fail; break; case LispCons_t: if (ARRAYP(object) && object->data.array.rank == 1) result = object->data.array.list; else goto coerce_fail; break; case LispPathname_t: result = APPLY1(Oparse_namestring, object); break; default: goto coerce_fail; } } else result = object; return (result); coerce_fail: LispDestroy("%s: cannot convert %s to %s", STRFUN(builtin), STROBJ(object), ATOMID(result_type)->value); /* NOTREACHED */ return (NIL); } static LispObj * LispReallyDo(LispBuiltin *builtin, int refs) /* do init test &rest body do* init test &rest body */ { GC_ENTER(); int stack, lex, head; LispObj *list, *symbol, *value, *values, *cons; LispObj *init, *test, *body; body = ARGUMENT(2); test = ARGUMENT(1); init = ARGUMENT(0); if (!CONSP(test)) LispDestroy("%s: end test condition must be a list, not %s", STRFUN(builtin), STROBJ(init)); CHECK_LIST(init); /* Save state */ stack = lisp__data.stack.length; lex = lisp__data.env.lex; head = lisp__data.env.length; values = cons = NIL; for (list = init; CONSP(list); list = CDR(list)) { symbol = CAR(list); if (!SYMBOLP(symbol)) { CHECK_CONS(symbol); value = CDR(symbol); symbol = CAR(symbol); CHECK_SYMBOL(symbol); CHECK_CONS(value); value = EVAL(CAR(value)); } else value = NIL; CHECK_CONSTANT(symbol); LispAddVar(symbol, value); /* Bind variable now */ if (refs) { ++lisp__data.env.head; } else { if (values == NIL) { values = cons = CONS(NIL, NIL); GC_PROTECT(values); } else { RPLACD(cons, CONS(NIL, NIL)); cons = CDR(cons); } } } if (!refs) lisp__data.env.head = lisp__data.env.length; for (;;) { if (EVAL(CAR(test)) != NIL) break; /* TODO Run this code in an implicit tagbody */ for (list = body; CONSP(list); list = CDR(list)) (void)EVAL(CAR(list)); /* Error checking already done in the initialization */ for (list = init, cons = values; CONSP(list); list = CDR(list)) { symbol = CAR(list); if (CONSP(symbol)) { value = CDDR(symbol); symbol = CAR(symbol); if (CONSP(value)) value = EVAL(CAR(value)); else value = NIL; } else value = NIL; if (refs) LispSetVar(symbol, value); else { RPLACA(cons, value); cons = CDR(cons); } } if (!refs) { for (list = init, cons = values; CONSP(list); list = CDR(list), cons = CDR(cons)) { symbol = CAR(list); if (CONSP(symbol)) { if (CONSP(CDR(symbol))) LispSetVar(CAR(symbol), CAR(cons)); } } } } if (CONSP(CDR(test))) value = EVAL(CADR(test)); else value = NIL; /* Restore state */ lisp__data.stack.length = stack; lisp__data.env.lex = lex; lisp__data.env.head = lisp__data.env.length = head; GC_LEAVE(); return (value); } LispObj * LispDo(LispBuiltin *builtin, int refs) /* do init test &rest body do* init test &rest body */ { int jumped; LispObj *result; LispBlock *block; jumped = 1; result = NIL; block = LispBeginBlock(NIL, LispBlockTag); if (setjmp(block->jmp) == 0) { result = LispReallyDo(builtin, refs); jumped = 0; } LispEndBlock(block); if (jumped) result = lisp__data.block.block_ret; return (result); } static LispObj * LispReallyDoListTimes(LispBuiltin *builtin, int times) /* dolist init &rest body dotimes init &rest body */ { GC_ENTER(); int head = lisp__data.env.length; long count = 0, end = 0; LispObj *symbol, *value = NIL, *result = NIL, *init, *body, *object; body = ARGUMENT(1); init = ARGUMENT(0); /* Parse arguments */ CHECK_CONS(init); symbol = CAR(init); CHECK_SYMBOL(symbol); init = CDR(init); if (init == NIL) { if (times) LispDestroy("%s: NIL is not a number", STRFUN(builtin)); } else { CHECK_CONS(init); value = CAR(init); init = CDR(init); if (init != NIL) { CHECK_CONS(init); result = CAR(init); } value = EVAL(value); if (times) { CHECK_INDEX(value); end = FIXNUM_VALUE(value); } else { CHECK_LIST(value); /* Protect iteration control from gc */ GC_PROTECT(value); } } /* The variable is only bound inside the loop, so it is safe to optimize * it out if there is no code to execute. But the result form may reference * the bound variable. */ if (!CONSP(body)) { if (times) count = end; else value = NIL; } /* Initialize counter */ CHECK_CONSTANT(symbol); if (times) LispAddVar(symbol, FIXNUM(count)); else LispAddVar(symbol, CONSP(value) ? CAR(value) : value); ++lisp__data.env.head; if (!CONSP(body) || (times && count >= end) || (!times && !CONSP(value))) goto loop_done; /* Execute iterations */ for (;;) { for (object = body; CONSP(object); object = CDR(object)) (void)EVAL(CAR(object)); /* Update symbols and check exit condition */ if (times) { ++count; LispSetVar(symbol, FIXNUM(count)); if (count >= end) break; } else { value = CDR(value); if (!CONSP(value)) { LispSetVar(symbol, NIL); break; } LispSetVar(symbol, CAR(value)); } } loop_done: result = EVAL(result); lisp__data.env.head = lisp__data.env.length = head; GC_LEAVE(); return (result); } LispObj * LispDoListTimes(LispBuiltin *builtin, int times) /* dolist init &rest body dotimes init &rest body */ { int did_jump, *pdid_jump = &did_jump; LispObj *result, **presult = &result; LispBlock *block; *presult = NIL; *pdid_jump = 1; block = LispBeginBlock(NIL, LispBlockTag); if (setjmp(block->jmp) == 0) { result = LispReallyDoListTimes(builtin, times); did_jump = 0; } LispEndBlock(block); if (did_jump) result = lisp__data.block.block_ret; return (result); } LispObj * LispLoadFile(LispObj *filename, int verbose, int print, int ifdoesnotexist) { LispObj *stream, *cod, *obj, *result; int ch; LispObj *savepackage; LispPackage *savepack; if (verbose) LispMessage("; Loading %s", THESTR(filename)); if (ifdoesnotexist) { GC_ENTER(); result = CONS(filename, CONS(Kif_does_not_exist, CONS(Kerror, NIL))); GC_PROTECT(result); stream = APPLY(Oopen, result); GC_LEAVE(); } else stream = APPLY1(Oopen, filename); if (stream == NIL) return (NIL); result = NIL; LispPushInput(stream); ch = LispGet(); if (ch != '#') LispUnget(ch); else if ((ch = LispGet()) == '!') { for (;;) { ch = LispGet(); if (ch == '\n' || ch == EOF) break; } } else { LispUnget(ch); LispUnget('#'); } /* Save package environment */ savepackage = PACKAGE; savepack = lisp__data.pack; cod = COD; /*CONSTCOND*/ while (1) { if ((obj = LispRead()) != NULL) { result = EVAL(obj); COD = cod; if (print) { int i; if (RETURN_COUNT >= 0) LispPrint(result, NIL, 1); for (i = 0; i < RETURN_COUNT; i++) LispPrint(RETURN(i), NIL, 1); } } if (lisp__data.eof) break; } LispPopInput(stream); /* Restore package environment */ PACKAGE = savepackage; lisp__data.pack = savepack; APPLY1(Oclose, stream); return (T); } void LispGetStringArgs(LispBuiltin *builtin, char **string1, char **string2, long *start1, long *end1, long *start2, long *end2) { long length1, length2; LispObj *ostring1, *ostring2, *ostart1, *oend1, *ostart2, *oend2; oend2 = ARGUMENT(5); ostart2 = ARGUMENT(4); oend1 = ARGUMENT(3); ostart1 = ARGUMENT(2); ostring2 = ARGUMENT(1); ostring1 = ARGUMENT(0); CHECK_STRING(ostring1); *string1 = THESTR(ostring1); length1 = STRLEN(ostring1); CHECK_STRING(ostring2); *string2 = THESTR(ostring2); length2 = STRLEN(ostring2); if (ostart1 == UNSPEC) *start1 = 0; else { CHECK_INDEX(ostart1); *start1 = FIXNUM_VALUE(ostart1); } if (oend1 == UNSPEC) *end1 = length1; else { CHECK_INDEX(oend1); *end1 = FIXNUM_VALUE(oend1); } if (ostart2 == UNSPEC) *start2 = 0; else { CHECK_INDEX(ostart2); *start2 = FIXNUM_VALUE(ostart2); } if (oend2 == UNSPEC) *end2 = length2; else { CHECK_INDEX(oend2); *end2 = FIXNUM_VALUE(oend2); } if (*start1 > *end1) LispDestroy("%s: :START1 %ld larger than :END1 %ld", STRFUN(builtin), *start1, *end1); if (*start2 > *end2) LispDestroy("%s: :START2 %ld larger than :END2 %ld", STRFUN(builtin), *start2, *end2); if (*end1 > length1) LispDestroy("%s: :END1 %ld larger than string length %ld", STRFUN(builtin), *end1, length1); if (*end2 > length2) LispDestroy("%s: :END2 %ld larger than string length %ld", STRFUN(builtin), *end2, length2); } LispObj * LispPathnameField(int field, int string) { int offset = field; LispObj *pathname, *result, *object; pathname = ARGUMENT(0); if (!PATHNAMEP(pathname)) pathname = APPLY1(Oparse_namestring, pathname); result = pathname->data.pathname; while (offset) { result = CDR(result); --offset; } object = result; result = CAR(result); if (string) { if (!STRINGP(result)) { if (result == NIL) result = STRING(""); else if (field == PATH_DIRECTORY) { char *name = THESTR(CAR(pathname->data.pathname)), *ptr; ptr = strrchr(name, PATH_SEP); if (ptr) { int length = ptr - name + 1; char data[PATH_MAX]; if (length > PATH_MAX - 1) length = PATH_MAX - 1; strncpy(data, name, length); data[length] = '\0'; result = STRING(data); } else result = STRING(""); } else result = Kunspecific; } else if (field == PATH_NAME) { object = CAR(CDR(object)); if (STRINGP(object)) { int length; char name[PATH_MAX + 1]; strcpy(name, THESTR(result)); length = STRLEN(result); if (length + 1 < sizeof(name)) { name[length++] = PATH_TYPESEP; name[length] = '\0'; } if (STRLEN(object) + length < sizeof(name)) strcpy(name + length, THESTR(object)); /* else LispDestroy ... */ result = STRING(name); } } } return (result); } LispObj * LispProbeFile(LispBuiltin *builtin, int probe) { GC_ENTER(); LispObj *result; char *name = NULL, resolved[PATH_MAX + 1]; struct stat st; LispObj *pathname; pathname = ARGUMENT(0); if (!POINTERP(pathname)) goto bad_pathname; if (XSTRINGP(pathname)) name = THESTR(pathname); else if (XPATHNAMEP(pathname)) name = THESTR(CAR(pathname->data.pathname)); else if (STREAMP(pathname) && pathname->data.stream.type == LispStreamFile) name = THESTR(CAR(pathname->data.stream.pathname->data.pathname)); #ifndef __UNIXOS2__ if (realpath(name, &resolved[0]) == NULL || stat(resolved, &st)) { #else if ((name == NULL) || stat(resolved, &st)) { #endif if (probe) return (NIL); LispDestroy("%s: realpath(\"%s\"): %s", STRFUN(builtin), name, strerror(errno)); } if (S_ISDIR(st.st_mode)) { int length = strlen(resolved); if (!length || resolved[length - 1] != PATH_SEP) { resolved[length++] = PATH_SEP; resolved[length] = '\0'; } } result = STRING(resolved); GC_PROTECT(result); result = APPLY1(Oparse_namestring, result); GC_LEAVE(); return (result); bad_pathname: LispDestroy("%s: bad pathname %s", STRFUN(builtin), STROBJ(pathname)); /*NOTREACHED*/ return (NIL); } LispObj * LispWriteString_(LispBuiltin *builtin, int newline) /* write-line string &optional output-stream &key start end write-string string &optional output-stream &key start end */ { char *text; long start, end, length; LispObj *string, *output_stream, *ostart, *oend; oend = ARGUMENT(3); ostart = ARGUMENT(2); output_stream = ARGUMENT(1); string = ARGUMENT(0); CHECK_STRING(string); LispCheckSequenceStartEnd(builtin, string, ostart, oend, &start, &end, &length); if (output_stream == UNSPEC) output_stream = NIL; text = THESTR(string); if (end > start) LispWriteStr(output_stream, text + start, end - start); if (newline) LispWriteChar(output_stream, '\n'); return (string); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/hash.h0000664000000000000000000000465512472175711015372 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/hash.h,v 1.2tsi Exp $ */ #ifndef Lisp_hash_h #define Lisp_hash_h #include "lisp/private.h" typedef struct _LispHashEntry { LispObj **keys; LispObj **values; long cache; long count; } LispHashEntry; struct _LispHashTable { LispHashEntry *entries; long num_entries; long count; int function; /* Function is EQ, EQL, EQUAL, or EQUALP */ double rehash_size; double rehash_threshold; }; /* * Prototypes */ void LispFreeHashTable(LispHashTable*); LispObj *Lisp_Clrhash(LispBuiltin*); LispObj *Lisp_Gethash(LispBuiltin*); LispObj *Lisp_HashTableCount(LispBuiltin*); LispObj *Lisp_HashTableP(LispBuiltin*); LispObj *Lisp_HashTableRehashSize(LispBuiltin*); LispObj *Lisp_HashTableRehashThreshold(LispBuiltin*); LispObj *Lisp_HashTableSize(LispBuiltin*); LispObj *Lisp_HashTableTest(LispBuiltin*); LispObj *Lisp_Maphash(LispBuiltin*); LispObj *Lisp_MakeHashTable(LispBuiltin*); LispObj *Lisp_Remhash(LispBuiltin*); LispObj *Lisp_XeditPuthash(LispBuiltin*); #endif /* Lisp_hash_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/bytecode.h0000664000000000000000000002207512472175711016241 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/bytecode.h,v 1.5tsi Exp $ */ #include "lisp/private.h" #ifndef Lisp_Bytecode_h #define Lisp_Bytecode_h /* Number of arguments for &REST functions with no side effects, * i.e. does not need to allocate new cells to build argument list. * If this value is changed, it is also required to add more * XBC_BCONS? opcodes and change ExecuteBytecode() */ #define MAX_BCONS 8 typedef enum { XBP_CONSP, XBP_LISTP, XBP_NUMBERP } LispBytePredicate; typedef enum { XBC_NOOP, XBC_INV, /* If NIL loaded, change to T else to NIL */ XBC_NIL, /* Load NIL */ XBC_T, /* Load T */ XBC_PRED, /* Preffix for predicate test */ /* Followed by byte indicating test */ XBC_CAR, /* Set loaded value to it's car */ XBC_CDR, /* Set loaded value to it's cdr */ XBC_CAR_SET, /* Set local variable to CAR or CDR of loaded value */ XBC_CDR_SET, /* Offset of local variable follows */ /* Sets C[AD]R of top of builtin stack with * loaded value and pop builtin stack */ XBC_RPLACA, XBC_RPLACD, /* Push only one argument in builtin stack, and call directly * LispObjectCompare without the need of pushing the second arguument */ XBC_EQ, XBC_EQL, XBC_EQUAL, XBC_EQUALP, XBC_LENGTH, XBC_LAST, XBC_NTHCDR, XBC_CAR_PUSH, /* Pushes CAR or CDR of loaded value to builtin stack */ XBC_CDR_PUSH, XBC_PUSH, /* Push argument in builtin stack */ XBC_PUSH_NIL, /* Pushes NIL in builtin stack */ XBC_PUSH_UNSPEC, /* Pushes # in builtin stack */ XBC_PUSH_T, /* Pushes T in builtin stack */ XBC_PUSH_NIL_N, /* Pushes NIL in the builtin stack N times */ XBC_PUSH_UNSPEC_N, /* Pushes # in the builtin stack N times */ /* The builtin stack base is saved when entering the bytecode * interpreter, and the bytecode does not reenter from builtin * functions, yet, so there is no need, for XBC_BSAVE and * XBC_BREST instructions */ XBC_LET, /* Push loaded value to stack */ XBC_LETX, /* Push loaded value to stack and bind */ /* Next byte(s) are the symbol offset */ XBC_LET_NIL, /* Push loaded value to stack */ XBC_LETX_NIL, /* Push loaded value to stack and bind */ /* Next byte(s) are the symbol offset */ XBC_LETBIND, /* Bind locally added variables */ /* Followed by number of symbols to bind */ XBC_UNLET, /* Unbind locally binded variables */ /* Followed by number of symbols to unbind */ XBC_LOAD, /* Load argument already from the stack */ /* Followed by offset follows the opcode */ XBC_LOAD_LET, /* Load argument and push */ XBC_LOAD_LETX, /* Load argument, push and bind */ /* Followed by a short and the atom to be bound */ XBC_LOAD_PUSH, XBC_LOADCON, /* Load a literal constant */ /* Next bytes are the constant object */ XBC_LOADCON_LET, /* Load a literal constant and push */ XBC_LOADCON_LETX, /* Load a literal constant, push and bind */ /* Followed by object constant and symbol to be bound */ XBC_LOADCON_PUSH, /* Load CAR or CDR of local variable */ XBC_LOAD_CAR, XBC_LOAD_CDR, /* Change local variable value to it's CAR or CDR */ XBC_LOAD_CAR_STORE, XBC_LOAD_CDR_STORE, XBC_LOADCON_SET, /* Followed by constant offset and local variable offset */ XBC_LOADSYM, /* Load object symbol value */ /* The object atom pointer follows de opcode */ XBC_LOADSYM_LET, /* Load object symbol value and push */ XBC_LOADSYM_LETX, /* Load object symbol value, push and bind */ /* The symbol atom name and bounded atom name to be bound follows */ XBC_LOADSYM_PUSH, XBC_LOAD_SET, /* Set value of local variable to the value of another */ /* Followed by two shorts */ XBC_LOAD_CAR_SET, /* Like LOAD_SET, but apply CAR or CDR in the value */ XBC_LOAD_CDR_SET, XBC_SET, /* Change value of local variable */ /* A short integer with relative offset follows opcode */ XBC_SETSYM, /* Change value of symbol */ /* The atom symbol pointer follows opcode */ XBC_SET_NIL, /* Like XBC_SET but sets the local variable to NIL */ XBC_CALL, /* Call builtin function */ /* 1 byte follows telling how many arguments to use */ /* LispBuiltin pointer follows opcode */ XBC_CALL_SET, /* Like BCALL, but also followed by an short index of local variable */ XBC_BYTECALL, /* Call bytecode */ /* 1 byte for number of arguments */ /* 1 byte for index in bytecode table */ XBC_FUNCALL, /* Opcode followed by function and arguments objects, to * be evaluated at run time, as it was not resolved at * bytecode generation time (or is not implemented in * the bytecode compiler) */ XBC_LETREC, /* Recursive function call */ /* 1 byte follows telling how many arguments the funtion receives */ /* Helper for math functions. Uses a preallocated CONS, * setting it's CAR to the loaded value, and in the same step * pushes the CONS to the builtin stack */ XBC_BCONS, /* Like BCONS but it is a list of 2 arguments, first argument * is saved on the stack, replace with list of 2 arguments */ XBC_BCONS1, /* Like BCONS1 but it is a list of 3 arguments, first arguments * are saved on the stack, replace with list of first stack * argument with list or 3 arguments, and pop stack */ XBC_BCONS2, XBC_BCONS3, XBC_BCONS4, XBC_BCONS5, XBC_BCONS6, XBC_BCONS7, /* Build a CONS */ XBC_CCONS, /* Make CONS of two constants */ /* Constants follow opcode */ XBC_CSTAR, /* Save the CAR of the CONS */ XBC_CFINI, /* Loaded value is the CDR */ /* These are to help in interactively building lists */ XBC_LSTAR, /* Start building a list in the gc protected stack */ XBC_LCONS, /* Add loaded object to list */ XBC_LFINI, /* List is finished */ /* Inconditional jumps */ XBC_JUMP, /* Jump relative to following signed int */ /* Conditional jumps, if true */ XBC_JUMPT, /* Jump relative to following signed int */ /* Conditional jumps, if false */ XBC_JUMPNIL, /* Jump relative to following signed int */ /* Structure field access and type check */ XBC_STRUCT, XBC_STRUCTP, XBC_RETURN /* Resume bytecode execution */ } LispByteOpcode; struct _LispBytecode { unsigned char *code; /* Bytecode data */ long length; /* length of bytecode stream */ }; /* * Prototypes */ void LispBytecodeInit(void); LispObj *Lisp_Compile(LispBuiltin*); LispObj *Lisp_Disassemble(LispBuiltin*); LispObj *LispCompileForm(LispObj*); LispObj *LispExecuteBytecode(LispObj*); void Com_And(LispCom*, LispBuiltin*); void Com_Block(LispCom*, LispBuiltin*); void Com_C_r(LispCom*, LispBuiltin*); void Com_Cond(LispCom*, LispBuiltin*); void Com_Cons(LispCom*, LispBuiltin*); void Com_Consp(LispCom*, LispBuiltin*); void Com_Dolist(LispCom*, LispBuiltin*); void Com_Eq(LispCom*, LispBuiltin*); void Com_Go(LispCom*, LispBuiltin*); void Com_If(LispCom*, LispBuiltin*); void Com_Last(LispCom*, LispBuiltin*); void Com_Length(LispCom*, LispBuiltin*); void Com_Let(LispCom*, LispBuiltin*); void Com_Letx(LispCom*, LispBuiltin*); void Com_Listp(LispCom*, LispBuiltin*); void Com_Loop(LispCom*, LispBuiltin*); void Com_Nthcdr(LispCom*, LispBuiltin*); void Com_Null(LispCom*, LispBuiltin*); void Com_Numberp(LispCom*, LispBuiltin*); void Com_Or(LispCom*, LispBuiltin*); void Com_Progn(LispCom*, LispBuiltin*); void Com_Return(LispCom*, LispBuiltin*); void Com_ReturnFrom(LispCom*, LispBuiltin*); void Com_Rplac_(LispCom*, LispBuiltin*); void Com_Setq(LispCom*, LispBuiltin*); void Com_Tagbody(LispCom*, LispBuiltin*); void Com_Unless(LispCom*, LispBuiltin*); void Com_Until(LispCom*, LispBuiltin*); void Com_When(LispCom*, LispBuiltin*); void Com_While(LispCom*, LispBuiltin*); #endif /* Lisp_Bytecode_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/io.c0000664000000000000000000003565012472175711015050 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/io.c,v 1.16tsi Exp $ */ #include "lisp/io.h" #include #include #include #include #include /* Match the FILE_XXX flags */ #define READ_BIT 0x01 #define WRITE_BIT 0x02 #define APPEND_BIT 0x04 #define BUFFERED_BIT 0x08 #define UNBUFFERED_BIT 0x10 #define BINARY_BIT 0x20 /* * Initialization */ extern int pagesize; /* * Implementation */ int LispGet(void) { int ch = EOF; LispUngetInfo *unget = lisp__data.unget[lisp__data.iunget]; if (unget->offset) ch = ((unsigned char*)unget->buffer)[--unget->offset]; else if (SINPUT->data.stream.readable) { LispFile *file = NULL; switch (SINPUT->data.stream.type) { case LispStreamStandard: case LispStreamFile: file = FSTREAMP(SINPUT); break; case LispStreamPipe: file = IPSTREAMP(SINPUT); break; case LispStreamString: ch = LispSgetc(SSTREAMP(SINPUT)); break; default: ch = EOF; break; } if (file != NULL) { if (file->nonblock) { if (fcntl(file->descriptor, F_SETFL, 0) < 0) LispDestroy("fcntl: %s", strerror(errno)); file->nonblock = 0; } ch = LispFgetc(file); } } else LispDestroy("cannot read from *STANDARD-INPUT*"); if (ch == EOF) lisp__data.eof = 1; return (ch); } int LispUnget(int ch) { LispUngetInfo *unget = lisp__data.unget[lisp__data.iunget]; if ((ch & 0xff) == ch) { if (unget->offset == sizeof(unget->buffer)) { LispWarning("character %c lost at LispUnget()", unget->buffer[0]); memmove(unget->buffer, unget->buffer + 1, unget->offset - 1); unget->buffer[unget->offset - 1] = ch; } else unget->buffer[unget->offset++] = ch; } return (ch); } void LispPushInput(LispObj *stream) { if (!STREAMP(stream) || !stream->data.stream.readable) LispDestroy("bad stream at PUSH-INPUT"); lisp__data.input_list = CONS(stream, lisp__data.input_list); SINPUT = stream; if (lisp__data.iunget + 1 == lisp__data.nunget) { LispUngetInfo **info = realloc(lisp__data.unget, sizeof(LispUngetInfo) * (lisp__data.nunget + 1)); if (!info || (info[lisp__data.nunget] = calloc(1, sizeof(LispUngetInfo))) == NULL) LispDestroy("out of memory"); lisp__data.unget = info; ++lisp__data.nunget; } ++lisp__data.iunget; memset(lisp__data.unget[lisp__data.iunget], '\0', sizeof(LispUngetInfo)); lisp__data.eof = 0; } void LispPopInput(LispObj *stream) { if (!CONSP(lisp__data.input_list) || stream != CAR(lisp__data.input_list)) LispDestroy("bad stream at POP-INPUT"); lisp__data.input_list = CDR(lisp__data.input_list); SINPUT = CONSP(lisp__data.input_list) ? CAR(lisp__data.input_list) : lisp__data.input_list; --lisp__data.iunget; lisp__data.eof = 0; } /* * Low level functions */ static int calculate_line(const void *data, int size) { int line = 0; const char *str, *ptr; for (str = (const char *)data, ptr = (const char *)data + size; str < ptr; str++) if (*ptr == '\n') ++line; return (line); } static int calculate_column(const void *data, int size, int column) { const char *str, *ptr; /* search for newline in data */ for (str = (const char *)data, ptr = (const char *)data + size - 1; ptr >= str; ptr--) if (*ptr == '\n') break; /* newline found */ if (ptr >= str) return (size - (ptr - str) - 1); /* newline not found */ return (column + size); } LispFile * LispFdopen(int descriptor, int mode) { LispFile *file = calloc(1, sizeof(LispFile)); if (file) { struct stat st; file->descriptor = descriptor; file->readable = (mode & READ_BIT) != 0; file->writable = (mode & WRITE_BIT) != 0; if (fstat(descriptor, &st) == 0) file->regular = S_ISREG(st.st_mode); else file->regular = 0; file->buffered = (mode & BUFFERED_BIT) != 0; if ((mode & UNBUFFERED_BIT) == 0) file->buffered = file->regular; if (file->buffered) { file->buffer = malloc(pagesize); if (file->buffer == NULL) file->buffered = 0; } file->line = 1; file->binary = (mode & BINARY_BIT) != 0; file->io_write = write; } return (file); } LispFile * LispFopen(const char *path, int mode) { LispFile *file; int descriptor; int flags = O_NOCTTY; /* check read/write attributes */ if ((mode & (READ_BIT | WRITE_BIT)) == (READ_BIT | WRITE_BIT)) flags |= O_RDWR; else if (mode & READ_BIT) flags |= O_RDONLY; else if (mode & WRITE_BIT) flags |= O_WRONLY; /* create if does not exist */ if (mode & WRITE_BIT) { flags |= O_CREAT; /* append if exists? */ if (mode & APPEND_BIT) flags |= O_APPEND; else flags |= O_TRUNC; } /* open file */ descriptor = open(path, flags, 0666); if (descriptor < 0) return (NULL); /* initialize LispFile structure */ file = LispFdopen(descriptor, mode); if (file == NULL) close(descriptor); return (file); } void LispFclose(LispFile *file) { /* flush any pending output */ LispFflush(file); /* cleanup */ close(file->descriptor); if (file->buffer) free(file->buffer); free(file); } io_write_fn LispSetFileWrite(LispFile *file, io_write_fn new_write) { io_write_fn old_write = file->io_write; file->io_write = new_write; return (old_write); } int LispFflush(LispFile *file) { if (file->writable && file->length) { int length = (*file->io_write)(file->descriptor, file->buffer, file->length); if (length > 0) { if (file->length > length) memmove(file->buffer, file->buffer + length, file->length - length); file->length -= length; } return (length); } return (0); } int LispFungetc(LispFile *file, int ch) { if (file->readable) { file->available = 1; file->unget = ch; /* this should never happen */ if (ch == '\n' && !file->binary) --file->line; } return (ch); } int LispFgetc(LispFile *file) { int ch; if (file->readable) { unsigned char c; if (file->available) { ch = file->unget; file->available = 0; } else if (file->buffered) { if (file->writable) { LispFflush(file); if (read(file->descriptor, &c, 1) == 1) ch = c; else ch = EOF; } else { if (file->offset < file->length) ch = ((unsigned char*)file->buffer)[file->offset++]; else { int length = read(file->descriptor, file->buffer, pagesize); if (length >= 0) file->length = length; else file->length = 0; file->offset = 0; if (file->length) ch = ((unsigned char*)file->buffer)[file->offset++]; else ch = EOF; } } } else if (read(file->descriptor, &c, 1) == 1) ch = c; else ch = EOF; } else ch = EOF; if (ch == '\n' && !file->binary) ++file->line; return (ch); } int LispFputc(LispFile *file, int ch) { if (file->writable) { unsigned char c = ch; if (file->buffered) { if (file->length + 1 >= pagesize) LispFflush(file); file->buffer[file->length++] = c; } else if ((*file->io_write)(file->descriptor, &c, 1) != 1) ch = EOF; if (!file->binary) { /* update column number */ if (ch == '\n') file->column = 0; else ++file->column; } } return (ch); } int LispSgetc(LispString *string) { int ch; if (string->input >= string->length) return (EOF); /* EOF reading from string */ ch = ((unsigned char*)string->string)[string->input++]; if (ch == '\n' && !string->binary) ++string->line; return (ch); } int LispSputc(LispString *string, int ch) { if (string->output + 1 >= string->space) { if (string->fixed) return (EOF); else { char *tmp = realloc(string->string, string->space + pagesize); if (tmp == NULL) return (EOF); string->string = tmp; string->space += pagesize; } } string->string[string->output++] = ch; if (string->length < string->output) string->length = string->output; /* update column number */ if (!string->binary) { if (ch == '\n') string->column = 0; else ++string->column; } return (ch); } char * LispFgets(LispFile *file, char *string, int size) { int ch, offset = 0; if (size < 1) return (string); for (;;) { if (offset + 1 >= size) break; if ((ch = LispFgetc(file)) == EOF) break; string[offset++] = ch; /* line number is calculated in LispFgetc */ if (ch == '\n') break; } string[offset] = '\0'; return (offset ? string : NULL); } int LispFputs(LispFile *file, const char *buffer) { return (LispFwrite(file, buffer, strlen(buffer))); } int LispSputs(LispString *string, const char *buffer) { return (LispSwrite(string, buffer, strlen(buffer))); } int LispFread(LispFile *file, void *data, int size) { int bytes, length; char *buffer; if (!file->readable) return (EOF); if (size <= 0) return (size); length = 0; buffer = (char*)data; /* check if there is an unget character */ if (file->available) { *buffer++ = file->unget; file->available = 0; if (--size == 0) { if (file->unget == '\n' && !file->binary) ++file->line; return (1); } length = 1; } if (file->buffered) { void *base_data = (char*)data - length; if (file->writable) { LispFflush(file); bytes = read(file->descriptor, buffer, size); if (bytes < 0) bytes = 0; if (!file->binary) file->line += calculate_line(base_data, length + bytes); return (length + bytes); } /* read anything that is in the buffer */ if (file->offset < file->length) { bytes = file->length - file->offset; if (bytes > size) bytes = size; memcpy(buffer, file->buffer + file->offset, bytes); buffer += bytes; file->offset += bytes; size -= bytes; } /* if there is still something to read */ if (size) { bytes = read(file->descriptor, buffer, size); if (bytes < 0) bytes = 0; length += bytes; } if (!file->binary) file->line += calculate_line(base_data, length); return (length); } bytes = read(file->descriptor, buffer, size); if (bytes < 0) bytes = 0; if (!file->binary) file->line += calculate_line(buffer - length, length + bytes); return (length + bytes); } int LispFwrite(LispFile *file, const void *data, int size) { if (!file->writable || size < 0) return (EOF); if (!file->binary) file->column = calculate_column(data, size, file->column); if (file->buffered) { int length, bytes; const char *buffer = (const char *)data; length = 0; if (size + file->length > pagesize) { /* fill remaining space in buffer and flush */ bytes = pagesize - file->length; memcpy(file->buffer + file->length, buffer, bytes); file->length += bytes; LispFflush(file); /* check if all data was written */ if (file->length) return (pagesize - file->length); length = bytes; buffer += bytes; size -= bytes; } while (size > pagesize) { /* write multiple of pagesize */ bytes = (*file->io_write)(file->descriptor, buffer, size - (size % pagesize)); if (bytes <= 0) return (length); length += bytes; buffer += bytes; size -= bytes; } if (size) { /* keep remaining data in buffer */ switch (size) { case 8: file->buffer[file->length++] = *buffer++; case 7: file->buffer[file->length++] = *buffer++; case 6: file->buffer[file->length++] = *buffer++; case 5: file->buffer[file->length++] = *buffer++; case 4: file->buffer[file->length++] = *buffer++; case 3: file->buffer[file->length++] = *buffer++; case 2: file->buffer[file->length++] = *buffer++; case 1: file->buffer[file->length++] = *buffer++; break; default: memcpy(file->buffer + file->length, buffer, size); file->length += size; break; } length += size; } return (length); } return ((*file->io_write)(file->descriptor, data, size)); } int LispSwrite(LispString *string, const void *data, int size) { int bytes; if (size < 0) return (EOF); if (string->output + size >= string->space) { if (string->fixed) { /* leave space for a ending nul character */ bytes = string->space - string->output - 1; if (bytes < size) size = bytes; if (size <= 0) return (-1); } else { char *tmp; bytes = string->space + size; bytes += pagesize - (bytes % pagesize); tmp = realloc(string->string, bytes); if (tmp == NULL) return (-1); string->string = tmp; string->space = bytes; } } memcpy(string->string + string->output, data, size); string->output += size; if (string->length < string->output) string->length = string->output; if (!string->binary) string->column = calculate_column(data, size, string->column); return (size); } const char * LispGetSstring(LispString *string, int *length) { if (string->string == NULL || string->length <= 0) { *length = 0; return (""); } *length = string->length; if (string->string[string->length -1] != '\0') { if (string->length < string->space) string->string[string->length] = '\0'; else if (string->fixed && string->space) string->string[string->space - 1] = '\0'; else { char *tmp = realloc(string->string, string->space + pagesize); if (tmp == NULL) string->string[string->space - 1] = '\0'; else { string->string = tmp; string->space += pagesize; string->string[string->length] = '\0'; } } } return (string->string); } int LispRename(const char *from, const char *to) { return (rename(from, to)); } int LispUnlink(const char *name) { return (unlink(name)); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/core.h0000664000000000000000000002024612472175711015371 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/core.h,v 1.35tsi Exp $ */ #ifndef Lisp_core_h #define Lisp_core_h #include "lisp/internal.h" void LispCoreInit(void); LispObj *Lisp_Acons(LispBuiltin*); LispObj *Lisp_Adjoin(LispBuiltin*); LispObj *Lisp_Append(LispBuiltin*); LispObj *Lisp_And(LispBuiltin*); LispObj *Lisp_Aref(LispBuiltin*); LispObj *Lisp_Assoc(LispBuiltin*); LispObj *Lisp_AssocIf(LispBuiltin*); LispObj *Lisp_AssocIfNot(LispBuiltin*); LispObj *Lisp_Apply(LispBuiltin*); LispObj *Lisp_Atom(LispBuiltin*); LispObj *Lisp_Block(LispBuiltin*); LispObj *Lisp_Boundp(LispBuiltin*); LispObj *Lisp_Butlast(LispBuiltin*); LispObj *Lisp_Nbutlast(LispBuiltin*); LispObj *Lisp_Car(LispBuiltin*); LispObj *Lisp_Case(LispBuiltin*); LispObj *Lisp_Catch(LispBuiltin*); LispObj *Lisp_Cdr(LispBuiltin*); LispObj *Lisp_C_r(LispBuiltin*); LispObj *Lisp_Coerce(LispBuiltin*); LispObj *Lisp_Cond(LispBuiltin*); LispObj *Lisp_Cons(LispBuiltin*); LispObj *Lisp_Consp(LispBuiltin*); LispObj *Lisp_Constantp(LispBuiltin*); LispObj *Lisp_CopyAlist(LispBuiltin*); LispObj *Lisp_CopyList(LispBuiltin*); LispObj *Lisp_CopyTree(LispBuiltin*); LispObj *Lisp_Defconstant(LispBuiltin*); LispObj *Lisp_Defmacro(LispBuiltin*); LispObj *Lisp_Defun(LispBuiltin*); LispObj *Lisp_Defsetf(LispBuiltin*); LispObj *Lisp_Defparameter(LispBuiltin*); LispObj *Lisp_Defvar(LispBuiltin*); LispObj *Lisp_Delete(LispBuiltin*); LispObj *Lisp_DeleteDuplicates(LispBuiltin*); LispObj *Lisp_DeleteIf(LispBuiltin*); LispObj *Lisp_DeleteIfNot(LispBuiltin*); LispObj *Lisp_Do(LispBuiltin*); LispObj *Lisp_DoP(LispBuiltin*); LispObj *Lisp_Documentation(LispBuiltin*); LispObj *Lisp_DoList(LispBuiltin*); LispObj *Lisp_DoTimes(LispBuiltin*); LispObj *Lisp_Elt(LispBuiltin*); LispObj *Lisp_Endp(LispBuiltin*); LispObj *Lisp_Eq(LispBuiltin*); LispObj *Lisp_Eql(LispBuiltin*); LispObj *Lisp_Equal(LispBuiltin*); LispObj *Lisp_Equalp(LispBuiltin*); LispObj *Lisp_Error(LispBuiltin*); LispObj *Lisp_Eval(LispBuiltin*); LispObj *Lisp_Every(LispBuiltin*); LispObj *Lisp_Some(LispBuiltin*); LispObj *Lisp_Notevery(LispBuiltin*); LispObj *Lisp_Notany(LispBuiltin*); LispObj *Lisp_Fboundp(LispBuiltin*); LispObj *Lisp_Find(LispBuiltin*); LispObj *Lisp_FindIf(LispBuiltin*); LispObj *Lisp_FindIfNot(LispBuiltin*); LispObj *Lisp_Fill(LispBuiltin*); LispObj *Lisp_Fmakunbound(LispBuiltin*); LispObj *Lisp_Functionp(LispBuiltin*); LispObj *Lisp_Funcall(LispBuiltin*); LispObj *Lisp_Gc(LispBuiltin*); LispObj *Lisp_Gensym(LispBuiltin*); LispObj *Lisp_Get(LispBuiltin*); LispObj *Lisp_Getenv(LispBuiltin*); LispObj *Lisp_Go(LispBuiltin*); LispObj *Lisp_If(LispBuiltin*); LispObj *Lisp_IgnoreErrors(LispBuiltin*); LispObj *Lisp_Intersection(LispBuiltin*); LispObj *Lisp_Nintersection(LispBuiltin*); LispObj *Lisp_Keywordp(LispBuiltin*); LispObj *Lisp_Lambda(LispBuiltin*); LispObj *Lisp_Last(LispBuiltin*); LispObj *Lisp_Let(LispBuiltin*); LispObj *Lisp_Length(LispBuiltin*); LispObj *Lisp_LetP(LispBuiltin*); LispObj *Lisp_List(LispBuiltin*); LispObj *Lisp_ListLength(LispBuiltin*); LispObj *Lisp_ListP(LispBuiltin*); LispObj *Lisp_Listp(LispBuiltin*); LispObj *Lisp_Loop(LispBuiltin*); LispObj *Lisp_MakeArray(LispBuiltin*); LispObj *Lisp_MakeList(LispBuiltin*); LispObj *Lisp_MakeSymbol(LispBuiltin*); LispObj *Lisp_Makunbound(LispBuiltin*); LispObj *Lisp_Mapc(LispBuiltin*); LispObj *Lisp_Mapcar(LispBuiltin*); LispObj *Lisp_Mapcan(LispBuiltin*); LispObj *Lisp_Mapl(LispBuiltin*); LispObj *Lisp_Maplist(LispBuiltin*); LispObj *Lisp_Mapcon(LispBuiltin*); LispObj *Lisp_Member(LispBuiltin*); LispObj *Lisp_MemberIf(LispBuiltin*); LispObj *Lisp_MemberIfNot(LispBuiltin*); LispObj *Lisp_MultipleValueBind(LispBuiltin*); LispObj *Lisp_MultipleValueCall(LispBuiltin*); LispObj *Lisp_MultipleValueProg1(LispBuiltin*); LispObj *Lisp_MultipleValueList(LispBuiltin*); LispObj *Lisp_MultipleValueSetq(LispBuiltin*); LispObj *Lisp_Nconc(LispBuiltin*); LispObj *Lisp_Nreverse(LispBuiltin*); LispObj *Lisp_NsetDifference(LispBuiltin*); LispObj *Lisp_Nsubstitute(LispBuiltin*); LispObj *Lisp_NsubstituteIf(LispBuiltin*); LispObj *Lisp_NsubstituteIfNot(LispBuiltin*); LispObj *Lisp_Nth(LispBuiltin*); LispObj *Lisp_Nthcdr(LispBuiltin*); LispObj *Lisp_NthValue(LispBuiltin*); LispObj *Lisp_Null(LispBuiltin*); LispObj *Lisp_Or(LispBuiltin*); LispObj *Lisp_Pairlis(LispBuiltin*); LispObj *Lisp_Pop(LispBuiltin*); LispObj *Lisp_Position(LispBuiltin*); LispObj *Lisp_PositionIf(LispBuiltin*); LispObj *Lisp_PositionIfNot(LispBuiltin*); LispObj *Lisp_Proclaim(LispBuiltin*); LispObj *Lisp_Prog1(LispBuiltin*); LispObj *Lisp_Prog2(LispBuiltin*); LispObj *Lisp_Progn(LispBuiltin*); LispObj *Lisp_Progv(LispBuiltin*); LispObj *Lisp_Provide(LispBuiltin*); LispObj *Lisp_Push(LispBuiltin*); LispObj *Lisp_Pushnew(LispBuiltin*); LispObj *Lisp_Quit(LispBuiltin*); LispObj *Lisp_Quote(LispBuiltin*); LispObj *Lisp_Remove(LispBuiltin*); LispObj *Lisp_RemoveDuplicates(LispBuiltin*); LispObj *Lisp_RemoveIf(LispBuiltin*); LispObj *Lisp_RemoveIfNot(LispBuiltin*); LispObj *Lisp_Remprop(LispBuiltin*); LispObj *Lisp_Replace(LispBuiltin*); LispObj *Lisp_Return(LispBuiltin*); LispObj *Lisp_ReturnFrom(LispBuiltin*); LispObj *Lisp_Reverse(LispBuiltin*); LispObj *Lisp_Rplaca(LispBuiltin*); LispObj *Lisp_Rplacd(LispBuiltin*); LispObj *Lisp_Search(LispBuiltin*); LispObj *Lisp_Setenv(LispBuiltin*); LispObj *Lisp_Set(LispBuiltin*); LispObj *Lisp_SetDifference(LispBuiltin*); LispObj *Lisp_SetExclusiveOr(LispBuiltin*); LispObj *Lisp_NsetExclusiveOr(LispBuiltin*); LispObj *Lisp_Setf(LispBuiltin*); LispObj *Lisp_Psetf(LispBuiltin*); LispObj *Lisp_SetQ(LispBuiltin*); LispObj *Lisp_Psetq(LispBuiltin*); LispObj *Lisp_Sleep(LispBuiltin*); LispObj *Lisp_Sort(LispBuiltin*); LispObj *Lisp_Subseq(LispBuiltin*); LispObj *Lisp_Subsetp(LispBuiltin*); LispObj *Lisp_Substitute(LispBuiltin*); LispObj *Lisp_SubstituteIf(LispBuiltin*); LispObj *Lisp_SubstituteIfNot(LispBuiltin*); LispObj *Lisp_Symbolp(LispBuiltin*); LispObj *Lisp_SymbolFunction(LispBuiltin*); LispObj *Lisp_SymbolName(LispBuiltin*); LispObj *Lisp_SymbolPackage(LispBuiltin*); LispObj *Lisp_SymbolPlist(LispBuiltin*); LispObj *Lisp_SymbolValue(LispBuiltin*); LispObj *Lisp_Tagbody(LispBuiltin*); LispObj *Lisp_Throw(LispBuiltin*); LispObj *Lisp_The(LispBuiltin*); LispObj *Lisp_TreeEqual(LispBuiltin*); LispObj *Lisp_Typep(LispBuiltin*); LispObj *Lisp_Union(LispBuiltin*); LispObj *Lisp_Nunion(LispBuiltin*); LispObj *Lisp_Unless(LispBuiltin*); LispObj *Lisp_Until(LispBuiltin*); LispObj *Lisp_Unsetenv(LispBuiltin*); LispObj *Lisp_UnwindProtect(LispBuiltin*); LispObj *Lisp_Values(LispBuiltin*); LispObj *Lisp_ValuesList(LispBuiltin*); LispObj *Lisp_Vector(LispBuiltin*); LispObj *Lisp_When(LispBuiltin*); LispObj *Lisp_While(LispBuiltin*); LispObj *Lisp_XeditEltStore(LispBuiltin*); LispObj *Lisp_XeditPut(LispBuiltin*); LispObj *Lisp_XeditSetSymbolPlist(LispBuiltin*); LispObj *Lisp_XeditVectorStore(LispBuiltin*); LispObj *Lisp_XeditDocumentationStore(LispBuiltin*); #endif x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/math.c0000664000000000000000000006457312472175711015400 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/math.c,v 1.23tsi Exp $ */ #include "lisp/math.h" #include "lisp/private.h" #ifdef __UNIXOS2__ # define finite(x) isfinite(x) #endif /* * Prototypes */ static LispObj *LispDivide(LispBuiltin*, int, int); /* * Initialization */ static LispObj *obj_zero, *obj_one; LispObj *Ocomplex, *Oequal_; LispObj *Oshort_float, *Osingle_float, *Odouble_float, *Olong_float; Atom_id Sdefault_float_format; /* * Implementation */ #include "lisp/mathimp.c" void LispMathInit(void) { LispObj *object, *result; mp_set_malloc(LispMalloc); mp_set_calloc(LispCalloc); mp_set_realloc(LispRealloc); mp_set_free(LispFree); number_init(); obj_zero = FIXNUM(0); obj_one = FIXNUM(1); Oequal_ = STATIC_ATOM("="); Ocomplex = STATIC_ATOM(Scomplex->value); Oshort_float = STATIC_ATOM("SHORT-FLOAT"); LispExportSymbol(Oshort_float); Osingle_float = STATIC_ATOM("SINGLE-FLOAT"); LispExportSymbol(Osingle_float); Odouble_float = STATIC_ATOM("DOUBLE-FLOAT"); LispExportSymbol(Odouble_float); Olong_float = STATIC_ATOM("LONG-FLOAT"); LispExportSymbol(Olong_float); object = STATIC_ATOM("*DEFAULT-FLOAT-FORMAT*"); LispProclaimSpecial(object, Odouble_float, NIL); LispExportSymbol(object); Sdefault_float_format = ATOMID(object); object = STATIC_ATOM("PI"); result = number_pi(); LispProclaimSpecial(object, result, NIL); LispExportSymbol(object); object = STATIC_ATOM("MOST-POSITIVE-FIXNUM"); LispDefconstant(object, FIXNUM(MOST_POSITIVE_FIXNUM), NIL); LispExportSymbol(object); object = STATIC_ATOM("MOST-NEGATIVE-FIXNUM"); LispDefconstant(object, FIXNUM(MOST_NEGATIVE_FIXNUM), NIL); LispExportSymbol(object); } LispObj * Lisp_Mul(LispBuiltin *builtin) /* * &rest numbers */ { n_number num; LispObj *number, *numbers; numbers = ARGUMENT(0); if (CONSP(numbers)) { number = CAR(numbers); numbers = CDR(numbers); if (!CONSP(numbers)) { CHECK_NUMBER(number); return (number); } } else return (FIXNUM(1)); set_number_object(&num, number); do { mul_number_object(&num, CAR(numbers)); numbers = CDR(numbers); } while (CONSP(numbers)); return (make_number_object(&num)); } LispObj * Lisp_Plus(LispBuiltin *builtin) /* + &rest numbers */ { n_number num; LispObj *number, *numbers; numbers = ARGUMENT(0); if (CONSP(numbers)) { number = CAR(numbers); numbers = CDR(numbers); if (!CONSP(numbers)) { CHECK_NUMBER(number); return (number); } } else return (FIXNUM(0)); set_number_object(&num, number); do { add_number_object(&num, CAR(numbers)); numbers = CDR(numbers); } while (CONSP(numbers)); return (make_number_object(&num)); } LispObj * Lisp_Minus(LispBuiltin *builtin) /* - number &rest more_numbers */ { n_number num; LispObj *number, *more_numbers; more_numbers = ARGUMENT(1); number = ARGUMENT(0); set_number_object(&num, number); if (!CONSP(more_numbers)) { neg_number(&num); return (make_number_object(&num)); } do { sub_number_object(&num, CAR(more_numbers)); more_numbers = CDR(more_numbers); } while (CONSP(more_numbers)); return (make_number_object(&num)); } LispObj * Lisp_Div(LispBuiltin *builtin) /* / number &rest more_numbers */ { n_number num; LispObj *number, *more_numbers; more_numbers = ARGUMENT(1); number = ARGUMENT(0); if (CONSP(more_numbers)) set_number_object(&num, number); else { num.complex = 0; num.real.type = N_FIXNUM; num.real.data.fixnum = 1; goto div_one_argument; } for (;;) { number = CAR(more_numbers); more_numbers = CDR(more_numbers); div_one_argument: div_number_object(&num, number); if (!CONSP(more_numbers)) break; } return (make_number_object(&num)); } LispObj * Lisp_OnePlus(LispBuiltin *builtin) /* 1+ number */ { n_number num; LispObj *number; number = ARGUMENT(0); num.complex = 0; num.real.type = N_FIXNUM; num.real.data.fixnum = 1; add_number_object(&num, number); return (make_number_object(&num)); } LispObj * Lisp_OneMinus(LispBuiltin *builtin) /* 1- number */ { n_number num; LispObj *number; number = ARGUMENT(0); num.complex = 0; num.real.type = N_FIXNUM; num.real.data.fixnum = -1; add_number_object(&num, number); return (make_number_object(&num)); } LispObj * Lisp_Less(LispBuiltin *builtin) /* < number &rest more-numbers */ { LispObj *compare, *number, *more_numbers; more_numbers = ARGUMENT(1); compare = ARGUMENT(0); if (CONSP(more_numbers)) { do { number = CAR(more_numbers); if (cmp_object_object(compare, number, 1) >= 0) return (NIL); compare = number; more_numbers = CDR(more_numbers); } while (CONSP(more_numbers)); } else { CHECK_REAL(compare); } return (T); } LispObj * Lisp_LessEqual(LispBuiltin *builtin) /* <= number &rest more-numbers */ { LispObj *compare, *number, *more_numbers; more_numbers = ARGUMENT(1); compare = ARGUMENT(0); if (CONSP(more_numbers)) { do { number = CAR(more_numbers); if (cmp_object_object(compare, number, 1) > 0) return (NIL); compare = number; more_numbers = CDR(more_numbers); } while (CONSP(more_numbers)); } else { CHECK_REAL(compare); } return (T); } LispObj * Lisp_Equal_(LispBuiltin *builtin) /* = number &rest more-numbers */ { LispObj *compare, *number, *more_numbers; more_numbers = ARGUMENT(1); compare = ARGUMENT(0); if (CONSP(more_numbers)) { do { number = CAR(more_numbers); if (cmp_object_object(compare, number, 0) != 0) return (NIL); compare = number; more_numbers = CDR(more_numbers); } while (CONSP(more_numbers)); } else { CHECK_REAL(compare); } return (T); } LispObj * Lisp_Greater(LispBuiltin *builtin) /* > number &rest more-numbers */ { LispObj *compare, *number, *more_numbers; more_numbers = ARGUMENT(1); compare = ARGUMENT(0); if (CONSP(more_numbers)) { do { number = CAR(more_numbers); if (cmp_object_object(compare, number, 1) <= 0) return (NIL); compare = number; more_numbers = CDR(more_numbers); } while (CONSP(more_numbers)); } else { CHECK_REAL(compare); } return (T); } LispObj * Lisp_GreaterEqual(LispBuiltin *builtin) /* >= number &rest more-numbers */ { LispObj *compare, *number, *more_numbers; more_numbers = ARGUMENT(1); compare = ARGUMENT(0); if (CONSP(more_numbers)) { do { number = CAR(more_numbers); if (cmp_object_object(compare, number, 1) < 0) return (NIL); compare = number; more_numbers = CDR(more_numbers); } while (CONSP(more_numbers)); } else { CHECK_REAL(compare); } return (T); } LispObj * Lisp_NotEqual(LispBuiltin *builtin) /* /= number &rest more-numbers */ { LispObj *object, *compare, *number, *more_numbers; more_numbers = ARGUMENT(1); number = ARGUMENT(0); if (!CONSP(more_numbers)) { CHECK_REAL(number); return (T); } /* compare all numbers */ while (1) { compare = number; for (object = more_numbers; CONSP(object); object = CDR(object)) { number = CAR(object); if (cmp_object_object(compare, number, 0) == 0) return (NIL); } if (CONSP(more_numbers)) { number = CAR(more_numbers); more_numbers = CDR(more_numbers); } else break; } return (T); } LispObj * Lisp_Min(LispBuiltin *builtin) /* min number &rest more-numbers */ { LispObj *result, *number, *more_numbers; more_numbers = ARGUMENT(1); result = ARGUMENT(0); if (CONSP(more_numbers)) { do { number = CAR(more_numbers); if (cmp_object_object(result, number, 1) > 0) result = number; more_numbers = CDR(more_numbers); } while (CONSP(more_numbers)); } else { CHECK_REAL(result); } return (result); } LispObj * Lisp_Max(LispBuiltin *builtin) /* max number &rest more-numbers */ { LispObj *result, *number, *more_numbers; more_numbers = ARGUMENT(1); result = ARGUMENT(0); if (CONSP(more_numbers)) { do { number = CAR(more_numbers); if (cmp_object_object(result, number, 1) < 0) result = number; more_numbers = CDR(more_numbers); } while (CONSP(more_numbers)); } else { CHECK_REAL(result); } return (result); } LispObj * Lisp_Abs(LispBuiltin *builtin) /* abs number */ { LispObj *result, *number; result = number = ARGUMENT(0); switch (OBJECT_TYPE(number)) { case LispFixnum_t: case LispInteger_t: case LispBignum_t: case LispDFloat_t: case LispRatio_t: case LispBigratio_t: if (cmp_real_object(&zero, number) > 0) { n_real real; set_real_object(&real, number); neg_real(&real); result = make_real_object(&real); } break; case LispComplex_t: { n_number num; set_number_object(&num, number); abs_number(&num); result = make_number_object(&num); } break; default: fatal_builtin_object_error(builtin, number, NOT_A_NUMBER); break; } return (result); } LispObj * Lisp_Complex(LispBuiltin *builtin) /* complex realpart &optional imagpart */ { LispObj *realpart, *imagpart; imagpart = ARGUMENT(1); realpart = ARGUMENT(0); CHECK_REAL(realpart); if (imagpart == UNSPEC) return (realpart); else { CHECK_REAL(imagpart); } if (!FLOATP(imagpart) && cmp_real_object(&zero, imagpart) == 0) return (realpart); return (COMPLEX(realpart, imagpart)); } LispObj * Lisp_Complexp(LispBuiltin *builtin) /* complexp object */ { LispObj *object; object = ARGUMENT(0); return (COMPLEXP(object) ? T : NIL); } LispObj * Lisp_Conjugate(LispBuiltin *builtin) /* conjugate number */ { n_number num; LispObj *number, *realpart, *imagpart; number = ARGUMENT(0); CHECK_NUMBER(number); if (REALP(number)) return (number); realpart = OCXR(number); num.complex = 0; num.real.type = N_FIXNUM; num.real.data.fixnum = -1; mul_number_object(&num, OCXI(number)); imagpart = make_number_object(&num); return (COMPLEX(realpart, imagpart)); } LispObj * Lisp_Decf(LispBuiltin *builtin) /* decf place &optional delta */ { n_number num; LispObj *place, *delta, *number; delta = ARGUMENT(1); place = ARGUMENT(0); if (SYMBOLP(place)) { number = LispGetVar(place); if (number == NULL) LispDestroy("EVAL: the variable %s is unbound", STROBJ(place)); } else number = EVAL(place); if (delta != UNSPEC) { LispObj *operand; operand = EVAL(delta); set_number_object(&num, number); sub_number_object(&num, operand); number = make_number_object(&num); } else { num.complex = 0; num.real.type = N_FIXNUM; num.real.data.fixnum = -1; add_number_object(&num, number); number = make_number_object(&num); } if (SYMBOLP(place)) { CHECK_CONSTANT(place); LispSetVar(place, number); } else { GC_ENTER(); GC_PROTECT(number); (void)APPLY2(Osetf, place, number); GC_LEAVE(); } return (number); } LispObj * Lisp_Denominator(LispBuiltin *builtin) /* denominator rational */ { LispObj *result, *rational; rational = ARGUMENT(0); switch (OBJECT_TYPE(rational)) { case LispFixnum_t: case LispInteger_t: case LispBignum_t: result = FIXNUM(1); break; case LispRatio_t: result = INTEGER(OFRD(rational)); break; case LispBigratio_t: if (mpi_fiti(OBRD(rational))) result = INTEGER(mpi_geti(OBRD(rational))); else { mpi *den = XALLOC(mpi); mpi_init(den); mpi_set(den, OBRD(rational)); result = BIGNUM(den); } break; default: LispDestroy("%s: %s is not a rational number", STRFUN(builtin), STROBJ(rational)); /*NOTREACHED*/ result = NIL; } return (result); } LispObj * Lisp_Evenp(LispBuiltin *builtin) /* evenp integer */ { LispObj *result, *integer; integer = ARGUMENT(0); switch (OBJECT_TYPE(integer)) { case LispFixnum_t: result = FIXNUM_VALUE(integer) % 2 ? NIL : T; break; case LispInteger_t: result = INT_VALUE(integer) % 2 ? NIL : T; break; case LispBignum_t: result = mpi_remi(OBI(integer), 2) ? NIL : T; break; default: fatal_builtin_object_error(builtin, integer, NOT_AN_INTEGER); /*NOTREACHED*/ result = NIL; } return (result); } /* only one float format */ LispObj * Lisp_Float(LispBuiltin *builtin) /* float number &optional other */ { LispObj *number, *other; other = ARGUMENT(1); number = ARGUMENT(0); if (other != UNSPEC) { CHECK_DFLOAT(other); } return (LispFloatCoerce(builtin, number)); } LispObj * LispFloatCoerce(LispBuiltin *builtin, LispObj *number) { double value; switch (OBJECT_TYPE(number)) { case LispFixnum_t: value = FIXNUM_VALUE(number); break; case LispInteger_t: value = INT_VALUE(number); break; case LispBignum_t: value = mpi_getd(OBI(number)); break; case LispDFloat_t: return (number); case LispRatio_t: value = (double)OFRN(number) / (double)OFRD(number); break; case LispBigratio_t: value = mpr_getd(OBR(number)); break; default: value = 0.0; fatal_builtin_object_error(builtin, number, NOT_A_REAL_NUMBER); break; } if (!finite(value)) fatal_error(FLOATING_POINT_OVERFLOW); return (DFLOAT(value)); } LispObj * Lisp_Floatp(LispBuiltin *builtin) /* floatp object */ { LispObj *object; object = ARGUMENT(0); return (FLOATP(object) ? T : NIL); } LispObj * Lisp_Gcd(LispBuiltin *builtin) /* gcd &rest integers */ { n_real real; LispObj *integers, *integer, *operand; integers = ARGUMENT(0); if (!CONSP(integers)) return (FIXNUM(0)); integer = CAR(integers); CHECK_INTEGER(integer); set_real_object(&real, integer); integers = CDR(integers); for (; CONSP(integers); integers = CDR(integers)) { operand = CAR(integers); gcd_real_object(&real, operand); } abs_real(&real); return (make_real_object(&real)); } LispObj * Lisp_Imagpart(LispBuiltin *builtin) /* imagpart number */ { LispObj *number; number = ARGUMENT(0); if (COMPLEXP(number)) return (OCXI(number)); else { CHECK_REAL(number); } return (FIXNUM(0)); } LispObj * Lisp_Incf(LispBuiltin *builtin) /* incf place &optional delta */ { n_number num; LispObj *place, *delta, *number; delta = ARGUMENT(1); place = ARGUMENT(0); if (SYMBOLP(place)) { number = LispGetVar(place); if (number == NULL) LispDestroy("EVAL: the variable %s is unbound", STROBJ(place)); } else number = EVAL(place); if (delta != UNSPEC) { LispObj *operand; operand = EVAL(delta); set_number_object(&num, number); add_number_object(&num, operand); number = make_number_object(&num); } else { num.complex = 0; num.real.type = N_FIXNUM; num.real.data.fixnum = 1; add_number_object(&num, number); number = make_number_object(&num); } if (SYMBOLP(place)) { CHECK_CONSTANT(place); LispSetVar(place, number); } else { GC_ENTER(); GC_PROTECT(number); (void)APPLY2(Osetf, place, number); GC_LEAVE(); } return (number); } LispObj * Lisp_Integerp(LispBuiltin *builtin) /* integerp object */ { LispObj *object; object = ARGUMENT(0); return (INTEGERP(object) ? T : NIL); } LispObj * Lisp_Isqrt(LispBuiltin *builtin) /* isqrt natural */ { LispObj *natural, *result; natural = ARGUMENT(0); if (cmp_object_object(natural, obj_zero, 1) < 0) goto not_a_natural_number; switch (OBJECT_TYPE(natural)) { case LispFixnum_t: result = FIXNUM((long)floor(sqrt(FIXNUM_VALUE(natural)))); break; case LispInteger_t: result = INTEGER((long)floor(sqrt(INT_VALUE(natural)))); break; case LispBignum_t: { mpi *bigi; bigi = XALLOC(mpi); mpi_init(bigi); mpi_sqrt(bigi, OBI(natural)); if (mpi_fiti(bigi)) { result = INTEGER(mpi_geti(bigi)); mpi_clear(bigi); XFREE(bigi); } else result = BIGNUM(bigi); } break; default: goto not_a_natural_number; } return (result); not_a_natural_number: LispDestroy("%s: %s is not a natural number", STRFUN(builtin), STROBJ(natural)); /*NOTREACHED*/ return (NIL); } LispObj * Lisp_Lcm(LispBuiltin *builtin) /* lcm &rest integers */ { n_real real, gcd; LispObj *integers, *operand; integers = ARGUMENT(0); if (!CONSP(integers)) return (FIXNUM(1)); operand = CAR(integers); CHECK_INTEGER(operand); set_real_object(&real, operand); integers = CDR(integers); gcd.type = N_FIXNUM; gcd.data.fixnum = 0; for (; CONSP(integers); integers = CDR(integers)) { operand = CAR(integers); if (real.type == N_FIXNUM && real.data.fixnum == 0) break; /* calculate gcd before changing integer */ clear_real(&gcd); set_real_real(&gcd, &real); gcd_real_object(&gcd, operand); /* calculate lcm */ mul_real_object(&real, operand); div_real_real(&real, &gcd); } clear_real(&gcd); abs_real(&real); return (make_real_object(&real)); } LispObj * Lisp_Logand(LispBuiltin *builtin) /* logand &rest integers */ { n_real real; LispObj *integers; integers = ARGUMENT(0); real.type = N_FIXNUM; real.data.fixnum = -1; for (; CONSP(integers); integers = CDR(integers)) and_real_object(&real, CAR(integers)); return (make_real_object(&real)); } LispObj * Lisp_Logeqv(LispBuiltin *builtin) /* logeqv &rest integers */ { n_real real; LispObj *integers; integers = ARGUMENT(0); real.type = N_FIXNUM; real.data.fixnum = -1; for (; CONSP(integers); integers = CDR(integers)) eqv_real_object(&real, CAR(integers)); return (make_real_object(&real)); } LispObj * Lisp_Logior(LispBuiltin *builtin) /* logior &rest integers */ { n_real real; LispObj *integers; integers = ARGUMENT(0); real.type = N_FIXNUM; real.data.fixnum = 0; for (; CONSP(integers); integers = CDR(integers)) ior_real_object(&real, CAR(integers)); return (make_real_object(&real)); } LispObj * Lisp_Lognot(LispBuiltin *builtin) /* lognot integer */ { n_real real; LispObj *integer; integer = ARGUMENT(0); CHECK_INTEGER(integer); set_real_object(&real, integer); not_real(&real); return (make_real_object(&real)); } LispObj * Lisp_Logxor(LispBuiltin *builtin) /* logxor &rest integers */ { n_real real; LispObj *integers; integers = ARGUMENT(0); real.type = N_FIXNUM; real.data.fixnum = 0; for (; CONSP(integers); integers = CDR(integers)) xor_real_object(&real, CAR(integers)); return (make_real_object(&real)); } LispObj * Lisp_Minusp(LispBuiltin *builtin) /* minusp number */ { LispObj *number; number = ARGUMENT(0); CHECK_REAL(number); return (cmp_real_object(&zero, number) > 0 ? T : NIL); } LispObj * Lisp_Mod(LispBuiltin *builtin) /* mod number divisor */ { LispObj *result; LispObj *number, *divisor; divisor = ARGUMENT(1); number = ARGUMENT(0); if (INTEGERP(number) && INTEGERP(divisor)) { n_real real; set_real_object(&real, number); mod_real_object(&real, divisor); result = make_real_object(&real); } else { n_number num; set_number_object(&num, number); divide_number_object(&num, divisor, NDIVIDE_FLOOR, 0); result = make_real_object(&(num.imag)); clear_real(&(num.real)); } return (result); } LispObj * Lisp_Numberp(LispBuiltin *builtin) /* numberp object */ { LispObj *object; object = ARGUMENT(0); return (NUMBERP(object) ? T : NIL); } LispObj * Lisp_Numerator(LispBuiltin *builtin) /* numerator rational */ { LispObj *result, *rational; rational = ARGUMENT(0); switch (OBJECT_TYPE(rational)) { case LispFixnum_t: case LispInteger_t: case LispBignum_t: result = rational; break; case LispRatio_t: result = INTEGER(OFRN(rational)); break; case LispBigratio_t: if (mpi_fiti(OBRN(rational))) result = INTEGER(mpi_geti(OBRN(rational))); else { mpi *num = XALLOC(mpi); mpi_init(num); mpi_set(num, OBRN(rational)); result = BIGNUM(num); } break; default: LispDestroy("%s: %s is not a rational number", STRFUN(builtin), STROBJ(rational)); /*NOTREACHED*/ result = NIL; } return (result); } LispObj * Lisp_Oddp(LispBuiltin *builtin) /* oddp integer */ { LispObj *result, *integer; integer = ARGUMENT(0); switch (OBJECT_TYPE(integer)) { case LispFixnum_t: result = FIXNUM_VALUE(integer) % 2 ? T : NIL; break; case LispInteger_t: result = INT_VALUE(integer) % 2 ? T : NIL; break; case LispBignum_t: result = mpi_remi(OBI(integer), 2) ? T : NIL; break; default: fatal_builtin_object_error(builtin, integer, NOT_AN_INTEGER); /*NOTREACHED*/ result = NIL; } return (result); } LispObj * Lisp_Plusp(LispBuiltin *builtin) /* plusp number */ { LispObj *number; number = ARGUMENT(0); CHECK_REAL(number); return (cmp_real_object(&zero, number) < 0 ? T : NIL); } LispObj * Lisp_Rational(LispBuiltin *builtin) /* rational number */ { LispObj *number; number = ARGUMENT(0); if (DFLOATP(number)) { double numerator = ODF(number); if ((long)numerator == numerator) number = INTEGER(numerator); else { n_real real; mpr *bigr = XALLOC(mpr); mpr_init(bigr); mpr_setd(bigr, numerator); real.type = N_BIGRATIO; real.data.bigratio = bigr; rbr_canonicalize(&real); number = make_real_object(&real); } } else { CHECK_REAL(number); } return (number); } LispObj * Lisp_Rationalp(LispBuiltin *builtin) /* rationalp object */ { LispObj *object; object = ARGUMENT(0); return (RATIONALP(object) ? T : NIL); } LispObj * Lisp_Realpart(LispBuiltin *builtin) /* realpart number */ { LispObj *number; number = ARGUMENT(0); if (COMPLEXP(number)) return (OCXR(number)); else { CHECK_REAL(number); } return (number); } LispObj * Lisp_Rem(LispBuiltin *builtin) /* rem number divisor */ { LispObj *result; LispObj *number, *divisor; divisor = ARGUMENT(1); number = ARGUMENT(0); if (INTEGERP(number) && INTEGERP(divisor)) { n_real real; set_real_object(&real, number); rem_real_object(&real, divisor); result = make_real_object(&real); } else { n_number num; set_number_object(&num, number); divide_number_object(&num, divisor, NDIVIDE_TRUNC, 0); result = make_real_object(&(num.imag)); clear_real(&(num.real)); } return (result); } LispObj * Lisp_Sqrt(LispBuiltin *builtin) /* sqrt number */ { n_number num; LispObj *number; number = ARGUMENT(0); set_number_object(&num, number); sqrt_number(&num); return (make_number_object(&num)); } LispObj * Lisp_Zerop(LispBuiltin *builtin) /* zerop number */ { LispObj *result, *number; number = ARGUMENT(0); switch (OBJECT_TYPE(number)) { case LispFixnum_t: case LispInteger_t: case LispBignum_t: case LispDFloat_t: case LispRatio_t: case LispBigratio_t: result = cmp_real_object(&zero, number) == 0 ? T : NIL; break; case LispComplex_t: result = cmp_real_object(&zero, OCXR(number)) == 0 && cmp_real_object(&zero, OCXI(number)) == 0 ? T : NIL; break; default: fatal_builtin_object_error(builtin, number, NOT_A_NUMBER); /*NOTREACHED*/ result = NIL; } return (result); } static LispObj * LispDivide(LispBuiltin *builtin, int fun, int flo) { n_number num; LispObj *number, *divisor; divisor = ARGUMENT(1); number = ARGUMENT(0); RETURN_COUNT = 1; if (cmp_real_object(&zero, number) == 0) { if (divisor != NIL) { CHECK_REAL(divisor); } return (RETURN(0) = obj_zero); } if (divisor == UNSPEC) divisor = obj_one; set_number_object(&num, number); if (num.complex) fatal_builtin_object_error(builtin, divisor, NOT_A_REAL_NUMBER); divide_number_object(&num, divisor, fun, flo); RETURN(0) = make_real_object(&(num.imag)); return (make_real_object(&(num.real))); } LispObj * Lisp_Ceiling(LispBuiltin *builtin) /* ceiling number &optional divisor */ { return (LispDivide(builtin, NDIVIDE_CEIL, 0)); } LispObj * Lisp_Fceiling(LispBuiltin *builtin) /* fceiling number &optional divisor */ { return (LispDivide(builtin, NDIVIDE_CEIL, 1)); } LispObj * Lisp_Floor(LispBuiltin *builtin) /* floor number &optional divisor */ { return (LispDivide(builtin, NDIVIDE_FLOOR, 0)); } LispObj * Lisp_Ffloor(LispBuiltin *builtin) /* ffloor number &optional divisor */ { return (LispDivide(builtin, NDIVIDE_FLOOR, 1)); } LispObj * Lisp_Round(LispBuiltin *builtin) /* round number &optional divisor */ { return (LispDivide(builtin, NDIVIDE_ROUND, 0)); } LispObj * Lisp_Fround(LispBuiltin *builtin) /* fround number &optional divisor */ { return (LispDivide(builtin, NDIVIDE_ROUND, 1)); } LispObj * Lisp_Truncate(LispBuiltin *builtin) /* truncate number &optional divisor */ { return (LispDivide(builtin, NDIVIDE_TRUNC, 0)); } LispObj * Lisp_Ftruncate(LispBuiltin *builtin) /* ftruncate number &optional divisor */ { return (LispDivide(builtin, NDIVIDE_TRUNC, 1)); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/lisp.h0000664000000000000000000000344012472175711015405 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/lisp.h,v 1.4 2002/07/16 05:19:39 paulo Exp $ */ #ifndef Lisp_lisp_h #define Lisp_lisp_h void LispBegin(void); void LispEnd(void); void *LispExecute(char*); void LispMachine(void); void LispSetPrompt(const char*); void LispSetInteractive(int); void LispSetExitOnError(int); void LispDebug(int); /* argument is boolean to enable/disable */ #endif /* Lisp_lisp_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/struct.h0000664000000000000000000000375012472175711015766 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/struct.h,v 1.6tsi Exp $ */ #ifndef Lisp_struct_h #define Lisp_struct_h #include "lisp/private.h" /* * Defines */ #define XSTRUCTP(object) ((object)->type == LispStruct_t) #define STRUCTP(object) (POINTERP(object) && XSTRUCTP(object)) #define STRUCT(fields, def) LispNewStruct(fields, def) /* * Prototypes */ LispObj *Lisp_Defstruct(LispBuiltin*); LispObj *Lisp_XeditMakeStruct(LispBuiltin*); LispObj *Lisp_XeditStructAccess(LispBuiltin*); LispObj *Lisp_XeditStructStore(LispBuiltin*); LispObj *Lisp_XeditStructType(LispBuiltin*); #endif /* Lisp_struct_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/hash.c0000664000000000000000000003663212472175711015365 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/hash.c,v 1.5 2003/04/27 18:17:32 tsi Exp $ */ #include "lisp/hash.h" /* A simple hash-table implementation * TODO: implement SXHASH and WITH-HASH-TABLE-ITERATOR * May need a rewrite for better performance, and will * need a rewrite if images/bytecode saved on disk. */ #define GET_HASH 1 #define PUT_HASH 2 #define REM_HASH 3 /* * Prototypes */ static unsigned long LispHashKey(LispObj*, int); static LispObj *LispHash(LispBuiltin*, int); static void LispRehash(LispHashTable*); static void LispFreeHashEntries(LispHashEntry*, long); /* * Initialization */ extern LispObj *Oeq, *Oeql, *Oequal, *Oequalp; /* Hash tables will have one of these sizes, unless the user * specified a very large size */ static long some_primes[] = { 5, 11, 17, 23, 31, 47, 71, 97, 139, 199, 307, 401, 607, 809, 1213, 1619, 2437, 3251, 4889, 6521 }; /* * Implementation */ static unsigned long LispHashKey(LispObj *object, int function) { mpi *bigi; char *string; long i, length; unsigned long key = ((unsigned long)object) >> 4; /* Must be the same object for EQ */ if (function == FEQ) goto hash_key_done; if (function == FEQUALP) { switch (OBJECT_TYPE(object)) { case LispSChar_t: key = (unsigned long)toupper(SCHAR_VALUE(object)); goto hash_key_done; case LispString_t: string = THESTR(object); length = STRLEN(object); if (length > 32) length = 32; for (i = 0, key = 0; i < length; i++) key = (key << 1) ^ toupper(string[i]); goto hash_key_done; default: break; } } /* Function is EQL, EQUAL or EQUALP */ switch (OBJECT_TYPE(object)) { case LispFixnum_t: case LispSChar_t: key = (unsigned long)FIXNUM_VALUE(object); goto hash_key_done; case LispInteger_t: key = (unsigned long)INT_VALUE(object); goto hash_key_done; case LispRatio_t: key = (object->data.ratio.numerator << 16) ^ object->data.ratio.denominator; goto hash_key_done; case LispDFloat_t: key = (unsigned long)DFLOAT_VALUE(object); break; case LispComplex_t: key = (LispHashKey(object->data.complex.imag, function) << 16) ^ LispHashKey(object->data.complex.real, function); goto hash_key_done; case LispBignum_t: bigi = object->data.mp.integer; length = bigi->size; if (length > 8) length = 8; key = bigi->sign; for (i = 0; i < length; i++) key = (key << 8) ^ bigi->digs[i]; goto hash_key_done; case LispBigratio_t: bigi = mpr_num(object->data.mp.ratio); length = bigi->size; if (length > 4) length = 4; key = bigi->sign; for (i = 0; i < length; i++) key = (key << 4) ^ bigi->digs[i]; bigi = mpr_den(object->data.mp.ratio); length = bigi->size; if (length > 4) length = 4; for (i = 0; i < length; i++) key = (key << 4) ^ bigi->digs[i]; goto hash_key_done; default: break; } /* Anything else must be the same object for EQL */ if (function == FEQL) goto hash_key_done; switch (OBJECT_TYPE(object)) { case LispString_t: string = THESTR(object); length = STRLEN(object); for (i = 0, key = 0; i < length; i++) key = (key << 1) ^ string[i]; break; case LispCons_t: key = (LispHashKey(CAR(object), function) << 16) ^ LispHashKey(CDR(object), function); break; case LispQuote_t: case LispBackquote_t: case LispPathname_t: key = LispHashKey(object->data.pathname, function); break; case LispRegex_t: key = LispHashKey(object->data.regex.pattern, function); break; default: break; } hash_key_done: return (key); } static LispObj * LispHash(LispBuiltin *builtin, int code) { LispHashEntry *entry; LispHashTable *hash; unsigned long key; LispObj *result; int found; long i; LispObj *okey, *hash_table, *value; if (code == REM_HASH) value = NIL; else { value = ARGUMENT(2); if (value == UNSPEC) value = NIL; } hash_table = ARGUMENT(1); okey = ARGUMENT(0); CHECK_HASHTABLE(hash_table); /* get hash entry */ hash = hash_table->data.hash.table; key = LispHashKey(okey, hash->function) % hash->num_entries; entry = hash->entries + key; /* search entry in the hash table */ if (entry->count == 0) i = 0; else { if (hash->function == FEQ) { for (i = entry->cache; i >= 0; i--) { if (entry->keys[i] == okey) goto found_key; } for (i = entry->cache + 1; i < entry->count; i++) { if (entry->keys[i] == okey) break; } } else { for (i = entry->cache; i >= 0; i--) { if (LispObjectCompare(entry->keys[i], okey, hash->function) == T) goto found_key; } for (i = entry->cache + 1; i < entry->count; i++) { if (LispObjectCompare(entry->keys[i], okey, hash->function) == T) break; } } } found_key: result = value; if ((found = i < entry->count) == 0) i = entry->count; switch (code) { case GET_HASH: RETURN_COUNT = 1; if (found) { RETURN(0) = T; entry->cache = i; result = entry->values[i]; } else RETURN(0) = NIL; break; case PUT_HASH: entry->cache = i; if (found) /* Just replace current entry */ entry->values[i] = value; else { if ((i % 4) == 0) { LispObj **keys, **values; keys = realloc(entry->keys, sizeof(LispObj*) * (i + 4)); if (keys == NULL) LispDestroy("out of memory"); values = realloc(entry->values, sizeof(LispObj*) * (i + 4)); if (values == NULL) { free(keys); LispDestroy("out of memory"); } entry->keys = keys; entry->values = values; } entry->keys[i] = okey; entry->values[i] = value; ++entry->count; ++hash->count; if (hash->count > hash->rehash_threshold * hash->num_entries) LispRehash(hash); } break; case REM_HASH: if (found) { result = T; --entry->count; --hash->count; if (i < entry->count) { memmove(entry->keys + i, entry->keys + i + 1, (entry->count - i) * sizeof(LispObj*)); memmove(entry->values + i, entry->values + i + 1, (entry->count - i) * sizeof(LispObj*)); } if (entry->cache && entry->cache == entry->count) --entry->cache; } break; } return (result); } static void LispRehash(LispHashTable *hash) { unsigned long key; LispHashEntry *entries, *nentry, *entry, *last; long i, size = hash->num_entries * hash->rehash_size; for (i = 0; i < sizeof(some_primes) / sizeof(some_primes[0]); i++) if (some_primes[i] >= size) { size = some_primes[i]; break; } entries = calloc(1, sizeof(LispHashEntry) * size); if (entries == NULL) goto out_of_memory; for (entry = hash->entries, last = entry + hash->num_entries; entry < last; entry++) { for (i = 0; i < entry->count; i++) { key = LispHashKey(entry->keys[i], hash->function) % size; nentry = entries + key; if ((nentry->count % 4) == 0) { LispObj **keys, **values; keys = realloc(nentry->keys, sizeof(LispObj*) * (nentry->count + 4)); if (keys == NULL) goto out_of_memory; values = realloc(nentry->values, sizeof(LispObj*) * (nentry->count + 4)); if (values == NULL) { free(keys); goto out_of_memory; } nentry->keys = keys; nentry->values = values; } nentry->keys[nentry->count] = entry->keys[i]; nentry->values[nentry->count] = entry->values[i]; ++nentry->count; } } LispFreeHashEntries(hash->entries, hash->num_entries); hash->entries = entries; hash->num_entries = size; return; out_of_memory: if (entries) LispFreeHashEntries(entries, size); LispDestroy("out of memory"); } static void LispFreeHashEntries(LispHashEntry *entries, long num_entries) { LispHashEntry *entry, *last; for (entry = entries, last = entry + num_entries; entry < last; entry++) { free(entry->keys); free(entry->values); } free(entries); } void LispFreeHashTable(LispHashTable *hash) { LispFreeHashEntries(hash->entries, hash->num_entries); free(hash); } LispObj * Lisp_Clrhash(LispBuiltin *builtin) /* clrhash hash-table */ { LispHashTable *hash; LispHashEntry *entry, *last; LispObj *hash_table = ARGUMENT(0); CHECK_HASHTABLE(hash_table); hash = hash_table->data.hash.table; for (entry = hash->entries, last = entry + hash->num_entries; entry < last; entry++) { free(entry->keys); free(entry->values); entry->keys = entry->values = NULL; entry->count = entry->cache = 0; } hash->count = 0; return (hash_table); } LispObj * Lisp_Gethash(LispBuiltin *builtin) /* gethash key hash-table &optional default */ { return (LispHash(builtin, GET_HASH)); } LispObj * Lisp_HashTableP(LispBuiltin *builtin) /* hash-table-p object */ { LispObj *object = ARGUMENT(0); return (HASHTABLEP(object) ? T : NIL); } LispObj * Lisp_HashTableCount(LispBuiltin *builtin) /* hash-table-count hash-table */ { LispObj *hash_table = ARGUMENT(0); CHECK_HASHTABLE(hash_table); return (FIXNUM(hash_table->data.hash.table->count)); } LispObj * Lisp_HashTableRehashSize(LispBuiltin *builtin) /* hash-table-rehash-size hash-table */ { LispObj *hash_table = ARGUMENT(0); CHECK_HASHTABLE(hash_table); return (DFLOAT(hash_table->data.hash.table->rehash_size)); } LispObj * Lisp_HashTableRehashThreshold(LispBuiltin *builtin) /* hash-table-rehash-threshold hash-table */ { LispObj *hash_table = ARGUMENT(0); CHECK_HASHTABLE(hash_table); return (DFLOAT(hash_table->data.hash.table->rehash_threshold)); } LispObj * Lisp_HashTableSize(LispBuiltin *builtin) /* hash-table-size hash-table */ { LispObj *hash_table = ARGUMENT(0); CHECK_HASHTABLE(hash_table); return (FIXNUM(hash_table->data.hash.table->num_entries)); } LispObj * Lisp_HashTableTest(LispBuiltin *builtin) /* hash-table-test hash-table */ { LispObj *hash_table = ARGUMENT(0); CHECK_HASHTABLE(hash_table); return (hash_table->data.hash.test); } LispObj * Lisp_Maphash(LispBuiltin *builtin) /* maphash function hash-table */ { long i; LispHashEntry *entry, *last; LispObj *function, *hash_table; hash_table = ARGUMENT(1); function = ARGUMENT(0); CHECK_HASHTABLE(hash_table); for (entry = hash_table->data.hash.table->entries, last = entry + hash_table->data.hash.table->num_entries; entry < last; entry++) { for (i = 0; i < entry->count; i++) APPLY2(function, entry->keys[i], entry->values[i]); } return (NIL); } LispObj * Lisp_MakeHashTable(LispBuiltin *builtin) /* make-hash-table &key test size rehash-size rehash-threshold initial-contents */ { int function = FEQL; unsigned long i, isize, xsize; double drsize, drthreshold; LispHashTable *hash_table; LispObj *cons, *result; LispObj *test, *size, *rehash_size, *rehash_threshold, *initial_contents; initial_contents = ARGUMENT(4); rehash_threshold = ARGUMENT(3); rehash_size = ARGUMENT(2); size = ARGUMENT(1); test = ARGUMENT(0); if (test != UNSPEC) { if (FUNCTIONP(test)) test = test->data.atom->object; if (test == Oeq) function = FEQ; else if (test == Oeql) function = FEQL; else if (test == Oequal) function = FEQUAL; else if (test == Oequalp) function = FEQUALP; else LispDestroy("%s: :TEST must be EQ, EQL, EQUAL, " "or EQUALP, not %s", STRFUN(builtin), STROBJ(test)); } else test = Oeql; if (size != UNSPEC) { CHECK_INDEX(size); isize = FIXNUM_VALUE(size); } else isize = 1; if (rehash_size != UNSPEC) { CHECK_DFLOAT(rehash_size); if (DFLOAT_VALUE(rehash_size) <= 1.0) LispDestroy("%s: :REHASH-SIZE must a float > 1, not %s", STRFUN(builtin), STROBJ(rehash_size)); drsize = DFLOAT_VALUE(rehash_size); } else drsize = 1.5; if (rehash_threshold != UNSPEC) { CHECK_DFLOAT(rehash_threshold); if (DFLOAT_VALUE(rehash_threshold) < 0.0 || DFLOAT_VALUE(rehash_threshold) > 1.0) LispDestroy("%s: :REHASH-THRESHOLD must a float " "in the range 0.0 - 1.0, not %s", STRFUN(builtin), STROBJ(rehash_threshold)); drthreshold = DFLOAT_VALUE(rehash_threshold); } else drthreshold = 0.75; if (initial_contents == UNSPEC) initial_contents = NIL; CHECK_LIST(initial_contents); for (xsize = 0, cons = initial_contents; CONSP(cons); xsize++, cons = CDR(cons)) CHECK_CONS(CAR(cons)); if (xsize > isize) isize = xsize; for (i = 0; i < sizeof(some_primes) / sizeof(some_primes[0]); i++) if (some_primes[i] >= isize) { isize = some_primes[i]; break; } hash_table = LispMalloc(sizeof(LispHashTable)); hash_table->entries = LispCalloc(1, sizeof(LispHashEntry) * isize); hash_table->num_entries = isize; hash_table->count = 0; hash_table->function = function; hash_table->rehash_size = drsize; hash_table->rehash_threshold = drthreshold; result = LispNew(NIL, NIL); result->type = LispHashTable_t; result->data.hash.table = hash_table; result->data.hash.test = test; LispMused(hash_table); LispMused(hash_table->entries); if (initial_contents != UNSPEC) { unsigned long key; LispHashEntry *entry; for (cons = initial_contents; CONSP(cons); cons = CDR(cons)) { key = LispHashKey(CAAR(cons), function) % isize; entry = hash_table->entries + key; if ((entry->count % 4) == 0) { LispObj **keys, **values; keys = realloc(entry->keys, sizeof(LispObj*) * (i + 4)); if (keys == NULL) LispDestroy("out of memory"); values = realloc(entry->values, sizeof(LispObj*) * (i + 4)); if (values == NULL) { free(keys); LispDestroy("out of memory"); } entry->keys = keys; entry->values = values; } entry->keys[entry->count] = CAAR(cons); entry->values[entry->count] = CDAR(cons); ++entry->count; } hash_table->count = xsize; } return (result); } LispObj * Lisp_Remhash(LispBuiltin *builtin) /* remhash key hash-table */ { return (LispHash(builtin, REM_HASH)); } LispObj * Lisp_XeditPuthash(LispBuiltin *builtin) /* lisp::puthash key hash-table value */ { return (LispHash(builtin, PUT_HASH)); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/io.h0000664000000000000000000000770012472175711015050 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/io.h,v 1.9tsi Exp $ */ #ifndef Lisp_io_h #define Lisp_io_h #include "lisp/private.h" #define FILE_READ 0x01 #define FILE_WRITE 0x02 #define FILE_IO 0x03 #define FILE_APPEND 0x06 /* append mode, write bit also set */ #define FILE_BUFFERED 0x08 /* force buffered mode */ #define FILE_UNBUFFERED 0x10 /* force unbuffered mode */ #define FILE_BINARY 0x20 /* * Types */ typedef ssize_t (*io_write_fn)(int, const void*, size_t); struct _LispFile { char *buffer; int line; /* input line number */ int column; /* output column number */ int descriptor; int length; /* number of bytes used */ int offset; /* read/write offset */ int unget : 8; /* unread char */ unsigned int readable : 1; unsigned int writable : 1; unsigned int regular : 1; /* regular file */ unsigned int buffered : 1; unsigned int available : 1; /* unget field holds a char */ unsigned int nonblock : 1; /* in nonblock mode */ unsigned int binary : 1; /* if set, don't calculate column/line-number */ io_write_fn io_write; }; struct _LispString { char *string; int line; /* input line number */ int column; /* output column number */ int space; /* number of bytes alocated */ int length; /* number of bytes used */ int input; /* input offset, for read operations */ int output; /* output offset, for write operations */ unsigned int fixed : 1; /* if set, don't try to reallocate string */ unsigned int binary : 1; /* if set, don't calculate column/line-number */ }; /* * Prototypes */ /* higher level functions */ int LispGet(void); int LispUnget(int); void LispPushInput(LispObj*); void LispPopInput(LispObj*); /* functions that read/write using the LispFile structure */ LispFile *LispFdopen(int, int); LispFile *LispFopen(const char*, int); void LispFclose(LispFile*); int LispFflush(LispFile*); int LispFungetc(LispFile*, int); int LispFgetc(LispFile*); int LispFputc(LispFile*, int); char *LispFgets(LispFile*, char*, int); int LispFputs(LispFile*, const char*); int LispFread(LispFile*, void*, int); int LispFwrite(LispFile*, const void*, int); int LispRename(const char*, const char*); int LispUnlink(const char*); /* io wrappers */ io_write_fn LispSetFileWrite(LispFile*, io_write_fn); /* functions that read/write using the LispString structure */ int LispSgetc(LispString*); int LispSputc(LispString*, int); int LispSputs(LispString*, const char*); int LispSwrite(LispString*, const void*, int); const char *LispGetSstring(LispString*, int*); #endif /* Lisp_io_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/lisp.c0000664000000000000000000045512012472175711015406 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/lisp.c,v 1.87tsi Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #ifdef sun #include #endif #include #include #include #include #include #include #ifndef X_NOT_POSIX #include /* for sysconf(), and getpagesize() */ #endif #include "lisp/bytecode.h" #include "lisp/read.h" #include "lisp/format.h" #include "lisp/math.h" #include "lisp/hash.h" #include "lisp/package.h" #include "lisp/pathname.h" #include "lisp/regex.h" #include "lisp/require.h" #include "lisp/stream.h" #include "lisp/struct.h" #include "lisp/time.h" #include "lisp/write.h" #include typedef struct { LispObj **objects; LispObj *freeobj; int nsegs; int nobjs; int nfree; } LispObjSeg; /* * Prototypes */ static void Lisp__GC(LispObj*, LispObj*); static LispObj *Lisp__New(LispObj*, LispObj*); /* run a user function, to be called only by LispEval */ static LispObj *LispRunFunMac(LispObj*, LispObj*, int, int); /* expands and executes a setf method, to be called only by Lisp_Setf */ LispObj *LispRunSetf(LispArgList*, LispObj*, LispObj*, LispObj*); LispObj *LispRunSetfMacro(LispAtom*, LispObj*, LispObj*); /* increases storage size for environment */ void LispMoreEnvironment(void); /* increases storage size for stack of builtin arguments */ void LispMoreStack(void); /* increases storage size for global variables */ void LispMoreGlobals(LispPackage*); #ifdef __GNUC__ static INLINE LispObj *LispDoGetVar(LispObj*); #endif static INLINE void LispDoAddVar(LispObj*, LispObj*); /* Helper for importing symbol(s) functions, * Search for the specified object in the current package */ static INLINE LispObj *LispGetVarPack(LispObj*); /* create environment for function call */ static int LispMakeEnvironment(LispArgList*, LispObj*, LispObj*, int, int); /* if not already in keyword package, move atom to keyword package */ static LispObj *LispCheckKeyword(LispObj*); /* builtin backquote parsing */ static LispObj *LispEvalBackquoteObject(LispObj*, int, int); /* used also by the bytecode compiler */ LispObj *LispEvalBackquote(LispObj*, int); /* create or change object property */ void LispSetAtomObjectProperty(LispAtom*, LispObj*); /* remove object property */ static void LispRemAtomObjectProperty(LispAtom*); /* allocates a new LispProperty for the given atom */ static void LispAllocAtomProperty(LispAtom*); /* Increment reference count of atom property */ static void LispIncrementAtomReference(LispAtom*); /* Decrement reference count of atom property */ static void LispDecrementAtomReference(LispAtom*); /* Removes all atom properties */ static void LispRemAtomAllProperties(LispAtom*); static LispObj *LispAtomPropertyFunction(LispAtom*, LispObj*, int); static INLINE void LispCheckMemLevel(void); void LispAllocSeg(LispObjSeg*, int); static INLINE void LispMark(LispObj*); /* functions, macros, setf methods, and structure definitions */ static INLINE void LispProt(LispObj*); static LispObj *LispCheckNeedProtect(LispObj*); static void LispSignalHandler(int); /* * Initialization */ LispMac lisp__data; static LispObj lispunbound = {LispNil_t}; LispObj *UNBOUND = &lispunbound; static volatile int lisp__disable_int; static volatile int lisp__interrupted; LispObj *Okey, *Orest, *Ooptional, *Oaux, *Olambda; Atom_id Snil, St; Atom_id Saux, Skey, Soptional, Srest; Atom_id Satom, Ssymbol, Sinteger, Scharacter, Sstring, Slist, Scons, Svector, Sarray, Sstruct, Skeyword, Sfunction, Spathname, Srational, Sfloat, Scomplex, Sopaque, Sdefault; LispObj *Oformat, *Kunspecific; LispObj *Oexpand_setf_method; static LispProperty noproperty; LispProperty *NOPROPERTY = &noproperty; static int segsize, minfree; int pagesize, gcpro; static LispObjSeg objseg = {NULL, NIL}; static LispObjSeg atomseg = {NULL, NIL}; int LispArgList_t; LispFile *Stdout, *Stdin, *Stderr; static LispBuiltin lispbuiltins[] = { {LispFunction, Lisp_Mul, "* &rest numbers"}, {LispFunction, Lisp_Plus, "+ &rest numbers"}, {LispFunction, Lisp_Minus, "- number &rest more-numbers"}, {LispFunction, Lisp_Div, "/ number &rest more-numbers"}, {LispFunction, Lisp_OnePlus, "1+ number"}, {LispFunction, Lisp_OneMinus, "1- number"}, {LispFunction, Lisp_Less, "< number &rest more-numbers"}, {LispFunction, Lisp_LessEqual, "<= number &rest more-numbers"}, {LispFunction, Lisp_Equal_, "= number &rest more-numbers"}, {LispFunction, Lisp_Greater, "> number &rest more-numbers"}, {LispFunction, Lisp_GreaterEqual, ">= number &rest more-numbers"}, {LispFunction, Lisp_NotEqual, "/= number &rest more-numbers"}, {LispFunction, Lisp_Max, "max number &rest more-numbers"}, {LispFunction, Lisp_Min, "min number &rest more-numbers"}, {LispFunction, Lisp_Abs, "abs number"}, {LispFunction, Lisp_Acons, "acons key datum alist"}, {LispFunction, Lisp_Adjoin, "adjoin item list &key key test test-not"}, {LispFunction, Lisp_AlphaCharP, "alpha-char-p char"}, {LispMacro, Lisp_And, "and &rest args", 1, 0, Com_And}, {LispFunction, Lisp_Append, "append &rest lists"}, {LispFunction, Lisp_Apply, "apply function arg &rest more-args", 1}, {LispFunction, Lisp_Aref, "aref array &rest subscripts"}, {LispFunction, Lisp_Assoc, "assoc item list &key test test-not key"}, {LispFunction, Lisp_AssocIf, "assoc-if predicate list &key key"}, {LispFunction, Lisp_AssocIfNot, "assoc-if-not predicate list &key key"}, {LispFunction, Lisp_Atom, "atom object"}, {LispMacro, Lisp_Block, "block name &rest body", 1, 0, Com_Block}, {LispFunction, Lisp_BothCaseP, "both-case-p character"}, {LispFunction, Lisp_Boundp, "boundp symbol"}, {LispFunction, Lisp_Butlast, "butlast list &optional count"}, {LispFunction, Lisp_Nbutlast, "nbutlast list &optional count"}, {LispFunction, Lisp_Car, "car list", 0, 0, Com_C_r}, {LispFunction, Lisp_Car, "first list", 0, 0, Com_C_r}, {LispMacro, Lisp_Case, "case keyform &rest body"}, {LispMacro, Lisp_Catch, "catch tag &rest body", 1}, {LispFunction, Lisp_Cdr, "cdr list", 0, 0, Com_C_r}, {LispFunction, Lisp_Cdr, "rest list", 0, 0, Com_C_r}, {LispFunction, Lisp_Ceiling, "ceiling number &optional divisor", 1}, {LispFunction, Lisp_Fceiling, "fceiling number &optional divisor", 1}, {LispFunction, Lisp_Char, "char string index"}, {LispFunction, Lisp_Char, "schar simple-string index"}, {LispFunction, Lisp_CharLess, "char< character &rest more-characters"}, {LispFunction, Lisp_CharLessEqual, "char<= character &rest more-characters"}, {LispFunction, Lisp_CharEqual_, "char= character &rest more-characters"}, {LispFunction, Lisp_CharGreater, "char> character &rest more-characters"}, {LispFunction, Lisp_CharGreaterEqual, "char>= character &rest more-characters"}, {LispFunction, Lisp_CharNotEqual_, "char/= character &rest more-characters"}, {LispFunction, Lisp_CharLessp, "char-lessp character &rest more-characters"}, {LispFunction, Lisp_CharNotGreaterp, "char-not-greaterp character &rest more-characters"}, {LispFunction, Lisp_CharEqual, "char-equal character &rest more-characters"}, {LispFunction, Lisp_CharGreaterp, "char-greaterp character &rest more-characters"}, {LispFunction, Lisp_CharNotLessp, "char-not-lessp character &rest more-characters"}, {LispFunction, Lisp_CharNotEqual, "char-not-equal character &rest more-characters"}, {LispFunction, Lisp_CharDowncase, "char-downcase character"}, {LispFunction, Lisp_CharInt, "char-code character"}, {LispFunction, Lisp_CharInt, "char-int character"}, {LispFunction, Lisp_CharUpcase, "char-upcase character"}, {LispFunction, Lisp_Character, "character object"}, {LispFunction, Lisp_Characterp, "characterp object"}, {LispFunction, Lisp_Clrhash, "clrhash hash-table"}, {LispFunction, Lisp_IntChar, "code-char integer"}, {LispFunction, Lisp_Coerce, "coerce object result-type"}, {LispFunction, Lisp_Compile, "compile name &optional definition", 1}, {LispFunction, Lisp_Complex, "complex realpart &optional imagpart"}, {LispMacro, Lisp_Cond, "cond &rest body", 0, 0, Com_Cond}, {LispFunction, Lisp_Cons, "cons car cdr", 0, 0, Com_Cons}, {LispFunction, Lisp_Consp, "consp object", 0, 0, Com_Consp}, {LispFunction, Lisp_Constantp, "constantp form &optional environment"}, {LispFunction, Lisp_Conjugate, "conjugate number"}, {LispFunction, Lisp_Complexp, "complexp object"}, {LispFunction, Lisp_CopyAlist, "copy-alist list"}, {LispFunction, Lisp_CopyList, "copy-list list"}, {LispFunction, Lisp_CopyTree, "copy-tree list"}, {LispFunction, Lisp_Close, "close stream &key abort"}, {LispFunction, Lisp_C_r, "caar list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cadr list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cdar list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cddr list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "caaar list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "caadr list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cadar list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "caddr list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cdaar list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cdadr list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cddar list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cdddr list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "caaaar list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "caaadr list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "caadar list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "caaddr list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cadaar list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cadadr list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "caddar list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cadddr list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cdaaar list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cdaadr list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cdadar list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cdaddr list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cddaar list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cddadr list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cdddar list", 0, 0, Com_C_r}, {LispFunction, Lisp_C_r, "cddddr list", 0, 0, Com_C_r}, {LispMacro, Lisp_Decf, "decf place &optional delta"}, {LispMacro, Lisp_Defconstant, "defconstant name initial-value &optional documentation"}, {LispMacro, Lisp_Defmacro, "defmacro name lambda-list &rest body"}, {LispMacro, Lisp_Defstruct, "defstruct name &rest description"}, {LispMacro, Lisp_Defun, "defun name lambda-list &rest body"}, {LispMacro, Lisp_Defsetf, "defsetf function lambda-list &rest body"}, {LispMacro, Lisp_Defparameter, "defparameter name initial-value &optional documentation"}, {LispMacro, Lisp_Defvar, "defvar name &optional initial-value documentation"}, {LispFunction, Lisp_Delete, "delete item sequence &key from-end test test-not start end count key"}, {LispFunction, Lisp_DeleteDuplicates, "delete-duplicates sequence &key from-end test test-not start end key"}, {LispFunction, Lisp_DeleteIf, "delete-if predicate sequence &key from-end start end count key"}, {LispFunction, Lisp_DeleteIfNot, "delete-if-not predicate sequence &key from-end start end count key"}, {LispFunction, Lisp_DeleteFile, "delete-file filename"}, {LispFunction, Lisp_Denominator, "denominator rational"}, {LispFunction, Lisp_DigitChar, "digit-char weight &optional radix"}, {LispFunction, Lisp_DigitCharP, "digit-char-p character &optional radix"}, {LispFunction, Lisp_Directory, "directory pathname &key all if-cannot-read"}, {LispFunction, Lisp_DirectoryNamestring, "directory-namestring pathname"}, {LispFunction, Lisp_Disassemble, "disassemble function"}, {LispMacro, Lisp_Do, "do init test &rest body"}, {LispMacro, Lisp_DoP, "do* init test &rest body"}, {LispFunction, Lisp_Documentation, "documentation symbol type"}, {LispMacro, Lisp_DoList, "dolist init &rest body", 0, 0, Com_Dolist}, {LispMacro, Lisp_DoTimes, "dotimes init &rest body"}, {LispMacro, Lisp_DoAllSymbols, "do-all-symbols init &rest body"}, {LispMacro, Lisp_DoExternalSymbols, "do-external-symbols init &rest body"}, {LispMacro, Lisp_DoSymbols, "do-symbols init &rest body"}, {LispFunction, Lisp_Elt, "elt sequence index"}, {LispFunction, Lisp_Endp, "endp object"}, {LispFunction, Lisp_EnoughNamestring, "enough-namestring pathname &optional defaults"}, {LispFunction, Lisp_Eq, "eq left right", 0, 0, Com_Eq}, {LispFunction, Lisp_Eql, "eql left right", 0, 0, Com_Eq}, {LispFunction, Lisp_Equal, "equal left right", 0, 0, Com_Eq}, {LispFunction, Lisp_Equalp, "equalp left right", 0, 0, Com_Eq}, {LispFunction, Lisp_Error, "error control-string &rest arguments"}, {LispFunction, Lisp_Evenp, "evenp integer"}, {LispFunction, Lisp_Export, "export symbols &optional package"}, {LispFunction, Lisp_Eval, "eval form"}, {LispFunction, Lisp_Every, "every predicate sequence &rest more-sequences"}, {LispFunction, Lisp_Some, "some predicate sequence &rest more-sequences"}, {LispFunction, Lisp_Notevery, "notevery predicate sequence &rest more-sequences"}, {LispFunction, Lisp_Notany, "notany predicate sequence &rest more-sequences"}, {LispFunction, Lisp_Fboundp, "fboundp symbol"}, {LispFunction, Lisp_Find, "find item sequence &key from-end test test-not start end key"}, {LispFunction, Lisp_FindIf, "find-if predicate sequence &key from-end start end key"}, {LispFunction, Lisp_FindIfNot, "find-if-not predicate sequence &key from-end start end key"}, {LispFunction, Lisp_FileNamestring, "file-namestring pathname"}, {LispFunction, Lisp_Fill, "fill sequence item &key start end"}, {LispFunction, Lisp_FindAllSymbols, "find-all-symbols string-or-symbol"}, {LispFunction, Lisp_FindSymbol, "find-symbol string &optional package", 1}, {LispFunction, Lisp_FindPackage, "find-package name"}, {LispFunction, Lisp_Float, "float number &optional other"}, {LispFunction, Lisp_Floatp, "floatp object"}, {LispFunction, Lisp_Floor, "floor number &optional divisor", 1}, {LispFunction, Lisp_Ffloor, "ffloor number &optional divisor", 1}, {LispFunction, Lisp_Fmakunbound, "fmakunbound symbol"}, {LispFunction, Lisp_Format, "format destination control-string &rest arguments"}, {LispFunction, Lisp_FreshLine, "fresh-line &optional output-stream"}, {LispFunction, Lisp_Funcall, "funcall function &rest arguments", 1}, {LispFunction, Lisp_Functionp, "functionp object"}, {LispFunction, Lisp_Gc, "gc &optional car cdr"}, {LispFunction, Lisp_Gcd, "gcd &rest integers"}, {LispFunction, Lisp_Gensym, "gensym &optional arg"}, {LispFunction, Lisp_Get, "get symbol indicator &optional default"}, {LispFunction, Lisp_Gethash, "gethash key hash-table &optional default", 1}, {LispMacro, Lisp_Go, "go tag", 0, 0, Com_Go}, {LispFunction, Lisp_GraphicCharP, "graphic-char-p char"}, {LispFunction, Lisp_HashTableP, "hash-table-p object"}, {LispFunction, Lisp_HashTableCount, "hash-table-count hash-table"}, {LispFunction, Lisp_HashTableRehashSize, "hash-table-rehash-size hash-table"}, {LispFunction, Lisp_HashTableRehashThreshold, "hash-table-rehash-threshold hash-table"}, {LispFunction, Lisp_HashTableSize, "hash-table-size hash-table"}, {LispFunction, Lisp_HashTableTest, "hash-table-test hash-table"}, {LispFunction, Lisp_HostNamestring, "host-namestring pathname"}, {LispMacro, Lisp_If, "if test then &optional else", 0, 0, Com_If}, {LispMacro, Lisp_IgnoreErrors, "ignore-errors &rest body", 1}, {LispFunction, Lisp_Imagpart, "imagpart number"}, {LispMacro, Lisp_InPackage, "in-package name"}, {LispMacro, Lisp_Incf, "incf place &optional delta"}, {LispFunction, Lisp_Import, "import symbols &optional package"}, {LispFunction, Lisp_InputStreamP, "input-stream-p stream"}, {LispFunction, Lisp_IntChar, "int-char integer"}, {LispFunction, Lisp_Integerp, "integerp object"}, {LispFunction, Lisp_Intern, "intern string &optional package", 1}, {LispFunction, Lisp_Intersection, "intersection list1 list2 &key test test-not key"}, {LispFunction, Lisp_Nintersection, "nintersection list1 list2 &key test test-not key"}, {LispFunction, Lisp_Isqrt, "isqrt natural"}, {LispFunction, Lisp_Keywordp, "keywordp object"}, {LispFunction, Lisp_Last, "last list &optional count", 0, 0, Com_Last}, {LispMacro, Lisp_Lambda, "lambda lambda-list &rest body"}, {LispFunction, Lisp_Lcm, "lcm &rest integers"}, {LispFunction, Lisp_Length, "length sequence", 0, 0, Com_Length}, {LispMacro, Lisp_Let, "let init &rest body", 1, 0, Com_Let}, {LispMacro, Lisp_LetP, "let* init &rest body", 1, 0, Com_Letx}, {LispFunction, Lisp_ListP, "list* object &rest more-objects"}, {LispFunction, Lisp_ListAllPackages, "list-all-packages"}, {LispFunction, Lisp_List, "list &rest args"}, {LispFunction, Lisp_ListLength, "list-length list"}, {LispFunction, Lisp_Listp, "listp object", 0, 0, Com_Listp}, {LispFunction, Lisp_Listen, "listen &optional input-stream"}, {LispFunction, Lisp_Load, "load filename &key verbose print if-does-not-exist"}, {LispFunction, Lisp_Logand, "logand &rest integers"}, {LispFunction, Lisp_Logeqv, "logeqv &rest integers"}, {LispFunction, Lisp_Logior, "logior &rest integers"}, {LispFunction, Lisp_Lognot, "lognot integer"}, {LispFunction, Lisp_Logxor, "logxor &rest integers"}, {LispMacro, Lisp_Loop, "loop &rest body", 0, 0, Com_Loop}, {LispFunction, Lisp_LowerCaseP, "lower-case-p character"}, {LispFunction, Lisp_MakeArray, "make-array dimensions &key element-type initial-element initial-contents adjustable fill-pointer displaced-to displaced-index-offset"}, {LispFunction, Lisp_MakeHashTable, "make-hash-table &key test size rehash-size rehash-threshold initial-contents"}, {LispFunction, Lisp_MakeList, "make-list size &key initial-element"}, {LispFunction, Lisp_MakePackage, "make-package package-name &key nicknames use"}, {LispFunction, Lisp_MakePathname, "make-pathname &key host device directory name type version defaults"}, {LispFunction, Lisp_MakeString, "make-string size &key initial-element element-type"}, {LispFunction, Lisp_MakeSymbol, "make-symbol name"}, {LispFunction, Lisp_MakeStringInputStream, "make-string-input-stream string &optional start end"}, {LispFunction, Lisp_MakeStringOutputStream, "make-string-output-stream &key element-type"}, {LispFunction, Lisp_GetOutputStreamString, "get-output-stream-string string-output-stream"}, {LispFunction, Lisp_Makunbound, "makunbound symbol"}, {LispFunction, Lisp_Mapc, "mapc function list &rest more-lists"}, {LispFunction, Lisp_Mapcar, "mapcar function list &rest more-lists"}, {LispFunction, Lisp_Mapcan, "mapcan function list &rest more-lists"}, {LispFunction, Lisp_Maphash, "maphash function hash-table"}, {LispFunction, Lisp_Mapl, "mapl function list &rest more-lists"}, {LispFunction, Lisp_Maplist, "maplist function list &rest more-lists"}, {LispFunction, Lisp_Mapcon, "mapcon function list &rest more-lists"}, {LispFunction, Lisp_Member, "member item list &key test test-not key"}, {LispFunction, Lisp_MemberIf, "member-if predicate list &key key"}, {LispFunction, Lisp_MemberIfNot, "member-if-not predicate list &key key"}, {LispFunction, Lisp_Minusp, "minusp number"}, {LispFunction, Lisp_Mod, "mod number divisor"}, {LispMacro, Lisp_MultipleValueBind, "multiple-value-bind symbols values &rest body"}, {LispMacro, Lisp_MultipleValueCall, "multiple-value-call function &rest form", 1}, {LispMacro, Lisp_MultipleValueProg1, "multiple-value-prog1 first-form &rest form", 1}, {LispMacro, Lisp_MultipleValueList, "multiple-value-list form"}, {LispMacro, Lisp_MultipleValueSetq, "multiple-value-setq symbols form"}, {LispFunction, Lisp_Nconc, "nconc &rest lists"}, {LispFunction, Lisp_Nreverse, "nreverse sequence"}, {LispFunction, Lisp_NsetDifference, "nset-difference list1 list2 &key test test-not key"}, {LispFunction, Lisp_Nsubstitute, "nsubstitute newitem olditem sequence &key from-end test test-not start end count key"}, {LispFunction, Lisp_NsubstituteIf, "nsubstitute-if newitem test sequence &key from-end start end count key"}, {LispFunction, Lisp_NsubstituteIfNot, "nsubstitute-if-not newitem test sequence &key from-end start end count key"}, {LispFunction, Lisp_Nth, "nth index list"}, {LispFunction, Lisp_Nthcdr, "nthcdr index list", 0, 0, Com_Nthcdr}, {LispMacro, Lisp_NthValue, "nth-value index form"}, {LispFunction, Lisp_Numerator, "numerator rational"}, {LispFunction, Lisp_Namestring, "namestring pathname"}, {LispFunction, Lisp_Null, "not arg", 0, 0, Com_Null}, {LispFunction, Lisp_Null, "null list", 0, 0, Com_Null}, {LispFunction, Lisp_Numberp, "numberp object", 0, 0, Com_Numberp}, {LispFunction, Lisp_Oddp, "oddp integer"}, {LispFunction, Lisp_Open, "open filename &key direction element-type if-exists if-does-not-exist external-format"}, {LispFunction, Lisp_OpenStreamP, "open-stream-p stream"}, {LispMacro, Lisp_Or, "or &rest args", 1, 0, Com_Or}, {LispFunction, Lisp_OutputStreamP, "output-stream-p stream"}, {LispFunction, Lisp_Packagep, "packagep object"}, {LispFunction, Lisp_PackageName, "package-name package"}, {LispFunction, Lisp_PackageNicknames, "package-nicknames package"}, {LispFunction, Lisp_PackageUseList, "package-use-list package"}, {LispFunction, Lisp_PackageUsedByList, "package-used-by-list package"}, {LispFunction, Lisp_Pairlis, "pairlis key data &optional alist"}, {LispFunction, Lisp_ParseInteger, "parse-integer string &key start end radix junk-allowed", 1}, {LispFunction, Lisp_ParseNamestring, "parse-namestring object &optional host defaults &key start end junk-allowed", 1}, {LispFunction, Lisp_PathnameHost, "pathname-host pathname"}, {LispFunction, Lisp_PathnameDevice, "pathname-device pathname"}, {LispFunction, Lisp_PathnameDirectory, "pathname-directory pathname"}, {LispFunction, Lisp_PathnameName, "pathname-name pathname"}, {LispFunction, Lisp_PathnameType, "pathname-type pathname"}, {LispFunction, Lisp_PathnameVersion, "pathname-version pathname"}, {LispFunction, Lisp_Pathnamep, "pathnamep object"}, {LispFunction, Lisp_Plusp, "plusp number"}, {LispMacro, Lisp_Pop, "pop place"}, {LispFunction, Lisp_Position, "position item sequence &key from-end test test-not start end key"}, {LispFunction, Lisp_PositionIf, "position-if predicate sequence &key from-end start end key"}, {LispFunction, Lisp_PositionIfNot, "position-if-not predicate sequence &key from-end start end key"}, {LispFunction, Lisp_Prin1, "prin1 object &optional output-stream"}, {LispFunction, Lisp_Princ, "princ object &optional output-stream"}, {LispFunction, Lisp_Print, "print object &optional output-stream"}, {LispFunction, Lisp_ProbeFile, "probe-file pathname"}, {LispFunction, Lisp_Proclaim, "proclaim declaration"}, {LispMacro, Lisp_Prog1, "prog1 first &rest body"}, {LispMacro, Lisp_Prog2, "prog2 first second &rest body"}, {LispMacro, Lisp_Progn, "progn &rest body", 1, 0, Com_Progn}, {LispMacro, Lisp_Progv, "progv symbols values &rest body", 1}, {LispFunction, Lisp_Provide, "provide module"}, {LispMacro, Lisp_Push, "push item place"}, {LispMacro, Lisp_Pushnew, "pushnew item place &key key test test-not"}, {LispFunction, Lisp_Quit, "quit &optional status"}, {LispMacro, Lisp_Quote, "quote object"}, {LispFunction, Lisp_Rational, "rational number"}, {LispFunction, Lisp_Rationalp, "rationalp object"}, {LispFunction, Lisp_Read, "read &optional input-stream eof-error-p eof-value recursive-p"}, {LispFunction, Lisp_ReadChar, "read-char &optional input-stream eof-error-p eof-value recursive-p"}, {LispFunction, Lisp_ReadCharNoHang, "read-char-no-hang &optional input-stream eof-error-p eof-value recursive-p"}, {LispFunction, Lisp_ReadLine, "read-line &optional input-stream eof-error-p eof-value recursive-p", 1}, {LispFunction, Lisp_Realpart, "realpart number"}, {LispFunction, Lisp_Replace, "replace sequence1 sequence2 &key start1 end1 start2 end2"}, {LispFunction, Lisp_ReadFromString, "read-from-string string &optional eof-error-p eof-value &key start end preserve-whitespace", 1}, {LispFunction, Lisp_Require, "require module &optional pathname"}, {LispFunction, Lisp_Rem, "rem number divisor"}, {LispFunction, Lisp_Remhash, "remhash key hash-table"}, {LispFunction, Lisp_Remove, "remove item sequence &key from-end test test-not start end count key"}, {LispFunction, Lisp_RemoveDuplicates, "remove-duplicates sequence &key from-end test test-not start end key"}, {LispFunction, Lisp_RemoveIf, "remove-if predicate sequence &key from-end start end count key"}, {LispFunction, Lisp_RemoveIfNot, "remove-if-not predicate sequence &key from-end start end count key"}, {LispFunction, Lisp_Remprop, "remprop symbol indicator"}, {LispFunction, Lisp_RenameFile, "rename-file filename new-name", 1}, {LispMacro, Lisp_Return, "return &optional result", 1, 0, Com_Return}, {LispMacro, Lisp_ReturnFrom, "return-from name &optional result", 1, 0, Com_ReturnFrom}, {LispFunction, Lisp_Reverse, "reverse sequence"}, {LispFunction, Lisp_Round, "round number &optional divisor", 1}, {LispFunction, Lisp_Fround, "fround number &optional divisor", 1}, {LispFunction, Lisp_Rplaca, "rplaca place value", 0, 0, Com_Rplac_}, {LispFunction, Lisp_Rplacd, "rplacd place value", 0, 0, Com_Rplac_}, {LispFunction, Lisp_Search, "search sequence1 sequence2 &key from-end test test-not key start1 start2 end1 end2"}, {LispFunction, Lisp_Set, "set symbol value"}, {LispFunction, Lisp_SetDifference, "set-difference list1 list2 &key test test-not key"}, {LispFunction, Lisp_SetExclusiveOr, "set-exclusive-or list1 list2 &key test test-not key"}, {LispFunction, Lisp_NsetExclusiveOr, "nset-exclusive-or list1 list2 &key test test-not key"}, {LispMacro, Lisp_Setf, "setf &rest form"}, {LispMacro, Lisp_Psetf, "psetf &rest form"}, {LispMacro, Lisp_SetQ, "setq &rest form", 0, 0, Com_Setq}, {LispMacro, Lisp_Psetq, "psetq &rest form"}, {LispFunction, Lisp_Sleep, "sleep seconds"}, {LispFunction, Lisp_Sort, "sort sequence predicate &key key"}, {LispFunction, Lisp_Sqrt, "sqrt number"}, {LispFunction, Lisp_Elt, "svref sequence index"}, {LispFunction, Lisp_Sort, "stable-sort sequence predicate &key key"}, {LispFunction, Lisp_Streamp, "streamp object"}, {LispFunction, Lisp_String, "string object"}, {LispFunction, Lisp_Stringp, "stringp object"}, {LispFunction, Lisp_StringEqual_, "string= string1 string2 &key start1 end1 start2 end2"}, {LispFunction, Lisp_StringLess, "string< string1 string2 &key start1 end1 start2 end2"}, {LispFunction, Lisp_StringGreater, "string> string1 string2 &key start1 end1 start2 end2"}, {LispFunction, Lisp_StringLessEqual, "string<= string1 string2 &key start1 end1 start2 end2"}, {LispFunction, Lisp_StringGreaterEqual, "string>= string1 string2 &key start1 end1 start2 end2"}, {LispFunction, Lisp_StringNotEqual_, "string/= string1 string2 &key start1 end1 start2 end2"}, {LispFunction, Lisp_StringConcat, "string-concat &rest strings"}, {LispFunction, Lisp_StringEqual, "string-equal string1 string2 &key start1 end1 start2 end2"}, {LispFunction, Lisp_StringGreaterp, "string-greaterp string1 string2 &key start1 end1 start2 end2"}, {LispFunction, Lisp_StringNotEqual, "string-not-equal string1 string2 &key start1 end1 start2 end2"}, {LispFunction, Lisp_StringNotGreaterp, "string-not-greaterp string1 string2 &key start1 end1 start2 end2"}, {LispFunction, Lisp_StringNotLessp, "string-not-lessp string1 string2 &key start1 end1 start2 end2"}, {LispFunction, Lisp_StringLessp, "string-lessp string1 string2 &key start1 end1 start2 end2"}, {LispFunction, Lisp_StringTrim, "string-trim character-bag string"}, {LispFunction, Lisp_StringLeftTrim, "string-left-trim character-bag string"}, {LispFunction, Lisp_StringRightTrim, "string-right-trim character-bag string"}, {LispFunction, Lisp_StringUpcase, "string-upcase string &key start end"}, {LispFunction, Lisp_NstringUpcase, "nstring-upcase string &key start end"}, {LispFunction, Lisp_StringDowncase, "string-downcase string &key start end"}, {LispFunction, Lisp_NstringDowncase, "nstring-downcase string &key start end"}, {LispFunction, Lisp_StringCapitalize, "string-capitalize string &key start end"}, {LispFunction, Lisp_NstringCapitalize, "nstring-capitalize string &key start end"}, {LispFunction, Lisp_Subseq, "subseq sequence start &optional end"}, {LispFunction, Lisp_Subsetp, "subsetp list1 list2 &key test test-not key"}, {LispFunction, Lisp_Substitute, "substitute newitem olditem sequence &key from-end test test-not start end count key"}, {LispFunction, Lisp_SubstituteIf, "substitute-if newitem test sequence &key from-end start end count key"}, {LispFunction, Lisp_SubstituteIfNot, "substitute-if-not newitem test sequence &key from-end start end count key"}, {LispFunction, Lisp_SymbolFunction, "symbol-function symbol"}, {LispFunction, Lisp_SymbolName, "symbol-name symbol"}, {LispFunction, Lisp_Symbolp, "symbolp object"}, {LispFunction, Lisp_SymbolPlist, "symbol-plist symbol"}, {LispFunction, Lisp_SymbolPackage, "symbol-package symbol"}, {LispFunction, Lisp_SymbolValue, "symbol-value symbol"}, {LispMacro, Lisp_Tagbody, "tagbody &rest body", 0, 0, Com_Tagbody}, {LispFunction, Lisp_Terpri, "terpri &optional output-stream"}, {LispFunction, Lisp_Typep, "typep object type"}, {LispMacro, Lisp_The, "the value-type form"}, {LispMacro, Lisp_Throw, "throw tag result", 1}, {LispMacro, Lisp_Time, "time form"}, {LispFunction, Lisp_Truename, "truename pathname"}, {LispFunction, Lisp_TreeEqual, "tree-equal tree-1 tree-2 &key test test-not"}, {LispFunction, Lisp_Truncate, "truncate number &optional divisor", 1}, {LispFunction, Lisp_Ftruncate, "ftruncate number &optional divisor", 1}, {LispFunction, Lisp_Unexport, "unexport symbols &optional package"}, {LispFunction, Lisp_Union, "union list1 list2 &key test test-not key"}, {LispFunction, Lisp_Nunion, "nunion list1 list2 &key test test-not key"}, {LispMacro, Lisp_Unless, "unless test &rest body", 1, 0, Com_Unless}, {LispFunction, Lisp_UserHomedirPathname, "user-homedir-pathname &optional host"}, {LispMacro, Lisp_UnwindProtect, "unwind-protect protect &rest cleanup"}, {LispFunction, Lisp_UpperCaseP, "upper-case-p character"}, {LispFunction, Lisp_Values, "values &rest objects", 1}, {LispFunction, Lisp_ValuesList, "values-list list", 1}, {LispFunction, Lisp_Vector, "vector &rest objects"}, {LispMacro, Lisp_When, "when test &rest body", 1, 0, Com_When}, {LispFunction, Lisp_Write, " write object &key case circle escape length level lines pretty readably right-margin stream"}, {LispFunction, Lisp_WriteChar, "write-char string &optional output-stream"}, {LispFunction, Lisp_WriteLine, "write-line string &optional output-stream &key start end"}, {LispFunction, Lisp_WriteString, "write-string string &optional output-stream &key start end"}, {LispFunction, Lisp_XeditCharStore, "lisp::char-store string index value", 0, 1}, {LispFunction, Lisp_XeditEltStore, "lisp::elt-store sequence index value", 0, 1}, {LispFunction, Lisp_XeditMakeStruct, "lisp::make-struct atom &rest init", 0, 1}, {LispFunction, Lisp_XeditPut, " lisp::put symbol indicator value", 0, 1}, {LispFunction, Lisp_XeditPuthash, "lisp::puthash key hash-table value", 0, 1}, {LispFunction, Lisp_XeditSetSymbolPlist, "lisp::set-symbol-plist symbol list", 0, 1}, {LispFunction, Lisp_XeditStructAccess, "lisp::struct-access atom struct", 0, 1}, {LispFunction, Lisp_XeditStructType, "lisp::struct-type atom struct", 0, 1}, {LispFunction, Lisp_XeditStructStore, "lisp::struct-store atom struct value", 0, 1}, {LispFunction, Lisp_XeditVectorStore, "lisp::vector-store array &rest values", 0, 1}, {LispFunction, Lisp_XeditDocumentationStore, "lisp::documentation-store symbol type string", 0, 1}, {LispFunction, Lisp_Zerop, "zerop number"}, }; static LispBuiltin extbuiltins[] = { {LispFunction, Lisp_Getenv, "getenv name"}, {LispFunction, Lisp_MakePipe, "make-pipe command-line &key direction element-type external-format"}, {LispFunction, Lisp_PipeBroken, "pipe-broken pipe-stream"}, {LispFunction, Lisp_PipeErrorStream, "pipe-error-stream pipe-stream"}, {LispFunction, Lisp_PipeInputDescriptor, "pipe-input-descriptor pipe-stream"}, {LispFunction, Lisp_PipeErrorDescriptor, "pipe-error-descriptor pipe-stream"}, {LispFunction, Lisp_Recomp, "re-comp pattern &key nospec icase nosub newline"}, {LispFunction, Lisp_Reexec, "re-exec regex string &key count start end notbol noteol"}, {LispFunction, Lisp_Rep, "re-p object"}, {LispFunction, Lisp_Setenv, "setenv name value &optional overwrite"}, {LispFunction, Lisp_Unsetenv, "unsetenv name"}, {LispFunction, Lisp_NstringTrim, "nstring-trim character-bag string"}, {LispFunction, Lisp_NstringLeftTrim, "nstring-left-trim character-bag string"}, {LispFunction, Lisp_NstringRightTrim, "nstring-right-trim character-bag string"}, {LispMacro, Lisp_Until, "until test &rest body", 0, 0, Com_Until}, {LispMacro, Lisp_While, "while test &rest body", 0, 0, Com_While}, }; /* byte code function argument list for functions that don't change it's * &REST argument list. */ extern LispObj x_cons[8]; /* * Implementation */ static int LispGetPageSize(void) { static int pagesize = -1; if (pagesize != -1) return pagesize; /* Try each supported method in the preferred order */ #if defined(_SC_PAGESIZE) || defined(HAVE_DECL__SC_PAGESIZE) pagesize = sysconf(_SC_PAGESIZE); #endif #ifdef _SC_PAGE_SIZE if (pagesize == -1) pagesize = sysconf(_SC_PAGE_SIZE); #endif #ifdef HAVE_GETPAGESIZE if (pagesize == -1) pagesize = getpagesize(); #endif #ifdef PAGE_SIZE if (pagesize == -1) pagesize = PAGE_SIZE; #endif if (pagesize < sizeof(LispObj) * 16) pagesize = sizeof(LispObj) * 16; /* need a reasonable sane size */ return pagesize; } void LispDestroy(const char *fmt, ...) { static char Error[] = "*** "; if (!lisp__data.destroyed) { char string[128]; va_list ap; va_start(ap, fmt); vsnprintf(string, sizeof(string), fmt, ap); va_end(ap); if (!lisp__data.ignore_errors) { if (Stderr->column) LispFputc(Stderr, '\n'); LispFputs(Stderr, Error); LispFputs(Stderr, string); LispFputc(Stderr, '\n'); LispFflush(Stderr); } else lisp__data.error_condition = STRING(string); #ifdef DEBUGGER if (lisp__data.debugging) { LispDebugger(LispDebugCallWatch, NIL, NIL); LispDebugger(LispDebugCallFatal, NIL, NIL); } #endif lisp__data.destroyed = 1; LispBlockUnwind(NULL); if (lisp__data.errexit) exit(1); } #ifdef DEBUGGER if (lisp__data.debugging) { /* when stack variables could be changed, this must be also changed! */ lisp__data.debug_level = -1; lisp__data.debug = LispDebugUnspec; } #endif while (lisp__data.mem.level) { --lisp__data.mem.level; if (lisp__data.mem.mem[lisp__data.mem.level]) free(lisp__data.mem.mem[lisp__data.mem.level]); } lisp__data.mem.index = 0; /* If the package was changed and an error happened */ PACKAGE = lisp__data.savepackage; lisp__data.pack = lisp__data.savepack; LispTopLevel(); if (!lisp__data.running) { static const char *Fatal = "*** Fatal: nowhere to longjmp.\n"; LispFputs(Stderr, Fatal); LispFflush(Stderr); abort(); } siglongjmp(lisp__data.jmp, 1); } void LispContinuable(const char *fmt, ...) { va_list ap; char string[128]; static const char *Error = "*** Error: "; if (Stderr->column) LispFputc(Stderr, '\n'); LispFputs(Stderr, Error); va_start(ap, fmt); vsnprintf(string, sizeof(string), fmt, ap); va_end(ap); LispFputs(Stderr, string); LispFputc(Stderr, '\n'); LispFputs(Stderr, "Type 'continue' if you want to proceed: "); LispFflush(Stderr); /* NOTE: does not check if stdin is a tty */ if (LispFgets(Stdin, string, sizeof(string)) && strcmp(string, "continue\n") == 0) return; LispDestroy("aborted on continuable error"); } void LispMessage(const char *fmt, ...) { va_list ap; char string[128]; if (Stderr->column) LispFputc(Stderr, '\n'); va_start(ap, fmt); vsnprintf(string, sizeof(string), fmt, ap); va_end(ap); LispFputs(Stderr, string); LispFputc(Stderr, '\n'); LispFflush(Stderr); } void LispWarning(const char *fmt, ...) { va_list ap; char string[128]; static const char *Warning = "*** Warning: "; if (Stderr->column) LispFputc(Stderr, '\n'); LispFputs(Stderr, Warning); va_start(ap, fmt); vsnprintf(string, sizeof(string), fmt, ap); va_end(ap); LispFputs(Stderr, string); LispFputc(Stderr, '\n'); LispFflush(Stderr); } void LispTopLevel(void) { int count; COD = NIL; #ifdef DEBUGGER if (lisp__data.debugging) { DBG = NIL; if (lisp__data.debug == LispDebugFinish) lisp__data.debug = LispDebugUnspec; lisp__data.debug_level = -1; lisp__data.debug_step = 0; } #endif gcpro = 0; lisp__data.block.block_level = 0; if (lisp__data.block.block_size) { while (lisp__data.block.block_size) free(lisp__data.block.block[--lisp__data.block.block_size]); free(lisp__data.block.block); lisp__data.block.block = NULL; } lisp__data.destroyed = lisp__data.ignore_errors = 0; if (CONSP(lisp__data.input_list)) { LispUngetInfo **info, *unget = lisp__data.unget[0]; while (CONSP(lisp__data.input_list)) lisp__data.input_list = CDR(lisp__data.input_list); SINPUT = lisp__data.input_list; while (lisp__data.nunget > 1) free(lisp__data.unget[--lisp__data.nunget]); if ((info = realloc(lisp__data.unget, sizeof(LispUngetInfo*))) != NULL) lisp__data.unget = info; lisp__data.unget[0] = unget; lisp__data.iunget = 0; lisp__data.eof = 0; } for (count = 0; lisp__data.mem.level;) { --lisp__data.mem.level; if (lisp__data.mem.mem[lisp__data.mem.level]) { ++count; #if 0 printf("LEAK: %p\n", lisp__data.mem.mem[lisp__data.mem.level]); #endif } } lisp__data.mem.index = 0; if (count) LispWarning("%d raw memory pointer(s) left. Probably a leak.", count); lisp__data.stack.base = lisp__data.stack.length = lisp__data.env.lex = lisp__data.env.length = lisp__data.env.head = 0; RETURN_COUNT = 0; lisp__data.protect.length = 0; lisp__data.savepackage = PACKAGE; lisp__data.savepack = lisp__data.pack; lisp__disable_int = lisp__interrupted = 0; } void LispGC(LispObj *car, LispObj *cdr) { Lisp__GC(car, cdr); } static void Lisp__GC(LispObj *car, LispObj *cdr) { register LispObj *entry, *last, *freeobj, **pentry, **eentry; register int nfree; unsigned i, j; LispAtom *atom; struct timeval start, end; #ifdef DEBUG long sec, msec; int count = objseg.nfree; #else long msec; #endif if (gcpro) return; DISABLE_INTERRUPTS(); nfree = 0; freeobj = NIL; ++lisp__data.gc.count; #ifdef DEBUG gettimeofday(&start, NULL); #else if (lisp__data.gc.timebits) gettimeofday(&start, NULL); #endif /* Need to measure timings again to check if it is not better/faster * to just mark these fields as any other data, as the interface was * changed to properly handle circular lists in the function body itself. */ if (lisp__data.gc.immutablebits) { for (j = 0; j < objseg.nsegs; j++) { for (entry = objseg.objects[j], last = entry + segsize; entry < last; entry++) entry->prot = 0; } } /* Protect all packages */ for (entry = PACK; CONSP(entry); entry = CDR(entry)) { LispObj *package = CAR(entry); LispPackage *pack = package->data.package.package; /* Protect cons cell */ entry->mark = 1; /* Protect the package cell */ package->mark = 1; /* Protect package name */ package->data.package.name->mark = 1; /* Protect package nicknames */ LispMark(package->data.package.nicknames); /* Protect global symbols */ for (pentry = pack->glb.pairs, eentry = pentry + pack->glb.length; pentry < eentry; pentry++) LispMark((*pentry)->data.atom->property->value); /* Traverse atom list, protecting properties, and function/structure * definitions if lisp__data.gc.immutablebits set */ for (atom = (LispAtom *)hash_iter_first(pack->atoms); atom; atom = (LispAtom *)hash_iter_next(pack->atoms)) { if (atom->property != NOPROPERTY) { if (atom->a_property) LispMark(atom->property->properties); if (lisp__data.gc.immutablebits) { if (atom->a_function || atom->a_compiled) LispProt(atom->property->fun.function); if (atom->a_defsetf) LispProt(atom->property->setf); if (atom->a_defstruct) LispProt(atom->property->structure.definition); } } } } /* protect environment */ for (pentry = lisp__data.env.values, eentry = pentry + lisp__data.env.length; pentry < eentry; pentry++) LispMark(*pentry); /* protect multiple return values */ for (pentry = lisp__data.returns.values, eentry = pentry + lisp__data.returns.count; pentry < eentry; pentry++) LispMark(*pentry); /* protect stack of arguments to builtin functions */ for (pentry = lisp__data.stack.values, eentry = pentry + lisp__data.stack.length; pentry < eentry; pentry++) LispMark(*pentry); /* protect temporary data used by builtin functions */ for (pentry = lisp__data.protect.objects, eentry = pentry + lisp__data.protect.length; pentry < eentry; pentry++) LispMark(*pentry); for (i = 0; i < sizeof(x_cons) / sizeof(x_cons[0]); i++) x_cons[i].mark = 0; LispMark(COD); #ifdef DEBUGGER LispMark(DBG); LispMark(BRK); #endif LispMark(PRO); LispMark(lisp__data.input_list); LispMark(lisp__data.output_list); LispMark(car); LispMark(cdr); for (j = 0; j < objseg.nsegs; j++) { for (entry = objseg.objects[j], last = entry + segsize; entry < last; entry++) { if (entry->prot) continue; else if (entry->mark) entry->mark = 0; else { switch (XOBJECT_TYPE(entry)) { case LispString_t: free(THESTR(entry)); entry->type = LispCons_t; break; case LispStream_t: switch (entry->data.stream.type) { case LispStreamString: free(SSTREAMP(entry)->string); free(SSTREAMP(entry)); break; case LispStreamFile: if (FSTREAMP(entry)) LispFclose(FSTREAMP(entry)); break; case LispStreamPipe: /* XXX may need special handling if child hangs */ if (PSTREAMP(entry)) { if (IPSTREAMP(entry)) LispFclose(IPSTREAMP(entry)); if (OPSTREAMP(entry)) LispFclose(OPSTREAMP(entry)); /* don't bother with error stream, will also * freed in this GC call, maybe just out * of order */ if (PIDPSTREAMP(entry) > 0) { kill(PIDPSTREAMP(entry), SIGTERM); waitpid(PIDPSTREAMP(entry), NULL, 0); } free(PSTREAMP(entry)); } break; default: break; } entry->type = LispCons_t; break; case LispBignum_t: mpi_clear(entry->data.mp.integer); free(entry->data.mp.integer); entry->type = LispCons_t; break; case LispBigratio_t: mpr_clear(entry->data.mp.ratio); free(entry->data.mp.ratio); entry->type = LispCons_t; break; case LispLambda_t: if (!SYMBOLP(entry->data.lambda.name)) LispFreeArgList((LispArgList*) entry->data.lambda.name->data.opaque.data); entry->type = LispCons_t; break; case LispRegex_t: refree(entry->data.regex.regex); free(entry->data.regex.regex); entry->type = LispCons_t; break; case LispBytecode_t: free(entry->data.bytecode.bytecode->code); free(entry->data.bytecode.bytecode); entry->type = LispCons_t; break; case LispHashTable_t: LispFreeHashTable(entry->data.hash.table); entry->type = LispCons_t; break; case LispCons_t: break; default: entry->type = LispCons_t; break; } CDR(entry) = freeobj; freeobj = entry; ++nfree; } } } objseg.nfree = nfree; objseg.freeobj = freeobj; lisp__data.gc.immutablebits = 0; #ifdef DEBUG gettimeofday(&end, NULL); sec = end.tv_sec - start.tv_sec; msec = end.tv_usec - start.tv_usec; if (msec < 0) { --sec; msec += 1000000; } LispMessage("gc: " "%ld sec, %ld msec, " "%d recovered, %d free, %d protected, %d total", sec, msec, objseg.nfree - count, objseg.nfree, objseg.nobjs - objseg.nfree, objseg.nobjs); #else if (lisp__data.gc.timebits) { gettimeofday(&end, NULL); if ((msec = end.tv_usec - start.tv_usec) < 0) msec += 1000000; lisp__data.gc.gctime += msec; } #endif ENABLE_INTERRUPTS(); } static INLINE void LispCheckMemLevel(void) { int i; /* Check for a free slot before the end. */ for (i = lisp__data.mem.index; i < lisp__data.mem.level; i++) if (lisp__data.mem.mem[i] == NULL) { lisp__data.mem.index = i; return; } /* Check for a free slot in the beginning */ for (i = 0; i < lisp__data.mem.index; i++) if (lisp__data.mem.mem[i] == NULL) { lisp__data.mem.index = i; return; } lisp__data.mem.index = lisp__data.mem.level; ++lisp__data.mem.level; if (lisp__data.mem.index < lisp__data.mem.space) /* There is free space to store pointer. */ return; else { void **ptr = (void**)realloc(lisp__data.mem.mem, (lisp__data.mem.space + 16) * sizeof(void*)); if (ptr == NULL) LispDestroy("out of memory"); lisp__data.mem.mem = ptr; lisp__data.mem.space += 16; } } void LispMused(void *pointer) { int i; DISABLE_INTERRUPTS(); for (i = lisp__data.mem.index; i >= 0; i--) if (lisp__data.mem.mem[i] == pointer) { lisp__data.mem.mem[i] = NULL; lisp__data.mem.index = i; goto mused_done; } for (i = lisp__data.mem.level - 1; i > lisp__data.mem.index; i--) if (lisp__data.mem.mem[i] == pointer) { lisp__data.mem.mem[i] = NULL; lisp__data.mem.index = i; break; } mused_done: ENABLE_INTERRUPTS(); } void * LispMalloc(size_t size) { void *pointer; DISABLE_INTERRUPTS(); LispCheckMemLevel(); if ((pointer = malloc(size)) == NULL) LispDestroy("out of memory, couldn't allocate %lu bytes", (unsigned long)size); lisp__data.mem.mem[lisp__data.mem.index] = pointer; ENABLE_INTERRUPTS(); return (pointer); } void * LispCalloc(size_t nmemb, size_t size) { void *pointer; DISABLE_INTERRUPTS(); LispCheckMemLevel(); if ((pointer = calloc(nmemb, size)) == NULL) LispDestroy("out of memory, couldn't allocate %lu bytes", (unsigned long)size); lisp__data.mem.mem[lisp__data.mem.index] = pointer; ENABLE_INTERRUPTS(); return (pointer); } void * LispRealloc(void *pointer, size_t size) { void *ptr; int i; DISABLE_INTERRUPTS(); if (pointer != NULL) { for (i = lisp__data.mem.index; i >= 0; i--) if (lisp__data.mem.mem[i] == pointer) goto index_found; for (i = lisp__data.mem.index + 1; i < lisp__data.mem.level; i++) if (lisp__data.mem.mem[i] == pointer) goto index_found; } LispCheckMemLevel(); i = lisp__data.mem.index; index_found: if ((ptr = realloc(pointer, size)) == NULL) LispDestroy("out of memory, couldn't realloc"); lisp__data.mem.mem[i] = ptr; ENABLE_INTERRUPTS(); return (ptr); } char * LispStrdup(const char *str) { char *ptr = LispMalloc(strlen(str) + 1); strcpy(ptr, str); return (ptr); } void LispFree(void *pointer) { int i; DISABLE_INTERRUPTS(); for (i = lisp__data.mem.index; i >= 0; i--) if (lisp__data.mem.mem[i] == pointer) { lisp__data.mem.mem[i] = NULL; lisp__data.mem.index = i; goto free_done; } for (i = lisp__data.mem.level - 1; i > lisp__data.mem.index; i--) if (lisp__data.mem.mem[i] == pointer) { lisp__data.mem.mem[i] = NULL; lisp__data.mem.index = i; break; } free_done: free(pointer); ENABLE_INTERRUPTS(); } LispObj * LispSetVariable(LispObj *var, LispObj *val, const char *fname, int eval) { if (!SYMBOLP(var)) LispDestroy("%s: %s is not a symbol", fname, STROBJ(var)); if (eval) val = EVAL(val); return (LispSetVar(var, val)); } int LispRegisterOpaqueType(const char *desc) { int length; LispOpaque *opaque; length = strlen(desc); opaque = (LispOpaque *)hash_check(lisp__data.opqs, desc, length); if (opaque == NULL) { opaque = (LispOpaque*)LispMalloc(sizeof(LispOpaque)); opaque->desc = (hash_key*)LispCalloc(1, sizeof(hash_key)); opaque->desc->value = LispStrdup(desc); opaque->desc->length = length; hash_put(lisp__data.opqs, (hash_entry *)opaque); LispMused(opaque->desc->value); LispMused(opaque->desc); LispMused(opaque); opaque->type = ++lisp__data.opaque; } return (opaque->type); } char * LispIntToOpaqueType(int type) { LispOpaque *opaque; if (type) { for (opaque = (LispOpaque *)hash_iter_first(lisp__data.opqs); opaque; opaque = (LispOpaque *)hash_iter_next(lisp__data.opqs)) { if (opaque->type == type) return (opaque->desc->value); } LispDestroy("Opaque type %d not registered", type); } return (Snil->value); } hash_key * LispGetAtomKey(const char *string, int perm) { int length; hash_entry *entry; length = strlen(string); entry = hash_check(lisp__data.strings, string, length); if (entry == NULL) { entry = LispCalloc(1, sizeof(hash_entry)); entry->key = LispCalloc(1, sizeof(hash_key)); if (perm) entry->key->value = (char *) string; else entry->key->value = LispStrdup(string); entry->key->length = length; hash_put(lisp__data.strings, entry); if (!perm) LispMused(entry->key->value); LispMused(entry->key); LispMused(entry); } return (entry->key); } LispAtom * LispDoGetAtom(const char *str, int perm) { int length; LispAtom *atom; length = strlen(str); atom = (LispAtom *)hash_check(lisp__data.pack->atoms, str, length); if (atom == NULL) { atom = (LispAtom*)LispCalloc(1, sizeof(LispAtom)); atom->key = LispGetAtomKey(str, perm); hash_put(lisp__data.pack->atoms, (hash_entry *)atom); atom->property = NOPROPERTY; LispMused(atom); } return (atom); } static void LispAllocAtomProperty(LispAtom *atom) { LispProperty *property; if (atom->property != NOPROPERTY) LispDestroy("internal error at ALLOC-ATOM-PROPERTY"); property = LispCalloc(1, sizeof(LispProperty)); LispMused(property); atom->property = property; property->package = lisp__data.pack; if (atom->package == NULL) atom->package = PACKAGE; LispIncrementAtomReference(atom); } static void LispIncrementAtomReference(LispAtom *atom) { if (atom->property != NOPROPERTY) /* if atom->property is NOPROPERTY, this is an unbound symbol */ ++atom->property->refcount; } /* Assumes atom property is not NOPROPERTY */ static void LispDecrementAtomReference(LispAtom *atom) { if (atom->property == NOPROPERTY) /* if atom->property is NOPROPERTY, this is an unbound symbol */ return; if (atom->property->refcount <= 0) LispDestroy("internal error at DECREMENT-ATOM-REFERENCE"); --atom->property->refcount; if (atom->property->refcount == 0) { LispRemAtomAllProperties(atom); free(atom->property); atom->property = NOPROPERTY; } } static void LispRemAtomAllProperties(LispAtom *atom) { if (atom->property != NOPROPERTY) { if (atom->a_object) LispRemAtomObjectProperty(atom); if (atom->a_function) { lisp__data.gc.immutablebits = 1; LispRemAtomFunctionProperty(atom); } else if (atom->a_compiled) { lisp__data.gc.immutablebits = 1; LispRemAtomCompiledProperty(atom); } else if (atom->a_builtin) { lisp__data.gc.immutablebits = 1; LispRemAtomBuiltinProperty(atom); } if (atom->a_defsetf) { lisp__data.gc.immutablebits = 1; LispRemAtomSetfProperty(atom); } if (atom->a_defstruct) { lisp__data.gc.immutablebits = 1; LispRemAtomStructProperty(atom); } } } void LispSetAtomObjectProperty(LispAtom *atom, LispObj *object) { if (atom->property == NOPROPERTY) LispAllocAtomProperty(atom); else if (atom->watch) { if (atom->object == lisp__data.package) { if (!PACKAGEP(object)) LispDestroy("Symbol %s must be a package, not %s", ATOMID(lisp__data.package)->value, STROBJ(object)); lisp__data.pack = object->data.package.package; } } atom->a_object = 1; SETVALUE(atom, object); } static void LispRemAtomObjectProperty(LispAtom *atom) { if (atom->a_object) { atom->a_object = 0; atom->property->value = NULL; } } void LispSetAtomCompiledProperty(LispAtom *atom, LispObj *bytecode) { if (atom->property == NOPROPERTY) LispAllocAtomProperty(atom); lisp__data.gc.immutablebits = 1; if (atom->a_builtin) { atom->a_builtin = 0; LispFreeArgList(atom->property->alist); } else atom->a_function = 0; atom->a_compiled = 1; atom->property->fun.function = bytecode; } void LispRemAtomCompiledProperty(LispAtom *atom) { if (atom->a_compiled) { lisp__data.gc.immutablebits = 1; atom->property->fun.function = NULL; atom->a_compiled = 0; LispFreeArgList(atom->property->alist); atom->property->alist = NULL; } } void LispSetAtomFunctionProperty(LispAtom *atom, LispObj *function, LispArgList *alist) { if (atom->property == NOPROPERTY) LispAllocAtomProperty(atom); lisp__data.gc.immutablebits = 1; if (atom->a_function == 0 && atom->a_builtin == 0 && atom->a_compiled == 0) atom->a_function = 1; else { if (atom->a_builtin) { atom->a_builtin = 0; LispFreeArgList(atom->property->alist); } else atom->a_compiled = 0; atom->a_function = 1; } atom->property->fun.function = function; atom->property->alist = alist; } void LispRemAtomFunctionProperty(LispAtom *atom) { if (atom->a_function) { lisp__data.gc.immutablebits = 1; atom->property->fun.function = NULL; atom->a_function = 0; LispFreeArgList(atom->property->alist); atom->property->alist = NULL; } } void LispSetAtomBuiltinProperty(LispAtom *atom, LispBuiltin *builtin, LispArgList *alist) { if (atom->property == NOPROPERTY) LispAllocAtomProperty(atom); lisp__data.gc.immutablebits = 1; if (atom->a_builtin == 0 && atom->a_function == 0) atom->a_builtin = 1; else { if (atom->a_function) { atom->a_function = 0; LispFreeArgList(atom->property->alist); } } atom->property->fun.builtin = builtin; atom->property->alist = alist; } void LispRemAtomBuiltinProperty(LispAtom *atom) { if (atom->a_builtin) { lisp__data.gc.immutablebits = 1; atom->property->fun.function = NULL; atom->a_builtin = 0; LispFreeArgList(atom->property->alist); atom->property->alist = NULL; } } void LispSetAtomSetfProperty(LispAtom *atom, LispObj *setf, LispArgList *alist) { if (atom->property == NOPROPERTY) LispAllocAtomProperty(atom); lisp__data.gc.immutablebits = 1; if (atom->a_defsetf) LispFreeArgList(atom->property->salist); atom->a_defsetf = 1; atom->property->setf = setf; atom->property->salist = alist; } void LispRemAtomSetfProperty(LispAtom *atom) { if (atom->a_defsetf) { lisp__data.gc.immutablebits = 1; atom->property->setf = NULL; atom->a_defsetf = 0; LispFreeArgList(atom->property->salist); atom->property->salist = NULL; } } void LispSetAtomStructProperty(LispAtom *atom, LispObj *def, int fun) { if (fun > 0xff) /* Not suported by the bytecode compiler... */ LispDestroy("SET-ATOM-STRUCT-PROPERTY: " "more than 256 fields not supported"); if (atom->property == NOPROPERTY) LispAllocAtomProperty(atom); lisp__data.gc.immutablebits = 1; atom->a_defstruct = 1; atom->property->structure.definition = def; atom->property->structure.function = fun; } void LispRemAtomStructProperty(LispAtom *atom) { if (atom->a_defstruct) { lisp__data.gc.immutablebits = 1; atom->property->structure.definition = NULL; atom->a_defstruct = 0; } } LispAtom * LispGetAtom(const char *str) { return (LispDoGetAtom(str, 0)); } LispAtom * LispGetPermAtom(const char *str) { return (LispDoGetAtom(str, 1)); } #define GET_PROPERTY 0 #define ADD_PROPERTY 1 #define REM_PROPERTY 2 static LispObj * LispAtomPropertyFunction(LispAtom *atom, LispObj *key, int function) { LispObj *list = NIL, *result = NIL; if (function == ADD_PROPERTY) { if (atom->property == NOPROPERTY) LispAllocAtomProperty(atom); if (atom->property->properties == NULL) { atom->a_property = 1; atom->property->properties = NIL; } } if (atom->a_property) { LispObj *base; for (base = list = atom->property->properties; CONSP(list); list = CDR(list)) { if (key == CAR(list)) { result = CDR(list); break; } base = list; list = CDR(list); if (!CONSP(list)) LispDestroy("%s: %s has an odd property list length", STROBJ(atom->object), function == REM_PROPERTY ? "REMPROP" : "GET"); } if (CONSP(list) && function == REM_PROPERTY) { if (!CONSP(CDR(list))) LispDestroy("REMPROP: %s has an odd property list length", STROBJ(atom->object)); if (base == list) atom->property->properties = CDDR(list); else RPLACD(CDR(base), CDDR(list)); } } if (!CONSP(list)) { if (function == ADD_PROPERTY) { atom->property->properties = CONS(key, CONS(NIL, atom->property->properties)); result = CDR(atom->property->properties); } } else if (function == REM_PROPERTY) result = T; return (result); } LispObj * LispGetAtomProperty(LispAtom *atom, LispObj *key) { return (LispAtomPropertyFunction(atom, key, GET_PROPERTY)); } LispObj * LispPutAtomProperty(LispAtom *atom, LispObj *key, LispObj *value) { LispObj *result = LispAtomPropertyFunction(atom, key, ADD_PROPERTY); RPLACA(result, value); return (result); } LispObj * LispRemAtomProperty(LispAtom *atom, LispObj *key) { return (LispAtomPropertyFunction(atom, key, REM_PROPERTY)); } LispObj * LispReplaceAtomPropertyList(LispAtom *atom, LispObj *list) { if (atom->property == NOPROPERTY) LispAllocAtomProperty(atom); if (atom->property->properties == NULL) atom->a_property = 1; atom->property->properties = list; return (list); } #undef GET_PROPERTY #undef ADD_PROPERTY #undef REM_PROPERTY /* Used to make sure that when defining a function like: * (defun my-function (... &key key1 key2 key3 ...) * key1, key2, and key3 will be in the keyword package */ static LispObj * LispCheckKeyword(LispObj *keyword) { if (KEYWORDP(keyword)) return (keyword); return (KEYWORD(ATOMID(keyword)->value)); } void LispUseArgList(LispArgList *alist) { if (alist->normals.num_symbols) LispMused(alist->normals.symbols); if (alist->optionals.num_symbols) { LispMused(alist->optionals.symbols); LispMused(alist->optionals.defaults); LispMused(alist->optionals.sforms); } if (alist->keys.num_symbols) { LispMused(alist->keys.symbols); LispMused(alist->keys.defaults); LispMused(alist->keys.sforms); LispMused(alist->keys.keys); } if (alist->auxs.num_symbols) { LispMused(alist->auxs.symbols); LispMused(alist->auxs.initials); } LispMused(alist); } void LispFreeArgList(LispArgList *alist) { if (alist->normals.num_symbols) LispFree(alist->normals.symbols); if (alist->optionals.num_symbols) { LispFree(alist->optionals.symbols); LispFree(alist->optionals.defaults); LispFree(alist->optionals.sforms); } if (alist->keys.num_symbols) { LispFree(alist->keys.symbols); LispFree(alist->keys.defaults); LispFree(alist->keys.sforms); LispFree(alist->keys.keys); } if (alist->auxs.num_symbols) { LispFree(alist->auxs.symbols); LispFree(alist->auxs.initials); } LispFree(alist); } static LispObj * LispCheckNeedProtect(LispObj *object) { if (object) { switch (OBJECT_TYPE(object)) { case LispNil_t: case LispAtom_t: case LispFunction_t: case LispFixnum_t: case LispSChar_t: return (NULL); default: return (object); } } return (NULL); } LispObj * LispListProtectedArguments(LispArgList *alist) { int i; GC_ENTER(); LispObj *arguments, *cons, *obj, *prev; arguments = cons = prev = NIL; for (i = 0; i < alist->optionals.num_symbols; i++) { if ((obj = LispCheckNeedProtect(alist->optionals.defaults[i])) != NULL) { if (arguments == NIL) { arguments = cons = prev = CONS(obj, NIL); GC_PROTECT(arguments); } else { RPLACD(cons, CONS(obj, NIL)); prev = cons; cons = CDR(cons); } } } for (i = 0; i < alist->keys.num_symbols; i++) { if ((obj = LispCheckNeedProtect(alist->keys.defaults[i])) != NULL) { if (arguments == NIL) { arguments = cons = prev = CONS(obj, NIL); GC_PROTECT(arguments); } else { RPLACD(cons, CONS(obj, NIL)); prev = cons; cons = CDR(cons); } } } for (i = 0; i < alist->auxs.num_symbols; i++) { if ((obj = LispCheckNeedProtect(alist->auxs.initials[i])) != NULL) { if (arguments == NIL) { arguments = cons = prev = CONS(obj, NIL); GC_PROTECT(arguments); } else { RPLACD(cons, CONS(obj, NIL)); prev = cons; cons = CDR(cons); } } } GC_LEAVE(); /* Don't add a NIL cell at the end, to save some space */ if (arguments != NIL) { if (arguments == cons) arguments = CAR(cons); else CDR(prev) = CAR(cons); } return (arguments); } LispArgList * LispCheckArguments(LispFunType type, LispObj *list, const char *name, int builtin) { static const char *types[4] = {"LAMBDA-LIST", "FUNCTION", "MACRO", "SETF-METHOD"}; static const char *fnames[4] = {"LAMBDA", "DEFUN", "DEFMACRO", "DEFSETF"}; #define IKEY 0 #define IOPTIONAL 1 #define IREST 2 #define IAUX 3 static const char *keys[4] = {"&KEY", "&OPTIONAL", "&REST", "&AUX"}; int rest, optional, key, aux, count; LispArgList *alist; LispObj *spec, *sform, *defval, *default_value; char description[8], *desc; /* If LispRealloc fails, the previous memory will be released * in LispTopLevel, unless LispMused was called on the pointer */ #define REALLOC_OBJECTS(pointer, count) \ pointer = LispRealloc(pointer, (count) * sizeof(LispObj*)) alist = LispCalloc(1, sizeof(LispArgList)); if (!CONSP(list)) { if (list != NIL) LispDestroy("%s %s: %s cannot be a %s argument list", fnames[type], name, STROBJ(list), types[type]); alist->description = GETATOMID("")->value; return (alist); } default_value = builtin ? UNSPEC : NIL; description[0] = '\0'; desc = description; rest = optional = key = aux = 0; for (; CONSP(list); list = CDR(list)) { spec = CAR(list); if (CONSP(spec)) { if (builtin) LispDestroy("builtin function argument cannot have default value"); if (aux) { if (!SYMBOLP(CAR(spec)) || (CDR(spec) != NIL && CDDR(spec) != NIL)) LispDestroy("%s %s: bad &AUX argument %s", fnames[type], name, STROBJ(spec)); defval = CDR(spec) != NIL ? CADR(spec) : NIL; count = alist->auxs.num_symbols; REALLOC_OBJECTS(alist->auxs.symbols, count + 1); REALLOC_OBJECTS(alist->auxs.initials, count + 1); alist->auxs.symbols[count] = CAR(spec); alist->auxs.initials[count] = defval; ++alist->auxs.num_symbols; if (count == 0) *desc++ = 'a'; ++alist->num_arguments; } else if (rest) LispDestroy("%s %s: syntax error parsing %s", fnames[type], name, keys[IREST]); else if (key) { LispObj *akey = CAR(spec); defval = default_value; sform = NULL; if (CONSP(akey)) { /* check for special case, as in: * (defun a (&key ((key name) 'default-value)) name) * (a 'key 'test) => TEST * (a) => DEFAULT-VALUE */ if (!SYMBOLP(CAR(akey)) || !CONSP(CDR(akey)) || !SYMBOLP(CADR(akey)) || CDDR(akey) != NIL || (CDR(spec) != NIL && CDDR(spec) != NIL)) LispDestroy("%s %s: bad special &KEY %s", fnames[type], name, STROBJ(spec)); if (CDR(spec) != NIL) defval = CADR(spec); spec = CADR(akey); akey = CAR(akey); } else { akey = NULL; if (!SYMBOLP(CAR(spec))) LispDestroy("%s %s: %s cannot be a %s argument name", fnames[type], name, STROBJ(CAR(spec)), types[type]); /* check if default value provided, and optionally a `svar' */ else if (CDR(spec) != NIL && (!CONSP(CDR(spec)) || (CDDR(spec) != NIL && (!SYMBOLP(CAR(CDDR(spec))) || CDR(CDDR(spec)) != NIL)))) LispDestroy("%s %s: bad argument specification %s", fnames[type], name, STROBJ(spec)); if (CONSP(CDR(spec))) { defval = CADR(spec); if (CONSP(CDDR(spec))) sform = CAR(CDDR(spec)); } /* Add to keyword package, and set the keyword in the * argument list, so that a function argument keyword * will reference the same object, and make comparison * simpler. */ spec = LispCheckKeyword(CAR(spec)); } count = alist->keys.num_symbols; REALLOC_OBJECTS(alist->keys.keys, count + 1); REALLOC_OBJECTS(alist->keys.defaults, count + 1); REALLOC_OBJECTS(alist->keys.sforms, count + 1); REALLOC_OBJECTS(alist->keys.symbols, count + 1); alist->keys.symbols[count] = spec; alist->keys.defaults[count] = defval; alist->keys.sforms[count] = sform; alist->keys.keys[count] = akey; ++alist->keys.num_symbols; if (count == 0) *desc++ = 'k'; alist->num_arguments += 1 + (sform != NULL); } else if (optional) { defval = default_value; sform = NULL; if (!SYMBOLP(CAR(spec))) LispDestroy("%s %s: %s cannot be a %s argument name", fnames[type], name, STROBJ(CAR(spec)), types[type]); /* check if default value provided, and optionally a `svar' */ else if (CDR(spec) != NIL && (!CONSP(CDR(spec)) || (CDDR(spec) != NIL && (!SYMBOLP(CAR(CDDR(spec))) || CDR(CDDR(spec)) != NIL)))) LispDestroy("%s %s: bad argument specification %s", fnames[type], name, STROBJ(spec)); if (CONSP(CDR(spec))) { defval = CADR(spec); if (CONSP(CDDR(spec))) sform = CAR(CDDR(spec)); } spec = CAR(spec); count = alist->optionals.num_symbols; REALLOC_OBJECTS(alist->optionals.symbols, count + 1); REALLOC_OBJECTS(alist->optionals.defaults, count + 1); REALLOC_OBJECTS(alist->optionals.sforms, count + 1); alist->optionals.symbols[count] = spec; alist->optionals.defaults[count] = defval; alist->optionals.sforms[count] = sform; ++alist->optionals.num_symbols; if (count == 0) *desc++ = 'o'; alist->num_arguments += 1 + (sform != NULL); } /* Normal arguments cannot have default value */ else LispDestroy("%s %s: syntax error parsing %s", fnames[type], name, STROBJ(spec)); } /* spec must be an atom, excluding keywords */ else if (!SYMBOLP(spec) || KEYWORDP(spec)) LispDestroy("%s %s: %s cannot be a %s argument", fnames[type], name, STROBJ(spec), types[type]); else { Atom_id atom = ATOMID(spec); if (atom->value[0] == '&') { if (atom == Srest) { if (rest || aux || CDR(list) == NIL || !SYMBOLP(CADR(list)) /* only &aux allowed after &rest */ || (CDDR(list) != NIL && !SYMBOLP(CAR(CDDR(list))) && ATOMID(CAR(CDDR(list))) != Saux)) LispDestroy("%s %s: syntax error parsing %s", fnames[type], name, ATOMID(spec)->value); if (key) LispDestroy("%s %s: %s not allowed after %s", fnames[type], name, keys[IREST], keys[IKEY]); rest = 1; continue; } else if (atom == Skey) { if (rest || aux) LispDestroy("%s %s: %s not allowed after %s", fnames[type], name, ATOMID(spec)->value, rest ? keys[IREST] : keys[IAUX]); key = 1; continue; } else if (atom == Soptional) { if (rest || optional || aux || key) LispDestroy("%s %s: %s not allowed after %s", fnames[type], name, ATOMID(spec)->value, rest ? keys[IREST] : optional ? keys[IOPTIONAL] : aux ? keys[IAUX] : keys[IKEY]); optional = 1; continue; } else if (atom == Saux) { /* &AUX must be the last keyword parameter */ if (aux) LispDestroy("%s %s: syntax error parsing %s", fnames[type], name, ATOMID(spec)->value); else if (builtin) LispDestroy("builtin function cannot have &AUX arguments"); aux = 1; continue; } /* Untill more lambda-list keywords supported, don't allow * argument names starting with the '&' character */ else LispDestroy("%s %s: %s not allowed/implemented", fnames[type], name, ATOMID(spec)->value); } /* Add argument to alist */ if (aux) { count = alist->auxs.num_symbols; REALLOC_OBJECTS(alist->auxs.symbols, count + 1); REALLOC_OBJECTS(alist->auxs.initials, count + 1); alist->auxs.symbols[count] = spec; alist->auxs.initials[count] = default_value; ++alist->auxs.num_symbols; if (count == 0) *desc++ = 'a'; ++alist->num_arguments; } else if (rest) { alist->rest = spec; *desc++ = 'r'; ++alist->num_arguments; } else if (key) { /* Add to keyword package, and set the keyword in the * argument list, so that a function argument keyword * will reference the same object, and make comparison * simpler. */ spec = LispCheckKeyword(spec); count = alist->keys.num_symbols; REALLOC_OBJECTS(alist->keys.keys, count + 1); REALLOC_OBJECTS(alist->keys.defaults, count + 1); REALLOC_OBJECTS(alist->keys.sforms, count + 1); REALLOC_OBJECTS(alist->keys.symbols, count + 1); alist->keys.symbols[count] = spec; alist->keys.defaults[count] = default_value; alist->keys.sforms[count] = NULL; alist->keys.keys[count] = NULL; ++alist->keys.num_symbols; if (count == 0) *desc++ = 'k'; ++alist->num_arguments; } else if (optional) { count = alist->optionals.num_symbols; REALLOC_OBJECTS(alist->optionals.symbols, count + 1); REALLOC_OBJECTS(alist->optionals.defaults, count + 1); REALLOC_OBJECTS(alist->optionals.sforms, count + 1); alist->optionals.symbols[count] = spec; alist->optionals.defaults[count] = default_value; alist->optionals.sforms[count] = NULL; ++alist->optionals.num_symbols; if (count == 0) *desc++ = 'o'; ++alist->num_arguments; } else { count = alist->normals.num_symbols; REALLOC_OBJECTS(alist->normals.symbols, count + 1); alist->normals.symbols[count] = spec; ++alist->normals.num_symbols; if (count == 0) *desc++ = '.'; ++alist->num_arguments; } } } /* Check for dotted argument list */ if (list != NIL) LispDestroy("%s %s: %s cannot end %s arguments", fnames[type], name, STROBJ(list), types[type]); *desc = '\0'; alist->description = LispGetAtomKey(description, 0)->value; return (alist); } void LispAddBuiltinFunction(LispBuiltin *builtin) { static LispObj stream; static LispString string; static int first = 1; LispObj *name, *obj, *list, *cons, *code; LispAtom *atom; LispArgList *alist; int length = lisp__data.protect.length; if (first) { stream.type = LispStream_t; stream.data.stream.source.string = &string; stream.data.stream.pathname = NIL; stream.data.stream.type = LispStreamString; stream.data.stream.readable = 1; stream.data.stream.writable = 0; string.output = 0; first = 0; } string.string = builtin->declaration; string.length = strlen(builtin->declaration); string.input = 0; code = COD; LispPushInput(&stream); name = LispRead(); list = cons = CONS(name, NIL); if (length + 1 >= lisp__data.protect.space) LispMoreProtects(); lisp__data.protect.objects[lisp__data.protect.length++] = list; while ((obj = LispRead()) != NULL) { RPLACD(cons, CONS(obj, NIL)); cons = CDR(cons); } LispPopInput(&stream); atom = name->data.atom; alist = LispCheckArguments(builtin->type, CDR(list), atom->key->value, 1); builtin->symbol = CAR(list); LispSetAtomBuiltinProperty(atom, builtin, alist); LispUseArgList(alist); /* Make function a extern symbol, unless told to not do so */ if (!builtin->internal) LispExportSymbol(name); lisp__data.protect.length = length; COD = code; /* LispRead protect data in COD */ } void LispAllocSeg(LispObjSeg *seg, int cellcount) { unsigned int i; LispObj **list, *obj; DISABLE_INTERRUPTS(); while (seg->nfree < cellcount) { if ((obj = (LispObj*)calloc(1, sizeof(LispObj) * segsize)) == NULL) { ENABLE_INTERRUPTS(); LispDestroy("out of memory"); } if ((list = (LispObj**)realloc(seg->objects, sizeof(LispObj*) * (seg->nsegs + 1))) == NULL) { free(obj); ENABLE_INTERRUPTS(); LispDestroy("out of memory"); } seg->objects = list; seg->objects[seg->nsegs] = obj; seg->nfree += segsize; seg->nobjs += segsize; for (i = 1; i < segsize; i++, obj++) { /* Objects of type cons are the most used, save some time * by not setting it's type in LispNewCons. */ obj->type = LispCons_t; CDR(obj) = obj + 1; } obj->type = LispCons_t; CDR(obj) = seg->freeobj; seg->freeobj = seg->objects[seg->nsegs]; ++seg->nsegs; } #ifdef DEBUG LispMessage("gc: %d cell(s) allocated at %d segment(s)", seg->nobjs, seg->nsegs); #endif ENABLE_INTERRUPTS(); } static INLINE void LispMark(register LispObj *object) { mark_again: switch (OBJECT_TYPE(object)) { case LispNil_t: case LispAtom_t: case LispFixnum_t: case LispSChar_t: case LispFunction_t: return; case LispLambda_t: if (OPAQUEP(object->data.lambda.name)) object->data.lambda.name->mark = 1; object->mark = 1; LispMark(object->data.lambda.data); object = object->data.lambda.code; goto mark_cons; case LispQuote_t: case LispBackquote_t: case LispFunctionQuote_t: object->mark = 1; object = object->data.quote; goto mark_again; case LispPathname_t: object->mark = 1; object = object->data.pathname; goto mark_again; case LispComma_t: object->mark = 1; object = object->data.comma.eval; goto mark_again; case LispComplex_t: if (POINTERP(object->data.complex.real)) object->data.complex.real->mark = 1; if (POINTERP(object->data.complex.imag)) object->data.complex.imag->mark = 1; break; case LispCons_t: mark_cons: for (; CONSP(object) && !object->mark; object = CDR(object)) { object->mark = 1; switch (OBJECT_TYPE(CAR(object))) { case LispNil_t: case LispAtom_t: case LispFixnum_t: case LispSChar_t: case LispPackage_t: /* protected in gc */ break; case LispInteger_t: case LispDFloat_t: case LispString_t: case LispRatio_t: case LispOpaque_t: case LispBignum_t: case LispBigratio_t: CAR(object)->mark = 1; break; default: LispMark(CAR(object)); break; } } if (POINTERP(object) && !object->mark) goto mark_again; return; case LispArray_t: LispMark(object->data.array.list); object->mark = 1; object = object->data.array.dim; goto mark_cons; case LispStruct_t: object->mark = 1; object = object->data.struc.fields; goto mark_cons; case LispStream_t: mark_stream: LispMark(object->data.stream.pathname); if (object->data.stream.type == LispStreamPipe) { object->mark = 1; object = object->data.stream.source.program->errorp; goto mark_stream; } break; case LispRegex_t: object->data.regex.pattern->mark = 1; break; case LispBytecode_t: object->mark = 1; object = object->data.bytecode.code; goto mark_again; case LispHashTable_t: { unsigned long i; LispHashEntry *entry = object->data.hash.table->entries, *last = entry + object->data.hash.table->num_entries; if (object->mark) return; object->mark = 1; for (; entry < last; entry++) { for (i = 0; i < entry->count; i++) { switch (OBJECT_TYPE(entry->keys[i])) { case LispNil_t: case LispAtom_t: case LispFixnum_t: case LispSChar_t: case LispFunction_t: case LispPackage_t: break; case LispInteger_t: case LispDFloat_t: case LispString_t: case LispRatio_t: case LispOpaque_t: case LispBignum_t: case LispBigratio_t: entry->keys[i]->mark = 1; break; default: LispMark(entry->keys[i]); break; } switch (OBJECT_TYPE(entry->values[i])) { case LispNil_t: case LispAtom_t: case LispFixnum_t: case LispSChar_t: case LispFunction_t: case LispPackage_t: break; case LispInteger_t: case LispDFloat_t: case LispString_t: case LispRatio_t: case LispOpaque_t: case LispBignum_t: case LispBigratio_t: entry->values[i]->mark = 1; break; default: LispMark(entry->values[i]); break; } } } } return; default: break; } object->mark = 1; } static INLINE void LispProt(register LispObj *object) { prot_again: switch (OBJECT_TYPE(object)) { case LispNil_t: case LispAtom_t: case LispFixnum_t: case LispSChar_t: case LispFunction_t: return; case LispLambda_t: if (OPAQUEP(object->data.lambda.name)) object->data.lambda.name->prot = 1; object->prot = 1; LispProt(object->data.lambda.data); object = object->data.lambda.code; goto prot_cons; case LispQuote_t: case LispBackquote_t: case LispFunctionQuote_t: object->prot = 1; object = object->data.quote; goto prot_again; case LispPathname_t: object->prot = 1; object = object->data.pathname; goto prot_again; case LispComma_t: object->prot = 1; object = object->data.comma.eval; goto prot_again; case LispComplex_t: if (POINTERP(object->data.complex.real)) object->data.complex.real->prot = 1; if (POINTERP(object->data.complex.imag)) object->data.complex.imag->prot = 1; break; case LispCons_t: prot_cons: for (; CONSP(object) && !object->prot; object = CDR(object)) { object->prot = 1; switch (OBJECT_TYPE(CAR(object))) { case LispNil_t: case LispAtom_t: case LispFixnum_t: case LispSChar_t: case LispFunction_t: case LispPackage_t: /* protected in gc */ break; case LispInteger_t: case LispDFloat_t: case LispString_t: case LispRatio_t: case LispOpaque_t: case LispBignum_t: case LispBigratio_t: CAR(object)->prot = 1; break; default: LispProt(CAR(object)); break; } } if (POINTERP(object) && !object->prot) goto prot_again; return; case LispArray_t: LispProt(object->data.array.list); object->prot = 1; object = object->data.array.dim; goto prot_cons; case LispStruct_t: object->prot = 1; object = object->data.struc.fields; goto prot_cons; case LispStream_t: prot_stream: LispProt(object->data.stream.pathname); if (object->data.stream.type == LispStreamPipe) { object->prot = 1; object = object->data.stream.source.program->errorp; goto prot_stream; } break; case LispRegex_t: object->data.regex.pattern->prot = 1; break; case LispBytecode_t: object->prot = 1; object = object->data.bytecode.code; goto prot_again; case LispHashTable_t: { unsigned long i; LispHashEntry *entry = object->data.hash.table->entries, *last = entry + object->data.hash.table->num_entries; if (object->prot) return; object->prot = 1; for (; entry < last; entry++) { for (i = 0; i < entry->count; i++) { switch (OBJECT_TYPE(entry->keys[i])) { case LispNil_t: case LispAtom_t: case LispFixnum_t: case LispSChar_t: case LispFunction_t: case LispPackage_t: break; case LispInteger_t: case LispDFloat_t: case LispString_t: case LispRatio_t: case LispOpaque_t: case LispBignum_t: case LispBigratio_t: entry->keys[i]->prot = 1; break; default: LispProt(entry->keys[i]); break; } switch (OBJECT_TYPE(entry->values[i])) { case LispNil_t: case LispAtom_t: case LispFixnum_t: case LispSChar_t: case LispFunction_t: case LispPackage_t: break; case LispInteger_t: case LispDFloat_t: case LispString_t: case LispRatio_t: case LispOpaque_t: case LispBignum_t: case LispBigratio_t: entry->values[i]->prot = 1; break; default: LispProt(entry->values[i]); break; } } } } return; default: break; } object->prot = 1; } void LispProtect(LispObj *key, LispObj *list) { PRO = CONS(CONS(key, list), PRO); } void LispUProtect(LispObj *key, LispObj *list) { LispObj *prev, *obj; for (prev = obj = PRO; obj != NIL; prev = obj, obj = CDR(obj)) if (CAR(CAR(obj)) == key && CDR(CAR(obj)) == list) { if (obj == PRO) PRO = CDR(PRO); else CDR(prev) = CDR(obj); return; } LispDestroy("no match for %s, at UPROTECT", STROBJ(key)); } static LispObj * Lisp__New(LispObj *car, LispObj *cdr) { int cellcount; LispObj *obj; Lisp__GC(car, cdr); #if 0 lisp__data.gc.average = (objseg.nfree + lisp__data.gc.average) >> 1; if (lisp__data.gc.average < minfree) { if (lisp__data.gc.expandbits < 6) ++lisp__data.gc.expandbits; } else if (lisp__data.gc.expandbits) --lisp__data.gc.expandbits; /* For 32 bit computers, where sizeof(LispObj) == 16, * minfree is set to 1024, and expandbits limited to 6, * the maximum extra memory requested here should be 1Mb */ cellcount = minfree << lisp__data.gc.expandbits; #else /* Try to keep at least 3 times more free cells than the de number * of used cells in the freelist, to amenize the cost of the gc time, * in the, currently, very simple gc strategy code. */ cellcount = (objseg.nobjs - objseg.nfree) * 3; cellcount = cellcount + (minfree - (cellcount % minfree)); #endif if (objseg.freeobj == NIL || objseg.nfree < cellcount) LispAllocSeg(&objseg, cellcount); obj = objseg.freeobj; objseg.freeobj = CDR(obj); --objseg.nfree; return (obj); } LispObj * LispNew(LispObj *car, LispObj *cdr) { LispObj *obj = objseg.freeobj; if (obj == NIL) obj = Lisp__New(car, cdr); else { objseg.freeobj = CDR(obj); --objseg.nfree; } return (obj); } LispObj * LispNewAtom(const char *str, int intern) { LispObj *object; LispAtom *atom = LispDoGetAtom(str, 0); if (atom->object) { if (intern && atom->package == NULL) atom->package = PACKAGE; return (atom->object); } if (atomseg.freeobj == NIL) LispAllocSeg(&atomseg, pagesize); object = atomseg.freeobj; atomseg.freeobj = CDR(object); --atomseg.nfree; object->type = LispAtom_t; object->data.atom = atom; atom->object = object; if (intern) atom->package = PACKAGE; return (object); } LispObj * LispNewStaticAtom(const char *str) { LispObj *object; LispAtom *atom = LispDoGetAtom(str, 1); object = LispNewSymbol(atom); return (object); } LispObj * LispNewSymbol(LispAtom *atom) { if (atom->object) { if (atom->package == NULL) atom->package = PACKAGE; return (atom->object); } else { LispObj *symbol; if (atomseg.freeobj == NIL) LispAllocSeg(&atomseg, pagesize); symbol = atomseg.freeobj; atomseg.freeobj = CDR(symbol); --atomseg.nfree; symbol->type = LispAtom_t; symbol->data.atom = atom; atom->object = symbol; atom->package = PACKAGE; return (symbol); } } /* function representation is created on demand and never released, * even if the function is undefined and never defined again */ LispObj * LispNewFunction(LispObj *symbol) { LispObj *function; if (symbol->data.atom->function) return (symbol->data.atom->function); if (symbol->data.atom->package == NULL) symbol->data.atom->package = PACKAGE; if (atomseg.freeobj == NIL) LispAllocSeg(&atomseg, pagesize); function = atomseg.freeobj; atomseg.freeobj = CDR(function); --atomseg.nfree; function->type = LispFunction_t; function->data.atom = symbol->data.atom; symbol->data.atom->function = function; return (function); } /* symbol name representation is created on demand and never released */ LispObj * LispSymbolName(LispObj *symbol) { LispObj *name; LispAtom *atom = symbol->data.atom; if (atom->name) return (atom->name); if (atomseg.freeobj == NIL) LispAllocSeg(&atomseg, pagesize); name = atomseg.freeobj; atomseg.freeobj = CDR(name); --atomseg.nfree; name->type = LispString_t; THESTR(name) = atom->key->value; STRLEN(name) = atom->key->length; name->data.string.writable = 0; atom->name = name; return (name); } LispObj * LispNewFunctionQuote(LispObj *object) { LispObj *quote = LispNew(object, NIL); quote->type = LispFunctionQuote_t; quote->data.quote = object; return (quote); } LispObj * LispNewDFloat(double value) { LispObj *dfloat = objseg.freeobj; if (dfloat == NIL) dfloat = Lisp__New(NIL, NIL); else { objseg.freeobj = CDR(dfloat); --objseg.nfree; } dfloat->type = LispDFloat_t; dfloat->data.dfloat = value; return (dfloat); } LispObj * LispNewString(const char *str, long length) { char *cstring = LispMalloc(length + 1); memcpy(cstring, str, length); cstring[length] = '\0'; return LispNewStringAlloced(cstring, length); } LispObj * LispNewStringAlloced(char *cstring, long length) { LispObj *string = objseg.freeobj; if (string == NIL) string = Lisp__New(NIL, NIL); else { objseg.freeobj = CDR(string); --objseg.nfree; } LispMused(cstring); string->type = LispString_t; THESTR(string) = cstring; STRLEN(string) = length; string->data.string.writable = 1; return (string); } LispObj * LispNewComplex(LispObj *realpart, LispObj *imagpart) { LispObj *complexp = objseg.freeobj; if (complexp == NIL) complexp = Lisp__New(realpart, imagpart); else { objseg.freeobj = CDR(complexp); --objseg.nfree; } complexp->type = LispComplex_t; complexp->data.complex.real = realpart; complexp->data.complex.imag = imagpart; return (complexp); } LispObj * LispNewInteger(long integer) { if (integer > MOST_POSITIVE_FIXNUM || integer < MOST_NEGATIVE_FIXNUM) { LispObj *object = objseg.freeobj; if (object == NIL) object = Lisp__New(NIL, NIL); else { objseg.freeobj = CDR(object); --objseg.nfree; } object->type = LispInteger_t; object->data.integer = integer; return (object); } return (FIXNUM(integer)); } LispObj * LispNewRatio(long num, long den) { LispObj *ratio = objseg.freeobj; if (ratio == NIL) ratio = Lisp__New(NIL, NIL); else { objseg.freeobj = CDR(ratio); --objseg.nfree; } ratio->type = LispRatio_t; ratio->data.ratio.numerator = num; ratio->data.ratio.denominator = den; return (ratio); } LispObj * LispNewVector(LispObj *objects) { GC_ENTER(); long count; LispObj *array, *dimension; for (count = 0, array = objects; CONSP(array); count++, array = CDR(array)) ; GC_PROTECT(objects); dimension = CONS(FIXNUM(count), NIL); array = LispNew(objects, dimension); array->type = LispArray_t; array->data.array.list = objects; array->data.array.dim = dimension; array->data.array.rank = 1; array->data.array.type = LispNil_t; array->data.array.zero = count == 0; GC_LEAVE(); return (array); } LispObj * LispNewQuote(LispObj *object) { LispObj *quote = LispNew(object, NIL); quote->type = LispQuote_t; quote->data.quote = object; return (quote); } LispObj * LispNewBackquote(LispObj *object) { LispObj *backquote = LispNew(object, NIL); backquote->type = LispBackquote_t; backquote->data.quote = object; return (backquote); } LispObj * LispNewComma(LispObj *object, int atlist) { LispObj *comma = LispNew(object, NIL); comma->type = LispComma_t; comma->data.comma.eval = object; comma->data.comma.atlist = atlist; return (comma); } LispObj * LispNewCons(LispObj *car, LispObj *cdr) { LispObj *cons = objseg.freeobj; if (cons == NIL) cons = Lisp__New(car, cdr); else { objseg.freeobj = CDR(cons); --objseg.nfree; } CAR(cons) = car; CDR(cons) = cdr; return (cons); } LispObj * LispNewLambda(LispObj *name, LispObj *code, LispObj *data, LispFunType type) { LispObj *fun = LispNew(data, code); fun->type = LispLambda_t; fun->funtype = type; fun->data.lambda.name = name; fun->data.lambda.code = code; fun->data.lambda.data = data; return (fun); } LispObj * LispNewStruct(LispObj *fields, LispObj *def) { LispObj *struc = LispNew(fields, def); struc->type = LispStruct_t; struc->data.struc.fields = fields; struc->data.struc.def = def; return (struc); } LispObj * LispNewOpaque(void *data, int type) { LispObj *opaque = LispNew(NIL, NIL); opaque->type = LispOpaque_t; opaque->data.opaque.data = data; opaque->data.opaque.type = type; return (opaque); } /* string argument must be static, or allocated */ LispObj * LispNewKeyword(const char *string) { LispObj *keyword; if (PACKAGE != lisp__data.keyword) { LispObj *savepackage; LispPackage *savepack; /* Save package environment */ savepackage = PACKAGE; savepack = lisp__data.pack; /* Change package environment */ PACKAGE = lisp__data.keyword; lisp__data.pack = lisp__data.key; /* Create symbol in keyword package */ keyword = LispNewStaticAtom(string); /* Restore package environment */ PACKAGE = savepackage; lisp__data.pack = savepack; } else /* Just create symbol in keyword package */ keyword = LispNewStaticAtom(string); /* Export keyword symbol */ LispExportSymbol(keyword); /* All keywords are constants */ keyword->data.atom->constant = 1; /* XXX maybe should bound the keyword to itself, but that would * require allocating a LispProperty structure for every keyword */ return (keyword); } LispObj * LispNewPathname(LispObj *obj) { LispObj *path = LispNew(obj, NIL); path->type = LispPathname_t; path->data.pathname = obj; return (path); } LispObj * LispNewStringStream(const char *string, int flags, long length) { char *newstring = LispMalloc(length + 1); memcpy(newstring, string, length); newstring[length] = '\0'; return LispNewStringStreamAlloced(newstring, flags, length); } LispObj * LispNewStringStreamAlloced(char *string, int flags, long length) { LispObj *stream = LispNew(NIL, NIL); SSTREAMP(stream) = LispCalloc(1, sizeof(LispString)); SSTREAMP(stream)->string = string; stream->type = LispStream_t; SSTREAMP(stream)->length = length; LispMused(SSTREAMP(stream)); LispMused(SSTREAMP(stream)->string); stream->data.stream.type = LispStreamString; stream->data.stream.readable = (flags & STREAM_READ) != 0; stream->data.stream.writable = (flags & STREAM_WRITE) != 0; SSTREAMP(stream)->space = length + 1; stream->data.stream.pathname = NIL; return (stream); } LispObj * LispNewFileStream(LispFile *file, LispObj *path, int flags) { LispObj *stream = LispNew(NIL, NIL); stream->type = LispStream_t; FSTREAMP(stream) = file; stream->data.stream.pathname = path; stream->data.stream.type = LispStreamFile; stream->data.stream.readable = (flags & STREAM_READ) != 0; stream->data.stream.writable = (flags & STREAM_WRITE) != 0; return (stream); } LispObj * LispNewPipeStream(LispPipe *program, LispObj *path, int flags) { LispObj *stream = LispNew(NIL, NIL); stream->type = LispStream_t; PSTREAMP(stream) = program; stream->data.stream.pathname = path; stream->data.stream.type = LispStreamPipe; stream->data.stream.readable = (flags & STREAM_READ) != 0; stream->data.stream.writable = (flags & STREAM_WRITE) != 0; return (stream); } LispObj * LispNewStandardStream(LispFile *file, LispObj *description, int flags) { LispObj *stream = LispNew(NIL, NIL); stream->type = LispStream_t; FSTREAMP(stream) = file; stream->data.stream.pathname = description; stream->data.stream.type = LispStreamStandard; stream->data.stream.readable = (flags & STREAM_READ) != 0; stream->data.stream.writable = (flags & STREAM_WRITE) != 0; return (stream); } LispObj * LispNewBignum(mpi *bignum) { LispObj *integer = LispNew(NIL, NIL); integer->type = LispBignum_t; integer->data.mp.integer = bignum; LispMused(bignum->digs); LispMused(bignum); return (integer); } LispObj * LispNewBigratio(mpr *bigratio) { LispObj *ratio = LispNew(NIL, NIL); ratio->type = LispBigratio_t; ratio->data.mp.ratio = bigratio; LispMused(mpr_num(bigratio)->digs); LispMused(mpr_den(bigratio)->digs); LispMused(bigratio); return (ratio); } /* name must be of type LispString_t */ LispObj * LispNewPackage(LispObj *name, LispObj *nicknames) { LispObj *package = LispNew(name, nicknames); LispPackage *pack = LispCalloc(1, sizeof(LispPackage)); package->type = LispPackage_t; package->data.package.name = name; package->data.package.nicknames = nicknames; package->data.package.package = pack; package->data.package.package->atoms = hash_new(STRTBLSZ, NULL); LispMused(pack); return (package); } LispObj * LispSymbolFunction(LispObj *symbol) { LispAtom *atom = symbol->data.atom; if ((atom->a_builtin && atom->property->fun.builtin->type == LispFunction) || (atom->a_function && atom->property->fun.function->funtype == LispFunction) || (atom->a_defstruct && atom->property->structure.function != STRUCT_NAME) || /* XXX currently bytecode is only generated for functions */ atom->a_compiled) symbol = FUNCTION(symbol); else LispDestroy("SYMBOL-FUNCTION: %s is not a function", STROBJ(symbol)); return (symbol); } static INLINE LispObj * LispGetVarPack(LispObj *symbol) { LispAtom *atom; atom = (LispAtom *)hash_get(lisp__data.pack->atoms, symbol->data.atom->key); return (atom ? atom->object : NULL); } /* package must be of type LispPackage_t */ void LispUsePackage(LispObj *package) { LispAtom *atom; LispPackage *pack; LispObj **pentry, **eentry; /* Already using its own symbols... */ if (package == PACKAGE) return; /* Check if package not already in use-package list */ for (pentry = lisp__data.pack->use.pairs, eentry = pentry + lisp__data.pack->use.length; pentry < eentry; pentry++) if (*pentry == package) return; /* Remember this package is in the use-package list */ if (lisp__data.pack->use.length + 1 >= lisp__data.pack->use.space) { LispObj **pairs = realloc(lisp__data.pack->use.pairs, (lisp__data.pack->use.space + 1) * sizeof(LispObj*)); if (pairs == NULL) LispDestroy("out of memory"); lisp__data.pack->use.pairs = pairs; ++lisp__data.pack->use.space; } lisp__data.pack->use.pairs[lisp__data.pack->use.length++] = package; /* Import all extern symbols from package */ pack = package->data.package.package; /* Traverse atom list, searching for extern symbols */ for (atom = (LispAtom *)hash_iter_first(pack->atoms); atom; atom = (LispAtom *)hash_iter_next(pack->atoms)) { if (atom->ext) LispImportSymbol(atom->object); } } /* symbol must be of type LispAtom_t */ void LispImportSymbol(LispObj *symbol) { int increment; LispAtom *atom; LispObj *current; current = LispGetVarPack(symbol); if (current == NULL || current->data.atom->property == NOPROPERTY) { /* No conflicts */ if (symbol->data.atom->a_object) { /* If it is a bounded variable */ if (lisp__data.pack->glb.length + 1 >= lisp__data.pack->glb.space) LispMoreGlobals(lisp__data.pack); lisp__data.pack->glb.pairs[lisp__data.pack->glb.length++] = symbol; } /* Create copy of atom in current package */ atom = LispDoGetAtom(ATOMID(symbol)->value, 0); /* Need to create a copy because if anything new is atached to the * property, the current package is the owner, not the previous one. */ /* And reference the same properties */ atom->property = symbol->data.atom->property; increment = 1; } else if (current->data.atom->property != symbol->data.atom->property) { /* Symbol already exists in the current package, * but does not reference the same variable */ LispContinuable("Symbol %s already defined in package %s. Redefine?", ATOMID(symbol)->value, THESTR(PACKAGE->data.package.name)); atom = current->data.atom; /* Continued from error, redefine variable */ LispDecrementAtomReference(atom); atom->property = symbol->data.atom->property; atom->a_object = atom->a_function = atom->a_builtin = atom->a_property = atom->a_defsetf = atom->a_defstruct = 0; increment = 1; } else { /* Symbol is already available in the current package, just update */ atom = current->data.atom; increment = 0; } /* If importing an important system variable */ atom->watch = symbol->data.atom->watch; /* Update constant flag */ atom->constant = symbol->data.atom->constant; /* Set home-package and unique-atom associated with symbol */ atom->package = symbol->data.atom->package; atom->object = symbol->data.atom->object; if (symbol->data.atom->a_object) atom->a_object = 1; if (symbol->data.atom->a_function) atom->a_function = 1; else if (symbol->data.atom->a_builtin) atom->a_builtin = 1; else if (symbol->data.atom->a_compiled) atom->a_compiled = 1; if (symbol->data.atom->a_property) atom->a_property = 1; if (symbol->data.atom->a_defsetf) atom->a_defsetf = 1; if (symbol->data.atom->a_defstruct) atom->a_defstruct = 1; if (increment) /* Increase reference count, more than one package using the symbol */ LispIncrementAtomReference(symbol->data.atom); } /* symbol must be of type LispAtom_t */ void LispExportSymbol(LispObj *symbol) { /* This does not automatically export symbols to another package using * the symbols of the current package */ symbol->data.atom->ext = 1; } #ifdef __GNUC__ LispObj * LispGetVar(LispObj *atom) { return (LispDoGetVar(atom)); } static INLINE LispObj * LispDoGetVar(LispObj *atom) #else #define LispDoGetVar LispGetVar LispObj * LispGetVar(LispObj *atom) #endif { LispAtom *name; int i, base, offset; Atom_id id; name = atom->data.atom; if (name->constant && name->package == lisp__data.keyword) return (atom); /* XXX offset should be stored elsewhere, it is unique, like the string * pointer. Unless a multi-thread interface is implemented (where * multiple stacks would be required, the offset value should be * stored with the string, so that a few cpu cicles could be saved * by initializing the value to -1, and only searching for the symbol * binding if it is not -1, and if no binding is found, because the * lexical scope was left, reset offset to -1. */ offset = name->offset; id = name->key; base = lisp__data.env.lex; i = lisp__data.env.head - 1; if (offset <= i && (offset >= base || name->dyn) && lisp__data.env.names[offset] == id) return (lisp__data.env.values[offset]); for (; i >= base; i--) if (lisp__data.env.names[i] == id) { name->offset = i; return (lisp__data.env.values[i]); } if (name->dyn) { /* Keep searching as maybe a rebound dynamic variable */ for (; i >= 0; i--) if (lisp__data.env.names[i] == id) { name->offset = i; return (lisp__data.env.values[i]); } if (name->a_object) { /* Check for a symbol defined as special, but not yet bound. */ if (name->property->value == UNBOUND) return (NULL); return (name->property->value); } } return (name->a_object ? name->property->value : NULL); } #ifdef DEBUGGER /* Same code as LispDoGetVar, but returns the address of the pointer to * the object value. Used only by the debugger */ void * LispGetVarAddr(LispObj *atom) { LispAtom *name; int i, base; Atom_id id; name = atom->data.atom; if (name->constant && name->package == lisp__data.keyword) return (&atom); id = name->string; i = lisp__data.env.head - 1; for (base = lisp__data.env.lex; i >= base; i--) if (lisp__data.env.names[i] == id) return (&(lisp__data.env.values[i])); if (name->dyn) { for (; i >= 0; i--) if (lisp__data.env.names[i] == id) return (&(lisp__data.env.values[i])); if (name->a_object) { /* Check for a symbol defined as special, but not yet bound */ if (name->property->value == UNBOUND) return (NULL); return (&(name->property->value)); } } return (name->a_object ? &(name->property->value) : NULL); } #endif /* Only removes global variables. To be called by makunbound * Local variables are unbounded once their block is closed anyway. */ void LispUnsetVar(LispObj *atom) { LispAtom *name = atom->data.atom; if (name->package) { int i; LispPackage *pack = name->package->data.package.package; for (i = pack->glb.length - 1; i > 0; i--) if (pack->glb.pairs[i] == atom) { LispRemAtomObjectProperty(name); --pack->glb.length; if (i < pack->glb.length) memmove(pack->glb.pairs + i, pack->glb.pairs + i + 1, sizeof(LispObj*) * (pack->glb.length - i)); /* unset hint about dynamically binded variable */ if (name->dyn) name->dyn = 0; break; } } } LispObj * LispAddVar(LispObj *atom, LispObj *obj) { if (lisp__data.env.length >= lisp__data.env.space) LispMoreEnvironment(); LispDoAddVar(atom, obj); return (obj); } static INLINE void LispDoAddVar(LispObj *symbol, LispObj *value) { LispAtom *atom = symbol->data.atom; atom->offset = lisp__data.env.length; lisp__data.env.values[lisp__data.env.length] = value; lisp__data.env.names[lisp__data.env.length++] = atom->key; } LispObj * LispSetVar(LispObj *atom, LispObj *obj) { LispPackage *pack; LispAtom *name; int i, base, offset; Atom_id id; name = atom->data.atom; offset = name->offset; id = name->key; base = lisp__data.env.lex; i = lisp__data.env.head - 1; if (offset <= i && (offset >= base || name->dyn) && lisp__data.env.names[offset] == id) return (lisp__data.env.values[offset] = obj); for (; i >= base; i--) if (lisp__data.env.names[i] == id) { name->offset = i; return (lisp__data.env.values[i] = obj); } if (name->dyn) { for (; i >= 0; i--) if (lisp__data.env.names[i] == id) return (lisp__data.env.values[i] = obj); if (name->watch) { LispSetAtomObjectProperty(name, obj); return (obj); } return (SETVALUE(name, obj)); } if (name->a_object) { if (name->watch) { LispSetAtomObjectProperty(name, obj); return (obj); } return (SETVALUE(name, obj)); } LispSetAtomObjectProperty(name, obj); pack = name->package->data.package.package; if (pack->glb.length >= pack->glb.space) LispMoreGlobals(pack); pack->glb.pairs[pack->glb.length++] = atom; return (obj); } void LispProclaimSpecial(LispObj *atom, LispObj *value, LispObj *doc) { int i = 0, dyn, glb; LispAtom *name; LispPackage *pack; glb = 0; name = atom->data.atom; pack = name->package->data.package.package; dyn = name->dyn; if (!dyn) { /* Note: don't check if a local variable already is using the symbol */ for (i = pack->glb.length - 1; i >= 0; i--) if (pack->glb.pairs[i] == atom) { glb = 1; break; } } if (dyn) { if (name->property->value == UNBOUND && value) /* if variable was just made special, but not bounded */ LispSetAtomObjectProperty(name, value); } else if (glb) /* Already a global variable, but not marked as special. * Set hint about dynamically binded variable. */ name->dyn = 1; else { /* create new special variable */ LispSetAtomObjectProperty(name, value ? value : UNBOUND); if (pack->glb.length >= pack->glb.space) LispMoreGlobals(pack); pack->glb.pairs[pack->glb.length] = atom; ++pack->glb.length; /* set hint about possibly dynamically binded variable */ name->dyn = 1; } if (doc != NIL) LispAddDocumentation(atom, doc, LispDocVariable); } void LispDefconstant(LispObj *atom, LispObj *value, LispObj *doc) { int i; LispAtom *name = atom->data.atom; LispPackage *pack = name->package->data.package.package; /* Unset hint about dynamically binded variable, if set. */ name->dyn = 0; /* Check if variable is bounded as a global variable */ for (i = pack->glb.length - 1; i >= 0; i--) if (pack->glb.pairs[i] == atom) break; if (i < 0) { /* Not a global variable */ if (pack->glb.length >= pack->glb.space) LispMoreGlobals(pack); pack->glb.pairs[pack->glb.length] = atom; ++pack->glb.length; } /* If already a constant variable */ if (name->constant && name->a_object && name->property->value != value) LispWarning("constant %s is being redefined", STROBJ(atom)); else name->constant = 1; /* Set constant value */ LispSetAtomObjectProperty(name, value); if (doc != NIL) LispAddDocumentation(atom, doc, LispDocVariable); } void LispAddDocumentation(LispObj *symbol, LispObj *documentation, LispDocType_t type) { int length; char *string; LispAtom *atom; LispObj *object; if (!SYMBOLP(symbol) || !STRINGP(documentation)) LispDestroy("DOCUMENTATION: invalid argument"); atom = symbol->data.atom; if (atom->documentation[type]) LispRemDocumentation(symbol, type); /* allocate documentation in atomseg */ if (atomseg.freeobj == NIL) LispAllocSeg(&atomseg, pagesize); length = STRLEN(documentation); string = LispMalloc(length); memcpy(string, THESTR(documentation), length); string[length] = '\0'; object = atomseg.freeobj; atomseg.freeobj = CDR(object); --atomseg.nfree; object->type = LispString_t; THESTR(object) = string; STRLEN(object) = length; object->data.string.writable = 0; atom->documentation[type] = object; LispMused(string); } void LispRemDocumentation(LispObj *symbol, LispDocType_t type) { LispAtom *atom; if (!SYMBOLP(symbol)) LispDestroy("DOCUMENTATION: invalid argument"); atom = symbol->data.atom; if (atom->documentation[type]) { /* reclaim object to atomseg */ free(THESTR(atom->documentation[type])); CDR(atom->documentation[type]) = atomseg.freeobj; atomseg.freeobj = atom->documentation[type]; atom->documentation[type] = NULL; ++atomseg.nfree; } } LispObj * LispGetDocumentation(LispObj *symbol, LispDocType_t type) { LispAtom *atom; if (!SYMBOLP(symbol)) LispDestroy("DOCUMENTATION: invalid argument"); atom = symbol->data.atom; return (atom->documentation[type] ? atom->documentation[type] : NIL); } LispObj * LispReverse(LispObj *list) { LispObj *tmp, *res = NIL; while (list != NIL) { tmp = CDR(list); CDR(list) = res; res = list; list = tmp; } return (res); } LispBlock * LispBeginBlock(LispObj *tag, LispBlockType type) { LispBlock *block; unsigned blevel = lisp__data.block.block_level + 1; if (blevel > lisp__data.block.block_size) { LispBlock **blk; if (blevel > MAX_STACK_DEPTH) LispDestroy("stack overflow"); DISABLE_INTERRUPTS(); blk = realloc(lisp__data.block.block, sizeof(LispBlock*) * (blevel + 1)); block = NULL; if (blk == NULL || (block = malloc(sizeof(LispBlock))) == NULL) { ENABLE_INTERRUPTS(); LispDestroy("out of memory"); } lisp__data.block.block = blk; lisp__data.block.block[lisp__data.block.block_size] = block; lisp__data.block.block_size = blevel; ENABLE_INTERRUPTS(); } block = lisp__data.block.block[lisp__data.block.block_level]; if (type == LispBlockCatch && !CONSTANTP(tag)) { tag = EVAL(tag); lisp__data.protect.objects[lisp__data.protect.length++] = tag; } block->type = type; block->tag = tag; block->stack = lisp__data.stack.length; block->protect = lisp__data.protect.length; block->block_level = lisp__data.block.block_level; lisp__data.block.block_level = blevel; #ifdef DEBUGGER if (lisp__data.debugging) { block->debug_level = lisp__data.debug_level; block->debug_step = lisp__data.debug_step; } #endif return (block); } void LispEndBlock(LispBlock *block) { lisp__data.protect.length = block->protect; lisp__data.block.block_level = block->block_level; #ifdef DEBUGGER if (lisp__data.debugging) { if (lisp__data.debug_level >= block->debug_level) { while (lisp__data.debug_level > block->debug_level) { DBG = CDR(DBG); --lisp__data.debug_level; } } lisp__data.debug_step = block->debug_step; } #endif } void LispBlockUnwind(LispBlock *block) { LispBlock *unwind; int blevel = lisp__data.block.block_level; while (blevel > 0) { unwind = lisp__data.block.block[--blevel]; if (unwind->type == LispBlockProtect) { BLOCKJUMP(unwind); } if (unwind == block) /* jump above unwind block */ break; } } static LispObj * LispEvalBackquoteObject(LispObj *argument, int list, int quote) { LispObj *result = argument, *object; if (!POINTERP(argument)) return (argument); else if (XCOMMAP(argument)) { /* argument may need to be evaluated */ int atlist; if (!list && argument->data.comma.atlist) /* cannot append, not in a list */ LispDestroy("EVAL: ,@ only allowed on lists"); --quote; if (quote < 0) LispDestroy("EVAL: comma outside of backquote"); result = object = argument->data.comma.eval; atlist = COMMAP(object) && object->data.comma.atlist; if (POINTERP(result) && (XCOMMAP(result) || XBACKQUOTEP(result))) /* nested commas, reduce 1 level, or backquote, * don't call LispEval or quote argument will be reset */ result = LispEvalBackquoteObject(object, 0, quote); else if (quote == 0) /* just evaluate it */ result = EVAL(result); if (quote != 0) result = result == object ? argument : COMMA(result, atlist); } else if (XBACKQUOTEP(argument)) { object = argument->data.quote; result = LispEvalBackquote(object, quote + 1); if (quote) result = result == object ? argument : BACKQUOTE(result); } else if (XQUOTEP(argument) && POINTERP(argument->data.quote) && (XCOMMAP(argument->data.quote) || XBACKQUOTEP(argument->data.quote) || XCONSP(argument->data.quote))) { /* ensures `',sym to be the same as `(quote ,sym) */ object = argument->data.quote; result = LispEvalBackquote(argument->data.quote, quote); result = result == object ? argument : QUOTE(result); } return (result); } LispObj * LispEvalBackquote(LispObj *argument, int quote) { int protect; LispObj *result, *object, *cons, *cdr; if (!CONSP(argument)) return (LispEvalBackquoteObject(argument, 0, quote)); result = cdr = NIL; protect = lisp__data.protect.length; /* always generate a new list for the result, even if nothing * is evaluated. It is not expected to use backqoutes when * not required. */ /* reserve a GC protected slot for the result */ if (protect + 1 >= lisp__data.protect.space) LispMoreProtects(); lisp__data.protect.objects[lisp__data.protect.length++] = NIL; for (cons = argument; ; cons = CDR(cons)) { /* if false, last argument, and if cons is not NIL, a dotted list */ int list = CONSP(cons), insert; if (list) object = CAR(cons); else object = cons; if (COMMAP(object)) /* need to insert list elements in result, not just cons it? */ insert = object->data.comma.atlist; else insert = 0; /* evaluate object, if required */ if (CONSP(object)) object = LispEvalBackquote(object, quote); else object = LispEvalBackquoteObject(object, insert, quote); if (result == NIL) { /* if starting result list */ if (!insert) { if (list) result = cdr = CONS(object, NIL); else result = cdr = object; /* gc protect result */ lisp__data.protect.objects[protect] = result; } else { if (!CONSP(object)) { result = cdr = object; /* gc protect result */ lisp__data.protect.objects[protect] = result; } else { result = cdr = CONS(CAR(object), NIL); /* gc protect result */ lisp__data.protect.objects[protect] = result; /* add remaining elements to result */ for (object = CDR(object); CONSP(object); object = CDR(object)) { RPLACD(cdr, CONS(CAR(object), NIL)); cdr = CDR(cdr); } if (object != NIL) { /* object was a dotted list */ RPLACD(cdr, object); cdr = CDR(cdr); } } } } else { if (!CONSP(cdr)) LispDestroy("EVAL: cannot append to %s", STROBJ(cdr)); if (!insert) { if (list) { RPLACD(cdr, CONS(object, NIL)); cdr = CDR(cdr); } else { RPLACD(cdr, object); cdr = object; } } else { if (!CONSP(object)) { RPLACD(cdr, object); /* if object is NIL, it is a empty list appended, not * creating a dotted list. */ if (object != NIL) cdr = object; } else { for (; CONSP(object); object = CDR(object)) { RPLACD(cdr, CONS(CAR(object), NIL)); cdr = CDR(cdr); } if (object != NIL) { /* object was a dotted list */ RPLACD(cdr, object); cdr = CDR(cdr); } } } } /* if last argument list element processed */ if (!list) break; } lisp__data.protect.length = protect; return (result); } void LispMoreEnvironment(void) { Atom_id *names; LispObj **values; DISABLE_INTERRUPTS(); names = realloc(lisp__data.env.names, (lisp__data.env.space + 256) * sizeof(Atom_id)); if (names != NULL) { values = realloc(lisp__data.env.values, (lisp__data.env.space + 256) * sizeof(LispObj*)); if (values != NULL) { lisp__data.env.names = names; lisp__data.env.values = values; lisp__data.env.space += 256; ENABLE_INTERRUPTS(); return; } else free(names); } ENABLE_INTERRUPTS(); LispDestroy("out of memory"); } void LispMoreStack(void) { LispObj **values; DISABLE_INTERRUPTS(); values = realloc(lisp__data.stack.values, (lisp__data.stack.space + 256) * sizeof(LispObj*)); if (values == NULL) { ENABLE_INTERRUPTS(); LispDestroy("out of memory"); } lisp__data.stack.values = values; lisp__data.stack.space += 256; ENABLE_INTERRUPTS(); } void LispMoreGlobals(LispPackage *pack) { LispObj **pairs; DISABLE_INTERRUPTS(); pairs = realloc(pack->glb.pairs, (pack->glb.space + 256) * sizeof(LispObj*)); if (pairs == NULL) { ENABLE_INTERRUPTS(); LispDestroy("out of memory"); } pack->glb.pairs = pairs; pack->glb.space += 256; ENABLE_INTERRUPTS(); } void LispMoreProtects(void) { LispObj **objects; DISABLE_INTERRUPTS(); objects = realloc(lisp__data.protect.objects, (lisp__data.protect.space + 256) * sizeof(LispObj*)); if (objects == NULL) { ENABLE_INTERRUPTS(); LispDestroy("out of memory"); } lisp__data.protect.objects = objects; lisp__data.protect.space += 256; ENABLE_INTERRUPTS(); } static int LispMakeEnvironment(LispArgList *alist, LispObj *values, LispObj *name, int eval, int builtin) { char *desc; int i, count, base; LispObj **symbols, **defaults, **sforms; #define BUILTIN_ARGUMENT(value) \ lisp__data.stack.values[lisp__data.stack.length++] = value /* If the index value is from register variables, this * can save some cpu time. Useful for normal arguments * that are the most common, and thus the ones that * consume more time in LispMakeEnvironment. */ #define BUILTIN_NO_EVAL_ARGUMENT(index, value) \ lisp__data.stack.values[index] = value #define NORMAL_ARGUMENT(symbol, value) \ LispDoAddVar(symbol, value) if (builtin) { base = lisp__data.stack.length; if (base + alist->num_arguments > lisp__data.stack.space) { do LispMoreStack(); while (base + alist->num_arguments > lisp__data.stack.space); } } else { base = lisp__data.env.length; if (base + alist->num_arguments > lisp__data.env.space) { do LispMoreEnvironment(); while (base + alist->num_arguments > lisp__data.env.space); } } desc = alist->description; switch (*desc++) { case '.': goto normal_label; case 'o': goto optional_label; case 'k': goto key_label; case 'r': goto rest_label; case 'a': goto aux_label; default: goto done_label; } /* Code below is done in several almost identical loops, to avoid * checking the value of the arguments eval and builtin too much times */ /* Normal arguments */ normal_label: i = 0; count = alist->normals.num_symbols; if (builtin) { if (eval) { for (; i < count && CONSP(values); i++, values = CDR(values)) { BUILTIN_ARGUMENT(EVAL(CAR(values))); } } else { for (; i < count && CONSP(values); i++, values = CDR(values)) { BUILTIN_NO_EVAL_ARGUMENT(base + i, CAR(values)); } /* macro BUILTIN_NO_EVAL_ARGUMENT does not update * lisp__data.stack.length, as there is no risk of GC while * adding the arguments. */ lisp__data.stack.length += i; } } else { symbols = alist->normals.symbols; if (eval) { for (; i < count && CONSP(values); i++, values = CDR(values)) { NORMAL_ARGUMENT(symbols[i], EVAL(CAR(values))); } } else { for (; i < count && CONSP(values); i++, values = CDR(values)) { NORMAL_ARGUMENT(symbols[i], CAR(values)); } } } if (i < count) LispDestroy("%s: too few arguments", STROBJ(name)); switch (*desc++) { case 'o': goto optional_label; case 'k': goto key_label; case 'r': goto rest_label; case 'a': goto aux_label; default: goto done_label; } /* &OPTIONAL */ optional_label: i = 0; count = alist->optionals.num_symbols; defaults = alist->optionals.defaults; sforms = alist->optionals.sforms; if (builtin) { if (eval) { for (; i < count && CONSP(values); i++, values = CDR(values)) BUILTIN_ARGUMENT(EVAL(CAR(values))); for (; i < count; i++) BUILTIN_ARGUMENT(UNSPEC); } else { for (; i < count && CONSP(values); i++, values = CDR(values)) BUILTIN_ARGUMENT(CAR(values)); for (; i < count; i++) BUILTIN_ARGUMENT(UNSPEC); } } else { symbols = alist->optionals.symbols; if (eval) { for (; i < count && CONSP(values); i++, values = CDR(values)) { NORMAL_ARGUMENT(symbols[i], EVAL(CAR(values))); if (sforms[i]) { NORMAL_ARGUMENT(sforms[i], T); } } } else { for (; i < count && CONSP(values); i++, values = CDR(values)) { NORMAL_ARGUMENT(symbols[i], CAR(values)); if (sforms[i]) { NORMAL_ARGUMENT(sforms[i], T); } } } /* default arguments are evaluated for macros */ for (; i < count; i++) { if (!CONSTANTP(defaults[i])) { int head = lisp__data.env.head; int lex = lisp__data.env.lex; lisp__data.env.lex = base; lisp__data.env.head = lisp__data.env.length; NORMAL_ARGUMENT(symbols[i], EVAL(defaults[i])); lisp__data.env.head = head; lisp__data.env.lex = lex; } else { NORMAL_ARGUMENT(symbols[i], defaults[i]); } if (sforms[i]) { NORMAL_ARGUMENT(sforms[i], NIL); } } } switch (*desc++) { case 'k': goto key_label; case 'r': goto rest_label; case 'a': goto aux_label; default: goto done_label; } /* &KEY */ key_label: { int argc, nused; LispObj *val, *karg, **keys; /* Count number of remaining arguments */ for (karg = values, argc = 0; CONSP(karg); karg = CDR(karg), argc++) { karg = CDR(karg); if (!CONSP(karg)) LispDestroy("%s: &KEY needs arguments as pairs", STROBJ(name)); } /* OPTIMIZATION: * Builtin functions require that the keyword be in the keyword package. * User functions don't need the arguments being pushed in the stack * in the declared order (bytecode expects it...). * XXX Error checking should be done elsewhere, code may be looping * and doing error check here may consume too much cpu time. * XXX Would also be good to already have the arguments specified in * the correct order. */ nused = 0; val = NIL; count = alist->keys.num_symbols; symbols = alist->keys.symbols; defaults = alist->keys.defaults; sforms = alist->keys.sforms; if (builtin) { /* Arguments must be created in the declared order */ i = 0; if (eval) { for (; i < count; i++) { for (karg = values; CONSP(karg); karg = CDDR(karg)) { /* This is only true if both point to the * same symbol in the keyword package. */ if (symbols[i] == CAR(karg)) { if (karg == values) values = CDDR(values); ++nused; BUILTIN_ARGUMENT(EVAL(CADR(karg))); goto keyword_builtin_eval_used_label; } } BUILTIN_ARGUMENT(UNSPEC); keyword_builtin_eval_used_label:; } } else { for (; i < count; i++) { for (karg = values; CONSP(karg); karg = CDDR(karg)) { if (symbols[i] == CAR(karg)) { if (karg == values) values = CDDR(values); ++nused; BUILTIN_ARGUMENT(CADR(karg)); goto keyword_builtin_used_label; } } BUILTIN_ARGUMENT(UNSPEC); keyword_builtin_used_label:; } } if (argc != nused) { /* Argument(s) may be incorrectly specified, or specified * twice (what is not an error). */ for (karg = values; CONSP(karg); karg = CDDR(karg)) { val = CAR(karg); if (KEYWORDP(val)) { for (i = 0; i < count; i++) if (symbols[i] == val) break; } else /* Just make the error test true */ i = count; if (i == count) goto invalid_keyword_label; } } } #if 0 else { /* The base offset of the atom in the stack, to check for * keywords specified twice. */ LispObj *symbol; int offset = lisp__data.env.length; keys = alist->keys.keys; for (karg = values; CONSP(karg); karg = CDDR(karg)) { symbol = CAR(karg); if (SYMBOLP(symbol)) { /* Must be a keyword, but even if it is a keyword, may * be a typo, so assume it is correct. If it is not * in the argument list, it is an error. */ for (i = 0; i < count; i++) { if (!keys[i] && symbols[i] == symbol) { LispAtom *atom = symbol->data.atom; /* Symbol found in the argument list. */ if (atom->offset >= offset && atom->offset < offset + nused && lisp__data.env.names[atom->offset] == atom->string) /* Specified more than once... */ goto keyword_duplicated_label; break; } } } else { Atom_id id; if (!QUOTEP(symbol) || !SYMBOLP(val = symbol->data.quote)) { /* Bad argument. */ val = symbol; goto invalid_keyword_label; } id = ATOMID(val); for (i = 0; i < count; i++) { if (keys[i] && ATOMID(keys[i]) == id) { LispAtom *atom = val->data.atom; /* Symbol found in the argument list. */ if (atom->offset >= offset && atom->offset < offset + nused && lisp__data.env.names[atom->offset] == atom->string) /* Specified more than once... */ goto keyword_duplicated_label; break; } } } if (i == count) { /* Argument specification not found. */ val = symbol; goto invalid_keyword_label; } ++nused; if (eval) { NORMAL_ARGUMENT(symbols[i], EVAL(CADR(karg))); } else { NORMAL_ARGUMENT(symbols[i], CADR(karg)); } if (sforms[i]) { NORMAL_ARGUMENT(sforms[i], T); } keyword_duplicated_label:; } /* Add variables that were not specified in the function call. */ if (nused < count) { int j; for (i = 0; i < count; i++) { Atom_id id = ATOMID(symbols[i]); for (j = offset + nused - 1; j >= offset; j--) { if (lisp__data.env.names[j] == id) break; } if (j < offset) { /* Argument not specified. Use default value */ /* default arguments are evaluated for macros */ if (!CONSTANTP(defaults[i])) { int head = lisp__data.env.head; int lex = lisp__data.env.lex; lisp__data.env.lex = base; lisp__data.env.head = lisp__data.env.length; NORMAL_ARGUMENT(symbols[i], EVAL(defaults[i])); lisp__data.env.head = head; lisp__data.env.lex = lex; } else { NORMAL_ARGUMENT(symbols[i], defaults[i]); } if (sforms[i]) { NORMAL_ARGUMENT(sforms[i], NIL); } } } } } #else else { int varset; sforms = alist->keys.sforms; keys = alist->keys.keys; /* Add variables */ for (i = 0; i < alist->keys.num_symbols; i++) { val = defaults[i]; varset = 0; if (keys[i]) { Atom_id atom = ATOMID(keys[i]); /* Special keyword specification, need to compare ATOMID * and keyword specification must be a quoted object */ for (karg = values; CONSP(karg); karg = CDR(karg)) { val = CAR(karg); if (QUOTEP(val) && atom == ATOMID(val->data.quote)) { val = CADR(karg); varset = 1; ++nused; break; } karg = CDR(karg); } } else { /* Normal keyword specification, can compare object pointers, * as they point to the same object in the keyword package */ for (karg = values; CONSP(karg); karg = CDR(karg)) { /* Don't check if argument is a valid keyword or * special quoted keyword */ if (symbols[i] == CAR(karg)) { val = CADR(karg); varset = 1; ++nused; break; } karg = CDR(karg); } } /* Add the variable to environment */ if (varset) { NORMAL_ARGUMENT(symbols[i], eval ? EVAL(val) : val); if (sforms[i]) { NORMAL_ARGUMENT(sforms[i], T); } } else { /* default arguments are evaluated for macros */ if (!CONSTANTP(val)) { int head = lisp__data.env.head; int lex = lisp__data.env.lex; lisp__data.env.lex = base; lisp__data.env.head = lisp__data.env.length; NORMAL_ARGUMENT(symbols[i], EVAL(val)); lisp__data.env.head = head; lisp__data.env.lex = lex; } else { NORMAL_ARGUMENT(symbols[i], val); } if (sforms[i]) { NORMAL_ARGUMENT(sforms[i], NIL); } } } if (argc != nused) { /* Argument(s) may be incorrectly specified, or specified * twice (what is not an error). */ for (karg = values; CONSP(karg); karg = CDDR(karg)) { val = CAR(karg); if (KEYWORDP(val)) { for (i = 0; i < count; i++) if (symbols[i] == val) break; } else if (QUOTEP(val) && SYMBOLP(val->data.quote)) { Atom_id atom = ATOMID(val->data.quote); for (i = 0; i < count; i++) if (ATOMID(keys[i]) == atom) break; } else /* Just make the error test true */ i = count; if (i == count) goto invalid_keyword_label; } } } #endif goto check_aux_label; invalid_keyword_label: { /* If not in argument specification list... */ char function_name[36]; strcpy(function_name, STROBJ(name)); LispDestroy("%s: %s is an invalid keyword", function_name, STROBJ(val)); } } check_aux_label: if (*desc == 'a') { /* &KEY uses all remaining arguments */ values = NIL; goto aux_label; } goto finished_label; /* &REST */ rest_label: if (!CONSP(values)) { if (builtin) { BUILTIN_ARGUMENT(values); } else { NORMAL_ARGUMENT(alist->rest, values); } values = NIL; } /* always allocate a new list, don't know if it will be retained */ else if (eval) { LispObj *cons; cons = CONS(EVAL(CAR(values)), NIL); if (builtin) { BUILTIN_ARGUMENT(cons); } else { NORMAL_ARGUMENT(alist->rest, cons); } values = CDR(values); for (; CONSP(values); values = CDR(values)) { RPLACD(cons, CONS(EVAL(CAR(values)), NIL)); cons = CDR(cons); } } else { LispObj *cons; cons = CONS(CAR(values), NIL); if (builtin) { BUILTIN_ARGUMENT(cons); } else { NORMAL_ARGUMENT(alist->rest, cons); } values = CDR(values); for (; CONSP(values); values = CDR(values)) { RPLACD(cons, CONS(CAR(values), NIL)); cons = CDR(cons); } } if (*desc != 'a') goto finished_label; /* &AUX */ aux_label: i = 0; count = alist->auxs.num_symbols; defaults = alist->auxs.initials; symbols = alist->auxs.symbols; { int lex = lisp__data.env.lex; lisp__data.env.lex = base; lisp__data.env.head = lisp__data.env.length; for (; i < count; i++) { NORMAL_ARGUMENT(symbols[i], EVAL(defaults[i])); ++lisp__data.env.head; } lisp__data.env.lex = lex; } done_label: if (CONSP(values)) LispDestroy("%s: too many arguments", STROBJ(name)); finished_label: if (builtin) lisp__data.stack.base = base; else { lisp__data.env.head = lisp__data.env.length; } #undef BULTIN_ARGUMENT #undef NORMAL_ARGUMENT #undef BUILTIN_NO_EVAL_ARGUMENT return (base); } LispObj * LispFuncall(LispObj *function, LispObj *arguments, int eval) { LispAtom *atom; LispArgList *alist; LispBuiltin *builtin; LispObj *lambda, *result; int macro, base; #ifdef DEBUGGER if (lisp__data.debugging) LispDebugger(LispDebugCallBegin, function, arguments); #endif switch (OBJECT_TYPE(function)) { case LispFunction_t: function = function->data.atom->object; case LispAtom_t: atom = function->data.atom; if (atom->a_builtin) { builtin = atom->property->fun.builtin; if (eval) eval = builtin->type != LispMacro; base = LispMakeEnvironment(atom->property->alist, arguments, function, eval, 1); if (builtin->multiple_values) { RETURN_COUNT = 0; result = builtin->function(builtin); } else { result = builtin->function(builtin); RETURN_COUNT = 0; } lisp__data.stack.base = lisp__data.stack.length = base; } else if (atom->a_compiled) { int lex = lisp__data.env.lex; lambda = atom->property->fun.function; alist = atom->property->alist; base = LispMakeEnvironment(alist, arguments, function, eval, 0); lisp__data.env.lex = base; result = LispExecuteBytecode(lambda); lisp__data.env.lex = lex; lisp__data.env.head = lisp__data.env.length = base; } else if (atom->a_function) { lambda = atom->property->fun.function; macro = lambda->funtype == LispMacro; alist = atom->property->alist; lambda = lambda->data.lambda.code; if (eval) eval = !macro; base = LispMakeEnvironment(alist, arguments, function, eval, 0); result = LispRunFunMac(function, lambda, macro, base); } else if (atom->a_defstruct && atom->property->structure.function != STRUCT_NAME) { LispObj cons; if (atom->property->structure.function == STRUCT_CONSTRUCTOR) atom = Omake_struct->data.atom; else if (atom->property->structure.function == STRUCT_CHECK) atom = Ostruct_type->data.atom; else atom = Ostruct_access->data.atom; builtin = atom->property->fun.builtin; cons.type = LispCons_t; cons.data.cons.cdr = arguments; if (eval) { LispObj quote; quote.type = LispQuote_t; quote.data.quote = function; cons.data.cons.car = "e; base = LispMakeEnvironment(atom->property->alist, &cons, function, 1, 1); } else { cons.data.cons.car = function; base = LispMakeEnvironment(atom->property->alist, &cons, function, 0, 1); } result = builtin->function(builtin); RETURN_COUNT = 0; lisp__data.stack.length = base; } else { LispDestroy("EVAL: the function %s is not defined", STROBJ(function)); /*NOTREACHED*/ result = NIL; } break; case LispLambda_t: lambda = function->data.lambda.code; alist = (LispArgList*)function->data.lambda.name->data.opaque.data; base = LispMakeEnvironment(alist, arguments, function, eval, 0); result = LispRunFunMac(function, lambda, 0, base); break; case LispCons_t: if (CAR(function) == Olambda) { function = EVAL(function); if (LAMBDAP(function)) { GC_ENTER(); GC_PROTECT(function); lambda = function->data.lambda.code; alist = (LispArgList*)function->data.lambda.name->data.opaque.data; base = LispMakeEnvironment(alist, arguments, NIL, eval, 0); result = LispRunFunMac(NIL, lambda, 0, base); GC_LEAVE(); break; } } default: LispDestroy("EVAL: %s is invalid as a function", STROBJ(function)); /*NOTREACHED*/ result = NIL; break; } #ifdef DEBUGGER if (lisp__data.debugging) LispDebugger(LispDebugCallEnd, function, result); #endif return (result); } LispObj * LispEval(LispObj *object) { LispObj *result; switch (OBJECT_TYPE(object)) { case LispAtom_t: if ((result = LispDoGetVar(object)) == NULL) LispDestroy("EVAL: the variable %s is unbound", STROBJ(object)); break; case LispCons_t: result = LispFuncall(CAR(object), CDR(object), 1); break; case LispQuote_t: result = object->data.quote; break; case LispFunctionQuote_t: result = object->data.quote; if (SYMBOLP(result)) result = LispSymbolFunction(result); else if (CONSP(result) && CAR(result) == Olambda) result = EVAL(result); else LispDestroy("FUNCTION: %s is not a function", STROBJ(result)); break; case LispBackquote_t: result = LispEvalBackquote(object->data.quote, 1); break; case LispComma_t: LispDestroy("EVAL: comma outside of backquote"); default: result = object; break; } return (result); } LispObj * LispApply1(LispObj *function, LispObj *argument) { LispObj arguments; arguments.type = LispCons_t; arguments.data.cons.car = argument; arguments.data.cons.cdr = NIL; return (LispFuncall(function, &arguments, 0)); } LispObj * LispApply2(LispObj *function, LispObj *argument1, LispObj *argument2) { LispObj arguments, cdr; arguments.type = cdr.type = LispCons_t; arguments.data.cons.car = argument1; arguments.data.cons.cdr = &cdr; cdr.data.cons.car = argument2; cdr.data.cons.cdr = NIL; return (LispFuncall(function, &arguments, 0)); } LispObj * LispApply3(LispObj *function, LispObj *arg1, LispObj *arg2, LispObj *arg3) { LispObj arguments, car, cdr; arguments.type = car.type = cdr.type = LispCons_t; arguments.data.cons.car = arg1; arguments.data.cons.cdr = &car; car.data.cons.car = arg2; car.data.cons.cdr = &cdr; cdr.data.cons.car = arg3; cdr.data.cons.cdr = NIL; return (LispFuncall(function, &arguments, 0)); } static LispObj * LispRunFunMac(LispObj *name, LispObj *code, int macro, int base) { LispObj *result = NIL; if (!macro) { int lex = lisp__data.env.lex; int did_jump = 1; LispBlock *block; block = LispBeginBlock(name, LispBlockClosure); lisp__data.env.lex = base; if (setjmp(block->jmp) == 0) { for (; CONSP(code); code = CDR(code)) result = EVAL(CAR(code)); did_jump = 0; } LispEndBlock(block); if (did_jump) result = lisp__data.block.block_ret; lisp__data.env.lex = lex; lisp__data.env.head = lisp__data.env.length = base; } else { GC_ENTER(); for (; CONSP(code); code = CDR(code)) result = EVAL(CAR(code)); /* FIXME this does not work if macro has &aux variables, * but there are several other missing features, like * destructuring and more lambda list keywords still missing. * TODO later. */ lisp__data.env.head = lisp__data.env.length = base; GC_PROTECT(result); result = EVAL(result); GC_LEAVE(); } return (result); } LispObj * LispRunSetf(LispArgList *alist, LispObj *setf, LispObj *place, LispObj *value) { GC_ENTER(); LispObj *store, *code, *expression, *result, quote; int base; code = setf->data.lambda.code; store = setf->data.lambda.data; quote.type = LispQuote_t; quote.data.quote = value; LispDoAddVar(CAR(store), "e); ++lisp__data.env.head; base = LispMakeEnvironment(alist, place, Oexpand_setf_method, 0, 0); /* build expansion macro */ expression = NIL; for (; CONSP(code); code = CDR(code)) expression = EVAL(CAR(code)); /* Minus 1 to pop the added variable */ lisp__data.env.head = lisp__data.env.length = base - 1; /* protect expansion, and executes it */ GC_PROTECT(expression); result = EVAL(expression); GC_LEAVE(); return (result); } LispObj * LispRunSetfMacro(LispAtom *atom, LispObj *arguments, LispObj *value) { int base; GC_ENTER(); LispObj *place, *body, *result, quote; place = NIL; base = LispMakeEnvironment(atom->property->alist, arguments, atom->object, 0, 0); body = atom->property->fun.function->data.lambda.code; /* expand macro body */ for (; CONSP(body); body = CDR(body)) place = EVAL(CAR(body)); /* protect expansion */ GC_PROTECT(place); /* restore environment */ lisp__data.env.head = lisp__data.env.length = base; /* value is already evaluated */ quote.type = LispQuote_t; quote.data.quote = value; /* call setf again */ result = APPLY2(Osetf, place, "e); GC_LEAVE(); return (result); } char * LispStrObj(LispObj *object) { static int first = 1; static char buffer[34]; static LispObj stream; static LispString string; if (first) { stream.type = LispStream_t; stream.data.stream.source.string = &string; stream.data.stream.pathname = NIL; stream.data.stream.type = LispStreamString; stream.data.stream.readable = 0; stream.data.stream.writable = 1; string.string = buffer; string.fixed = 1; string.space = sizeof(buffer) - 1; first = 0; } string.length = string.output = 0; LispWriteObject(&stream, object); /* make sure string is nul terminated */ string.string[string.length] = '\0'; if (string.length >= 32) { if (buffer[0] == '(') strcpy(buffer + 27, "...)"); else strcpy(buffer + 28, "..."); } return (buffer); } void LispPrint(LispObj *object, LispObj *stream, int newline) { if (stream != NIL && !STREAMP(stream)) { LispDestroy("PRINT: %s is not a stream", STROBJ(stream)); } if (newline && LispGetColumn(stream)) LispWriteChar(stream, '\n'); LispWriteObject(stream, object); if (stream == NIL || (stream->data.stream.type == LispStreamStandard && stream->data.stream.source.file == Stdout)) LispFflush(Stdout); } void LispUpdateResults(LispObj *cod, LispObj *res) { LispSetVar(RUN[2], LispGetVar(RUN[1])); LispSetVar(RUN[1], LispGetVar(RUN[0])); LispSetVar(RUN[0], cod); LispSetVar(RES[2], LispGetVar(RES[1])); LispSetVar(RES[1], LispGetVar(RES[0])); LispSetVar(RES[0], res); } void LispSignalHandler(int signum) { LispSignal(signum); } void LispSignal(int signum) { const char *errstr; char buffer[32]; if (lisp__disable_int) { lisp__interrupted = signum; return; } switch (signum) { case SIGINT: errstr = "interrupted"; break; case SIGFPE: errstr = "floating point exception"; break; default: sprintf(buffer, "signal %d received", signum); errstr = buffer; break; } LispDestroy("%s", errstr); } void LispDisableInterrupts(void) { ++lisp__disable_int; } void LispEnableInterrupts(void) { --lisp__disable_int; if (lisp__disable_int <= 0 && lisp__interrupted) LispSignal(lisp__interrupted); } void LispMachine(void) { LispObj *cod, *obj; lisp__data.sigint = signal(SIGINT, LispSignalHandler); lisp__data.sigfpe = signal(SIGFPE, LispSignalHandler); /*CONSTCOND*/ while (1) { if (sigsetjmp(lisp__data.jmp, 1) == 0) { lisp__data.running = 1; if (lisp__data.interactive && lisp__data.prompt) { LispFputs(Stdout, lisp__data.prompt); LispFflush(Stdout); } if ((cod = LispRead()) != NULL) { obj = EVAL(cod); if (lisp__data.interactive) { if (RETURN_COUNT >= 0) LispPrint(obj, NIL, 1); if (RETURN_COUNT > 0) { int i; for (i = 0; i < RETURN_COUNT; i++) LispPrint(RETURN(i), NIL, 1); } LispUpdateResults(cod, obj); if (LispGetColumn(NIL)) LispWriteChar(NIL, '\n'); } } LispTopLevel(); } if (lisp__data.eof) break; } signal(SIGINT, lisp__data.sigint); signal(SIGFPE, lisp__data.sigfpe); lisp__data.running = 0; } void * LispExecute(char *str) { static LispObj stream; static LispString string; static int first = 1; int running = lisp__data.running; LispObj *result, *cod, *obj, **presult = &result; if (str == NULL || *str == '\0') return (NIL); *presult = NIL; if (first) { stream.type = LispStream_t; stream.data.stream.source.string = &string; stream.data.stream.pathname = NIL; stream.data.stream.type = LispStreamString; stream.data.stream.readable = 1; stream.data.stream.writable = 0; string.output = 0; first = 0; } string.string = str; string.length = strlen(str); string.input = 0; LispPushInput(&stream); if (!running) { lisp__data.running = 1; if (sigsetjmp(lisp__data.jmp, 1) != 0) return (NULL); } cod = COD; /*CONSTCOND*/ while (1) { if ((obj = LispRead()) != NULL) { result = EVAL(obj); COD = cod; } if (lisp__data.eof) break; } LispPopInput(&stream); lisp__data.running = running; return (result); } void LispBegin(void) { int i; LispAtom *atom; char results[4]; LispObj *object, *path, *ext; pagesize = LispGetPageSize(); segsize = pagesize / sizeof(LispObj); lisp__data.strings = hash_new(STRTBLSZ, NULL); lisp__data.opqs = hash_new(STRTBLSZ, NULL); /* Initialize memory management */ lisp__data.mem.mem = (void**)calloc(lisp__data.mem.space = 16, sizeof(void*)); lisp__data.mem.index = lisp__data.mem.level = 0; /* Allow LispGetVar to check ATOMID() of unbound symbols */ UNBOUND->data.atom = (LispAtom*)LispCalloc(1, sizeof(LispAtom)); LispMused(UNBOUND->data.atom); noproperty.value = UNBOUND; if (Stdin == NULL) Stdin = LispFdopen(0, FILE_READ); if (Stdout == NULL) Stdout = LispFdopen(1, FILE_WRITE | FILE_BUFFERED); if (Stderr == NULL) Stderr = LispFdopen(2, FILE_WRITE); /* minimum number of free cells after GC * if sizeof(LispObj) == 16, than a minfree of 1024 would try to keep * at least 16Kb of free cells. */ minfree = 1024; MOD = COD = PRO = NIL; #ifdef DEBUGGER DBG = BRK = NIL; #endif /* allocate initial object cells */ LispAllocSeg(&objseg, minfree); LispAllocSeg(&atomseg, pagesize); lisp__data.gc.average = segsize; /* Don't allow gc in initialization */ GCDisable(); /* Initialize package system, the current package is LISP. Order of * initialization is very important here */ lisp__data.lisp = LispNewPackage(STRING("LISP"), CONS(STRING("COMMON-LISP"), NIL)); /* Make LISP package the current one */ lisp__data.pack = lisp__data.savepack = lisp__data.lisp->data.package.package; /* Allocate space in LISP package */ LispMoreGlobals(lisp__data.pack); /* Allocate space for multiple value return values */ lisp__data.returns.values = malloc(MULTIPLE_VALUES_LIMIT * (sizeof(LispObj*))); /* Create the first atom, do it "by hand" because macro "PACKAGE" * cannot yet be used. */ atom = LispGetPermAtom("*PACKAGE*"); lisp__data.package = atomseg.freeobj; atomseg.freeobj = CDR(atomseg.freeobj); --atomseg.nfree; lisp__data.package->type = LispAtom_t; lisp__data.package->data.atom = atom; atom->object = lisp__data.package; atom->package = lisp__data.lisp; /* Set package list, to be used by (gc) and (list-all-packages) */ PACK = CONS(lisp__data.lisp, NIL); /* Make *PACKAGE* a special variable */ LispProclaimSpecial(lisp__data.package, lisp__data.lisp, NIL); /* Value of macro "PACKAGE" is now properly available */ /* Changing *PACKAGE* is like calling (in-package) */ lisp__data.package->data.atom->watch = 1; /* And available to other packages */ LispExportSymbol(lisp__data.package); /* Initialize stacks */ LispMoreEnvironment(); LispMoreStack(); /* Create the KEYWORD package */ Skeyword = GETATOMID("KEYWORD"); object = LispNewPackage(STRING(Skeyword->value), CONS(STRING(""), NIL)); /* Update list of packages */ PACK = CONS(object, PACK); /* Allow easy access to the keyword package */ lisp__data.keyword = object; lisp__data.key = object->data.package.package; /* Initialize some static important symbols */ Olambda = STATIC_ATOM("LAMBDA"); LispExportSymbol(Olambda); Okey = STATIC_ATOM("&KEY"); LispExportSymbol(Okey); Orest = STATIC_ATOM("&REST"); LispExportSymbol(Orest); Ooptional = STATIC_ATOM("&OPTIONAL"); LispExportSymbol(Ooptional); Oaux = STATIC_ATOM("&AUX"); LispExportSymbol(Oaux); Kunspecific = KEYWORD("UNSPECIFIC"); Oformat = STATIC_ATOM("FORMAT"); Oexpand_setf_method = STATIC_ATOM("EXPAND-SETF-METHOD"); Omake_struct = STATIC_ATOM("MAKE-STRUCT"); Ostruct_access = STATIC_ATOM("STRUCT-ACCESS"); Ostruct_store = STATIC_ATOM("STRUCT-STORE"); Ostruct_type = STATIC_ATOM("STRUCT-TYPE"); Smake_struct = ATOMID(Omake_struct); Sstruct_access = ATOMID(Ostruct_access); Sstruct_store = ATOMID(Ostruct_store); Sstruct_type = ATOMID(Ostruct_type); /* Initialize some static atom ids */ Snil = GETATOMID("NIL"); St = GETATOMID("T"); Saux = ATOMID(Oaux); Skey = ATOMID(Okey); Soptional = ATOMID(Ooptional); Srest = ATOMID(Orest); Sand = GETATOMID("AND"); Sor = GETATOMID("OR"); Snot = GETATOMID("NOT"); Satom = GETATOMID("ATOM"); Ssymbol = GETATOMID("SYMBOL"); Sinteger = GETATOMID("INTEGER"); Scharacter = GETATOMID("CHARACTER"); Sstring = GETATOMID("STRING"); Slist = GETATOMID("LIST"); Scons = GETATOMID("CONS"); Svector = GETATOMID("VECTOR"); Sarray = GETATOMID("ARRAY"); Sstruct = GETATOMID("STRUCT"); Sfunction = GETATOMID("FUNCTION"); Spathname = GETATOMID("PATHNAME"); Srational = GETATOMID("RATIONAL"); Sfloat = GETATOMID("FLOAT"); Scomplex = GETATOMID("COMPLEX"); Sopaque = GETATOMID("OPAQUE"); Sdefault = GETATOMID("DEFAULT"); LispArgList_t = LispRegisterOpaqueType("LispArgList*"); lisp__data.unget = malloc(sizeof(LispUngetInfo*)); lisp__data.unget[0] = calloc(1, sizeof(LispUngetInfo)); lisp__data.nunget = 1; lisp__data.standard_input = ATOM2("*STANDARD-INPUT*"); SINPUT = STANDARDSTREAM(Stdin, lisp__data.standard_input, STREAM_READ); lisp__data.interactive = 1; LispProclaimSpecial(lisp__data.standard_input, lisp__data.input_list = SINPUT, NIL); LispExportSymbol(lisp__data.standard_input); lisp__data.standard_output = ATOM2("*STANDARD-OUTPUT*"); SOUTPUT = STANDARDSTREAM(Stdout, lisp__data.standard_output, STREAM_WRITE); LispProclaimSpecial(lisp__data.standard_output, lisp__data.output_list = SOUTPUT, NIL); LispExportSymbol(lisp__data.standard_output); object = ATOM2("*STANDARD-ERROR*"); lisp__data.error_stream = STANDARDSTREAM(Stderr, object, STREAM_WRITE); LispProclaimSpecial(object, lisp__data.error_stream, NIL); LispExportSymbol(object); lisp__data.modules = ATOM2("*MODULES*"); LispProclaimSpecial(lisp__data.modules, MOD, NIL); LispExportSymbol(lisp__data.modules); object = CONS(KEYWORD("UNIX"), CONS(KEYWORD("XEDIT"), NIL)); lisp__data.features = ATOM2("*FEATURES*"); LispProclaimSpecial(lisp__data.features, object, NIL); LispExportSymbol(lisp__data.features); object = ATOM2("MULTIPLE-VALUES-LIMIT"); LispDefconstant(object, FIXNUM(MULTIPLE_VALUES_LIMIT + 1), NIL); LispExportSymbol(object); /* Reenable gc */ GCEnable(); LispBytecodeInit(); LispPackageInit(); LispCoreInit(); LispMathInit(); LispPathnameInit(); LispStreamInit(); LispRegexInit(); LispWriteInit(); lisp__data.prompt = isatty(0) ? "> " : NULL; lisp__data.errexit = !lisp__data.interactive; if (lisp__data.interactive) { /* add +, ++, +++, *, **, and *** */ for (i = 0; i < 3; i++) { results[i] = '+'; results[i + 1] = '\0'; RUN[i] = ATOM(results); LispSetVar(RUN[i], NIL); LispExportSymbol(RUN[i]); } for (i = 0; i < 3; i++) { results[i] = '*'; results[i + 1] = '\0'; RES[i] = ATOM(results); LispSetVar(RES[i], NIL); LispExportSymbol(RES[i]); } } else RUN[0] = RUN[1] = RUN[2] = RES[0] = RES[1] = RES[2] = NIL; /* Add LISP builtin functions */ for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) LispAddBuiltinFunction(&lispbuiltins[i]); EXECUTE("(require \"lisp\")"); object = ATOM2("*DEFAULT-PATHNAME-DEFAULTS*"); #ifdef LISPDIR { int length; const char *pathname = LISPDIR; length = strlen(pathname); if (length && pathname[length - 1] != '/') { char *fixed_pathname = LispMalloc(length + 2); strcpy(fixed_pathname, LISPDIR); strcpy(fixed_pathname + length, "/"); path = LSTRING2(fixed_pathname, length + 1); } else path = LSTRING(pathname, length); } #else path = STRING(""); #endif GCDisable(); LispProclaimSpecial(object, APPLY1(Oparse_namestring, path), NIL); LispExportSymbol(object); GCEnable(); /* Create and make EXT the current package */ PACKAGE = ext = LispNewPackage(STRING("EXT"), NIL); lisp__data.pack = lisp__data.savepack = PACKAGE->data.package.package; /* Update list of packages */ PACK = CONS(ext, PACK); /* Import LISP external symbols in EXT package */ LispUsePackage(lisp__data.lisp); /* Add EXT non standard builtin functions */ for (i = 0; i < sizeof(extbuiltins) / sizeof(extbuiltins[0]); i++) LispAddBuiltinFunction(&extbuiltins[i]); /* Create and make USER the current package */ GCDisable(); PACKAGE = LispNewPackage(STRING("USER"), CONS(STRING("COMMON-LISP-USER"), NIL)); GCEnable(); lisp__data.pack = lisp__data.savepack = PACKAGE->data.package.package; /* Update list of packages */ PACK = CONS(PACKAGE, PACK); /* USER package inherits all LISP external symbols */ LispUsePackage(lisp__data.lisp); /* And all EXT external symbols */ LispUsePackage(ext); LispTopLevel(); } void LispEnd(void) { /* XXX needs to free all used memory, not just close file descriptors */ } void LispSetPrompt(const char *prompt) { lisp__data.prompt = prompt; } void LispSetInteractive(int interactive) { lisp__data.interactive = !!interactive; } void LispSetExitOnError(int errexit) { lisp__data.errexit = !!errexit; } void LispDebug(int enable) { lisp__data.debugging = !!enable; #ifdef DEBUGGER /* assumes we are at the toplevel */ DBG = BRK = NIL; lisp__data.debug_level = -1; lisp__data.debug_step = 0; #endif } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/debugger.h0000664000000000000000000000453012472175711016223 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/debugger.h,v 1.7tsi Exp $ */ #ifndef Lisp_debugger_h #define Lisp_debugger_h /* * Definitions */ #define DBGPROMPT "DEBUG> " #ifdef DEBUGGER /* * Types */ typedef enum _LispDebugState { LispDebugUnspec, /* initial state */ LispDebugRun, /* just run, until breakpoint or error */ LispDebugFinish, /* evaluates until selected form is finished */ LispDebugNext, /* evaluate form */ LispDebugStep /* evaluate form, and step on subforms */ } LispDebugState; typedef enum _LispDebugCall { LispDebugCallBegin, LispDebugCallEnd, LispDebugCallFatal, LispDebugCallWatch /* just remove watched variables that lost context */ } LispDebugCall; typedef enum _LispDebugBreak { LispDebugBreakFunction, LispDebugBreakVariable } LispDebugBreak; #include "lisp/private.h" /* * Prototypes */ void LispDebugger(LispDebugCall, LispObj*, LispObj*); #endif /* DEBUGGER */ #endif /* Lisp_debugger_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/regex.h0000664000000000000000000000330712472175711015552 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/regex.h,v 1.3tsi Exp $ */ #ifndef Lisp_regex_h #define Lisp_regex_h #include "lisp/internal.h" /* * Prototypes */ void LispRegexInit(void); LispObj *Lisp_Recomp(LispBuiltin*); LispObj *Lisp_Reexec(LispBuiltin*); LispObj *Lisp_Rep(LispBuiltin*); #endif /* Lisp_regex_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/format.h0000664000000000000000000000315212472175711015726 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/format.h,v 1.3tsi Exp $ */ #ifndef Lisp_format_h #define Lisp_format_h #include "lisp/private.h" /* * Prototypes */ LispObj *Lisp_Format(LispBuiltin*); #endif /* Lisp_format_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/stream.c0000664000000000000000000005151112472175711015726 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/stream.c,v 1.21tsi Exp $ */ #include "lisp/read.h" #include "lisp/stream.h" #include "lisp/pathname.h" #include "lisp/write.h" #include "lisp/private.h" #include #include #include #include #include /* * Initialization */ #define DIR_PROBE 0 #define DIR_INPUT 1 #define DIR_OUTPUT 2 #define DIR_IO 3 #define EXT_NIL 0 #define EXT_ERROR 1 #define EXT_NEW_VERSION 2 #define EXT_RENAME 3 #define EXT_RENAME_DELETE 4 #define EXT_OVERWRITE 5 #define EXT_APPEND 6 #define EXT_SUPERSEDE 7 #define NOEXT_NIL 0 #define NOEXT_ERROR 1 #define NOEXT_CREATE 2 #define NOEXT_NOTHING 3 extern char **environ; LispObj *Oopen, *Oclose, *Otruename; LispObj *Kif_does_not_exist, *Kprobe, *Kinput, *Koutput, *Kio, *Knew_version, *Krename, *Krename_and_delete, *Koverwrite, *Kappend, *Ksupersede, *Kcreate; /* * Implementation */ void LispStreamInit(void) { Oopen = STATIC_ATOM("OPEN"); Oclose = STATIC_ATOM("CLOSE"); Otruename = STATIC_ATOM("TRUENAME"); Kif_does_not_exist = KEYWORD("IF-DOES-NOT-EXIST"); Kprobe = KEYWORD("PROBE"); Kinput = KEYWORD("INPUT"); Koutput = KEYWORD("OUTPUT"); Kio = KEYWORD("IO"); Knew_version = KEYWORD("NEW-VERSION"); Krename = KEYWORD("RENAME"); Krename_and_delete = KEYWORD("RENAME-AND-DELETE"); Koverwrite = KEYWORD("OVERWRITE"); Kappend = KEYWORD("APPEND"); Ksupersede = KEYWORD("SUPERSEDE"); Kcreate = KEYWORD("CREATE"); } LispObj * Lisp_DeleteFile(LispBuiltin *builtin) /* delete-file filename */ { GC_ENTER(); LispObj *filename; filename = ARGUMENT(0); if (STRINGP(filename)) { filename = APPLY1(Oparse_namestring, filename); GC_PROTECT(filename); } else if (STREAMP(filename)) { if (filename->data.stream.type != LispStreamFile) LispDestroy("%s: %s is not a FILE-STREAM", STRFUN(builtin), STROBJ(filename)); filename = filename->data.stream.pathname; } else { CHECK_PATHNAME(filename); } GC_LEAVE(); return (LispUnlink(THESTR(CAR(filename->data.pathname))) ? NIL : T); } LispObj * Lisp_RenameFile(LispBuiltin *builtin) /* rename-file filename new-name */ { int code; GC_ENTER(); char *from, *to; LispObj *old_truename, *new_truename; LispObj *filename, *new_name; new_name = ARGUMENT(1); filename = ARGUMENT(0); if (STRINGP(filename)) { filename = APPLY1(Oparse_namestring, filename); GC_PROTECT(filename); } else if (STREAMP(filename)) { if (filename->data.stream.type != LispStreamFile) LispDestroy("%s: %s is not a FILE-STREAM", STRFUN(builtin), STROBJ(filename)); filename = filename->data.stream.pathname; } else { CHECK_PATHNAME(filename); } old_truename = APPLY1(Otruename, filename); GC_PROTECT(old_truename); if (STRINGP(new_name)) { new_name = APPLY3(Oparse_namestring, new_name, NIL, filename); GC_PROTECT(new_name); } else { CHECK_PATHNAME(new_name); } from = THESTR(CAR(filename->data.pathname)); to = THESTR(CAR(new_name->data.pathname)); code = LispRename(from, to); if (code) LispDestroy("%s: rename(%s, %s): %s", STRFUN(builtin), from, to, strerror(errno)); GC_LEAVE(); new_truename = APPLY1(Otruename, new_name); RETURN_COUNT = 2; RETURN(0) = old_truename; RETURN(1) = new_truename; return (new_name); } LispObj * Lisp_Streamp(LispBuiltin *builtin) /* streamp object */ { LispObj *object; object = ARGUMENT(0); return (STREAMP(object) ? T : NIL); } LispObj * Lisp_InputStreamP(LispBuiltin *builtin) /* input-stream-p stream */ { LispObj *stream; stream = ARGUMENT(0); CHECK_STREAM(stream); return (stream->data.stream.readable ? T : NIL); } LispObj * Lisp_OpenStreamP(LispBuiltin *builtin) /* open-stream-p stream */ { LispObj *stream; stream = ARGUMENT(0); CHECK_STREAM(stream); return (stream->data.stream.readable || stream->data.stream.writable ? T : NIL); } LispObj * Lisp_OutputStreamP(LispBuiltin *builtin) /* output-stream-p stream */ { LispObj *stream; stream = ARGUMENT(0); CHECK_STREAM(stream); return (stream->data.stream.writable ? T : NIL); } LispObj * Lisp_Open(LispBuiltin *builtin) /* open filename &key direction element-type if-exists if-does-not-exist external-format */ { GC_ENTER(); char *string; LispObj *stream = NIL; int mode, flags, direction, exist, noexist, file_exist; LispFile *file; LispObj *filename, *odirection, *element_type, *if_exists, *if_does_not_exist, *external_format; external_format = ARGUMENT(5); if_does_not_exist = ARGUMENT(4); if_exists = ARGUMENT(3); element_type = ARGUMENT(2); odirection = ARGUMENT(1); filename = ARGUMENT(0); if (STRINGP(filename)) { filename = APPLY1(Oparse_namestring, filename); GC_PROTECT(filename); } else if (STREAMP(filename)) { if (filename->data.stream.type != LispStreamFile) LispDestroy("%s: %s is not a FILE-STREAM", STRFUN(builtin), STROBJ(filename)); filename = filename->data.stream.pathname; } else { CHECK_PATHNAME(filename); } if (odirection != UNSPEC) { direction = -1; if (KEYWORDP(odirection)) { if (odirection == Kprobe) direction = DIR_PROBE; else if (odirection == Kinput) direction = DIR_INPUT; else if (odirection == Koutput) direction = DIR_OUTPUT; else if (odirection == Kio) direction = DIR_IO; } if (direction == -1) LispDestroy("%s: bad :DIRECTION %s", STRFUN(builtin), STROBJ(odirection)); } else direction = DIR_INPUT; if (element_type != UNSPEC) { /* just check argument... */ if (SYMBOLP(element_type) && ATOMID(element_type) == Scharacter) ; /* do nothing */ else if (KEYWORDP(element_type) && ATOMID(element_type) == Sdefault) ; /* do nothing */ else LispDestroy("%s: only :%s and %s supported for :ELEMENT-TYPE, not %s", STRFUN(builtin), Sdefault->value, Scharacter->value, STROBJ(element_type)); } if (if_exists != UNSPEC) { exist = -1; if (if_exists == NIL) exist = EXT_NIL; else if (KEYWORDP(if_exists)) { if (if_exists == Kerror) exist = EXT_ERROR; else if (if_exists == Knew_version) exist = EXT_NEW_VERSION; else if (if_exists == Krename) exist = EXT_RENAME; else if (if_exists == Krename_and_delete) exist = EXT_RENAME_DELETE; else if (if_exists == Koverwrite) exist = EXT_OVERWRITE; else if (if_exists == Kappend) exist = EXT_APPEND; else if (if_exists == Ksupersede) exist = EXT_SUPERSEDE; } if (exist == -1) LispDestroy("%s: bad :IF-EXISTS %s", STRFUN(builtin), STROBJ(if_exists)); } else exist = EXT_ERROR; if (if_does_not_exist != UNSPEC) { noexist = -1; if (if_does_not_exist == NIL) noexist = NOEXT_NIL; if (KEYWORDP(if_does_not_exist)) { if (if_does_not_exist == Kerror) noexist = NOEXT_ERROR; else if (if_does_not_exist == Kcreate) noexist = NOEXT_CREATE; } if (noexist == -1) LispDestroy("%s: bad :IF-DOES-NO-EXISTS %s", STRFUN(builtin), STROBJ(if_does_not_exist)); } else noexist = direction != DIR_INPUT ? NOEXT_NOTHING : NOEXT_ERROR; if (external_format != UNSPEC) { /* just check argument... */ if (SYMBOLP(external_format) && ATOMID(external_format) == Scharacter) ; /* do nothing */ else if (KEYWORDP(external_format) && ATOMID(external_format) == Sdefault) ; /* do nothing */ else LispDestroy("%s: only :%s and %s supported for :EXTERNAL-FORMAT, not %s", STRFUN(builtin), Sdefault->value, Scharacter->value, STROBJ(external_format)); } /* string representation of pathname */ string = THESTR(CAR(filename->data.pathname)); mode = 0; file_exist = access(string, F_OK) == 0; if (file_exist) { if (exist == EXT_NIL) { GC_LEAVE(); return (NIL); } } else { if (noexist == NOEXT_NIL) { GC_LEAVE(); return (NIL); } if (noexist == NOEXT_ERROR) LispDestroy("%s: file %s does not exist", STRFUN(builtin), STROBJ(CAR(filename->data.quote))); else if (noexist == NOEXT_CREATE) { LispFile *tmp = LispFopen(string, FILE_WRITE); if (tmp) LispFclose(tmp); else LispDestroy("%s: cannot create file %s", STRFUN(builtin), STROBJ(CAR(filename->data.quote))); } } if (direction == DIR_OUTPUT || direction == DIR_IO) { if (file_exist) { if (exist == EXT_ERROR) LispDestroy("%s: file %s already exists", STRFUN(builtin), STROBJ(CAR(filename->data.quote))); if (exist == EXT_RENAME) { /* Add an ending '~' at the end of the backup file */ char tmp[PATH_MAX + 1]; strcpy(tmp, string); if (strlen(tmp) + 1 > PATH_MAX) LispDestroy("%s: backup name for %s too long", STRFUN(builtin), STROBJ(CAR(filename->data.quote))); strcat(tmp, "~"); if (rename(string, tmp)) LispDestroy("%s: rename: %s", STRFUN(builtin), strerror(errno)); mode |= FILE_WRITE; } else if (exist == EXT_OVERWRITE) mode |= FILE_WRITE; else if (exist == EXT_APPEND) mode |= FILE_APPEND; } else mode |= FILE_WRITE; if (direction == DIR_IO) mode |= FILE_IO; } else mode |= FILE_READ; file = LispFopen(string, mode); if (file == NULL) LispDestroy("%s: open: %s", STRFUN(builtin), strerror(errno)); flags = 0; if (direction == DIR_PROBE) { LispFclose(file); file = NULL; } else { if (direction == DIR_INPUT || direction == DIR_IO) flags |= STREAM_READ; if (direction == DIR_OUTPUT || direction == DIR_IO) flags |= STREAM_WRITE; } stream = FILESTREAM(file, filename, flags); GC_LEAVE(); return (stream); } LispObj * Lisp_Close(LispBuiltin *builtin) /* close stream &key abort */ { LispObj *stream, *oabort; oabort = ARGUMENT(1); stream = ARGUMENT(0); CHECK_STREAM(stream); if (stream->data.stream.readable || stream->data.stream.writable) { stream->data.stream.readable = stream->data.stream.writable = 0; if (stream->data.stream.type == LispStreamFile) { LispFclose(stream->data.stream.source.file); stream->data.stream.source.file = NULL; } else if (stream->data.stream.type == LispStreamPipe) { if (IPSTREAMP(stream)) { LispFclose(IPSTREAMP(stream)); IPSTREAMP(stream) = NULL; } if (OPSTREAMP(stream)) { LispFclose(OPSTREAMP(stream)); OPSTREAMP(stream) = NULL; } if (EPSTREAMP(stream)) { LispFclose(EPSTREAMP(stream)); EPSTREAMP(stream) = NULL; } if (PIDPSTREAMP(stream) > 0) { kill(PIDPSTREAMP(stream), oabort == UNSPEC || oabort == NIL ? SIGTERM : SIGKILL); waitpid(PIDPSTREAMP(stream), NULL, 0); } } return (T); } return (NIL); } LispObj * Lisp_Listen(LispBuiltin *builtin) /* listen &optional input-stream */ { LispFile *file = NULL; LispObj *result = NIL; LispObj *stream; stream = ARGUMENT(0); if (stream == UNSPEC) stream = NIL; else if (stream != NIL) { CHECK_STREAM(stream); } else stream = lisp__data.standard_input; if (stream->data.stream.readable) { switch (stream->data.stream.type) { case LispStreamString: if (SSTREAMP(stream)->input < SSTREAMP(stream)->length) result = T; break; case LispStreamFile: file = FSTREAMP(stream); break; case LispStreamStandard: file = FSTREAMP(stream); break; case LispStreamPipe: file = IPSTREAMP(stream); break; } if (file != NULL) { if (file->available || file->offset < file->length) result = T; else { unsigned char c; if (!file->nonblock) { if (fcntl(file->descriptor, F_SETFL, O_NONBLOCK) < 0) LispDestroy("%s: fcntl: %s", STRFUN(builtin), strerror(errno)); file->nonblock = 1; } if (read(file->descriptor, &c, 1) == 1) { LispFungetc(file, c); result = T; } } } } return (result); } LispObj * Lisp_MakeStringInputStream(LispBuiltin *builtin) /* make-string-input-stream string &optional start end */ { char *string; long start, end, length; LispObj *ostring, *ostart, *oend, *result; oend = ARGUMENT(2); ostart = ARGUMENT(1); ostring = ARGUMENT(0); start = end = 0; CHECK_STRING(ostring); LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, &start, &end, &length); string = THESTR(ostring); if (end - start != length) length = end - start; result = LSTRINGSTREAM(string + start, STREAM_READ, length); return (result); } LispObj * Lisp_MakeStringOutputStream(LispBuiltin *builtin) /* make-string-output-stream &key element-type */ { LispObj *element_type; element_type = ARGUMENT(0); if (element_type != UNSPEC) { /* just check argument... */ if (SYMBOLP(element_type) && ATOMID(element_type) == Scharacter) ; /* do nothing */ else if (KEYWORDP(element_type) && ATOMID(element_type) == Sdefault) ; /* do nothing */ else LispDestroy("%s: only :%s and %s supported for :ELEMENT-TYPE, not %s", STRFUN(builtin), Sdefault->value, Scharacter->value, STROBJ(element_type)); } return (LSTRINGSTREAM("", STREAM_WRITE, 1)); } LispObj * Lisp_GetOutputStreamString(LispBuiltin *builtin) /* get-output-stream-string string-output-stream */ { int length; const char *string; LispObj *string_output_stream, *result; string_output_stream = ARGUMENT(0); if (!STREAMP(string_output_stream) || string_output_stream->data.stream.type != LispStreamString || string_output_stream->data.stream.readable || !string_output_stream->data.stream.writable) LispDestroy("%s: %s is not an output string stream", STRFUN(builtin), STROBJ(string_output_stream)); string = LispGetSstring(SSTREAMP(string_output_stream), &length); result = LSTRING(string, length); /* reset string */ SSTREAMP(string_output_stream)->output = SSTREAMP(string_output_stream)->length = SSTREAMP(string_output_stream)->column = 0; return (result); } /* XXX Non standard functions below */ LispObj * Lisp_MakePipe(LispBuiltin *builtin) /* make-pipe command-line &key :direction :element-type :external-format */ { char *string; LispObj *stream = NIL; int flags, direction; LispFile *error_file; LispPipe *program; int ifd[2]; int ofd[2]; int efd[2]; char *argv[4]; LispObj *command_line, *odirection, *element_type, *external_format; external_format = ARGUMENT(3); element_type = ARGUMENT(2); odirection = ARGUMENT(1); command_line = ARGUMENT(0); if (PATHNAMEP(command_line)) command_line = CAR(command_line->data.quote); else if (!STRINGP(command_line)) LispDestroy("%s: %s is a bad pathname", STRFUN(builtin), STROBJ(command_line)); if (odirection != UNSPEC) { direction = -1; if (KEYWORDP(odirection)) { if (odirection == Kprobe) direction = DIR_PROBE; else if (odirection == Kinput) direction = DIR_INPUT; else if (odirection == Koutput) direction = DIR_OUTPUT; else if (odirection == Kio) direction = DIR_IO; } if (direction == -1) LispDestroy("%s: bad :DIRECTION %s", STRFUN(builtin), STROBJ(odirection)); } else direction = DIR_INPUT; if (element_type != UNSPEC) { /* just check argument... */ if (SYMBOLP(element_type) && ATOMID(element_type) == Scharacter) ; /* do nothing */ else if (KEYWORDP(element_type) && ATOMID(element_type) == Sdefault) ; /* do nothing */ else LispDestroy("%s: only :%s and %s supported for :ELEMENT-TYPE, not %s", STRFUN(builtin), Sdefault->value, Scharacter->value, STROBJ(element_type)); } if (external_format != UNSPEC) { /* just check argument... */ if (SYMBOLP(external_format) && ATOMID(external_format) == Scharacter) ; /* do nothing */ else if (KEYWORDP(external_format) && ATOMID(external_format) == Sdefault) ; /* do nothing */ else LispDestroy("%s: only :%s and %s supported for :EXTERNAL-FORMAT, not %s", STRFUN(builtin), Sdefault->value, Scharacter->value, STROBJ(external_format)); } string = THESTR(command_line); program = LispMalloc(sizeof(LispPipe)); if (direction != DIR_PROBE) { argv[0] = "sh"; argv[1] = "-c"; argv[2] = string; argv[3] = NULL; pipe(ifd); pipe(ofd); pipe(efd); if ((program->pid = fork()) == 0) { close(0); close(1); close(2); dup2(ofd[0], 0); dup2(ifd[1], 1); dup2(efd[1], 2); close(ifd[0]); close(ifd[1]); close(ofd[0]); close(ofd[1]); close(efd[0]); close(efd[1]); execve("/bin/sh", argv, environ); exit(-1); } else if (program->pid < 0) LispDestroy("%s: fork: %s", STRFUN(builtin), strerror(errno)); program->input = LispFdopen(ifd[0], FILE_READ | FILE_UNBUFFERED); close(ifd[1]); program->output = LispFdopen(ofd[1], FILE_WRITE | FILE_UNBUFFERED); close(ofd[0]); error_file = LispFdopen(efd[0], FILE_READ | FILE_UNBUFFERED); close(efd[1]); } else { program->pid = -1; program->input = program->output = error_file = NULL; } flags = direction == DIR_PROBE ? 0 : STREAM_READ; program->errorp = FILESTREAM(error_file, command_line, flags); flags = 0; if (direction != DIR_PROBE) { if (direction == DIR_INPUT || direction == DIR_IO) flags |= STREAM_READ; if (direction == DIR_OUTPUT || direction == DIR_IO) flags |= STREAM_WRITE; } stream = PIPESTREAM(program, command_line, flags); LispMused(program); return (stream); } /* Helper function, primarily for use with the xt module */ LispObj * Lisp_PipeBroken(LispBuiltin *builtin) /* pipe-broken pipe-stream */ { int pid, status, retval; LispObj *result = NIL; LispObj *pipe_stream; pipe_stream = ARGUMENT(0); if (!STREAMP(pipe_stream) || pipe_stream->data.stream.type != LispStreamPipe) LispDestroy("%s: %s is not a pipe stream", STRFUN(builtin), STROBJ(pipe_stream)); if ((pid = PIDPSTREAMP(pipe_stream)) > 0) { retval = waitpid(pid, &status, WNOHANG | WUNTRACED); if (retval == pid || (retval == -1 && errno == ECHILD)) result = T; } return (result); } /* Helper function, so that it is not required to redirect error output */ LispObj * Lisp_PipeErrorStream(LispBuiltin *builtin) /* pipe-error-stream pipe-stream */ { LispObj *pipe_stream; pipe_stream = ARGUMENT(0); if (!STREAMP(pipe_stream) || pipe_stream->data.stream.type != LispStreamPipe) LispDestroy("%s: %s is not a pipe stream", STRFUN(builtin), STROBJ(pipe_stream)); return (pipe_stream->data.stream.source.program->errorp); } /* Helper function, primarily for use with the xt module */ LispObj * Lisp_PipeInputDescriptor(LispBuiltin *builtin) /* pipe-input-descriptor pipe-stream */ { LispObj *pipe_stream; pipe_stream = ARGUMENT(0); if (!STREAMP(pipe_stream) || pipe_stream->data.stream.type != LispStreamPipe) LispDestroy("%s: %s is not a pipe stream", STRFUN(builtin), STROBJ(pipe_stream)); if (!IPSTREAMP(pipe_stream)) LispDestroy("%s: pipe %s is unreadable", STRFUN(builtin), STROBJ(pipe_stream)); return (INTEGER(LispFileno(IPSTREAMP(pipe_stream)))); } /* Helper function, primarily for use with the xt module */ LispObj * Lisp_PipeErrorDescriptor(LispBuiltin *builtin) /* pipe-error-descriptor pipe-stream */ { LispObj *pipe_stream; pipe_stream = ARGUMENT(0); if (!STREAMP(pipe_stream) || pipe_stream->data.stream.type != LispStreamPipe) LispDestroy("%s: %s is not a pipe stream", STRFUN(builtin), STROBJ(pipe_stream)); if (!EPSTREAMP(pipe_stream)) LispDestroy("%s: pipe %s is closed", STRFUN(builtin), STROBJ(pipe_stream)); return (INTEGER(LispFileno(EPSTREAMP(pipe_stream)))); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/xedit.h0000664000000000000000000000700712472175711015556 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/xedit.h,v 1.5tsi Exp $ */ #ifndef Lisp_xedit_h #define Lisp_xedit_h #ifdef XEDIT_LISP_PRIVATE #include "lisp/private.h" #include "lisp/io.h" #include "lisp/read.h" #include "lisp/write.h" LispObj *Xedit_AddEntity(LispBuiltin*); LispObj *Xedit_AutoFill(LispBuiltin*); LispObj *Xedit_Background(LispBuiltin*); LispObj *Xedit_CharAfter(LispBuiltin*); LispObj *Xedit_CharBefore(LispBuiltin*); LispObj *Xedit_ClearEntities(LispBuiltin*); LispObj *Xedit_ConvertPropertyList(LispBuiltin*); LispObj *Xedit_Font(LispBuiltin*); LispObj *Xedit_Foreground(LispBuiltin*); LispObj *Xedit_GotoChar(LispBuiltin*); LispObj *Xedit_HorizontalScrollbar(LispBuiltin*); LispObj *Xedit_Insert(LispBuiltin*); LispObj *Xedit_Justification(LispBuiltin*); LispObj *Xedit_LeftColumn(LispBuiltin*); LispObj *Xedit_Point(LispBuiltin*); LispObj *Xedit_PointMax(LispBuiltin*); LispObj *Xedit_PointMin(LispBuiltin*); LispObj *Xedit_PropertyList(LispBuiltin*); LispObj *Xedit_ReadText(LispBuiltin*); LispObj *Xedit_ReplaceText(LispBuiltin*); LispObj *Xedit_RightColumn(LispBuiltin*); LispObj *Xedit_Scan(LispBuiltin*); LispObj *Xedit_SearchBackward(LispBuiltin*); LispObj *Xedit_SearchForward(LispBuiltin*); LispObj *Xedit_VerticalScrollbar(LispBuiltin*); LispObj *Xedit_WrapMode(LispBuiltin*); LispObj *Xedit_XrmStringToQuark(LispBuiltin*); #else #define LispObj void #endif /* XEDIT_LISP_PRIVATE */ typedef struct _EditModeInfo { char *desc; /* Mode description */ Widget sme; /* Menu entry */ LispObj *symbol; /* Symbol holding syntax data */ LispObj *syntax; /* The syntax definition */ } EditModeInfo; /* Typedef'ed to XeditLispData in ../xedit.h */ struct _XeditLispData { LispObj *syntax; /* Syntax definition */ LispObj *syntable; /* Syntax-table the cursor is located */ int disable_highlight; /* Working in the buffer */ }; void LispXeditInitialize(void); void XeditLispExecute(Widget, XawTextPosition, XawTextPosition); void XeditLispSetEditMode(xedit_flist_item*, LispObj*); void XeditLispUnsetEditMode(xedit_flist_item*); extern EditModeInfo *mode_infos; extern Cardinal num_mode_infos; #endif /* Lisp_xedit_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/test/0000775000000000000000000000000012472176532015245 5ustar x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/test/psql-3.lsp0000664000000000000000000000755512472175711017116 0ustar ;; Postgresql C library interface, example program 3, using the xedit ;; lisp interface ;; Test the binary cursor interface ;; ;; populate a database by doing the following: ;; ;; CREATE TABLE test1 (i int4, d real, p polygon); ;; ;; INSERT INTO test1 values (1, 3.567, polygon '(3.0, 4.0, 1.0, 2.0)'); ;; ;; INSERT INTO test1 values (2, 89.05, polygon '(4.0, 3.0, 2.0, 1.0)'); ;; ;; the expected output is: ;; ;; tuple 0: got i = (4 bytes) 1, d = (4 bytes) 3.567000, p = (4 ;; bytes) 2 points boundbox = (hi=3.000000/4.000000, lo = ;; 1.000000,2.000000) tuple 1: got i = (4 bytes) 2, d = (4 bytes) ;; 89.050003, p = (4 bytes) 2 points boundbox = ;; (hi=4.000000/3.000000, lo = 2.000000,1.000000) ;; Output of the lisp code: ;; ;; type[0] = 23, size[0] = 4 ;; type[1] = 700, size[1] = 4 ;; type[2] = 604, size[2] = -1 ;; tuple 0: got ;; i = (4 bytes) 1 ;; d = (4 bytes) 3.567 ;; p = (4 bytes) 2 points boundbox = (hi=3.0/4.0, lo = 1.0/2.0) ;; tuple 1: got ;; i = (4 bytes) 2 ;; d = (4 bytes) 89.05 ;; p = (4 bytes) 2 points boundbox = (hi=4.0/3.0, lo = 2.0/1.0) (require "psql") (defun exit-nicely (conn) (pq-finish conn) (quit 1) ) ;; begin, by setting the parameters for a backend connection if the ;; parameters are null, then the system will try to use reasonable ;; defaults by looking up environment variables or, failing that, ;; using hardwired constants (setq pghost nil) ; host name of the backend server (setq pgport nil) ; port of the backend server (setq pgoptions nil) ; special options to start up the backend server (setq pgtty nil) ; debugging tty for the backend server (setq pgdbname "test") ; change this to the name of your test database ;; XXX Note: getenv not yet implemented in the ; lisp interpreter ;; make a connection to the database (setq conn (pq-setdb pghost pgport pgoptions pgtty pgdbname)) ;; check to see that the backend connection was successfully made (when (= (pq-status conn) pg-connection-bad) (format t "Connection to database '~A' failed.~%" pgdbname) (format t "~A" (pq-error-message conn)) (exit-nicely conn)) (setq res (pq-exec conn "BEGIN")) (when (= (pq-status conn) pg-connection-bad) (format t "BEGIN command failed~%") (pq-clear res) (exit-nicely conn)) ;; Should PQclear PGresult whenever it is no longer needed to avoid memory leaks (pq-clear res) (setq res (pq-exec conn "DECLARE mycursor BINARY CURSOR FOR select * from test1")) (when (= (pq-status conn) pg-connection-bad) (format t "DECLARE CURSOR command failed~%") (pq-clear res) (exit-nicely conn)) (pq-clear res) (setq res (pq-exec conn "FETCH ALL in mycursor")) (when (or (null res) (not (= (pq-result-status res) pgres-tuples-ok))) (format t "FETCH ALL command didn't return tuples properly~%") (pq-clear res) (exit-nicely conn)) (setq i-fnum (pq-fnumber res "i")) (setq d-fnum (pq-fnumber res "d")) (setq p-fnum (pq-fnumber res "p")) (dotimes (i 3) (format t "type[~D] = ~D, size[~D] = ~D~%" i (pq-ftype res i) i (pq-fsize res i)) ) (dotimes (i (pq-ntuples res)) (setq i-val (pq-getvalue res i i-fnum 'int32)) (setq d-val (pq-getvalue res i d-fnum 'float)) (setq p-val (pq-getvalue res i p-fnum 'pg-polygon)) (format t "tuple ~D: got~%" i) (format t " i = (~D bytes) ~D~%" (pq-getlength res i i-fnum) i-val) (format t " d = (~D bytes) ~D~%" (pq-getlength res i d-fnum) d-val) (format t " p = (~D bytes) ~D points~,8@Tboundbox = (hi=~F/~F, lo = ~F/~F)~%" (pq-getlength res i d-fnum) (pg-polygon-num-points p-val) (pg-point-x (pg-box-high (pg-polygon-boundbox p-val))) (pg-point-y (pg-box-high (pg-polygon-boundbox p-val))) (pg-point-x (pg-box-low (pg-polygon-boundbox p-val))) (pg-point-y (pg-box-low (pg-polygon-boundbox p-val)))) ) (pq-clear res) (setq res (pq-exec conn "CLOSE mycursor")) (pq-clear res) (setq res (pq-exec conn "COMMIT")) (pq-clear res) (pq-finish conn) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/test/stream.lsp0000664000000000000000000006562612472175711017275 0ustar ;; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/test/stream.lsp,v 1.3 2002/12/06 03:25:29 paulo Exp $ ;; ;; most format tests from the cltl second edition samples ;; basic io/format/pathname/stream tests (defun do-format-test (error-test expect arguments &aux result (error t) unused error-value) (multiple-value-setq (unused error-value) (ignore-errors (setq result (apply #'format nil arguments)) (setq error nil) ) ) (if error-test (or error (format t "ERROR: no error for (format nil~{ ~S~}), result was ~S~%" arguments result)) (if error (format t "ERROR: (format nil~{ ~S~}) => ~S~%" arguments error-value) (or (string= result expect) (format t "(format nil~{ ~S~}) => should be ~S not ~S~%" arguments expect result))) ) ) (defun format-test (expect &rest arguments) (do-format-test nil expect arguments)) (defun format-error (&rest arguments) (do-format-test t nil arguments)) (defun compare-test (test expect function arguments &aux result (error t) unused error-value) (multiple-value-setq (unused error-value) (ignore-errors (setq result (apply function arguments)) (setq error nil) ) ) (if error (format t "ERROR: (~S~{ ~S~}) => ~S~%" function arguments error-value) (or (funcall test result expect) (format t "(~S~{ ~S~}) => should be ~S not ~S~%" function arguments expect result ) ) ) ) (defun compare-eval (test expect form &aux result (error t) unused error-value) (multiple-value-setq (unused error-value) (ignore-errors (setq result (eval form)) (setq error nil) ) ) (if error (format t "ERROR: ~S => ~S~%" form error-value) (or (funcall test result expect) (format t "~S => should be ~S not ~S~%" form expect result ) ) ) ) (defun error-test (function &rest arguments &aux result (error t)) (ignore-errors (setq result (apply function arguments)) (setq error nil) ) (or error (format t "ERROR: no error for (~S~{ ~S~}), result was ~S~%" function arguments result) ) ) (defun error-eval (form &aux result (error t)) (ignore-errors (setq result (eval form)) (setq error nil) ) (or error (format t "ERROR: no error for ~S, result was ~S~%" form result) ) ) (defun eq-test (expect function &rest arguments) (compare-test #'eq expect function arguments)) (defun eql-test (expect function &rest arguments) (compare-test #'eql expect function arguments)) (defun equal-test (expect function &rest arguments) (compare-test #'equal expect function arguments)) (defun equalp-test (expect function &rest arguments) (compare-test #'equalp expect function arguments)) (defun eq-eval (expect form) (compare-eval #'eq expect form)) (defun eql-eval (expect form) (compare-eval #'eql expect form)) (defun equal-eval (expect form) (compare-eval #'equal expect form)) (defun equalp-eval (expect form) (compare-eval #'equalp expect form)) (defun bool-test (expect function &rest arguments &aux result (error t) unused error-value) (multiple-value-setq (unused error-value) (ignore-errors (setq result (apply function arguments)) (setq error nil) ) ) (if error (format t "ERROR: (~S~{ ~S~}) => ~S~%" function arguments error-value) (or (eq (null result) (null expect)) (format t "(~S~{ ~S~}) => should be ~A not ~A~%" function arguments expect result ) ) ) ) (defun bool-eval (expect form &aux result (error t) unused error-value) (multiple-value-setq (unused error-value) (ignore-errors (setq result (eval form)) (setq error nil) ) ) (if error (format t "ERROR: ~S => ~S~%" form error-value) (or (eq (null result) (null expect)) (format t "~S => should be ~A not ~A~%" form expect result ) ) ) ) ;; format - function ;; ~c (format-test "A" "~C" #\A) (format-test " " "~C" #\Space) (format-test "A" "~:C" #\A) (format-test "Space" "~:C" #\Space) (format-test "#\\A" "~@C" #\A) (format-test "#\\Space" "~@C" #\Space) (format-test " " "~A" #\Space) (let ((*print-escape* t)) (format-test " " "~A" #\Space)) (format-test "#\\Space" "~S" #\Space) (let ((*print-escape* nil)) (format-test "#\\Space" "~S" #\Space)) ;; ~% (format-test " " "~%") (format-test " " "~3%") ;; ~& (format-test "" "~&") (format-test " " "~2&") ;; ~| (format-test " " "~|") ;; ~~ (format-test "~~~" "~3~") ;; radix (format-test "1101" "~,,' ,4:B" 13) (format-test "1 0001" "~,,' ,4:B" 17) (format-test "1101 0000 0101" "~14,,' ,4:B" 3333) (format-test "1 22" "~3,,,' ,2:R" 17) (format-test "6|55|35" "~,,'|,2:D" #xFFFF) (format-test "1,000,000" "~,,,3:D" 1000000) (format-test "one hundred and twenty-three thousand, four hundred and fifty-six" "~R" 123456) (format-test "six hundred and fifty-four thousand, three hundred twenty-first" "~:R" 654321) (format-test "MCCXXXIV" "~@R" 1234) (format-test "MCCXXXXVIIII" "~@:R" 1249) (format-test "3039" "~X" 12345) (format-test "30071" "~O" 12345) (format-test "9IX" "~36R" 12345) (format-test "11000000111001" "~B" 12345) (format-test "The answer is 5." "The answer is ~D." 5) (format-test "The answer is 5." "The answer is ~3D." 5) (format-test "The answer is 005." "The answer is ~3,'0D." 5) (format-test "1111 1010 1100 1110" "~,,' ,4:B" #xFACE) (format-test "1 1100 1110" "~,,' ,4:B" #x1CE) (format-test "1111 1010 1100 1110" "~19,,' ,4:B" #xFACE) (format-test " 1 1100 1110" "~19,,' ,4:B" #x1CE) ;; 6.37 and 6.38 are correct #+xedit (format-test "6.38" "~4,2F" 6.375d0) (format-test "10.0" "~,1F" 9.995d0) ;; 6.37E+2 and 6.38E+2 are correct #+xedit (format-test " 6.38E+2" "~8,2E" 637.5) (do* ( (n '(3.14159 -3.14159 100.0 1234.0 0.006) (cdr n)) (r '(" 3.14| 31.42| 3.14|3.1416|3.14|3.14159" " -3.14|-31.42| -3.14|-3.142|-3.14|-3.14159" "100.00|******|100.00| 100.0|100.00|100.0" "1234.00|******|??????|1234.0|1234.00|1234.0" " 0.01| 0.06| 0.01| 0.006|0.01|0.006") (cdr r)) (x (car n) (car n)) ) ((endp n)) (format-test (car r) "~6,2F|~6,2,1,'*F|~6,2,,'?F|~6F|~,2F|~F" x x x x x x) ) (do* ( (n '(3.14159 -3.14159 1100.0 1.1e13 #+xedit 1.1e120) (cdr n)) (r '(" 3.14E+0| 31.42$-01|+.003E+03| 3.14E+0" " -3.14E+0|-31.42$-01|-.003E+03| -3.14E+0" " 1.10E+3| 11.00$+02|+.001E+06| 1.10E+3" "*********| 11.00$+12|+.001E+16| 1.10E+13" #+xedit "*********|??????????|%%%%%%%%%|1.10E+120") (cdr r)) (x (car n) (car n)) ) ((endp n)) (format-test (car r) "~9,2,1,,'*E|~10,3,2,2,'?,,'$E|~9,3,2,-2,'%@E|~9,2E" x x x x) ) (do ( (k -5 (1+ k)) (r '("Scale factor -5: | 0.000003E+06|" "Scale factor -4: | 0.000031E+05|" "Scale factor -3: | 0.000314E+04|" "Scale factor -2: | 0.003142E+03|" "Scale factor -1: | 0.031416E+02|" "Scale factor 0: | 0.314159E+01|" "Scale factor 1: | 3.141590E+00|" "Scale factor 2: | 31.41590E-01|" "Scale factor 3: | 314.1590E-02|" "Scale factor 4: | 3141.590E-03|" "Scale factor 5: | 31415.90E-04|" "Scale factor 6: | 314159.0E-05|" "Scale factor 7: | 3141590.E-06|") (cdr r)) ) ((endp r)) (format-test (car r) "Scale factor ~2D: | ~12,6,2,VE|" k k 3.14159) ) (do* ( (n '(0.0314159 0.314159 3.14159 31.4159 314.159 3141.59 3.14E12 #+xedit 3.14d120) (cdr n)) (r '(" 3.14E-2|314.2$-04|0.314E-01| 3.14E-2" " 0.31 |0.314 |0.314 | 0.31 " " 3.1 | 3.14 | 3.14 | 3.1 " " 31. | 31.4 | 31.4 | 31. " " 3.14E+2| 314. | 314. | 3.14E+2" " 3.14E+3|314.2$+01|0.314E+04| 3.14E+3" "*********|314.0$+10|0.314E+13| 3.14E+12" #+xedit "*********|?????????|%%%%%%%%%|3.14E+120") (cdr r)) (x (car n) (car n)) ) ((endp n)) (format-test (car r) "~9,2,1,,'*G|~9,3,2,3,'?,,'$G|~9,3,2,0,'%G|~9,2G" x x x x) ) (format-test " 1." "~4,0f" 0.5) (format-test " 0." "~4,0f" 0.4) ;; ~p (setq n 3) (format-test "3 items found.""~D item~:P found." n) (format-test "three dogs are here." "~R dog~:[s are~; is~] here." n (= n 1)) (format-test "three dogs are here." "~R dog~:*~[s are~; is~:;s are~] here." n) (format-test "Here are three puppies.""Here ~[are~;is~:;are~] ~:*~R pupp~:@P." n) (format-test "7 tries/1 win" "~D tr~:@P/~D win~:P" 7 1) (format-test "1 try/0 wins" "~D tr~:@P/~D win~:P" 1 0) (format-test "1 try/3 wins" "~D tr~:@P/~D win~:P" 1 3) ;; ~t (format-test " foo" "~8Tfoo") #+xedit (format-test " foo" "~8,3Tfoo") (format-test " foo" "~8,3@Tfoo") (format-test " foo" "~1,3@Tfoo") ;; ~* (format-test "2" "~*~D" 1 2 3 4) (format-test "4" "~3*~D" 1 2 3 4) (format-test "2" "~3*~2:*~D" 1 2 3 4) (format-test "4 3 2 1 2 3 4" "~3@*~D ~2@*~D ~1@*~D ~0@*~D ~D ~D ~D" 1 2 3 4) ;; ~? (format-test " 7" "~? ~D" "<~A ~D>" '("Foo" 5) 7) (format-test " 7" "~? ~D" "<~A ~D>" '("Foo" 5 14) 7) (format-test " 7" "~@? ~D" "<~A ~D>" "Foo" 5 7) (format-test " 14" "~@? ~D" "<~A ~D>" "Foo" 5 14 7) (format-error "~:[abc~:@(def~;ghi~:@(jkl~]mno~)" 1) (format-error "~?ghi~)" "abc~@(def") ;; ~(...~) (format-test "XIV xiv" "~@R ~(~@R~)" 14 14) (format-test "Zero errors detected." "~@(~R~) error~:P detected." 0) (format-test "One error detected." "~@(~R~) error~:P detected." 1) (format-test "Twenty-three errors detected." "~@(~R~) error~:P detected." 23) ;; ~[...~] (format-test "Persian Cat" "~[Siamese~;Manx~;Persian~] Cat" 2) (format-test " Cat" "~[Siamese~;Manx~;Persian~] Cat" 3) (format-test "Siamese Cat" "~[Siamese~;Manx~;Persian~] Cat" 0) (setq *print-level* nil *print-length* 5) (format-test " print length = 5" "~@[ print level = ~D~]~@[ print length = ~D~]" *print-level* *print-length*) (setq foo "Items:~#[ none~; ~S~; ~S and ~S~:;~@{ ~#[~;and ~]~S~^,~}~].") (format-test "Items: none." foo) (format-test "Items: FOO." foo 'foo) (format-test "Items: FOO and BAR." foo 'foo 'bar) (format-test "Items: FOO, BAR, and BAZ." foo 'foo 'bar 'baz) (format-test "Items: FOO, BAR, BAZ, and QUUX." foo 'foo 'bar 'baz 'quux) ;; ~{...~} (format-test "The winners are: FRED HARRY JILL." "The winners are:~{ ~S~}." '(fred harry jill)) (format-test "Pairs: ." "Pairs:~{ <~S,~S>~}." '(a 1 b 2 c 3)) (format-test "Pairs: ." "Pairs:~:{ <~S,~S>~}." '((a 1) (b 2) (c 3))) (format-test "Pairs: ." "Pairs:~:@{ <~S,~S>~}." '(a 1) '(b 2) '(c 3)) ;; ~<...~> (format-test "foo bar" "~10") (format-test " foo bar" "~10:") (format-test " foo bar " "~10:@") (format-test " foobar" "~10") (format-test " foobar" "~10:") (format-test "foobar " "~10@") (format-test " foobar " "~10:@") ;; ~^ (setq donestr "Done.~^ ~D warning~:P.~^ ~D error~:P.") (format-test "Done." donestr) (format-test "Done. 3 warnings." donestr 3) (format-test "Done. 1 warning. 5 errors." donestr 1 5) (format-test "/HOT .../HAMBURGER/ICE .../FRENCH ..." "~:{/~S~^ ...~}" '((hot dog) (hamburger) (ice cream) (french fries))) (format-test "/HOT .../HAMBURGER .../ICE .../FRENCH" "~:{/~S~:^ ...~}" '((hot dog) (hamburger) (ice cream) (french fries))) (format-test "/HOT .../HAMBURGER" "~:{/~S~:#^ ...~}" '((hot dog) (hamburger) (ice cream) (french fries))) (setq tellstr "~@(~@[~R~]~^ ~A.~)") (format-test "Twenty-three" tellstr 23) (format-test " Losers." tellstr nil "losers") (format-test "Twenty-three losers." tellstr 23 "losers") (format-test " FOO" "~15<~S~;~^~S~;~^~S~>" 'foo) (format-test "FOO BAR" "~15<~S~;~^~S~;~^~S~>" 'foo 'bar) (format-test "FOO BAR BAZ" "~15<~S~;~^~S~;~^~S~>" 'foo 'bar 'baz) ;; make-pathname - function (equal-test #P"/public/games/chess.db" #'make-pathname :directory '(:absolute "public" "games") :name "chess" :type "db") (equal-test #P"/etc/passwd" #'list* #P"/etc/passwd") (setq path (make-pathname :directory '(:absolute "public" "games") :name "chess" :type "db")) (eq-test path #'pathname path) (eq-test nil #'pathname-host path) (eq-test nil #'pathname-device path) (equal-test '(:absolute "public" "games") #'pathname-directory path) (equal-test "chess" #'pathname-name path) (equal-test "db" #'pathname-type path) (eq-test nil #'pathname-version path) (equal-test #P"/tmp/foo.txt" #'make-pathname :defaults "/tmp/foo.txt") #+xedit (equal-test #P"/tmp/foo.txt" #'pathname "///tmp///foo.txt") ;; XXX changed to remove extra separators ;; (equal-test #P"///tmp///foo.txt" #'pathname "///tmp///foo.txt") ;; merge-pathnames - function (equal-test #P"/tmp/foo.txt" #'merge-pathnames "/tmp/foo" "/tmp/foo.txt") (equal-test #P"/tmp/foo.txt" #'merge-pathnames "foo" "/tmp/foo.txt") (equal-test #P"/tmp/foo/bar.txt" #'merge-pathnames "foo/bar" "/tmp/foo.txt") ;; namestring - function (setq path (merge-pathnames "foo/bar" "/tmp/foo.txt")) (equal-test "/tmp/foo/bar.txt" #'namestring path) (equal-test "" #'host-namestring path) (equal-test "/tmp/foo/" #'directory-namestring path) (equal-test "bar.txt" #'file-namestring path) (equal-test "/tmp/foo/bar.txt" #'enough-namestring path) (equal-test "foo/bar.txt" #'enough-namestring path "/tmp/") (equal-test "bar.txt" #'enough-namestring path "/tmp/foo/") (equal-test "foo/bar.txt" #'enough-namestring path "/tmp/foo") ;; parse-namestring - function (equal-eval '(#P"foo" 3) '(multiple-value-list (parse-namestring "foo"))) (equal-eval '(#P"foo" 0) '(multiple-value-list (parse-namestring #P"foo"))) ;; read - function (setq is (make-string-input-stream " foo ")) (eq-test t #'streamp is) (eq-test t #'input-stream-p is) (eq-test nil #'output-stream-p is) (eq-test 'foo #'read is) (eq-test t #'close is) (setq is (make-string-input-stream "xfooy" 1 4)) (eq-test 'foo #'read is) (eq-test t #'close is) (setq is (make-string-input-stream "")) (eq-test nil #'read is nil) (eq-test 'end-of-string #'read is nil 'end-of-string) (close is) (error-test #'read is) (error-test #'read is nil) (error-test #'read is nil 'end-of-string) (eq-test t #'streamp is) (eq-test nil #'input-stream-p is) (eq-test nil #'streamp "test") (error-test #'input-stream-p "test") ;; read-char - function (setq is (make-string-input-stream "0123")) (setq test nil) (equal-eval '(#\0 #\1 #\2 #\3) '(do ((c (read-char is) (read-char is nil 'the-end))) ((not (characterp c)) test) (setq test (append test (list c))))) (close is) (setq is (make-string-input-stream "abc")) (eql-test #\a #'read-char is) (eql-test #\b #'read-char is) (eql-test #\c #'read-char is) (error-test #'read-char is) (eq-test nil #'read-char is nil) (eq-test :end-of-string #'read-char is nil :end-of-string) (eq-test t #'close is) ;; read-char-no-hang - function (setq is (make-string-input-stream "0123")) (setq test nil) (equal-eval '(#\0 #\1 #\2 #\3) '(do ((c (read-char-no-hang is) (read-char-no-hang is nil 'the-end))) ((not (characterp c)) test) (setq test (append test (list c))))) (close is) (setq is (make-string-input-stream "abc")) (eql-test #\a #'read-char-no-hang is) (eql-test #\b #'read-char-no-hang is) (eql-test #\c #'read-char-no-hang is) (error-test #'read-char-no-hang is) (eq-test nil #'read-char-no-hang is nil) (eq-test :end-of-string #'read-char-no-hang is nil :end-of-string) (eq-test t #'close is) #+(and xedit unix) (progn ;; wait one second for input pooling every 0.1 seconds (defun wait-for-cat () (let ((time 0.0)) (loop (and (listen is) (return)) (sleep 0.1) (when (>= (incf time 0.1) 1.0) (format t "Cat is sleeping~%") (return))))) (setq is (make-pipe "/bin/cat" :direction :io)) (equal-test "dog" #'write-line "dog" is) (wait-for-cat) (eql-test #\d #'read-char-no-hang is) (eql-test #\o #'read-char-no-hang is) (eql-test #\g #'read-char-no-hang is) (eql-test #\Newline #'read-char-no-hang is) (eq-test nil #'read-char-no-hang is) (eq-test nil #'read-char-no-hang is) (equal-test "mouse" #'write-line "mouse" is) (wait-for-cat) (eql-test #\m #'read-char-no-hang is) (eql-test #\o #'read-char-no-hang is) (eql-test #\u #'read-char-no-hang is) (eql-test #\s #'read-char-no-hang is) (eql-test #\e #'read-char-no-hang is) (eql-test #\Newline #'read-char-no-hang is) (eq-test nil #'read-char-no-hang is) (eq-test t #'close is) (error-test #'read-char-no-hang is) (error-test #'read-char-no-hang is nil) (error-test #'read-char-no-hang is nil t) ) ;; read-from-string - function (equal-eval '(3 5) '(multiple-value-list (read-from-string " 1 3 5" t nil :start 2))) (equal-eval '((a b c) 7) '(multiple-value-list (read-from-string "(a b c)"))) (error-test #'read-from-string "") (eq-test nil #'read-from-string "" nil) (eq-test 'end-of-file #'read-from-string "" nil 'end-of-file) ;; read-line - function (setq is (make-string-input-stream "line 1 line 2")) (equal-eval '("line 1" nil) '(multiple-value-list (read-line is))) (equal-eval '("line 2" t) '(multiple-value-list (read-line is))) (error-test #'read-line is) (equal-eval '(nil t) '(multiple-value-list (read-line is nil))) (equal-eval '(end-of-string t) '(multiple-value-list (read-line is nil 'end-of-string))) ;; write - function ;; XXX several write options still missing (setq os (make-string-output-stream)) (equal-test '(1 2 3 4) #'write '(1 2 3 4) :stream os) (equal-test "(1 2 3 4)" #'get-output-stream-string os) (eq-test t #'streamp os) (eq-test t #'output-stream-p os) (eq-test nil #'input-stream-p os) (equal-test '(:foo :bar) #'write '(:foo :bar) :case :downcase :stream os) (equal-test "(:foo :bar)" #'get-output-stream-string os) (equal-test '(:foo :bar) #'write '(:foo :bar) :case :capitalize :stream os) (equal-test "(:Foo :Bar)" #'get-output-stream-string os) (equal-test '(:foo :bar) #'write '(:foo :bar) :case :upcase :stream os) (equal-test "(:FOO :BAR)" #'get-output-stream-string os) (equal-test '(foo bar baz) #'write '(foo bar baz) :length 2 :stream os) (equal-test "(FOO BAR ...)" #'get-output-stream-string os) (equal-test '(foo (bar) baz) #'write '(foo (bar) baz) :level 1 :stream os) (equal-test "(FOO # BAZ)" #'get-output-stream-string os) (setq circle '#1=(1 #1#)) (eq-test circle #'write circle :circle t :stream os) (equal-test "#1=(1 #1#)" #'get-output-stream-string os) (eql-test #\Space #'write #\Space :stream os) (equal-test "#\\Space" #'get-output-stream-string os) (eql-test #\Space #'write #\Space :escape nil :stream os) (equal-test " " #'get-output-stream-string os) (eq-test t #'close os) (eq-test nil #'output-stream-p os) (error-test #'output-stream-p "test") (error-test #'write 'foo :stream "bar") ;; fresh-line - function (setq os (make-string-output-stream)) (equal-test "some text" #'write-string "some text" os) (eq-test t #'fresh-line os) (eq-test nil #'fresh-line os) (equal-test "more text" #'write-string "more text" os) (equal-test "some text more text" #'get-output-stream-string os) (equal-test nil #'fresh-line os) (equal-test nil #'fresh-line os) (equal-test "" #'get-output-stream-string os) (close os) (error-test #'fresh-line 1) ;; prin1 - function ;; (prin1 object stream) == ;; (write object :stream stream :escape t) (setq p-os (make-string-output-stream) w-os (make-string-output-stream)) (dolist (object (list #\a 1 "string" 2.5d0 '(a . b) '(a b c) #P"foo" *package* *standard-input* #c(1 2) #(1 2 3) (make-hash-table))) (eq-test object #'prin1 object p-os) (eq-test object #'write object :stream w-os :escape t) (equal-test (get-output-stream-string p-os) #'get-output-stream-string w-os)) (close p-os) (close w-os) (error-test #'prin1 1 1) ;; princ - function ;; (princ object stream) == ;; (write object :stream stream :escape nil :readably nil) ;; XXX readably not yet implemented (setq p-os (make-string-output-stream) w-os (make-string-output-stream)) (dolist (object (list #\a 1 "string" 2.5d0 '(a . b) '(a b c) #P"foo" *package* *standard-input* #c(1 2) #(1 2 3) (make-hash-table))) (eq-test object #'princ object p-os) (eq-test object #'write object :stream w-os :escape nil) (equal-test (get-output-stream-string p-os) #'get-output-stream-string w-os)) (close p-os) (close w-os) (error-test #'princ 1 1) ;; print - function ;; (print object stream) == ;; (progn ;; (terpri stream) ;; (write object :stream stream :escape t) ;; (write-char #\Space stream)) (setq p-os (make-string-output-stream) w-os (make-string-output-stream)) (dolist (object (list #\a 1 "string" 2.5d0 '(a . b) '(a b c) #P"foo" *package* *standard-input* #c(1 2) #(1 2 3) (make-hash-table))) (eq-test object #'print object p-os) (progn (eq-test nil #'terpri w-os) (eq-test object #'write object :stream w-os :escape t) (eql-test #\Space #'write-char #\Space w-os)) (equal-test (get-output-stream-string p-os) #'get-output-stream-string w-os)) (close p-os) (close w-os) (error-test #'print 1 1) ;; terpri - function (setq os (make-string-output-stream)) (equal-test "some text" #'write-string "some text" os) (eq-test nil #'terpri os) (eq-test nil #'terpri os) (equal-test "more text" #'write-string "more text" os) (equal-test "some text more text" #'get-output-stream-string os) (equal-test nil #'terpri os) (equal-test nil #'terpri os) (equal-test " " #'get-output-stream-string os) (close os) (error-test #'terpri 1) ;; write-char - function (equal-eval "a b" '(with-output-to-string (s) (write-char #\a s) (write-char #\Space s) (write-char #\b s))) (error-test #'write-char 1) ;; write-line - function (setq os (make-string-output-stream)) (equal-test "text" #'write-line "text" os) (equal-test "text " #'get-output-stream-string os) (eql-test #\< #'write-char #\< os) (equal-test "text" #'write-line "text" os :start 1 :end 3) (eql-test #\> #'write-char #\> os) (equal-test "" #'get-output-stream-string os) (error-test #'write-line 1) (close os) ;; write-string - function (setq os (make-string-output-stream)) (equal-test "text" #'write-string "text" os) (equal-test "text" #'get-output-stream-string os) (eql-test #\< #'write-char #\< os) (equal-test "text" #'write-string "text" os :start 1 :end 3) (eql-test #\> #'write-char #\> os) (equal-test "" #'get-output-stream-string os) (error-test #'write-string #\a) (close os) ;; open - function (setq name #P"delete-me.text") (bool-eval t '(setq file (open name :direction :output))) (equal-test "some text" #'write-line "some text" file) (close file) (equal-test "delete-me.text" #'file-namestring (truename name)) (setq file (open name :direction :output :if-exists :rename)) (equal-test "other text" #'write-line "other text" file) (close file) (equal-test "delete-me.text" #'file-namestring (truename name)) ;; Clisp returns the pathname if the file exists #+xedit (eq-test t #'delete-file name) #+clisp (bool-test t #'delete-file name) (setq backup #+xedit "delete-me.text~" #+clisp "delete-me.text%" #+cmu "delete-me.text.BAK") (bool-test t #'delete-file backup) (eq-test nil #'delete-file name) (eq-test nil #'directory name) (eq-test nil #'directory backup) ;; test append (with-open-file (s name :direction :output :if-exists :error) (write-line "line 1" s)) (with-open-file (s name :direction :output :if-exists :append) (write-line "line 2" s)) (with-open-file (s name :direction :input) (equal-test "line 1" #'read-line s) (equal-test "line 2" #'read-line s) (eq-test 'eof #'read-line s nil 'eof) ) (bool-test t #'delete-file name) ;; test overwrite (with-open-file (s name :direction :output :if-exists :error) (write-line "overwrite-me" s)) (with-open-file (s name :direction :output :if-exists :overwrite) (write-line "some-text" s)) (with-open-file (s name :direction :input) (equal-test "some-text" #'read-line s) (eq-test 'eof #'read-line s nil 'eof)) ;; test check for file existence (eq-test nil #'open name :direction :output :if-exists nil) (error-test #'open name :direction :output :if-exists :error) (bool-test t #'delete-file name) ;; test check for no file existence (eq-test nil #'open name :direction :output :if-does-not-exist nil) (error-test #'open name :direction :output :if-does-not-exist :error) #+xedit ;; test io -- not sure if this is the expected behaviour (progn (with-open-file (s name :direction :io) (write-line "foo" s) (write-line "bar" s)) (with-open-file (s name :direction :io :if-exists :append) (equal-test "foo" #'read-line s) (equal-test "bar" #'read-line s) (eq-test 'eof #'read-line s nil 'eof) (write-line "baz" s)) (with-open-file (s name :direction :io :if-exists :append) (equal-test "foo" #'read-line s) (equal-test "bar" #'read-line s) (equal-test "baz" #'read-line s) (eq-test 'eof #'read-line s nil 'eof)) (bool-test t #'delete-file name) ) ;; delete-file - function (eq-eval nil '(with-open-file (s "delete-me.text" :direction :output :if-exists :error))) (eq-test t #'pathnamep (setq p (probe-file "delete-me.text"))) (bool-test t #'delete-file p) (eq-test nil #'probe-file "delete-me.text") (bool-eval t '(with-open-file (s "delete-me.text" :direction :output :if-exists :error) (delete-file s))) (bool-test nil #'probe-file "delete-me.text") ;; rename-file - function (setq name "foo.bar") (bool-eval t '(setq file (open name :direction :output :if-exists :error))) (eq-test t #'close file) (setq result (multiple-value-list (rename-file name "bar.foo"))) (eql-test 3 #'length result) (eq-test t #'pathnamep (first result)) (eq-test t #'pathnamep (second result)) (eq-test t #'pathnamep (third result)) (equal-test (third result) #'truename "bar.foo") (eq-test nil #'directory name) (eq-test nil #'directory (second result)) (equal-test (list (third result)) #'directory (third result)) (error-test #'truename name) (error-test #'truename (second result)) (eq-test nil #'probe-file name) (bool-test t #'probe-file (first result)) (eq-test nil #'probe-file (second result)) (bool-test t #'probe-file (third result)) (bool-test t #'delete-file "bar.foo") (eq-test nil #'delete-file (third result)) (eq-test nil #'delete-file (second result)) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/test/hello.lsp0000664000000000000000000000512712472175711017073 0ustar ;; ;; Copyright (c) 2001 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/test/hello.lsp,v 1.1 2001/08/31 15:00:15 paulo Exp $ ;; (require "xaw") (require "xt") (defun quit-callback (widget user call) (quit)) (defun fix-shell-size (shell) (let ((size (xt-get-values shell '("width" "height")))) (xt-set-values shell (list (cons "minWidth" (cdar size)) (cons "maxWidth" (cdar size)) (cons "minHeight" (cdadr size)) (cons "maxHeight" (cdadr size))) ) ) ) (setq toplevel (xt-app-initialize 'appcontext "Hello" '(("title" . "Hello World!")))) (setq form (xt-create-managed-widget "form" form-widget-class toplevel '(("background" . "gray85") ("displayList" . "foreground rgb:7/9/7;lines 1,-1,-1,-1,-1,1;foreground gray90;lines -1,0,0,0,0,-1") ))) (setq button (xt-create-managed-widget "button" command-widget-class form '(("label" . "Goodbye world!") ("tip" . "This sample uses some customizations") ("foreground" . "gray10") ("background" . "gray80") ("displayList" . "foreground rgb:7/9/7;lines 1,-1,-1,-1,-1,1;foreground gray90;lines -1,0,0,0,0,-1") ))) (xt-add-callback button "callback" 'quit-callback) (xt-realize-widget toplevel) (fix-shell-size toplevel) (xt-app-main-loop appcontext) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/test/psql-1.lsp0000664000000000000000000000473212472175711017106 0ustar ;; Postgresql C library interface, example program 1, using the xedit ;; lisp interface ;; Test the C version of libpq, the PostgreSQL frontend library. (require "psql") (defun exit-nicely (conn) (pq-finish conn) (quit 1) ) ;; begin, by setting the parameters for a backend connection if the ;; parameters are null, then the system will try to use reasonable ;; defaults by looking up environment variables or, failing that, ;; using hardwired constants (setq pghost nil) ; host name of the backend server (setq pgport nil) ; port of the backend server (setq pgoptions nil) ; special options to start up the backend server (setq pgtty nil) ; debugging tty for the backend server (setq pgdbname "template1") ;; make a connection to the database (setq conn (pq-setdb pghost pgport pgoptions pgtty pgdbname)) ;; check to see that the backend connection was successfully made (when (= (pq-status conn) pg-connection-bad) (format t "Connection to database '~A' failed.~%" pgdbname) (format t "~A" (pq-error-message conn)) (exit-nicely conn)) ;; start a transaction block (setq res (pq-exec conn "BEGIN")) (when (or (null res) (not (= (pq-result-status res) pgres-command-ok))) (format t "BEGIN command failed~%") (pq-clear res) (exit-nicely conn)) ;; Should PQclear PGresult whenever it is no longer needed to avoid memory leaks (pq-clear res) ;; fetch rows from the pg_database, the system catalog of databases (setq res (pq-exec conn "DECLARE mycursor CURSOR FOR select * from pg_database")) (when (or (null res) (not (= (pq-result-status res) pgres-command-ok))) (format t "DECLARE CURSOR command failed~%") (pq-clear res) (exit-nicely conn)) (pq-clear res) (setq res (pq-exec conn "FETCH ALL in mycursor")) (when (or (null res) (not (= (pq-result-status res) pgres-tuples-ok))) (format t "FETCH ALL command didn't return tuples properly~%") (pq-clear res) (exit-nicely conn)) ;; first, print out the attribute names (setq nfields (pq-nfields res)) (dotimes (i nfields) (format t "~15@<~A~>" (pq-fname res i)) ) (format t "~%") ;; next, print out the rows (setq ntuples (pq-ntuples res)) (dotimes (i ntuples) (dotimes (j nfields) (format t "~15@<~A~>" (pq-getvalue res i j)) ) (format t "~%") ) (pq-clear res) ;; close the cursor (setq res (pq-exec conn "CLOSE mycursor")) (pq-clear res) ;; commit the transaction (setq res (pq-exec conn "COMMIT")) (pq-clear res) ;; close the connection to the database and cleanup (pq-finish conn) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/test/widgets.lsp0000664000000000000000000000571212472175711017436 0ustar ;; ;; Copyright (c) 2001 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/test/widgets.lsp,v 1.1 2001/08/31 15:00:15 paulo Exp $ ;; (require "xaw") (require "xt") (defun quit-callback (widget user call) (quit)) (setq toplevel (xt-app-initialize 'appcontext "Widgets" '(("title" . "Widgets (without customization)")))) (setq vpane (xt-create-managed-widget "vpane" paned-widget-class toplevel)) (setq form (xt-create-managed-widget "form" form-widget-class vpane)) (xt-create-managed-widget "command" command-widget-class form '(("label" . "Command Widget"))) (xt-create-managed-widget "label" label-widget-class form '(("label" . "Label Widget") ("fromVert" . "command"))) (xt-create-managed-widget "button" menu-button-widget-class form '(("label" . "MenuButton Widget") ("fromVert" . "label"))) (setq popup (xt-create-managed-widget "menu" simple-menu-widget-class toplevel)) (xt-create-managed-widget "smebsb" sme-bsb-object-class popup '(("label" . "SmeBSB Object"))) (xt-create-managed-widget "smeline" sme-line-object-class popup) (xt-create-managed-widget "smebsb2" sme-bsb-object-class popup '(("label" . "SmeBSB Object two"))) (xt-create-managed-widget "toggle" toggle-widget-class form '(("label" . "Toggle Widget") ("fromVert" . "button"))) (xt-create-managed-widget "repeater" repeater-widget-class form '(("label" . "Repeater Widget") ("fromVert" . "toggle"))) (setq quit (xt-create-managed-widget "quit" command-widget-class vpane '(("label" . "Quit")))) (xt-add-callback quit "callback" 'quit-callback) (xt-realize-widget toplevel) (xt-app-main-loop appcontext) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/test/regex.lsp0000664000000000000000000003702412472175711017103 0ustar ;; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/test/regex.lsp,v 1.1 2002/12/10 03:59:04 paulo Exp $ ;; ;; Basic regex tests. This file is only for xedit lisp and for it's regex ;; library. Note that the regex library used by xedit lisp is not mean't ;; to be fully compatible with most regexes, but to be as fast as possible. ;; This means that some patterns that looks basic may never be matched, ;; but it is expected that almost any pattern can be rewritten to be ;; matched, or in the worst case, it may be required to search in the ;; regions matched by a previous regex. (defun re-test (expect &rest arguments &aux result (error t) unused error-value) (multiple-value-setq (unused error-value) (ignore-errors (setq result (apply #'re-exec arguments)) (setq error nil))) (if error (format t "ERROR: (re-exec~{ ~S~}) => ~S~%" arguments error-value) (or (equal result expect) (format t "(re-exec~{ ~S~}) => should be ~S not ~S~%" arguments expect result)))) ;; errors only generated for regex compilation (or incorrect arguments) (defun re-error (&rest arguments &aux result (error t) unused error-value) (multiple-value-setq (unused error-value) (ignore-errors (setq result (apply #'re-comp arguments)) (setq error nil))) (or error (format t "ERROR: no error for (re-comp~{ ~S~})" arguments))) (re-error "") (re-error "a**") (re-error "[a") (re-error "a{") (re-error "a(") (re-error "a||b") (re-error "|b|c") (re-error "a|b|") (setq re (re-comp "abc")) (re-test '((0 . 3)) re "abc") (re-test '((0 . 3)) re "abc" :notbol t) (re-test '((0 . 3)) re "abc" :noteol t) (re-test '((0 . 3)) re "abc" :notbol t :noteol t) (re-test '((14 . 17)) re "aaaaaaaaaaaaaaabc") (re-test '((14 . 17)) re "aaaaaaaaaaaaaaabc" :start 12 :end 17) (re-test '((30 . 33)) re "xxxxxxxxxxxxxxaaaaaaaaaaaaaaaaabcxx") (re-test '((30 . 33)) re "xxxxxxxxxxxxxxaaaaaaaaaaaaaaaaabcxx" :start 28 :end 34) (setq re (re-comp "^abc")) (re-test '((0 . 3)) re "abc") (re-test :nomatch re "xabc") (re-test '((1 . 4)) re "xabc" :start 1) (re-test :nomatch re "xabc" :start 1 :notbol t) (setq re (re-comp "abc$")) (re-test '((0 . 3)) re "abc") (re-test :nomatch re "xabcx") (re-test '((1 . 4)) re "xabcx" :end 4) (re-test :nomatch re "xabc" :end 4 :noteol t) (setq re (re-comp "^abc$")) (re-test '((0 . 3)) re "abc") (re-test :nomatch re "xabcx") (re-test '((1 . 4)) re "xabcx" :start 1 :end 4) (re-test :nomatch re "xabcx" :start 1 :end 4 :notbol t) (re-test :nomatch re "xabcx" :start 1 :end 4 :noteol t) (re-test :nomatch re "xabcx" :start 1 :end 4 :notbol t :noteol t) (re-test nil re "abc" :count 0) (setq re (re-comp "abc|bcd|cde")) (re-test '((0 . 3)) re "abc") (re-test '((1 . 4)) re "aabc") (re-test '((3 . 6)) re "xxxbcdef") (re-test '((8 . 11)) re "abdzzzcdabcde") (re-test '((13 . 16)) re "xxxxabdecdabdcde") (setq re (re-comp "^abc|bcd$|cde")) (re-test '((0 . 3)) re "abcde") (re-test '((3 . 6)) re "xabcde") (re-test '((1 . 4)) re "xabcde" :start 1) (re-test '((3 . 6)) re "xabcde" :start 1 :notbol t) (re-test '((2 . 5)) re "xabcd") (re-test :nomatch re "xabcd" :noteol t) (re-test nil re "xabcd" :count 0) (re-test :nomatch re "abcdx" :notbol t) (setq re (re-comp "a?bc|ab?c|abc?")) (re-test '((0 . 3)) re "abc") (re-test :nomatch re "xxxb") (re-test '((3 . 5)) re "xxxbc") (re-test '((5 . 7)) re "sssssab") (re-test '((0 . 3)) re "abcd") (re-test '((1 . 4)) re "aabcdef") (re-test '((1 . 3)) re "aabbccdef") ;; ab matches abc? (setq re (re-comp "a?bc")) (re-test '((2 . 4)) re "acbcd") (re-test '((2 . 5)) re "acabcd") (setq re (re-comp "ab?c")) (re-test '((1 . 3)) re "xacc") (re-test '((2 . 5)) re "xxabcc") (setq re (re-comp "abc?")) (re-test '((1 . 3)) re "xababc") (re-test '((2 . 5)) re "xxabccabc") (setq re (re-comp "a*bc|ab*c|abc*")) (re-test '((0 . 9)) re "aaaaaaabc") (re-test '((1 . 10)) re "xaaaaaaabc") (re-test '((3 . 12)) re "xyzaaaaaaabc") (re-test '((0 . 4)) re "abbc") (re-test '((2 . 9)) re "xxabbbbbc") (re-test '((0 . 12)) re "abcccccccccc") (re-test '((0 . 12)) re "abccccccccccd") (re-test '((16 . 29)) re "xxxxxxxaaaaaaaaaabbbbbbbbbbbccccccccccc") (re-test '((11 . 13)) re "xxxbbbbbbbbbc") (re-test '((8 . 10)) re "aaaaazbxacd") (setq re (re-comp "a*bc")) (re-test '((2 . 4)) re "acbcd") (re-test '((2 . 5)) re "acabcd") (re-test '((2 . 8)) re "acaaaabcd") (setq re (re-comp "ab*c")) (re-test '((1 . 3)) re "xacc") (re-test '((2 . 5)) re "xxabcc") (re-test '((3 . 8)) re "xxaabbbcc") (setq re (re-comp "abc*")) (re-test '((1 . 3)) re "xababc") (re-test '((2 . 5)) re "xxabcbabccc") (re-test '((3 . 7)) re "axxabccabc") (setq re (re-comp "a+bc|ab+c|abc+")) (re-test :nomatch re "xxxbc") (re-test '((1 . 6)) re "xaaabc") (re-test '((8 . 12)) re "zzzzaaaaabbc") (re-test '((7 . 15)) re "zzzzaaaabbbbbbcccc") (setq re (re-comp "a.c")) (re-test '((0 . 3)) re "abc") (re-test '((1 . 4)) re "aaac") (re-test :nomatch re "xac") (re-test '((3 . 6)) re "xaxaac") (re-test '((2 . 5)) re "xxabc") (re-test '((3 . 6)) re "acxaxc") (setq re (re-comp "a*c")) (re-test '((0 . 1)) re "c") (re-test '((5 . 6)) re "xxxxxc") (re-test '((8 . 9)) re "xxxxxxxxc") (re-test '((7 . 8)) re "xxxxxxxcc") (re-test '((0 . 2)) re "ac") (re-test '((0 . 5)) re "aaaac") (re-test '((1 . 3)) re "xac") (re-test '((3 . 6)) re "xxxaac") (re-test '((2 . 4)) re "xxac") (re-test '((4 . 6)) re "xxxxac") (setq re (re-comp "a+c")) (re-test '((2 . 5)) re "xxaac") (re-test '((3 . 8)) re "xxxaaaac") (re-test '((6 . 8)) re "xaaaabac") (re-test :nomatch re "xxxc") (re-test '((4 . 9)) re "xxxxaaaaccc") (setq re (re-comp "a{4}b")) (re-test '((19 . 24)) re "xabxxaabxxxaaabxxxxaaaab") (re-test '((4 . 9)) re "aaabaaaab") (setq re (re-comp "a{4,}b")) (re-test '((3 . 8)) re "xxxaaaab") (re-test '((8 . 25)) re "zaaabzzzaaaaaaaaaaaaaaaab") (setq re (re-comp "a{,4}b")) (re-test '((0 . 1)) re "b") (re-test '((8 . 9)) re "xxxxxxxxb") (re-test '((6 . 11)) re "xaaaaaaaaab") (re-test '((3 . 5)) re "xxxab") (re-test '((6 . 10)) re "aaaaaxaaab") (setq re (re-comp "a{2,4}b")) (re-test :nomatch re "xab") (re-test '((1 . 4)) re "xaab") (re-test '((1 . 5)) re "xaaab") (re-test '((2 . 7)) re "xxaaaab") (re-test '((4 . 9)) re "xxxaaaaab") (setq re (re-comp "foo(bar|baz)fee")) (re-test '((9 . 18)) re "feebarbazfoobarfee") (re-test '((9 . 18) (12 . 15)) re "feebarbazfoobarfee" :count 2) (re-test '((13 . 22)) re "foofooobazfeefoobazfee") (re-test '((13 . 22) (16 . 19)) re "foofooobazfeefoobazfee" :count 3) (setq re (re-comp "foo(bar|baz)fee" :nosub t)) (re-test '((9 . 18)) re "feebarbazfoobarfee") (re-test '((9 . 18)) re "feebarbazfoobarfee" :count 2) (re-test '((13 . 22)) re "foofooobazfeefoobazfee") (re-test '((13 . 22)) re "foofooobazfeefoobazfee" :count 3) (setq re (re-comp "f(oo|ee)ba[rz]")) (re-test :nomatch re "barfoebaz") (re-test '((3 . 9) (4 . 6)) re "bazfoobar" :count 2) (re-test '((3 . 9) (4 . 6)) re "barfeebaz" :count 2) (setq re (re-comp "f(oo|ee)ba[rz]" :nosub t)) (re-test :nomatch re "barfoebaz") (re-test '((3 . 9)) re "bazfoobar" :count 2) (re-test '((3 . 9)) re "barfeebaz" :count 2) (setq re (re-comp "\\<(int|char)\\>")) (re-test '((15 . 18)) re "aint character int foo") (re-test '((15 . 18) (15 . 18)) re "aint character int foo" :count 2) (setq re (re-comp "\\<(int|char)\\>" :nosub t)) (re-test '((15 . 18)) re "aint character int foo" :count 2) (setq re (re-comp "foo.*bar")) (re-test '((11 . 17)) re "barfoblaboofoobarfoobarfoobar") (setq re (re-comp "foo.+bar")) (re-test :nomatch re "foobar") (re-test '((6 . 13)) re "fobbarfooxbarfooybar") (setq re (re-comp "foo.?bar")) (re-test '((1 . 7)) re "xfoobar") (re-test :nomatch re "xxfooxxbar") (re-test '((3 . 10)) re "yyyfootbar") (setq re (re-comp "a.*b.*c")) (re-test '((0 . 3)) re "abc") (re-test '((9 . 18)) re "xxxxxxxxxabbbbbbbccaaaaabbbc") (setq re (re-comp "a.+b.*c")) (re-test :nomatch re "xxxabc") (re-test '((2 . 7)) re "xxaxbbc") (setq re (re-comp "a.+b.?c")) (re-test '((1 . 5)) re "xaabc") (re-test '((2 . 7)) re "xxaabbc") (setq re (re-comp "(foo.*|bar)fee")) (re-test '((3 . 9) (3 . 6)) re "barfoofee" :count 2) (re-test '((0 . 9) (0 . 6)) re "foobarfee" :count 2) (re-test '((4 . 10) (4 . 7)) re "xxfobarfee" :count 2) (re-test '((3 . 17) (3 . 14)) re "barfooooooobarfee" :count 2) (re-test '((4 . 10) (4 . 7)) re "xxfobarfeefoobar" :count 2) (setq re (re-comp "(foo.+|bar)fee")) (re-test :nomatch re "barfoofee" :count 2) (re-test '((3 . 10) (3 . 7)) re "barfooxfee" :count 2) (setq re (re-comp "(foo.?|bar)fee")) (re-test :nomatch re "foobar" :count 2) (re-test '((2 . 8) (2 . 5)) re "bafoofee" :count 2) (re-test '((2 . 9) (2 . 6)) re "bafooofeebarfee" :count 4) (re-test '((2 . 8) (2 . 5)) re "bafoofeebarfee" :count 2) (re-test nil re "bafoofeebarfee" :count 0) (re-test '((2 . 8)) re "bafoofeebarfee" :count 1) (setq re (re-comp "(a|b|c)\\1")) (re-test '((0 . 2) (0 . 1)) re "aa" :count 2) (setq re (re-comp "(a|b|c)(a|b|c)\\1\\2")) (re-test '((0 . 4) (0 . 1) (1 . 2)) re "acac" :count 5) (re-test '((4 . 8) (4 . 5) (5 . 6)) re "xxxxacac" :count 4) (re-test '((24 . 28) (24 . 25) (25 . 26)) re "xxacabacbcacbbacbcaaccabcaca" :count 3) (re-test '((4 . 8) (4 . 5) (5 . 6)) re "xyabcccc" :count 3) (re-test '((4 . 8) (4 . 5)) re "xyabcccc" :count 2) (re-test '((4 . 8)) re "xyabcccc" :count 1) (re-test nil re "xyabcccc" :count 0) (setq re (re-comp "(a*b)\\1")) (re-test '((3 . 15) (3 . 9)) re "xxxaaaaabaaaaab" :count 2) (re-test '((7 . 9) (7 . 8)) re "abaabaxbb" :count 2) (setq re (re-comp "(ab+c)\\1")) (re-test '((3 . 13) (3 . 8)) re "xaaabbbcabbbc" :count 3) (setq re (re-comp "(ab?c)\\1")) (re-test :nomatch re "abcac" :count 2) (re-test '((4 . 8) (4 . 6)) re "acabacac" :count 2) (re-test '((5 . 11) (5 . 8)) re "abcacabcabc" :count 2) (re-test '((3 . 7) (3 . 5)) re "abcacac" :count 2) (setq re (re-comp "a(.*)b\\1")) (re-test '((3 . 5) (4 . 4)) re "xxxab" :count 2) (re-test '((4 . 12) (5 . 8)) re "xxxxazzzbzzz" :count 2) (setq re (re-comp "abc" :icase t)) (re-test '((0 . 3)) re "AbC") (setq re (re-comp "[0-9][a-z]+" :icase t)) (re-test '((3 . 10)) re "xxx0aaZxYT9") (setq re (re-comp "a.b" :icase t)) (re-test '((10 . 13)) re "aaaaaaaaaaaxB") (setq re (re-comp "a.*z" :icase t)) (re-test '((3 . 9)) re "xxxAaaaaZ") (re-test '((2 . 6)) re "xxaaaZaaa") (setq re (re-comp "\\<(lambda|defun|defmacro)\\>" :icase t)) (re-test '((5 . 11)) re " (lambda") (re-test '((5 . 11) (5 . 11)) re " (lambda" :count 2) (re-test :nomatch re "lamda defunn deffmacro") (setq re (re-comp "\\<(nil|t)\\>" :icase t)) (re-test '((3 . 6)) re "it Nil") (re-test '((3 . 6) (3 . 6)) re "it Nil" :count 6) (re-test :nomatch re "nilo") (setq re (re-comp "\\<(begin|end)\\>" :icase t)) (re-test '((21 . 24) (21 . 24)) re "beginning the ending EnD" :count 7) (setq re (re-comp "a.*" :newline t)) (re-test '((0 . 1)) re "a aaa") (re-test '((3 . 4)) re "xyza aa") (setq re (re-comp "a.+" :newline t)) (re-test '((2 . 5)) re "a aaa") (re-test '((5 . 7)) re "xyza aa") (setq re (re-comp "a.?" :newline t)) (re-test '((0 . 1)) re "a aaa") (re-test '((3 . 4)) re "xyza aa") (setq re (re-comp "a.*b.*c" :newline t)) (re-test '((11 . 14)) re "xxaa zyacb abc") (re-test '((6 . 9)) re "xxxab abc c") (setq re (re-comp "a.+b.*c" :newline t)) (re-test '((6 . 10)) re "ab bc abbc") (setq re (re-comp "a.?b.*c" :newline t)) (re-test '((4 . 8)) re "ab cabbc cc") (setq re (re-comp "^foo$" :newline t)) (re-test '((11 . 14)) re "bar foobar foo") (re-test '((0 . 3)) re "foo bar foo bar") (re-test '((8 . 11)) re "foo bar foo bar" :notbol t) (re-test '((8 . 11)) re "foo bar foo" :notbol t) (re-test :nomatch re "foo bar foo" :notbol t :noteol t) (setq re (re-comp "^\\s*#\\s*(define|include)\\s+.+" :newline t)) (re-test '((8 . 18)) re "#define #include x") (re-test '((8 . 18) (9 . 16)) re "#define #include x" :count 2) (setq re (re-comp "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")) (re-test '((3 . 259)) re "zzzxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzzz") (setq re (re-comp "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~")) (re-test '((13 . 333)) re "String here: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~/") (setq re (re-comp "(.*)\\D(\\d+)")) (re-test '((0 . 6) (0 . 3) (4 . 6)) re "abcW12" :count 3) (re-test '((0 . 6) (0 . 3)) re "abcW12" :count 2) (re-test '((0 . 6)) re "abcW12" :count 1) (re-test nil re "abcW12" :count 0) (re-test '((0 . 6) (0 . 3) (4 . 6)) re "abcW12abcW12" :count 3) (re-test '((0 . 6) (0 . 3) (4 . 6)) re "abcW12abcW12a" :count 3) (setq re (re-comp ".*\\d")) (re-test '((0 . 2)) re "a1a1a1aaaaaaa") ; minimal match only (setq re (re-comp "(.*)\\d")) (re-test '((0 . 2) (0 . 1)) re "a1a1a1aaaaaaa" :count 2); minimal match only (setq re (re-comp ".*(\\d)")) (re-test '((0 . 2) (1 . 2)) re "a1a1a1aaaaaaa" :count 2); minimal match only ;; XXX this very simple pattern was entering an infinite loop ;; actually, this pattern is not supported, just test if is not ;; crashing (not supported because it is not cheap to match variations ;; of the pattern) (setq re (re-comp "(.*a)?")) (re-test '((0 . 1)) re "aaaa") ; expected, minimal match (re-test '((0 . 1) (0 . 1)) re "aaaa" :count 2) ;; Tue Dec 11 22:22:51 BRST 2007 Fix a regression with the pattern below ;; returning a match to an empty string. ;; Note that inverting the order of the "alternatives" works with the ;; versions of libre prior to this (one line) fix (setq re (re-comp "\\\\\\d{3}|\\\\.")) (re-test :nomatch re "\\") ;; previous version should work with the pattern inverted (setq re (re-comp "\\\\.|\\\\\\d{3}")) (re-test :nomatch re "\\") x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/test/psql-2.lsp0000664000000000000000000000445312472175711017107 0ustar ;; Postgresql C library interface, example program 2, using the xedit ;; lisp interface ;; Test of the asynchronous notification interface ;; ;; Start this program, then from psql in another window do ;; NOTIFY TBL2; ;; ;; Or, if you want to get fancy, try this: ;; Populate a database with the following: ;; ;; CREATE TABLE TBL1 (i int4); ;; ;; CREATE TABLE TBL2 (i int4); ;; ;; CREATE RULE r1 AS ON INSERT TO TBL1 DO ;; (INSERT INTO TBL2 values (new.i); NOTIFY TBL2); ;; ;; and do ;; ;; INSERT INTO TBL1 values (10); (require "psql") (defun exit-nicely (conn) (pq-finish conn) (quit 1) ) ;; begin, by setting the parameters for a backend connection if the ;; parameters are null, then the system will try to use reasonable ;; defaults by looking up environment variables or, failing that, ;; using hardwired constants (setq pghost nil) ; host name of the backend server (setq pgport nil) ; port of the backend server (setq pgoptions nil) ; special options to start up the backend server (setq pgtty nil) ; debugging tty for the backend server (setq pgdbname "test") ; change this to the name of your test database ;; XXX Note: getenv not yet implemented in the ; lisp interpreter ;; make a connection to the database (setq conn (pq-setdb pghost pgport pgoptions pgtty pgdbname)) ;; check to see that the backend connection was successfully made (when (= (pq-status conn) pg-connection-bad) (format t "Connection to database '~A' failed.~%" pgdbname) (format t "~A" (pq-error-message conn)) (exit-nicely conn)) (setq res (pq-exec conn "LISTEN TBL2")) (when (= (pq-status conn) pg-connection-bad) (format t "LISTEN command failed~%") (format t "~A" (pq-error-message conn)) (exit-nicely conn)) ;; Should PQclear PGresult whenever it is no longer needed to avoid memory leaks (pq-clear res) (loop ;; wait a little bit between checks; waiting with select() ;; would be more efficient. ;; XXX Note: sleep not yet implemented in the lisp interpreter ;; collect any asynchronous backend messages (pq-consume-input conn) ;; check for asynchronous notify messages (when (setq notifies (pq-notifies conn)) (format t "ASYNC NOTIFY of '~A' from backend pid '~D' received~%" (pg-notify-relname notifies) (pg-notify-be-pid notifies)) ) ) (pq-finish conn) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/test/list.lsp0000664000000000000000000017344112472175711016750 0ustar ;; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/test/list.lsp,v 1.5 2002/11/26 04:06:30 paulo Exp $ ;; ;; basic lisp function tests ;; Most of the tests are just the examples from the ;; ;; Common Lisp HyperSpec (TM) ;; Copyright 1996-2001, Xanalys Inc. All rights reserved. ;; ;; Some tests are hand crafted, to test how the interpreter treats ;; uncommon arguments or special conditions #| MAJOR PROBLEMS: o NIL and T should be always treated as symbols, actually it is legal to say (defun nil (...) ...) o There aren't true uninterned symbols, there are only symbols that did not yet establish the home package, but once one is created, an interned symbol is always returned. |# (defun compare-test (test expect function arguments &aux result (error t) unused error-value) (multiple-value-setq (unused error-value) (ignore-errors (setq result (apply function arguments)) (setq error nil) ) ) (if error (format t "ERROR: (~S~{ ~S~}) => ~S~%" function arguments error-value) (or (funcall test result expect) (format t "(~S~{ ~S~}) => should be ~S not ~S~%" function arguments expect result ) ) ) ) (defun compare-eval (test expect form &aux result (error t) unused error-value) (multiple-value-setq (unused error-value) (ignore-errors (setq result (eval form)) (setq error nil) ) ) (if error (format t "ERROR: ~S => ~S~%" form error-value) (or (funcall test result expect) (format t "~S => should be ~S not ~S~%" form expect result ) ) ) ) (defun error-test (function &rest arguments &aux result (error t)) (ignore-errors (setq result (apply function arguments)) (setq error nil) ) (or error (format t "ERROR: no error for (~S~{ ~S~}), result was ~S~%" function arguments result) ) ) (defun error-eval (form &aux result (error t)) (ignore-errors (setq result (eval form)) (setq error nil) ) (or error (format t "ERROR: no error for ~S, result was ~S~%" form result) ) ) (defun eq-test (expect function &rest arguments) (compare-test #'eq expect function arguments)) (defun eql-test (expect function &rest arguments) (compare-test #'eql expect function arguments)) (defun equal-test (expect function &rest arguments) (compare-test #'equal expect function arguments)) (defun equalp-test (expect function &rest arguments) (compare-test #'equalp expect function arguments)) (defun eq-eval (expect form) (compare-eval #'eq expect form)) (defun eql-eval (expect form) (compare-eval #'eql expect form)) (defun equal-eval (expect form) (compare-eval #'equal expect form)) (defun equalp-eval (expect form) (compare-eval #'equalp expect form)) ;; clisp treats strings loaded from a file as constants (defun xseq (sequence) #+clisp (if *load-pathname* (copy-seq sequence) sequence) #-clisp sequence ) ;; apply - function (equal-test '((+ 2 3) . 4) #'apply 'cons '((+ 2 3) 4)) (eql-test -1 #'apply #'- '(1 2)) (eql-test 7 #'apply #'max 3 5 '(2 7 3)) (error-test #'apply #'+ 1) (error-test #'apply #'+ 1 2) (error-test #'apply #'+ 1 . 2) (error-test #'apply #'+ 1 2 3) (error-test #'apply #'+ 1 2 . 3) (eql-test 6 #'apply #'+ 1 2 3 ()) ;; eq - function (eq-eval t '(let* ((a #\a) (b a)) (eq a b))) (eq-test t #'eq 'a 'a) (eq-test nil #'eq 'a 'b) (eq-eval t '(eq #1=1 #1#)) (eq-test nil #'eq "abc" "abc") (setq a '('x #c(1 2) #\z)) (eq-test nil #'eq a (copy-seq a)) ;; eql - function (eq-test t #'eql 1 1) (eq-test t #'eql 1.3d0 1.3d0) (eq-test nil #'eql 1 1d0) (eq-test t #'eql #c(1 -5) #c(1 -5)) (eq-test t #'eql 'a 'a) (eq-test nil #'eql :a 'a) (eq-test t #'eql #c(5d0 0) 5d0) (eq-test nil #'eql #c(5d0 0d0) 5d0) (eq-test nil #'eql "abc" "abc") (equal-eval '(1 5/6 #p"test" #\#) '(setq a '(1 5/6 #p"test" #\#))) (eq-test nil #'eql a (copy-seq a)) (setf hash0 (make-hash-table) hash1 (make-hash-table) (gethash 1 hash0) 2 (gethash 1 hash1) 2 (gethash :foo hash0) :bar (gethash :foo hash1) :bar ) (defstruct test a b c) (setq struc0 (make-test :a 1 :b 2 :c #\c) struc1 (make-test :a 1 :b 2 :c #\c) ) ;; equal - function (eq-test t #'equal "abc" "abc") (eq-test t #'equal 1 1) (eq-test t #'equal #c(1 2) #c(1 2)) (eq-test nil #'equal #c(1 2) #c(1 2d0)) (eq-test t #'equal #\A #\A) (eq-test nil #'equal #\A #\a) (eq-test nil #'equal "abc" "Abc") (equal-eval '(1 2 3/5 #\a) '(setq a '(1 2 3/5 #\a))) (eq-test t #'equal a (copy-seq a)) (eq-test nil #'equal hash0 hash1) (eq-test nil #'equal struc0 struc1) (eq-test nil #'equal #(1 2 3 4) #(1 2 3 4)) ;; equalp - function (eq-test t #'equalp hash0 hash1) (setf (gethash 2 hash0) "FoObAr" (gethash 2 hash1) "fOoBaR" ) (eq-test t #'equalp hash0 hash1) (setf (gethash 3 hash0) 3 (gethash 3d0 hash1) 3 ) (eq-test nil #'equalp hash0 hash1) (eq-test t #'equalp struc0 struc1) (setf (test-a struc0) #\a (test-a struc1) #\A ) (eq-test t #'equalp struc0 struc1) (setf (test-b struc0) 'test (test-b struc1) :test ) (eq-test nil #'equalp struc0 struc1) (eq-test t #'equalp #c(1/2 1d0) #c(0.5d0 1)) (eq-test t #'equalp 1 1d0) (eq-test t #'equalp #(1 2 3 4) #(1 2 3 4)) (eq-test t #'equalp #(1 #\a 3 4d0) #(1 #\A 3 4)) ;; acons - function (equal-test '((1 . "one")) #'acons 1 "one" nil) (equal-test '((2 . "two") (1 . "one")) #'acons 2 "two" '((1 . "one"))) ;; adjoin - function (equal-test '(nil) #'adjoin nil nil) (equal-test '(a) #'adjoin 'a nil) (equal-test '(1 2 3) #'adjoin 1 '(1 2 3)) (equal-test '(1 2 3) #'adjoin 2 '(1 2 3)) (equal-test '((1) (1) (2) (3)) #'adjoin '(1) '((1) (2) (3))) (equal-test '((1) (2) (3)) #'adjoin '(1) '((1) (2) (3)) :key #'car) (error-test #'adjoin nil 1) ;; alpha-char-p - function (eq-test t #'alpha-char-p #\a) (eq-test nil #'alpha-char-p #\5) (error-test #'alpha-char-p 'a) ;; alphanumericp - function (eq-test t #'alphanumericp #\Z) (eq-test t #'alphanumericp #\8) (eq-test nil #'alphanumericp #\#) ;; and - macro (eql-eval 1 '(setq temp1 1 temp2 1 temp3 1)) (eql-eval 2 '(and (incf temp1) (incf temp2) (incf temp3))) (eq-eval t '(and (eql 2 temp1) (eql 2 temp2) (eql 2 temp3))) (eql-eval 1 '(decf temp3)) (eq-eval nil '(and (decf temp1) (decf temp2) (eq temp3 'nil) (decf temp3))) (eq-eval t '(and (eql temp1 temp2) (eql temp2 temp3))) (eq-eval t '(and)) (equal-eval '(1 2 3) '(multiple-value-list (and (values 'a) (values 1 2 3)))) (equal-eval nil '(and (values) t)) ;; append - function (equal-test '(a b c d e f g) #'append '(a b c) '(d e f) '() '(g)) (equal-test '(a b c . d) #'append '(a b c) 'd) (eq-test nil #'append) (eql-test 'a #'append nil 'a) (error-test #'append 1 2) ;; assoc - function (equal-test '(1 . "one") #'assoc 1 '((2 . "two") (1 . "one"))) (equal-test '(2 . "two") #'assoc 2 '((1 . "one") (2 . "two"))) (eq-test nil #'assoc 1 nil) (equal-test '(2 . "two") #'assoc-if #'evenp '((1 . "one") (2 . "two"))) (equal-test '(3 . "three") #'assoc-if-not #'(lambda(x) (< x 3)) '((1 . "one") (2 . "two") (3 . "three"))) (equal-test '("two" . 2) #'assoc #\o '(("one" . 1) ("two" . 2) ("three" . 3)) :key #'(lambda (x) (char x 2))) (equal-test '(a . b) #'assoc 'a '((x . a) (y . b) (a . b) (a . c))) ;; atom - function (eq-test t #'atom 1) (eq-test t #'atom '()) (eq-test nil #'atom '(1)) (eq-test t #'atom 'a) ;; block - special operator (eq-eval nil '(block empty)) (eql-eval 2 '(let ((x 1)) (block stop (setq x 2) (return-from stop) (setq x 3)) x)) (eql-eval 2 '(block twin (block twin (return-from twin 1)) 2)) ;; both-case-p - function (eq-test t #'both-case-p #\a) (eq-test nil #'both-case-p #\1) ;; boundp - function (eql-eval 1 '(setq x 1)) (eq-test t #'boundp 'x) (makunbound 'x) (eq-test nil #'boundp 'x) (eq-eval nil '(let ((x 1)) (boundp 'x))) (error-test #'boundp 1) ;; butlast, nbutlast - function (setq x '(1 2 3 4 5 6 7 8 9)) (equal-test '(1 2 3 4 5 6 7 8) #'butlast x) (equal-eval '(1 2 3 4 5 6 7 8 9) 'x) (eq-eval nil '(nbutlast x 9)) (equal-test '(1) #'nbutlast x 8) (equal-eval '(1) 'x) (eq-test nil #'butlast nil) (eq-test nil #'nbutlast '()) (error-test #'butlast 1 2) (error-test #'butlast -1 '(1 2)) ;; car, cdr, caar ... - function (eql-test 1 #'car '(1 2)) (eql-test 2 #'cdr '(1 . 2)) (eql-test 1 #'caar '((1 2))) (eql-test 2 #'cadr '(1 2)) (eql-test 2 #'cdar '((1 . 2))) (eql-test 3 #'cddr '(1 2 . 3)) (eql-test 1 #'caaar '(((1 2)))) (eql-test 2 #'caadr '(1 (2 3))) (eql-test 2 #'cadar '((1 2) 2 3)) (eql-test 3 #'caddr '(1 2 3 4)) (eql-test 2 #'cdaar '(((1 . 2)) 3)) (eql-test 3 #'cdadr '(1 (2 . 3) 4)) (eql-test 3 #'cddar '((1 2 . 3) 3)) (eql-test 4 #'cdddr '(1 2 3 . 4)) (eql-test 1 #'caaaar '((((1 2))))) (eql-test 2 #'caaadr '(1 ((2)))) (eql-test 2 #'caadar '((1 (2)) 3)) (eql-test 3 #'caaddr '(1 2 (3 4))) (eql-test 2 #'cadaar '(((1 2)) 3)) (eql-test 3 #'cadadr '(1 (2 3) 4)) (eql-test 3 #'caddar '((1 2 3) 4)) (eql-test 4 #'cadddr '(1 2 3 4 5)) (eql-test 2 #'cdaaar '((((1 . 2))) 3)) (eql-test 3 #'cdaadr '(1 ((2 . 3)) 4)) (eql-test 3 #'cdadar '((1 (2 . 3)) 4)) (eql-test 4 #'cdaddr '(1 2 (3 . 4) 5)) (eql-test 3 #'cddaar '(((1 2 . 3)) 4)) (eql-test 4 #'cddadr '(1 (2 3 . 4) 5)) (eql-test 4 #'cdddar '((1 2 3 . 4) 5)) (eql-test 5 #'cddddr '(1 2 3 4 . 5)) ;; first ... tenth, rest - function (eql-test 2 #'rest '(1 . 2)) (eql-test 1 #'first '(1 2)) (eql-test 2 #'second '(1 2 3)) (eql-test 2 #'second '(1 2 3)) (eql-test 3 #'third '(1 2 3 4)) (eql-test 4 #'fourth '(1 2 3 4 5)) (eql-test 5 #'fifth '(1 2 3 4 5 6)) (eql-test 6 #'sixth '(1 2 3 4 5 6 7)) (eql-test 7 #'seventh '(1 2 3 4 5 6 7 8)) (eql-test 8 #'eighth '(1 2 3 4 5 6 7 8 9)) (eql-test 9 #'ninth '(1 2 3 4 5 6 7 8 9 10)) (eql-test 10 #'tenth '(1 2 3 4 5 6 7 8 9 10 11)) (error-test #'car 1) (error-test #'car #c(1 2)) (error-test #'car #(1 2)) ;; case - macro (eql-eval t '(let ((a 1)) (case a ((4 5 6) nil) ((3 2 1) t) (otherwise :error)))) (eql-eval t '(let ((a 1)) (case a ((3 2) nil) (1 t) (t :error)))) (error-eval '(let ((a 1)) (case a (2 :error) (t nil) (otherwise t)))) (error-eval '(let ((a 1)) (case a (2 :error) (otherwise t) (t nil)))) ;; catch - special operator (eql-eval 3 '(catch 'dummy-tag 1 2 (throw 'dummy-tag 3) 4)) (eql-eval 4 '(catch 'dummy-tag 1 2 3 4)) (eq-eval 'throw-back '(defun throw-back (tag) (throw tag t))) (eq-eval t '(catch 'dummy-tag (throw-back 'dummy-tag) 2)) ;; char - function (eql-test #\a #'char "abc" 0) (eql-test #\b #'char "abc" 1) (error-test #'char "abc" 3) ;; char-* - function (eq-test nil #'alpha-char-p #\3) (eq-test t #'alpha-char-p #\y) (eql-test #\a #'char-downcase #\a) (eql-test #\a #'char-downcase #\a) (eql-test #\1 #'char-downcase #\1) (error-test #'char-downcase 1) (eql-test #\A #'char-upcase #\a) (eql-test #\A #'char-upcase #\A) (eql-test #\1 #'char-upcase #\1) (error-test #'char-upcase 1) (eq-test t #'lower-case-p #\a) (eq-test nil #'lower-case-p #\A) (eq-test t #'upper-case-p #\W) (eq-test nil #'upper-case-p #\w) (eq-test t #'both-case-p #\x) (eq-test nil #'both-case-p #\%) (eq-test t #'char= #\d #\d) (eq-test t #'char-equal #\d #\d) (eq-test nil #'char= #\A #\a) (eq-test t #'char-equal #\A #\a) (eq-test nil #'char= #\d #\x) (eq-test nil #'char-equal #\d #\x) (eq-test nil #'char= #\d #\D) (eq-test t #'char-equal #\d #\D) (eq-test nil #'char/= #\d #\d) (eq-test nil #'char-not-equal #\d #\d) (eq-test nil #'char/= #\d #\d) (eq-test nil #'char-not-equal #\d #\d) (eq-test t #'char/= #\d #\x) (eq-test t #'char-not-equal #\d #\x) (eq-test t #'char/= #\d #\D) (eq-test nil #'char-not-equal #\d #\D) (eq-test t #'char= #\d #\d #\d #\d) (eq-test t #'char-equal #\d #\d #\d #\d) (eq-test nil #'char= #\d #\D #\d #\d) (eq-test t #'char-equal #\d #\D #\d #\d) (eq-test nil #'char/= #\d #\d #\d #\d) (eq-test nil #'char-not-equal #\d #\d #\d #\d) (eq-test nil #'char/= #\d #\d #\D #\d) (eq-test nil #'char-not-equal #\d #\d #\D #\d) (eq-test nil #'char= #\d #\d #\x #\d) (eq-test nil #'char-equal #\d #\d #\x #\d) (eq-test nil #'char/= #\d #\d #\x #\d) (eq-test nil #'char-not-equal #\d #\d #\x #\d) (eq-test nil #'char= #\d #\y #\x #\c) (eq-test nil #'char-equal #\d #\y #\x #\c) (eq-test t #'char/= #\d #\y #\x #\c) (eq-test t #'char-not-equal #\d #\y #\x #\c) (eq-test nil #'char= #\d #\c #\d) (eq-test nil #'char-equal #\d #\c #\d) (eq-test nil #'char/= #\d #\c #\d) (eq-test nil #'char-not-equal #\d #\c #\d) (eq-test t #'char< #\d #\x) (eq-test t #'char-lessp #\d #\x) (eq-test t #'char-lessp #\d #\X) (eq-test t #'char-lessp #\D #\x) (eq-test t #'char-lessp #\D #\X) (eq-test t #'char<= #\d #\x) (eq-test t #'char-not-greaterp #\d #\x) (eq-test t #'char-not-greaterp #\d #\X) (eq-test t #'char-not-greaterp #\D #\x) (eq-test t #'char-not-greaterp #\D #\X) (eq-test nil #'char< #\d #\d) (eq-test nil #'char-lessp #\d #\d) (eq-test nil #'char-lessp #\d #\D) (eq-test nil #'char-lessp #\D #\d) (eq-test nil #'char-lessp #\D #\D) (eq-test t #'char<= #\d #\d) (eq-test t #'char-not-greaterp #\d #\d) (eq-test t #'char-not-greaterp #\d #\D) (eq-test t #'char-not-greaterp #\D #\d) (eq-test t #'char-not-greaterp #\D #\D) (eq-test t #'char< #\a #\e #\y #\z) (eq-test t #'char-lessp #\a #\e #\y #\z) (eq-test t #'char-lessp #\a #\e #\y #\Z) (eq-test t #'char-lessp #\a #\E #\y #\z) (eq-test t #'char-lessp #\A #\e #\y #\Z) (eq-test t #'char<= #\a #\e #\y #\z) (eq-test t #'char-not-greaterp #\a #\e #\y #\z) (eq-test t #'char-not-greaterp #\a #\e #\y #\Z) (eq-test t #'char-not-greaterp #\A #\e #\y #\z) (eq-test nil #'char< #\a #\e #\e #\y) (eq-test nil #'char-lessp #\a #\e #\e #\y) (eq-test nil #'char-lessp #\a #\e #\E #\y) (eq-test nil #'char-lessp #\A #\e #\E #\y) (eq-test t #'char<= #\a #\e #\e #\y) (eq-test t #'char-not-greaterp #\a #\e #\e #\y) (eq-test t #'char-not-greaterp #\a #\E #\e #\y) (eq-test t #'char> #\e #\d) (eq-test t #'char-greaterp #\e #\d) (eq-test t #'char-greaterp #\e #\D) (eq-test t #'char-greaterp #\E #\d) (eq-test t #'char-greaterp #\E #\D) (eq-test t #'char>= #\e #\d) (eq-test t #'char-not-lessp #\e #\d) (eq-test t #'char-not-lessp #\e #\D) (eq-test t #'char-not-lessp #\E #\d) (eq-test t #'char-not-lessp #\E #\D) (eq-test t #'char> #\d #\c #\b #\a) (eq-test t #'char-greaterp #\d #\c #\b #\a) (eq-test t #'char-greaterp #\d #\c #\b #\A) (eq-test t #'char-greaterp #\d #\c #\B #\a) (eq-test t #'char-greaterp #\d #\C #\b #\a) (eq-test t #'char-greaterp #\D #\C #\b #\a) (eq-test t #'char>= #\d #\c #\b #\a) (eq-test t #'char-not-lessp #\d #\c #\b #\a) (eq-test t #'char-not-lessp #\d #\c #\b #\A) (eq-test t #'char-not-lessp #\D #\c #\b #\a) (eq-test t #'char-not-lessp #\d #\C #\B #\a) (eq-test nil #'char> #\d #\d #\c #\a) (eq-test nil #'char-greaterp #\d #\d #\c #\a) (eq-test nil #'char-greaterp #\d #\d #\c #\A) (eq-test nil #'char-greaterp #\d #\D #\c #\a) (eq-test nil #'char-greaterp #\d #\D #\C #\a) (eq-test t #'char>= #\d #\d #\c #\a) (eq-test t #'char-not-lessp #\d #\d #\c #\a) (eq-test t #'char-not-lessp #\d #\D #\c #\a) (eq-test t #'char-not-lessp #\D #\d #\c #\a) (eq-test t #'char-not-lessp #\D #\D #\c #\A) (eq-test nil #'char> #\e #\d #\b #\c #\a) (eq-test nil #'char-greaterp #\e #\d #\b #\c #\a) (eq-test nil #'char-greaterp #\E #\d #\b #\c #\a) (eq-test nil #'char-greaterp #\e #\D #\b #\c #\a) (eq-test nil #'char-greaterp #\E #\d #\B #\c #\A) (eq-test nil #'char>= #\e #\d #\b #\c #\a) (eq-test nil #'char-not-lessp #\e #\d #\b #\c #\a) (eq-test nil #'char-not-lessp #\e #\d #\b #\c #\A) (eq-test nil #'char-not-lessp #\E #\d #\B #\c #\a) ;; char-code - function ;; XXX assumes ASCII (eql-test 49 #'char-code #\1) (eql-test 90 #'char-code #\Z) (eql-test 127 #'char-code #\Delete) (eql-test 27 #'char-code #\Escape) (eql-test 13 #'char-code #\Return) (eql-test 0 #'char-code #\Null) (eql-test 10 #'char-code #\Newline) (error-test #'char-code 65) ;; character - function (eql-test #\a #'character #\a) (eql-test #\a #'character "a") (eql-test #\A #'character 'a) ;; XXX assumes ASCII, and should be allowed to fail? (eql-test #\A #'character 65) (error-test #'character 1/2) (error-test #'character "abc") (error-test #'character :test) (eq-test #\T #'character t) (error-test #'character nil) ;; characterp - function (eq-test t #'characterp #\a) (eq-test nil #'characterp 1) (eq-test nil #'characterp 1/2) (eq-test nil #'characterp 'a) (eq-test nil #'characterp '`a) ;; TODO coerce ;; cond - macro (eql-eval 2 '(let ((a 1)) (cond ((= a 2) 1) ((= a 1) 2) ((= a 0) 1) (t nil)))) (eql-eval nil '(let ((a 1)) (cond ((= a 2) 1) (t nil) ((= a 1) 2) ((= a 0) 1)))) ;; consp - function (predicate) (eq-test t #'consp '(1 2)) (eq-test t #'consp '(1 . 2)) (eq-test nil #'consp nil) (eq-test nil #'consp 1) ;; constantp - function (predicate) (eq-test t #'constantp 1) (eq-test t #'constantp #\x) (eq-test t #'constantp :test) (eq-test nil #'constantp 'test) (eq-test t #'constantp ''1) (eq-test t #'constantp '(quote 1)) (eq-test t #'constantp "string") (eq-test t #'constantp #c(1 2)) (eq-test t #'constantp #(1 2)) (eq-test nil #'constantp #p"test") (eq-test nil #'constantp '(1 2)) (eq-test nil #'constantp (make-hash-table)) (eq-test nil #'constantp *package*) (eq-test nil #'constantp *standard-input*) ;; copy-list, copy-alist and copy-tree - function (equal-test '(1 2) #'copy-list '(1 2)) (equal-test '(1 . 2) #'copy-list '(1 . 2)) (eq-test nil #'copy-list nil) (error-test #'copy-list 1) (equal-eval '(1 (2 3)) '(setq x '(1 (2 3)))) (equal-eval x '(setq y (copy-list x))) (equal-test '("one" (2 3)) #'rplaca x "one") (eql-test 1 #'car y) (equal-test '("two" 3) #'rplaca (cadr x) "two") (eq-test (caadr x) #'caadr y) (equal-eval '(1 (2 3) 4) '(setq a '(1 (2 3) 4) b (copy-list a))) (eq-eval t '(eq (cadr a) (cadr b))) (eq-eval t '(eq (car a) (car b))) (setq a '(1 (2 3) 4) b (copy-alist a)) (eq-eval nil '(eq (cadr a) (cadr b))) (eq-eval t '(eq (car a) (car b))) (eq-test nil #'copy-alist nil) (eq-test nil #'copy-list nil) (error-test #'copy-list 1) (setq a '(1 (2 (3)))) (setq as-list (copy-list a)) (setq as-alist (copy-alist a)) (setq as-tree (copy-tree a)) (eq-eval t '(eq (cadadr a) (cadadr as-list))) (eq-eval t '(eq (cadadr a) (cadadr as-alist))) (eq-eval nil '(eq (cadadr a) (cadadr as-tree))) ;; decf - macro (setq n 2) (eql-eval 1 '(decf n)) (eql-eval 1 'n) (setq n -2147483648) (eql-eval -2147483649 '(decf n)) (eql-eval -2147483649 'n) (setq n 0) (eql-eval -0.5d0 '(decf n 0.5d0)) (eql-eval -0.5d0 'n) (setq n 1) (eql-eval 1/2 '(decf n 1/2)) (eql-eval 1/2 'n) ;; delete and remove - function (setq a '(1 3 4 5 9) b a) (equal-test '(1 3 5 9) #'remove 4 a) (eq-eval t '(eq a b)) (setq a (delete 4 a)) (equal-eval '(1 3 5 9) 'a) (setq a '(1 2 4 1 3 4 5) b a) (equal-test '(1 2 1 3 5) #'remove 4 a) (eq-eval t '(eq a b)) (equal-test '(1 2 1 3 4 5) #'remove 4 a :count 1) (eq-eval t '(eq a b)) (equal-test '(1 2 4 1 3 5) #'remove 4 a :count 1 :from-end t) (eq-eval t '(eq a b)) (equal-test '(4 3 4 5) #'remove 3 a :test #'>) (eq-eval t '(eq a b)) (setq a (delete 4 '(1 2 4 1 3 4 5))) (equal-eval '(1 2 1 3 5) 'a) (setq a (delete 4 '(1 2 4 1 3 4 5) :count 1)) (equal-eval '(1 2 1 3 4 5) 'a) (setq a (delete 4 '(1 2 4 1 3 4 5) :count 1 :from-end t)) (equal-eval '(1 2 4 1 3 5) 'a) (equal-test "abc" #'delete-if #'digit-char-p "a1b2c3") (equal-test "123" #'delete-if-not #'digit-char-p "a1b2c3") (eq-test nil #'delete 1 nil) (eq-test nil #'remove 1 nil) (setq a '(1 2 3 4 :test 5 6 7 8) b a) (equal-test '(1 2 :test 7 8) #'remove-if #'numberp a :start 2 :end 7) (eq-eval t '(eq a b)) (setq a (delete-if #'numberp a :start 2 :end 7)) (equal-eval '(1 2 :test 7 8) 'a) ;; digit-char - function (eql-test #\0 #'digit-char 0) (eql-test #\A #'digit-char 10 11) (eq-test nil #'digit-char 10 10) (eql-test 35 #'digit-char-p #\z 36) (error-test #'digit-char #\a) (error-test #'digit-char-p 1/2) ;; TODO directory (known to have problems with parameters like "../*/../*/") ;; elt - function (eql-test #\a #'elt "xabc" 1) (eql-test 3 #'elt '(0 1 2 3) 3) (error-test #'elt nil 0) ;; endp - function (eql-test t #'endp nil) (error-test #'endp t) (eql-test nil #'endp '(1 . 2)) (error-test #'endp #(1 2)) ;; every - function (eql-test t #'every 'not-used ()) (eql-test t #'every #'characterp "abc") (eql-test nil #'every #'< '(1 2 3) '(4 5 6) #(7 8 -1)) (eql-test t #'every #'< '(1 2 3) '(4 5 6) #(7 8)) ;; fboundp and fmakunbound - function (eq-test t #'fboundp 'car) (eq-eval 'test '(defun test ())) (eq-test t #'fboundp 'test) (eq-test 'test #'fmakunbound 'test) (eq-test nil #'fboundp 'test) (eq-eval 'test '(defmacro test (x) x)) (eq-test t #'fboundp 'test) (eq-test 'test #'fmakunbound 'test) ;; fill - function (setq x (list 1 2 3 4)) (equal-test '((4 4 4 4) (4 4 4 4) (4 4 4 4) (4 4 4 4)) #'fill x '(4 4 4 4)) (eq-eval t '(eq (car x) (cadr x))) (equalp-test '#(a z z d e) #'fill '#(a b c d e) 'z :start 1 :end 3) (equal-test "012ee" #'fill (xseq "01234") #\e :start 3) (error-test #'fill 1 #\a) ;; find - function (eql-test #\Space #'find #\d "here are some letters that can be looked at" :test #'char>) (eql-test 3 #'find-if #'oddp '(1 2 3 4 5) :end 3 :from-end t) (eq-test nil #'find-if-not #'complexp '#(3.5 2 #C(1.0 0.0) #C(0.0 1.0)) :start 2) (eq-test nil #'find 1 "abc") (error-test #'find 1 #c(1 2)) ;; find-symbol - function (equal-eval '(nil nil) '(multiple-value-list (find-symbol "NEVER-BEFORE-USED"))) (equal-eval '(nil nil) '(multiple-value-list (find-symbol "NEVER-BEFORE-USED"))) (setq test (multiple-value-list (intern "NEVER-BEFORE-USED"))) (equal-eval test '(read-from-string "(never-before-used nil)")) (equal-eval '(never-before-used :internal) '(multiple-value-list (intern "NEVER-BEFORE-USED"))) (equal-eval '(never-before-used :internal) '(multiple-value-list (find-symbol "NEVER-BEFORE-USED"))) (equal-eval '(nil nil) '(multiple-value-list (find-symbol "never-before-used"))) (equal-eval '(car :inherited) '(multiple-value-list (find-symbol "CAR" 'common-lisp-user))) (equal-eval '(car :external) '(multiple-value-list (find-symbol "CAR" 'common-lisp))) ;; XXX these will generate wrong results, NIL is not really a symbol ;; currently in the interpreter (equal-eval '(nil :inherited) '(multiple-value-list (find-symbol "NIL" 'common-lisp-user))) (equal-eval '(nil :external) '(multiple-value-list (find-symbol "NIL" 'common-lisp))) (setq test (multiple-value-list (find-symbol "NIL" (prog1 (make-package "JUST-TESTING" :use '()) (intern "NIL" "JUST-TESTING"))))) (equal-eval (read-from-string "(just-testing::nil :internal)") 'test) (eq-eval t '(export 'just-testing::nil 'just-testing)) (equal-eval '(just-testing:nil :external) '(multiple-value-list (find-symbol "NIL" 'just-testing))) #+xedit (equal-eval '(nil nil) '(multiple-value-list (find-symbol "NIL" "KEYWORD"))) #| ;; optional result of previous form: (equal-eval '(:nil :external) '(multiple-value-list (find-symbol "NIL" "KEYWORD"))) |# ;; funcall - function (eql-test 6 #'funcall #'+ 1 2 3) (eql-test 1 #'funcall #'car '(1 2 3)) (equal-test '(1 2 3) #'funcall #'list 1 2 3) ;; TODO properly implement ``function'' ;; functionp - function (predicate) (eq-test nil #'functionp 'append) (eq-test t #'functionp #'append) (eq-test nil #'functionp '(lambda (x) (* x x))) (eq-test t #'functionp #'(lambda (x) (* x x))) (eq-test t #'functionp (symbol-function 'append)) (eq-test nil #'functionp 1) (eq-test nil #'functionp nil) ;; gensym - function (setq sym1 (gensym)) (eq-test nil #'symbol-package sym1) (setq sym1 (gensym 100)) (setq sym2 (gensym 100)) (eq-test nil #'eq sym1 sym2) (eq-test nil #'equalp (gensym) (gensym)) ;; get - accessor (defun make-person (first-name last-name) (let ((person (gensym "PERSON"))) (setf (get person 'first-name) first-name) (setf (get person 'last-name) last-name) person)) (eq-eval '*john* '(defvar *john* (make-person "John" "Dow"))) (eq-eval '*sally* '(defvar *sally* (make-person "Sally" "Jones"))) (equal-eval "John" '(get *john* 'first-name)) (equal-eval "Jones" '(get *sally* 'last-name)) (defun marry (man woman married-name) (setf (get man 'wife) woman) (setf (get woman 'husband) man) (setf (get man 'last-name) married-name) (setf (get woman 'last-name) married-name) married-name) (equal-eval "Dow-Jones" '(marry *john* *sally* "Dow-Jones")) (equal-eval "Dow-Jones" '(get *john* 'last-name)) (equal-eval "Sally" '(get (get *john* 'wife) 'first-name)) (equal-eval `(wife ,*sally* last-name "Dow-Jones" first-name "John") '(symbol-plist *john*)) (eq-eval 'age '(defmacro age (person &optional (default ''thirty-something)) `(get ,person 'age ,default))) (eq-eval 'thirty-something '(age *john*)) (eql-eval 20 '(age *john* 20)) (eql-eval 25 '(setf (age *john*) 25)) (eql-eval 25 '(age *john*)) (eql-eval 25 '(age *john* 20)) ;; graphic-char-p - function (eq-test t #'graphic-char-p #\a) (eq-test t #'graphic-char-p #\Space) (eq-test nil #'graphic-char-p #\Newline) (eq-test nil #'graphic-char-p #\Tab) (eq-test nil #'graphic-char-p #\Rubout) ;; if - special operator (eq-eval nil '(if nil t)) (eq-eval nil '(if t nil t)) (eq-eval nil '(if nil t nil)) (eq-eval nil '(if nil t (if nil (if nil t) nil))) ;; incf - macro (setq n 1) (eql-eval 2 '(incf n)) (eql-eval 2 'n) (setq n 2147483647) (eql-eval 2147483648 '(incf n)) (eql-eval 2147483648 'n) (setq n 0) (eql-eval 0.5d0 '(incf n 0.5d0)) (eql-eval 0.5d0 'n) (setq n 1) (eql-eval 3/2 '(incf n 1/2)) (eql-eval 3/2 'n) ;; intersection - function (setq list1 (list 1 1 2 3 4 'a 'b 'c "A" "B" "C" "d") list2 (list 1 4 5 'b 'c 'd "a" "B" "c" "D")) (equal-test '(1 1 4 b c) #'intersection list1 list2) (equal-test '(1 1 4 b c "B") #'intersection list1 list2 :test 'equal) (equal-test '(1 1 4 b c "A" "B" "C" "d") #'intersection list1 list2 :test #'equalp) (setq list1 (nintersection list1 list2)) (equal-eval '(1 1 4 b c) 'list1) (setq list1 (copy-list '((1 . 2) (2 . 3) (3 . 4) (4 . 5)))) (setq list2 (copy-list '((1 . 3) (2 . 4) (3 . 6) (4 . 8)))) (equal-test '((2 . 3) (3 . 4)) #'nintersection list1 list2 :key #'cdr) ;; keywordp - function (predicate) (eq-test t #'keywordp :test) (eq-test nil #'keywordp 'test) (eq-test nil #'keywordp '#:test) (eq-test nil #'keywordp 1) (eq-test nil #'keywordp #'keywordp) (eq-test nil #'keywordp nil) ;; last - function (equal-test '(3) #'last '(1 2 3)) (equal-test '(2 . 3) #'last '(1 2 . 3)) (eq-test nil #'last nil) (eql-test () #'last '(1 2 3) 0) (setq a '(1 . 2)) (eql-test 2 #'last a 0) (eq-test a #'last a 1) (eq-test a #'last a 2) (eq-test t #'last t) (equal-test #c(1 2) #'last #c(1 2)) (equalp-test #(1 2 3) #'last #(1 2 3)) ;; length - function (eql-test 3 #'length "abc") (eql-test 0 #'length nil) (eql-test 1 #'length '(1 . 2)) (eql-test 2 #'length #(1 2)) (error-test #'length #c(1 2)) (error-test #'length t) ;; let - special operator (eql-eval 2 '(setq a 1 b 2)) (eql-eval 2 '(let ((a 2)) a)) (eql-eval 1 'a) (eql-eval 1 '(let ((a 3) (b a)) b)) (eql-eval 2 'b) ;; let* - special operator (setq a 1 b 2) (eql-eval 2 '(let* ((a 2)) a)) (eql-eval 1 'a) (eql-eval 3 '(let* ((a 3) (b a)) b)) (eql-eval 2 'b) ;; list - function (equal-test '(1) #'list 1) (equal-test '(3 4 a b 4) #'list 3 4 'a (car '(b . c)) (+ 6 -2)) (eq-test nil #'list) ;; list-length - function (eql-test 4 #'list-length '(a b c d)) (eql-test 3 #'list-length '(a (b c) d)) (eql-test 0 #'list-length '()) (eql-test 0 #'list-length nil) (defun circular-list (&rest elements) (let ((cycle (copy-list elements))) (nconc cycle cycle))) (eq-test nil #'list-length (circular-list 'a 'b)) (eq-test nil #'list-length (circular-list 'a)) (eql-test 0 #'list-length (circular-list)) ;; list* - function (eql-test 1 #'list* 1) (equal-test '(a b c . d) #'list* 'a 'b 'c 'd) (error-test #'list*) (setq a '(1 2)) (eq-test a #'list* a) ;; listp - function (predicate) (eq-test t #'listp nil) (eq-test t #'listp '(1 . 2)) (eq-test nil #'listp t) (eq-test nil #'listp #'listp) (eq-test nil #'listp #(1 2)) (eq-test nil #'listp #c(1 2)) ;; lower-case-p - function (eq-test t #'lower-case-p #\a) (eq-test nil #'lower-case-p #\1) (eq-test nil #'lower-case-p #\Newline) (error-test #'lower-case-p 1) ;; TODO make-array (will be rewritten) ;; make-list - function (equal-test '(nil nil nil) #'make-list 3) (equal-test '((1 2) (1 2)) #'make-list 2 :initial-element '(1 2)) (eq-test nil #'make-list 0) (eq-test nil #'make-list 0 :initial-element 1) ;; make-package - function (setq pack1 (make-package "PACKAGE-1" :nicknames '("PACK-1" "PACK1"))) (setq pack2 (make-package "PACKAGE-2" :nicknames '("PACK-2" "PACK2") :use '("PACK1"))) (equal-test (list pack2) #'package-used-by-list pack1) (equal-test (list pack1) #'package-use-list pack2) (eq-test pack1 #'symbol-package 'pack1::test) (eq-test pack2 #'symbol-package 'pack2::test) ;; make-string - function (equal-test "55555" #'make-string 5 :initial-element #\5) (equal-test "" #'make-string 0) (error-test #'make-string 10 :initial-element t) (error-test #'make-string 10 :initial-element nil) (error-test #'make-string 10 :initial-element 1) (eql-test 10 #'length (make-string 10)) ;; make-symbol - function (setq a "TEST") ;; This will fail (eq-test nil #'eq (make-symbol a) (make-symbol a)) (equal-test a #'symbol-name (make-symbol a)) (setq temp-string "temp") (setq temp-symbol (make-symbol temp-string)) (equal-test temp-string #'symbol-name temp-symbol) (equal-eval '(nil nil) '(multiple-value-list (find-symbol temp-string))) ;; makunbound - function (eq-eval 1 '(setf (symbol-value 'a) 1)) (eq-test t #'boundp 'a) (eql-eval 1 'a) (eq-test 'a #'makunbound 'a) (eq-test nil #'boundp 'a) (error-test #'makunbound 1) ;; mapc - function (setq dummy nil) (equal-test '(1 2 3 4) #'mapc #'(lambda (&rest x) (setq dummy (append dummy x))) '(1 2 3 4) '(a b c d e) '(x y z)) (equal-eval '(1 a x 2 b y 3 c z) 'dummy) ;; mapcan - function (equal-test '(d 4 e 5) #'mapcan #'(lambda (x y) (if (null x) nil (list x y))) '(nil nil nil d e) '(1 2 3 4 5 6)) (equal-test '(1 3 4 5) #'mapcan #'(lambda (x) (and (numberp x) (list x))) '(a 1 b c 3 4 d 5)) ;; mapcar - function (equal-test '(1 2 3) #'mapcar #'car '((1 a) (2 b) (3 c))) (equal-test '(3 4 2 5 6) #'mapcar #'abs '(3 -4 2 -5 -6)) (equal-test '((a . 1) (b . 2) (c . 3)) #'mapcar #'cons '(a b c) '(1 2 3)) (equal-test '((1 3 5)) #'mapcar #'list* '(1 2) '(3 4) '((5))) (equal-test '((1 3 5) (2 4 6)) #'mapcar #'list* '(1 2) '(3 4) '((5) (6))) ;; mapcon - function (equal-test '(1 a 2 b (3) c) #'mapcon #'car '((1 a) (2 b) ((3) c))) (equal-test '((1 2 3 4) (2 3 4) (3 4) (4)) #'mapcon #'list '(1 2 3 4)) ;; mapl - function (setq dummy nil) (equal-test '(1 2 3 4) #'mapl #'(lambda (x) (push x dummy)) '(1 2 3 4)) (equal-eval '((4) (3 4) (2 3 4) (1 2 3 4)) 'dummy) ;; maplist - function (equal-test '((1 2 3 4 1 2 1 2 3) (2 3 4 2 2 3)) #'maplist #'append '(1 2 3 4) '(1 2) '(1 2 3)) (equal-test '((foo a b c d) (foo b c d) (foo c d) (foo d)) #'maplist #'(lambda (x) (cons 'foo x)) '(a b c d)) (equal-test '(0 0 1 0 1 1 1) #'maplist #'(lambda (x) (if (member (car x) (cdr x)) 0 1)) '(a b a c d b c)) ;; member - function (setq a '(1 2 3)) (eq-test (cdr a) #'member 2 a) (setq a '((1 . 2) (3 . 4))) (eq-test (cdr a) #'member 2 a :test-not #'= :key #'cdr) (eq-test nil #'member 'e '(a b c d)) (eq-test nil #'member 1 nil) (error-test #'member 2 '(1 . 2)) (setq a '(a b nil c d)) (eq-test (cddr a) #'member-if #'listp a) (setq a '(a #\Space 5/3 foo)) (eq-test (cddr a) #'member-if #'numberp a) (setq a '(3 6 9 11 . 12)) (eq-test (cdddr a) #'member-if-not #'zerop a :key #'(lambda (x) (mod x 3))) ;; multiple-value-bind - macro (equal-eval '(11 9) '(multiple-value-bind (f r) (floor 130 11) (list f r))) ;; multiple-value-call - special operator (equal-eval '(1 / 2 3 / / 2 0.5) '(multiple-value-call #'list 1 '/ (values 2 3) '/ (values) '/ (floor 2.5))) (eql-eval 10 '(multiple-value-call #'+ (floor 5 3) (floor 19 4))) ;; multiple-value-list - macro (equal-eval '(-1 1) '(multiple-value-list (floor -3 4))) (eql-eval nil '(multiple-value-list (values))) (equal-eval '(nil) '(multiple-value-list (values nil))) ;; multiple-value-prog1 - special operator (setq temp '(1 2 3)) (equal-eval temp '(multiple-value-list (multiple-value-prog1 (values-list temp) (setq temp nil) (values-list temp)))) ;; multiple-value-setq - macro (eql-eval 1 '(multiple-value-setq (quotient remainder) (truncate 3.5d0 2))) (eql-eval 1 quotient) (eql-eval 1.5d0 'remainder) (eql-eval 1 '(multiple-value-setq (a b c) (values 1 2))) (eql-eval 1 'a) (eql-eval 2 'b) (eq-eval nil 'c) (eql-eval 4 '(multiple-value-setq (a b) (values 4 5 6))) (eql-eval 4 'a) (eql-eval 5 'b) (setq a 1) (eql-eval nil '(multiple-value-setq (a) (values))) (eql-eval nil 'a) ;; nconc - function (eq-test nil #'nconc) (setq x '(a b c)) (setq y '(d e f)) (equal-test '(a b c d e f) #'nconc x y) (equal-eval '(a b c d e f) 'x) (eq-test y #'cdddr x) (equal-test '(1 . 2) #'nconc (list 1) 2) (error-test #'nconc 1 2 3) (equal-eval '(k l m) '(setq foo (list 'a 'b 'c 'd 'e) bar (list 'f 'g 'h 'i 'j) baz (list 'k 'l 'm))) (equal-test '(a b c d e f g h i j k l m) #'nconc foo bar baz) (equal-eval '(a b c d e f g h i j k l m) 'foo) (equal-eval (nthcdr 5 foo) 'bar) (equal-eval (nthcdr 10 foo) 'baz) (setq foo (list 'a 'b 'c 'd 'e) bar (list 'f 'g 'h 'i 'j) baz (list 'k 'l 'm)) (equal-eval '(a b c d e f g h i j k l m) '(setq foo (nconc nil foo bar nil baz))) (equal-eval '(a b c d e f g h i j k l m) 'foo) (equal-eval (nthcdr 5 foo) 'bar) (equal-eval (nthcdr 10 foo) 'baz) ;; notany - function (eql-test t #'notany #'> '(1 2 3 4) '(5 6 7 8) '(9 10 11 12)) (eql-test t #'notany 'not-used ()) (eql-test nil #'notany #'characterp #(1 2 3 4 5 #\6 7 8)) ;; notevery - function (eql-test nil #'notevery #'< '(1 2 3 4) '(5 6 7 8) '(9 10 11 12)) (eql-test nil #'notevery 'not-used ()) (eql-test t #'notevery #'numberp #(1 2 3 4 5 #\6 7 8)) ;; nth - accessor (function) (eql-test 'foo #'nth 0 '(foo bar baz)) (eql-test 'bar #'nth 1 '(foo bar baz)) (eq-test nil #'nth 3 '(foo bar baz)) (error-test #'nth 0 #c(1 2)) (error-test #'nth 0 #(1 2)) (error-test #'nth 0 "test") ;; nth-value - macro (equal-eval 'a '(nth-value 0 (values 'a 'b))) (equal-eval 'b '(nth-value 1 (values 'a 'b))) (eq-eval nil '(nth-value 2 (values 'a 'b))) (equal-eval '(3332987528 3332987528 t) '(multiple-value-list (let* ((x 83927472397238947423879243432432432) (y 32423489732) (a (nth-value 1 (floor x y))) (b (mod x y))) (values a b (= a b))))) ;; nthcdr - function (eq-test nil #'nthcdr 0 '()) (eq-test nil #'nthcdr 3 '()) (equal-test '(a b c) #'nthcdr 0 '(a b c)) (equal-test '(c) #'nthcdr 2 '(a b c)) (eq-test () #'nthcdr 4 '(a b c)) (eql-test 1 #'nthcdr 1 '(0 . 1)) (error-test #'nthcdr -1 '(1 2)) (error-test #'nthcdr #\Null '(1 2)) (error-test #'nthcdr 1 t) (error-test #'nthcdr 1 #(1 2 3)) ;; or - macro (eq-eval nil '(or)) (setq temp0 nil temp1 10 temp2 20 temp3 30) (eql-eval 10 '(or temp0 temp1 (setq temp2 37))) (eql-eval 20 'temp2) (eql-eval 11 '(or (incf temp1) (incf temp2) (incf temp3))) (eql-eval 11 'temp1) (eql-eval 20 temp2) (eql-eval 30 'temp3) (eql-eval 11 '(or (values) temp1)) (eql-eval 11 '(or (values temp1 temp2) temp3)) (equal-eval '(11 20) '(multiple-value-list (or temp0 (values temp1 temp2)))) (equal-eval '(20 30) '(multiple-value-list (or (values temp0 temp1) (values temp2 temp3)))) ;; packagep - function (predicate) (eq-test t #'packagep *package*) (eq-test nil #'packagep 10) (eq-test t #'packagep (make-package "TEST-PACKAGE")) (eq-test nil #'packagep 'keyword) (eq-test t #'packagep (find-package 'keyword)) ;; pairlis - function #+xedit ;; order of result may vary (progn (equal-test '((one . 1) (two . 2) (three . 3) (four . 19)) #'pairlis '(one two) '(1 2) '((three . 3) (four . 19))) (setq keys '(1 2 3) data '("one" "two" "three") alist '((4 . "four"))) (equal-test '((1 . "one") (2 . "two") (3 . "three")) #'pairlis keys data) (equal-test '((1 . "one") (2 . "two") (3 . "three") (4 . "four")) #'pairlis keys data alist) (equal-eval '(1 2 3) 'keys) (equal-eval '("one" "two" "three") 'data) (equal-eval '((4 . "four")) 'alist) (eq-test nil #'pairlis 1 2) (error-test #'pairlis '(1 2 3) '(4 5)) ) ;; pop - macro (setq stack '(a b c) test stack) (eq-eval 'a '(pop stack)) (eq-eval (cdr test) 'stack) (setq llst '((1 2 3 4)) test (car llst)) (eq-eval 1 '(pop (car llst))) (eq-eval (cdr test) '(car llst)) (error-eval '(pop 1)) (error-eval '(pop nil)) ;; dotted list (setq stack (cons 1 2)) (eq-eval 1 '(pop stack)) (error-eval '(pop stack)) ;; circular list (setq stack '#1=(1 . #1#) *print-circle* t) (eql-eval 1 '(pop stack)) (eql-eval 1 '(pop stack)) (eql-eval 1 '(pop (cdr stack))) ;; position - function (eql-test 4 #'position #\a "baobab" :from-end t) (eql-test 2 #'position-if #'oddp '((1) (2) (3) (4)) :start 1 :key #'car) (eq-test nil #'position 595 '()) (eq-test 4 #'position-if-not #'integerp '(1 2 3 4 5.0)) (eql-test 1 #'position (char-int #\1) "0123" :key #'char-int) ;; prog - macro (eq-eval nil '(prog () :error)) (eq-eval 'ok '(prog ((a 0)) l1 (if (< a 10) (go l3) (go l2)) (return 'failed) l2 (return 'ok) (return 'failed) l3 (incf a) (go l1) (return 'failed) )) (setq a 1) (eq-eval '/= '(prog ((a 2) (b a)) (return (if (= a b) '= '/=)))) ;; prog* - macro (setq a 1) (eq-eval nil '(prog* () :error)) (eq-eval 'ok '(prog* ((a 0) (b 0)) l1 (if (< a 10) (go l3) (go l2)) (return 'failed) l2 (if (< b 10) (go l4) (return 'ok)) (return 'failed) l3 (incf a) (go l1) (return 'failed) l4 (incf b) (setq a 0) (go l1) (return 'failed) )) (eq-eval '= '(prog* ((a 2) (b a)) (return (if (= a b) '= '/=)))) ;; prog1 - macro (setq temp 1) (eql-eval 1 '(prog1 temp (incf temp) (eql-eval 2 'temp) temp)) (eql-eval 2 'temp) (eql-eval 2 '(prog1 temp (setq temp nil) (eql-eval nil 'temp) temp)) (eq-eval nil 'temp) (eql-eval 1 '(prog1 (values 1 2 3) 4)) (setq temp (list 'a 'b 'c)) (eq-eval 'a '(prog1 (car temp) (setf (car temp) 'alpha))) (equal-eval '(alpha b c) 'temp) (equal-eval '(1) '(multiple-value-list (prog1 (values 1 2) (values 4 5)))) ;; prog2 - macro (setq temp 1) (eql-eval 3 '(prog2 (incf temp) (incf temp) (incf temp))) (eql-eval 4 'temp) (eql-eval 2 '(prog2 1 (values 2 3 4) 5)) (equal-eval '(3) '(multiple-value-list (prog2 (values 1 2) (values 3 4) (values 5 6)))) ;; progn - special operator (eq-eval nil '(progn)) (eql-eval 3 '(progn 1 2 3)) (equal-eval '(1 2 3) '(multiple-value-list (progn (values 1 2 3)))) (setq a 1) (eq-eval 'here '(if a (progn (setq a nil) 'here) (progn (setq a t) 'there))) (eq-eval nil 'a) ;; progv - special operator (makunbound '*x*) ;; make sure it is not bound (setq *x* 1) (eql-eval 2 '(progv '(*x*) '(2) *x*)) (eql-eval 1 '*x*) (equal-eval '(3 4) '(let ((*x* 3)) (progv '(*x*) '(4) (list *x* (symbol-value '*x*))))) (makunbound '*x*) (defvar *x* 1) (equal-eval '(4 4) '(let ((*x* 3)) (progv '(*x*) '(4) (list *x* (symbol-value '*x*))))) (equal-eval '(4 4) '(multiple-value-list (let ((*x* 3)) (progv '(*x*) '(4) (values-list (list *x* (symbol-value '*x*))))))) ;; push - macro (setq llst '(nil)) (equal-eval '(1) '(push 1 (car llst))) (equal-eval '((1)) 'llst) (equal-eval '(1 1) '(push 1 (car llst))) (equal-eval '((1 1)) 'llst) (setq x '(a (b c) d)) (equal-eval '(5 B C) '(push 5 (cadr x))) (equal-eval '(a (5 b c) d) 'x) ;; pushnew - macro (setq x '(a (b c) d)) (equal-eval '(5 b c) '(pushnew 5 (cadr x))) (equal-eval '(a (5 b c) d) 'x) (equal-eval '(5 b c) '(pushnew 'b (cadr x))) (equal-eval '(a (5 b c) d) 'x) (setq lst '((1) (1 2) (1 2 3))) (equal-eval '((2) (1) (1 2) (1 2 3)) '(pushnew '(2) lst)) (equal-eval '((1) (2) (1) (1 2) (1 2 3)) '(pushnew '(1) lst)) (equal-eval '((1) (2) (1) (1 2) (1 2 3)) '(pushnew '(1) lst :test 'equal)) (equal-eval '((1) (2) (1) (1 2) (1 2 3)) '(pushnew '(1) lst :key #'car)) ;; remove-duplicates - function (equal-test "aBcD" #'remove-duplicates "aBcDAbCd" :test #'char-equal :from-end t) (equal-test '(a c b d e) #'remove-duplicates '(a b c b d d e)) (equal-test '(a b c d e) #'remove-duplicates '(a b c b d d e) :from-end t) (equal-test '((bar #\%) (baz #\A)) #'remove-duplicates '((foo #\a) (bar #\%) (baz #\A)) :test #'char-equal :key #'cadr) (equal-test '((foo #\a) (bar #\%)) #'remove-duplicates '((foo #\a) (bar #\%) (baz #\A)) :test #'char-equal :key #'cadr :from-end t) (setq tester (list 0 1 2 3 4 5 6)) (equal-test '(0 4 5 6) #'delete-duplicates tester :key #'oddp :start 1 :end 6) ;; replace - function (equal-test "abcd456hij" #'replace (copy-seq "abcdefghij") "0123456789" :start1 4 :end1 7 :start2 4) (setq lst (xseq "012345678")) (equal-test "010123456" #'replace lst lst :start1 2 :start2 0) (equal-eval "010123456" 'lst) ;; rest - accessor (equal-eval '(2) '(rest '(1 2))) (eql-eval 2 '(rest '(1 . 2))) (eq-eval nil '(rest '(1))) (setq *cons* '(1 . 2)) (equal-eval "two" '(setf (rest *cons*) "two")) (equal-eval '(1 . "two") '*cons*) ;; return - macro (eq-eval nil '(block nil (return) 1)) (eql-eval 1 '(block nil (return 1) 2)) (equal-eval '(1 2) '(multiple-value-list (block nil (return (values 1 2)) 3))) (eql-eval 1 '(block nil (block alpha (return 1) 2))) (eql-eval 2 '(block alpha (block nil (return 1)) 2)) (eql-eval 1 '(block nil (block nil (return 1) 2))) ;; return-from - special operator (eq-eval nil '(block alpha (return-from alpha) 1)) (eql-eval 1 '(block alpha (return-from alpha 1) 2)) (equal-eval '(1 2) '(multiple-value-list (block alpha (return-from alpha (values 1 2)) 3))) (eql-eval 2 '(let ((a 0)) (dotimes (i 10) (incf a) (when (oddp i) (return))) a)) (eq-eval 'temp '(defun temp (x) (if x (return-from temp ''dummy)) 44)) (eql-eval 44 '(temp nil)) (eq-eval 'dummy (temp t)) (eql-eval 2 (block nil (unwind-protect (return-from nil 1) (return-from nil 2)))) (error-eval '(funcall (block nil #'(lambda () (return-from nil))))) ;; reverse - function (setq str (xseq "abc") test str) (equal-test "cba" #'reverse str) (eq-eval test 'str) (equal-eval "cba" '(setq test (nreverse str))) (equal-eval "cba" 'test) (setq l (list 1 2 3) test l) (equal-eval '(3 2 1) '(setq test (nreverse l))) (equal-eval '(3 2 1) 'test) ;; rplac? - function (eql-eval '*some-list* '(defparameter *some-list* (list* 'one 'two 'three 'four))) (equal-eval '(one two three . four) '*some-list*) (equal-test '(uno two three . four) #'rplaca *some-list* 'uno) (equal-eval '(uno two three . four) '*some-list*) (equal-test '(three iv) #'rplacd (last *some-list*) (list 'iv)) (equal-eval '(uno two three iv) '*some-list*) ;; search - function (eql-test 7 #'search "dog" "it's a dog's life") (eql-test 2 #'search '(0 1) '(2 4 6 1 3 5) :key #'oddp) (eql-test 8 #'search "foo" "foooobarfooooobarfo" :from-end t) (eql-test 5 #'search "123" (mapcar #'(lambda (x) (+ x (char-code #\0))) '(1 2 34 3 2 1 2 3 4 3 2 1)) :from-end t :key #'(lambda (x) (if (integerp x) (code-char x) x))) (eql-test 0 #'search "abc" "abcd" :from-end t) (eql-test 3 #'search "bar" "foobar") ;; set - function (eql-eval 1 '(setf (symbol-value 'n) 1)) (eql-test 2 #'set 'n 2) (eql-test 2 #'symbol-value 'n) (eql-eval 4 '(let ((n 3)) (setq n (+ n 1)) (setf (symbol-value 'n) (* n 10)) (set 'n (+ (symbol-value 'n) n)) n)) (eql-eval 44 'n) (defvar *n* 2) (eql-eval 80 '(let ((*n* 3)) (setq *n* (+ *n* 1)) (setf (symbol-value '*n*) (* *n* 10)) (set '*n* (+ (symbol-value '*n*) *n*)) *n*)) (eql-eval 2 '*n*) (eq-eval '*even-count* '(defvar *even-count* 0)) (eq-eval '*odd-count* '(defvar *odd-count* 0)) (eql-eval 'tally-list '(defun tally-list (list) (dolist (element list) (set (if (evenp element) '*even-count* '*odd-count*) (+ element (if (evenp element) *even-count* *odd-count*)))))) (eq-eval nil '(tally-list '(1 9 4 3 2 7))) (eql-eval 6 '*even-count*) (eql-eval 20 '*odd-count*) ;; set-difference - function (setq lst1 (list "A" "b" "C" "d") lst2 (list "a" "B" "C" "d")) (equal-test '("A" "b" "C" "d") #'set-difference lst1 lst2) (equal-test '("A" "b") #'set-difference lst1 lst2 :test 'equal) (eq-test nil #'set-difference lst1 lst2 :test #'equalp) (equal-test '("A" "b") #'nset-difference lst1 lst2 :test #'string=) (setq lst1 '(("a" . "b") ("c" . "d") ("e" . "f")) lst2 '(("c" . "a") ("e" . "b") ("d" . "a"))) (equal-test '(("c" . "d") ("e" . "f")) #'nset-difference lst1 lst2 :test #'string= :key #'cdr) (equal-eval '(("c" . "a") ("e" . "b") ("d" . "a")) 'lst2) (equal-test '("banana" "lemon" "rhubarb") #'set-difference '("strawberry" "chocolate" "banana" "lemon" "pistachio" "rhubarb") '(#\c #\w) :test #'(lambda (s c) (find c s))) ;; set-exclusive-or - function (setq lst1 (list 1 "a" "b") lst2 (list 1 "A" "b")) (equal-test '("a" "b" "A" "b") #'set-exclusive-or lst1 lst2) (equal-test '("a" "A") #'set-exclusive-or lst1 lst2 :test #'equal) (eq-test nil #'set-exclusive-or lst1 lst2 :test 'equalp) (equal-test '("a" "b" "A" "b") #'nset-exclusive-or lst1 lst2) (setq lst1 '(("a" . "b") ("c" . "d") ("e" . "f")) lst2 '(("c" . "a") ("e" . "b") ("d" . "a"))) (equal-test '(("c" . "d") ("e" . "f") ("c" . "a") ("d" . "a")) #'nset-exclusive-or lst1 lst2 :test #'string= :key #'cdr) ;; setf - macro (setq x (cons 'a 'b) y (list 1 2 3)) (equal-eval '(1 x 3) '(setf (car x) 'x (cadr y) (car x) (cdr x) y)) (equal-eval '(x 1 x 3) 'x) (equal-eval '(1 x 3) 'y) (setq x (cons 'a 'b) y (list 1 2 3)) (eq-eval nil '(psetf (car x) 'x (cadr y) (car x) (cdr x) y)) (equal-eval '(x 1 a 3) 'x) (equal-eval '(1 a 3) 'y) (error-eval '(setf x)) (error-eval '(psetf x)) ;; setq - special form (eql-eval 3 '(setq a 1 b 2 c 3)) (eql-eval 1 'a) (eql-eval 2 'b) (eql-eval 3 'c) (eql-eval 7 '(setq a (1+ b) b (1+ a) c (+ a b))) (eql-eval 3 'a) (eql-eval 4 'b) (eql-eval 7 'c) (eq-eval nil '(psetq a 1 b 2 c 3)) (eql-eval 1 'a) (eql-eval 2 'b) (eql-eval 3 'c) (equal-eval '(2 1) '(multiple-value-list (let ((a 1) (b 2)) (psetq a b b a) (values a b)))) (error-eval '(setq x)) (error-eval '(setq x 1 y)) ;; some - function (eq-test t #'some #'= '(1 2 3 4 5) '(5 4 3 2 1)) ;; sort - function (setq tester (copy-seq "lkjashd")) (equal-test "adhjkls" #'sort tester #'char-lessp) (setq tester (list '(1 2 3) '(4 5 6) '(7 8 9))) (equal-test '((7 8 9) (4 5 6) (1 2 3)) #'sort tester #'> :key #'car) (setq tester (list 1 2 3 4 5 6 7 8 9 0)) (equal-test '(1 3 5 7 9 2 4 6 8 0) #'stable-sort tester #'(lambda (x y) (and (oddp x) (evenp y)))) (equalp-test #((("Kathy" "Chapman") "Editorial") (("Dick" "Gabriel") "Objects") (("Gregor" "Kiczales") "Objects") (("Sandra" "Loosemore") "Compiler") (("Larry" "Masinter") "Cleanup") (("David" "Moon") "Objects") (("Kent" "Pitman") "Conditions") (("Dick" "Waters") "Iteration") (("JonL" "White") "Iteration")) #'sort (setq committee-data (vector (list (list "JonL" "White") "Iteration") (list (list "Dick" "Waters") "Iteration") (list (list "Dick" "Gabriel") "Objects") (list (list "Kent" "Pitman") "Conditions") (list (list "Gregor" "Kiczales") "Objects") (list (list "David" "Moon") "Objects") (list (list "Kathy" "Chapman") "Editorial") (list (list "Larry" "Masinter") "Cleanup") (list (list "Sandra" "Loosemore") "Compiler"))) #'string-lessp :key #'cadar) (equalp-eval #((("Larry" "Masinter") "Cleanup") (("Sandra" "Loosemore") "Compiler") (("Kent" "Pitman") "Conditions") (("Kathy" "Chapman") "Editorial") (("Dick" "Waters") "Iteration") (("JonL" "White") "Iteration") (("Dick" "Gabriel") "Objects") (("Gregor" "Kiczales") "Objects") (("David" "Moon") "Objects")) '(setq committee-data (stable-sort committee-data #'string-lessp :key #'cadr))) (error-test #'sort #c(1 2)) ;; string - function (setq a "already a string") (eq-test a #'string a) (equal-test "ELM" #'string 'elm) (equal-test "c" #'string #\c) ;; string-* - function (eq-test t #'string= "foo" "foo") (eq-test nil #'string= "foo" "Foo") (eq-test nil #'string= "foo" "bar") (eq-test t #'string= "together" "frog" :start1 1 :end1 3 :start2 2) (eq-test t #'string-equal "foo" "Foo") (eq-test t #'string= "abcd" "01234abcd9012" :start2 5 :end2 9) (eql-test 3 #'string< "aaaa" "aaab") (eql-test 4 #'string>= "aaaaa" "aaaa") (eql-test 5 #'string-not-greaterp "Abcde" "abcdE") (eql-test 6 #'string-lessp "012AAAA789" "01aaab6" :start1 3 :end1 7 :start2 2 :end2 6) (eq-test nil #'string-not-equal "AAAA" "aaaA") (error-test #'string= #(1 2 3) '(1 2 3)) (eql-test 0 #'string< "abcd" "efg") (eql-test 1 #'string< "abcd" "afg") (eql-test 0 #'string/= "foo" "baar") (eql-test nil #'string/= "foobar" "foobar") ;; string-{upcase,downcase,capitalize} - function (equal-test "ABCDE" #'string-upcase "abcde") (equal-test "aBCDe" #'string-upcase "abcde" :start 1 :end 4) (equal-test "aBCDe" #'nstring-upcase (xseq "abcde") :start 1 :end 4) (equal-test "DR. LIVINGSTON, I PRESUME?" #'string-upcase "Dr. Livingston, I presume?") (equal-test "Dr. LIVINGSTON, I Presume?" #'string-upcase "Dr. Livingston, I presume?" :start 4 :end 19) (equal-test "Dr. LIVINGSTON, I Presume?" #'nstring-upcase (xseq "Dr. Livingston, I presume?") :start 4 :end 19) (equal-test "Dr. LiVINGston, I presume?" #'string-upcase "Dr. Livingston, I presume?" :start 6 :end 10) (equal-test "Dr. LiVINGston, I presume?" #'nstring-upcase (xseq "Dr. Livingston, I presume?") :start 6 :end 10) (equal-test "dr. livingston, i presume?" #'string-downcase "Dr. Livingston, I presume?") (equal-test "Dr. livingston, i Presume?" #'string-downcase "Dr. Livingston, I Presume?" :start 1 :end 17) (equal-test "Dr. livingston, i Presume?" #'nstring-downcase (xseq "Dr. Livingston, I Presume?") :start 1 :end 17) (equal-test "Elm 13c Arthur;Fig Don'T" #'string-capitalize "elm 13c arthur;fig don't") (equal-test "elm 13C Arthur;Fig Don't" #'string-capitalize "elm 13c arthur;fig don't" :start 6 :end 21) (equal-test "elm 13C Arthur;Fig Don't" #'nstring-capitalize (xseq "elm 13c arthur;fig don't") :start 6 :end 21) (equal-test " Hello " #'string-capitalize " hello ") (equal-test " Hello " #'nstring-capitalize (xseq " hello ")) (equal-test "Occluded Casements Forestall Inadvertent Defenestration" #'string-capitalize "occlUDeD cASEmenTs FOreSTAll iNADVertent DEFenestraTION") (equal-test "Don'T!" #'string-capitalize "DON'T!") (equal-test "Pipe 13a, Foo16c" #'string-capitalize "pipe 13a, foo16c") (setq str (copy-seq "0123ABCD890a")) (equal-test "0123AbcD890a" #'nstring-downcase str :start 5 :end 7) (equal-eval "0123AbcD890a" 'str) (error-test #'nstring-capitalize 1) (error-test #'string-capitalize "foobar" :start 4 :end 2) (equal-test "foobar" #'string-capitalize "foobar" :start 0 :end 0) ;; string-{,left-,right-}trim - function (equal-test "kaaak" #'string-trim "abc" "abcaakaaakabcaaa") #+xedit (equal-test "kaaak" #'nstring-trim "abc" "abcaakaaakabcaaa") (equal-test "garbanzo beans" #'string-trim '(#\Space #\Tab #\Newline) " garbanzo beans ") #+xedit (equal-test "garbanzo beans" #'nstring-trim '(#\Space #\Tab #\Newline) " garbanzo beans ") (equal-test "three (silly) words" #'string-trim " (*)" " ( *three (silly) words* ) ") #+xedit (equal-test "three (silly) words" #'nstring-trim " (*)" " ( *three (silly) words* ) ") (equal-test "labcabcabc" #'string-left-trim "abc" "labcabcabc") #+xedit (equal-test "labcabcabc" #'nstring-left-trim "abc" "labcabcabc") (equal-test "three (silly) words* ) " #'string-left-trim " (*)" " ( *three (silly) words* ) ") #+xedit (equal-test "three (silly) words* ) " #'nstring-left-trim " (*)" " ( *three (silly) words* ) ") (equal-test " ( *three (silly) words" #'string-right-trim " (*)" " ( *three (silly) words* ) ") #+xedit (equal-test " ( *three (silly) words" #'nstring-right-trim " (*)" " ( *three (silly) words* ) ") (error-test #'string-trim 123 "123") (error-test #'string-left-trim 123 "123") ;; stringp - function (predicate) (eq-test t #'stringp "abc") (eq-test nil #'stringp #\a) (eq-test nil #'stringp 1) (eq-test nil #'stringp #(#\a #\b #\c)) ;; subseq - accessor (setq str (xseq "012345")) (equal-test "2345" #'subseq str 2) (equal-test "34" #'subseq str 3 5) (equal-eval "abc" '(setf (subseq str 4) "abc")) (equal-eval "0123ab" 'str) (equal-eval "A" '(setf (subseq str 0 2) "A")) (equal-eval "A123ab" 'str) ;; subsetp - function (setq cosmos '(1 "a" (1 2))) (eq-test t #'subsetp '(1) cosmos) (eq-test nil #'subsetp '((1 2)) cosmos) (eq-test t #'subsetp '((1 2)) cosmos :test 'equal) (eq-test t #'subsetp '(1 "A") cosmos :test #'equalp) (eq-test nil #'subsetp '((1) (2)) '((1) (2))) (eq-test t #'subsetp '((1) (2)) '((1) (2)) :key #'car) ;; svref - function ;; XXX vectors will be reimplemented, just a test for the current implementation (setq v (vector 1 2 'sirens)) (eql-eval 1 '(svref v 0)) (eql-eval 'sirens '(svref v 2)) (eql-eval 'newcomer '(setf (svref v 1) 'newcomer)) (equalp-eval #(1 newcomer sirens) 'v) ;; symbol-name - function (equal-test "TEMP" #'symbol-name 'temp) (equal-test "START" #'symbol-name :start) (error-test #'symbol-name 1) ;; symbol-package - function (eq-test (find-package "LISP") #'symbol-package 'car) (eql-test *package* #'symbol-package 'bus) (eq-test (find-package "KEYWORD") #'symbol-package :optional) ;; Gensyms are uninterned, so have no home package. (eq-test nil #'symbol-package (gensym)) (setq pk1 (make-package 'pk1)) (intern "SAMPLE1" "PK1") (eq-eval t '(export (find-symbol "SAMPLE1" "PK1") "PK1")) (setq pk2 (make-package 'pk2 :use '(pk1))) (equal-eval '(pk1:sample1 :inherited) '(multiple-value-list (find-symbol "SAMPLE1" "PK2"))) (eq-test pk1 #'symbol-package 'pk1::sample1) (eq-test pk1 #'symbol-package 'pk2::sample1) (eq-test pk1 #'symbol-package 'pk1::sample2) (eq-test pk2 #'symbol-package 'pk2::sample2) ;; The next several forms create a scenario in which a symbol ;; is not really uninterned, but is "apparently uninterned", ;; and so SYMBOL-PACKAGE still returns NIL. (setq s3 'pk1::sample3) (eq-eval t '(import s3 'pk2)) (eq-eval t '(unintern s3 'pk1)) ;; XXX unintern not yet implemented (eq-test nil #'symbol-package s3) ;; fail due to unintern not implemented (eq-test t #'eq s3 'pk2::sample3) ;; symbol-plist - accessor (setq sym (gensym)) (eq-eval () '(symbol-plist sym)) (eq-eval 'val1 '(setf (get sym 'prop1) 'val1)) (equal-eval '(prop1 val1) '(symbol-plist sym)) (eq-eval 'val2 '(setf (get sym 'prop2) 'val2)) (equal-eval '(prop2 val2 prop1 val1) '(symbol-plist sym)) (setq sym-plist (list 'prop3 'val3)) (eq-eval sym-plist '(setf (symbol-plist sym) sym-plist)) (eq-eval sym-plist '(symbol-plist sym)) ;; symbol-value - accessor (eql-eval 1 '(setf (symbol-value 'a) 1)) (eql-eval 1 '(symbol-value 'a)) ;; SYMBOL-VALUE cannot see lexical variables. (eql-eval 1 '(let ((a 2)) (symbol-value 'a))) (eql-eval 1 '(let ((a 2)) (setq a 3) (symbol-value 'a))) #+xedit ;; incorrect... (progn ;; SYMBOL-VALUE can see dynamic variables. ;; declare not yet implemented (proclaim '(special a)) (eql-eval 2 '(let ((a 2)) (symbol-value 'a))) (eql-eval 1 'a) (eql-eval 3 '(let ((a 2)) (setq a 3) (symbol-value 'a))) (eql-eval 1 'a) ;; declare not yet implement (makunbound 'a) (eql-eval 2 '(let ((a 2)) (setf (symbol-value 'a) 3) a)) (eql-eval 3 'a) (eql-eval 3 '(symbol-value 'a)) ;; declare not yet implement (makunbound 'a) (equal-eval '(5 4) '(multiple-value-list (let ((a 4)) ;; declare not yet implemented (defparameter a 3) (let ((b (symbol-value 'a))) (setf (symbol-value 'a) 5) (values a b))))) (eql-eval 3 'a) ) (eq-eval :any-keyword '(symbol-value :any-keyword)) ;; XXX these will fail (eq-eval nil '(symbol-value 'nil)) (eq-eval nil '(symbol-value '())) ;; symbolp - function (predicate) (eq-test t #'symbolp 'elephant) (eq-test nil #'symbolp 12) ;; XXX these will fail (eq-test t #'symbolp nil) (eq-test t #'symbolp '()) (eq-test t #'symbolp :test) (eq-test nil #'symbolp "hello") ;; remprop - function (setq test (make-symbol "PSEUDO-PI")) (eq-eval () '(symbol-plist test)) (eq-eval t '(setf (get test 'constant) t)) (eql-eval 3.14 '(setf (get test 'approximation) 3.14)) (eql-eval 'noticeable '(setf (get test 'error-range) 'noticeable)) (equal-eval '(error-range noticeable approximation 3.14 constant t) '(symbol-plist test)) (eq-eval nil '(setf (get test 'approximation) nil)) (equal-eval '(error-range noticeable approximation nil constant t) '(symbol-plist test)) (eq-eval nil (get test 'approximation)) (eq-test t #'remprop test 'approximation) (eq-eval nil '(get test 'approximation)) (equal-eval '(error-range noticeable constant t) '(symbol-plist test)) (eq-test nil #'remprop test 'approximation) (equal-eval '(error-range noticeable constant t) '(symbol-plist test)) (eq-test t #'remprop test 'error-range) (eql-eval 3 '(setf (get test 'approximation) 3)) (equal-eval '(approximation 3 constant t) '(symbol-plist test)) ;; throw - special operator (equal-eval '(3 9) '(multiple-value-list (catch 'result (setq i 0 j 0) (loop (incf j 3) (incf i) (if (= i 3) (throw 'result (values i j))))))) (eql-eval 2 '(catch nil (unwind-protect (throw nil 1) (throw nil 2)))) ;; XXX undefined consequences (eql-eval 2 '(catch 'a (catch 'b (unwind-protect (throw 'a 1) (throw 'b 2))))) (eq-eval :outer-catch '(catch 'foo (setq string (format nil "The inner catch returns ~s." (catch 'foo (unwind-protect (throw 'foo :first-throw) (throw 'foo :second-throw))))) :outer-catch)) (equal-eval "The inner catch returns :SECOND-THROW." 'string) ;; tree-equal - function (setq tree1 '(1 (1 2)) tree2 '(1 (1 2))) (eq-test t #'tree-equal tree1 tree2) (eq-test nil #'eql tree1 tree2) (setq tree1 '('a ('b 'c)) tree2 '('a ('b 'c))) (eq-test t #'tree-equal tree1 tree2 :test 'eq) (eq-test t #'tree-equal 1 1) (eq-test nil #'tree-equal (list 1 2) (cons 1 2)) (eq-test nil #'tree-equal 1 2) ;; union - function (equal-test '(b c f a d) #'union '(a b c) '(f a d)) (equal-test '((y 6) (z 2) (x 4)) #'union '((x 5) (y 6)) '((z 2) (x 4)) :key #'car) (setq lst1 (list 1 2 '(1 2) "a" "b") lst2 (list 2 3 '(2 3) "B" "C")) (equal-test '(1 (1 2) "a" "b" 2 3 (2 3) "B" "C") #'nunion lst1 lst2) ;; unless - macro (eq-eval 'hello '(when t 'hello)) (eq-eval nil '(unless t 'hello)) (eq-eval nil (when nil 'hello)) (eq-eval 'hello '(unless nil 'hello)) (eq-eval nil (when t)) (eql-eval nil '(unless nil)) (setq test nil) (equal-eval '(3 2 1) '(when t (push 1 test) (push 2 test) (push 3 test))) (equal-eval '(3 2 1) 'test) (setq test nil) (eq-eval nil '(unless t (push 1 test) (push 2 test) (push 3 test))) (eq-eval nil 'test) (eq-eval nil '(when nil (push 1 test) (push 2 test) (push 3 test))) (eq-eval nil 'test) (equal-eval '(3 2 1) '(unless nil (push 1 test) (push 2 test) (push 3 test))) (equal-eval '(3 2 1) 'test) (equal-eval '((4) nil (5) nil 6 (6) 7 (7)) '(let ((x 3)) (list (when (oddp x) (incf x) (list x)) (when (oddp x) (incf x) (list x)) (unless (oddp x) (incf x) (list x)) (unless (oddp x) (incf x) (list x)) (if (oddp x) (incf x) (list x)) (if (oddp x) (incf x) (list x)) (if (not (oddp x)) (incf x) (list x)) (if (not (oddp x)) (incf x) (list x))))) ;; unwind-protect - special operator (defun dummy-function (x) (setq state 'running) (unless (numberp x) (throw 'abort 'not-a-number)) (setq state (1+ x))) (eql-eval 2 '(catch 'abort (dummy-function 1))) (eql-eval 2 'state) (eq-eval 'not-a-number '(catch 'abort (dummy-function 'trash))) (eq-eval 'running 'state) (eq-eval 'not-a-number '(catch 'abort (unwind-protect (dummy-function 'trash) (setq state 'aborted)))) (eq-eval 'aborted 'state) (eql-eval 2 '(block nil (unwind-protect (return 1) (return 2)))) ;; XXX undefined consequences (eql-eval 2 '(block a (block b (unwind-protect (return-from a 1) (return-from b 2))))) (eql-eval 2 '(catch nil (unwind-protect (throw nil 1) (throw nil 2)))) ;; XXX undefined consequences (eql-eval 2 '(catch 'a (catch 'b (unwind-protect (throw 'a 1) (throw 'b 2))))) (eq-eval ':outer-catch '(catch 'foo (setq string (format nil "The inner catch returns ~s." (catch 'foo (unwind-protect (throw 'foo :first-throw) (throw 'foo :second-throw))))) :outer-catch)) (equal-eval "The inner catch returns :SECOND-THROW." 'string) (eql-eval 10 '(catch 'a (catch 'b (unwind-protect (1+ (catch 'a (throw 'b 1))) (throw 'a 10))))) ;; XXX undefined consequences (eql-eval 4 '(catch 'foo (catch 'bar (unwind-protect (throw 'foo 3) (throw 'bar 4) (print 'xxx))))) (eql-eval 4 '(catch 'bar (catch 'foo (unwind-protect (throw 'foo 3) (throw 'bar 4) (print 'xxx))))) (eql-eval 5 '(block nil (let ((x 5)) (unwind-protect (return) (return x))))) ;; upper-case-p - function (eq-test t #'upper-case-p #\A) (eq-test nil #'upper-case-p #\a) (eq-test nil #'upper-case-p #\5) (error-test #'upper-case-p 1) ;; values - accessor (eq-eval () '(multiple-value-list (values))) (equal-eval '(1) '(multiple-value-list (values 1))) (equal-eval '(1 2) '(multiple-value-list (values 1 2))) (equal-eval '(1 2 3) '(multiple-value-list (values 1 2 3))) (equal-eval '(1 4 5) '(multiple-value-list (values (values 1 2 3) 4 5))) ;; values-list - function (eq-eval nil '(multiple-value-list (values-list nil))) (equal-eval '(1) '(multiple-value-list (values-list '(1)))) (equal-eval '(1 2) '(multiple-value-list (values-list '(1 2)))) (equal-eval '(1 2 3) '(multiple-value-list (values-list '(1 2 3)))) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/test/math.lsp0000664000000000000000000013326112472175711016722 0ustar ;; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/test/math.lsp,v 1.4 2002/11/30 23:13:14 paulo Exp $ ;; ;; basic math tests ;; This is far from a good regression test, but in the current stage of ;; the interpreter, this is good enough to make sure it is not "so" ;; broken. But note that this does not test all cases where there is ;; change in the type of a numeric object. (setq *default-float-format* 'double-float) ;; floating point results may differ from implementation to implementation (?!) (defun test (expect function &rest arguments &aux result (error t)) (ignore-errors (setq result (apply function arguments)) (setq error nil) ) (if error (format t "ERROR: (~A~{ ~A~})~%" function arguments) ;; Use eql to make sure result and expect have the same type (or (eql result expect) #-xedit ;; hack... (or (and (floatp result) (floatp expect) (< (abs (- (abs result) (abs expect))) 0.00000000000001d0) ) (format t "(~A~{ ~A~}) => should be ~A not ~A~%" function arguments expect result ) ) #+xedit (format t "(~A~{ ~A~}) => should be ~A not ~A~%" function arguments expect result ) ) ) ) (defun div-test (quotient remainder function &rest arguments &aux quo rem (error t)) (ignore-errors (multiple-value-setq (quo rem) (apply function arguments)) (setq error nil) ) (if error (format t "ERROR: (~A~{ ~A~})~%" function arguments) (or (and (eql quotient quo) (eql remainder rem)) #-xedit ;; hack (or (or (eql quotient quo) (and (floatp quotient) (floatp quo) (< (abs (- (abs quotient) (abs quo))) 0.00000000000001d0) ) ) (or (eql remainder rem) (and (floatp remainder) (floatp rem) (< (abs (- (abs remainder) (abs rem))) 0.00000000000001d0) ) ) (format t "(~A~{ ~A~}) => should be ~A; ~A not ~A; ~A~%" function arguments quotient remainder quo rem ) ) #+xedit (format t "(~A~{ ~A~}) => should be ~A; ~A not ~A; ~A~%" function arguments quotient remainder quo rem ) ) ) ) (defun bool-test (expect function &rest arguments &aux result (error t)) (ignore-errors (setq result (apply function arguments)) (setq error nil) ) (if error (format t "ERROR: (~A~{ ~A~})~%" function arguments) (or (eq result expect) (format t "(~A~{ ~A~}) => should be ~A not ~A~%" function arguments expect result ) ) ) ) (defun error-test (function &rest arguments &aux result (error t)) (ignore-errors (setq result (apply function arguments)) (setq error nil)) (unless error (format t "ERROR: no error for (~A~{ ~A}), result was ~A~%" function arguments result))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; fixnum fixnum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 0 #'+) (test 5 #'+ 5) (test -2 #'+ -2) (test 3 #'+ 2 1) (test 134217728 #'+ 134217727 1) (test -134217729 #'+ -134217728 -1) (test 2147483648 #'+ 2147483647 1) (test -2147483649 #'+ -2147483648 -1) (test -5 #'- 5) (test 6 #'- -6) (test 1 #'- 2 1) (test 134217728 #'- 134217727 -1) (test -2147483649 #'- -2147483648 1) (test 4294967295 #'- 2147483647 -2147483648) (test 1 #'*) (test 4 #'* 4) (test -5 #'* -5) (test 6 #'* 2 3) (test 2147483648 #'* 65536 32768) (test 2147418112 #'* 65536 32767) (test 134217728 #'* 65536 2048) (test -134217728 #'* 65536 -2048) (test 1/3 #'/ 3) (test -1/4 #'/ -4) (test 1/3 #'/ 10 30) (test -1/2 #'/ -5 10) (test -4 #'/ 20 -5) (test 431432412345/32 #'/ 431432412345 32) (test -2147483647/2147483648 #'/ 2147483647 -2147483648) (test -1 #'/ 2147483648 -2147483648) (test 2147483648 #'/ -2147483648 -1) (test -1/2147483648 #'/ 1 -2147483648) (test 1 #'min 2 3 4 1 5) (test 7 #'max 0 -2 7 6 3) (test -2147483648 #'min -2147483648 2147483647) (test 2147483647 #'max -2147483648 2147483647) (bool-test t #'< 1 2) (bool-test nil #'< 2 2) (bool-test nil #'< 4 3) (bool-test t #'< -2147483648 -1) (bool-test t #'< -2147483648 2147483648) (bool-test t #'<= 3 3) (bool-test nil #'<= 3 2) (bool-test t #'<= 3 7) (bool-test t #'<= -2147483648 2147483648) (bool-test t #'= 1 1) (bool-test nil #'= 1 -1) (bool-test t #'= -2147483648 -2147483648) (bool-test t #'>= 4 3) (bool-test t #'>= 5 5) (bool-test nil #'>= 4 9) (bool-test t #'>= 2147483647 -2147483648) (bool-test t #'> 7 5) (bool-test nil #'> 20 20) (bool-test nil #'> 19 31) (bool-test nil #'> 2147483647 2147483648) (bool-test nil #'> -2147483648 2147483647) (bool-test nil #'/= 2147483647 2147483647) (bool-test t #'/= 2147483647 -2147483648) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; fixnum bignum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 4123412341238575768576858308380 #'+ 431412 4123412341238575768576857876968) (test -653653534554686349560628211 #'- 4231423 653653534554686349564859634) (test 17952112630025927929 #'* 4342423 4134123421423) (test 412341/766687896595678 #'/ 412341 766687896595678) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; fixnum flonum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 566594.4123d0 #'+ 43141 523453.4123d0) (test -2.106249523586876d9 #'+ -2147483647 41234123.413124d0) (test -6530250.653d0 #'- 4314 6534564.653d0) (test -358687.653d0 #'- -324123 34564.653d0) (test 3.26338916904d67 #'* 431234 756756d56) (test 5.731169192902366d-50 #'/ 3 5234534d43) (bool-test t #'< 423421 646454d0) (bool-test t #'= 43242113 43242113d0) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; fixnum fixratio ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 38654705646/17 #'+ 2147483647 2147483647/17) (test -2146748499/17 #'+ 43244 -2147483647/17) (test 17633127/4232 #'- 4321 653345/4232) (test 28227714415090/4323 #'* 4312442 6545645/4323) (test 639030/1441 #'* 42 15215/1441) (test 924444112/547 #'/ 3432342 1641/808) (bool-test t #'> 41342 42423/32) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; fixnum bigratio ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 134681902103055335/31231131234 #'+ 4312423 53453535353/31231131234) (test 134681795195984629/31231131234 #'- 4312423 53453535353/31231131234) (test 230514255287590319/31231131234 #'* 4312423 53453535353/31231131234) (test 134681848649519982/53453535353 #'/ 4312423 53453535353/31231131234) (bool-test t #'> 4312423 53453535353/31231131234) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bignum fixnum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 4123412341234124068 #'+ 4123412341234123412 656) (test 2147483647 #'+ 2147483648 -1) (test 2147483648 #'- 2147483647 -1) (test 3245393337480 #'* 4242344232 765) (test 1414114744/255 #'/ 4242344232 765) (bool-test nil #'< 2147483648 1) (bool-test t #'> 2147483648 -2147483648) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bignum flonum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 5.452523543454353d15 #'+ 5452523543454353 423d-6) (test -3.41423d205 #'- 54235423452345424443423 341423d200) (test 2.7061221650759596d89 #'* 413423412341231232 6.545643242d71) (test 9.744908405310087d-29 #'/ 41341234214 4242342d32) (bool-test t #'< 4314123412312341234123 4234242d46) (bool-test nil #'> 42342342142142421412341242 423423.432423d51) (bool-test t #'= 100000000000000000000 1d20) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bignum fixratio ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 3027180466416641662/7 #'+ 432454352345234523 1/7) (test 4294967295/2 #'- 2147483648 1/2) (test 14113747078041141/152263 #'* 42341241234123423 1/456789) (test 475355357536664/19 #'* 43214123412424 11/19) (test 143960192608 #'/ 4234123312 1/34) (test 15032385536/5 #'/ 2147483648 5/7) (bool-test nil #'< 4123412341234123 423424/23) (bool-test nil #'= 2147483648 1/3) (bool-test t #'> 2147483648 1/3) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bignum bigratio ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test -493153721444554600746963362777609/11404707804137 #'+ -43241241241241234234 18178448448449/11404707804137) (test 22573725350444837506376255369215081106984960/431241324242143434377 #'- 52345923457394857234895 455/431241324242143434377) (test 355905909219316970540364021939287762325439304380984344811607132990/14374707710807 #'* 45523452345234790345923405723902389345782390 23454234524234523623623/43124123132421) (test -853356237922877963618542794532291751029677352/21566206170617061706171 #'/ 4131234123412342 -43132412341234123412342/413124123412312234123412312312) (bool-test nil #'< 9482384762389461234892 463124869123897/43124123456678) (bool-test t #'/= 4689123469123846123843 4123894623894612/211) (bool-test t #'> 90437849234701234891203 4234123423/37) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; flonum fixnum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 4.3291328479d86 #'+ 43291328479d76 431243) (test 4.123123123432d58 #'- 4123123123432d46 2147483647) (test 4.1974800714094d109 #'* 970874791d96 43234) (test -1.0004838618250252d55 #'/ -432423.432d56 4322143) (bool-test nil #'< 4324932.342d5 4321421) (bool-test t #'> 2147483648d0 2147483647) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; flonum bignum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 4.3124325345d62 #'+ 4312432.5345d56 431241234901234791023479023) (test 4.123123443242d39 #'- 41231234.43242d32 -10947390284720389) (test 9.81681448753991d48 #'* 42342.89d27 231840917980324712) (test 6.837110051466236d49 #'/ -64832d57 -948236894126) (bool-test nil #'< 7589079203d56 43214124124312) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; flonum flonum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 4.12685643412d7 #'+ 34442.3412d0 41234122d0) (test -4.23432d84 #'- -45523453d56 423432d79) (test 2.0000000000000004d0 #'* 1.4142135623730951d0 1.4142135623730951d0) (test -1.414213562373095d0 #'/ -2d0 1.4142135623730951d0) (test 0.7071067811865476d0 #'/ 1.4142135623730951d0 2d0) (bool-test nil #'< 43124123d56 4231412d43) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; flonum fixratio ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 3.41412d61 #'+ 341412d56 3/652) (test 4.312443d72 #'- 43124.43d68 42421/5678) (test -4.32112300201218d73 #'* 4321123d67 -2147483648/2147483647) (test 3.388443859138533d58 #'/ 432412d54 13744/1077) (bool-test t #'> 423194237d43 4231412/23) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; flonum bigratio ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 4.378904431d62 #'+ 4378904.431d56 49230471923047129/32412341234126) (test 0d0 #'- 1.7320508075688772d0 3900231685776981/2251799813685248) (test 5.000000000000001d0 #'* 2.23606797749979d0 629397181890197/281474976710656) (test 7.000000000000001d0 #'/ 2.6457513110645907d0 1125899906842624/2978851154656373) (bool-test nil #'< 790412390412d45 1005712007432/10518078881) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; fixratio fixnum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 23502480199/57 #'+ 1/57 412324214) (test -1608505/39 #'- 11/39 41244) (test 241844976595/3121 #'* 45245/3121 5345231) (test 4231/30211050 #'/ 4231/67890 445) (bool-test nil #'< 43123/12 -3432) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; fixratio bignum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 290071443963580821646/4115 #'+ -14119/4115 70491237901234711) (test 92654360215843653827434431256/1237 #'- 423412/1237 -74902473901247901234789012) (test 139081825032265225396/111 #'* 13/777 74890213478912044444) (test -22/19000187487170108051697772680759 #'/ -176/31 4903274190237447239147812304712) (bool-test t #'< 7094123/312 423412429047) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; fixratio flonum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 3756.777956289953d0 #'+ 41290/11 3.141592653589793d0) (test 3750.494770982774d0 #'- 41290/11 3.141592653589793d0) (test 11792.396424247505d0 #'* 41290/11 3.141592653589793d0) (test 1194.8195636844289d0 #'/ 41290/11 3.141592653589793d0) (bool-test nil #'< 41290/11 3.141592653589793d0) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; fixratio fixratio ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test -2/2147483647 #'+ 2147483646/2147483647 -2147483648/2147483647) (test 4611686015206162432/2305843005992468481 #'+ 2147483648/2147483646 2147483648/2147483647) (test 114/91 #'+ 5/7 7/13) (test 2 #'- 2147483646/2147483647 -2147483648/2147483647) (test -6442450939/4611686009837453315 #'- 2147483646/2147483647 2147483647/2147483645) (test 214/231 #'- 5/7 -7/33) (test 183092240452/408559 #'* '432421/3217 423412/127) (test 1057751/7345 #'* 34121/65 31/113) (test -93866791/102381559 #'/ 143747/107 -956837/653) (test 117/517 #'/ 13/33 47/27) (bool-test nil #'< 5/3 7/9) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; fixratio bigratio ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 1211321073398067249731082729214954013/1099249926163926018396018404101914 #'+ 23141/21 572903572390457239/52345234579234572304572304957234) (test -1210401943424090457832980748892408320175/1099249926163926018396018404101914 #'+ -23123441/21 572903572390457239/52345234579234572304572304957234) (test -130565585970579643613431728982140/1297324236427391 #'- 6/83 1573079349043128237436315709694/15630412487077) (test 119377824848653/98027 #'* 4123/61 28954117111/1607) (test -533081148/1126543487854337661125 #'/ 4132412/125 -9012347902834701289/129) (bool-test nil #'< 4132412/125 -9012347902834701289/129) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bigratio fixnum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 48668779872364438/8438103123 #'+ 49032749012471920/8438103123 -43134) (test 49396718152579402/8438103123 #'- 49032749012471920/8438103123 -43134) (test -704992865301321265760/2812701041 #'* 49032749012471920/8438103123 -43134) (test -24516374506235960/181984570053741 #'/ 49032749012471920/8438103123 -43134) (bool-test t #'> 49032749012471920/8438103123 -43134) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bigratio bignum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 22765322736543569109219273030163417097453878379283263605274270/46382946123894712341 #'+ 4692318468912374612389461278/46382946123894712341 490812348912346238794612389461238961238912) (test -22765322736543569109219273030163417097453878379283263605274270/46382946123894712341 #'- -4692318468912374612389461278/46382946123894712341 490812348912346238794612389461238961238912) (test -2303047849571666696101160700266058250647016644840659232609643130849536/46382946123894712341 #'* 4692318468912374612389461278/46382946123894712341 -490812348912346238794612389461238961238912) (test 2346159234456187306194730639/11382661368271784554609636515081706202567704733454325607906496 #'/ -4692318468912374612389461278/46382946123894712341 -490812348912346238794612389461238961238912) (bool-test t #'< 4692318468912374612389461278/46382946123894712341 490812348912346238794612389461238961238912) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bigratio flonum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 63.2771680782255d0 #'+ 31.63858403911275d0 4452734852783697/140737488355328) (test 0d0 #'+ -31.63858403911275d0 4452734852783697/140737488355328) (test -1001.0000000000001d0 #'* -31.63858403911275d0 4452734852783697/140737488355328) (test 1d0 #'/ -31.63858403911275d0 -4452734852783697/140737488355328) (bool-test nil #'< -31.63858403911275d0 -4452734852783697/140737488355328) (bool-test nil #'> -31.63858403911275d0 -4452734852783697/140737488355328) (bool-test nil #'/= -31.63858403911275d0 -4452734852783697/140737488355328) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bigratio fixratio ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 0 #'+ 2147483648/2147483647 -2147483648/2147483647) (test 3230093924913437/413416372043776 #'+ 45705840067699/8796093022208 123/47) (test 4294967296/2147483647 #'- 2147483648/2147483647 -2147483648/2147483647) (test 1066255041450269/413416372043776 #'- 45705840067699/8796093022208 123/47) (test -5621818328326977/413416372043776 #'* -45705840067699/8796093022208 123/47) (test -2148174483181853/1081919441731584 #'/ 45705840067699/8796093022208 -123/47) (bool-test t #'> 45705840067699/8796093022208 123/47) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bigratio bigratio ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 2679495973598190955776211861634126560767052764822779809414184089582/140710542183009389719255843429922029722593 #'+ 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891) (test 2679495973598190955776211861634126560767052765333892522296541398514/140710542183009389719255843429922029722593 #'- 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891) (test -4866460021317766216371472892133283923086494176/140710542183009389719255843429922029722593 #'* 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891) (test -1339747986799095477888105930817063280383526382539168082927681372024/127778178220589327233 #'/ 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891) (bool-test t #'> 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; complex real ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test #c(2147483648 -1) #'+ #c(1 -1) 2147483647) (test #c(2.147483648d9 -1) #'+ #c(2147483647 -1) 1d0) (test #c(129642370237029633787/3 0.25d0) #'- #c(-11/3 0.25d0) -43214123412343211266) (test #c(23470/21 4.333333333333334d0) #'* #c(2347/7 1.3d0) 10/3) (test #c(134217728/11 67108864/11) #'* #c(65536 32768) 2048/11) (test #c(1.3133333333333332d0 82304) #'/ #c(1.97d0 123456) 3/2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; real complex ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test #c(80/7 7/13) #'+ 3/7 #c(11 7/13)) (test #c(1.2345d47 -1) #'+ 12345d43 #c(-2147483648 -1)) (test #c(-2147483649 2147483647) #'+ -2147483648 #c(-1 2147483647)) (test #c(41/15 1.23456d68) #'- #c(7/5 1234.56d65) -4/3) (test #c(-41/19 2147483648) #'* #c(41/19 -2147483648) -1) (test #c(-88046829568/40802189293 2.147483649d41) #'* #c(41/19 -2147483648d32) -2147483648/2147483647) (test #c(-5.0691244239631335d0 1.3911008563333336d16) #'/ #c(-11/7 4312412654633334) 0.31d0) (bool-test t #'= #c(1 0.0) 1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; complex complex ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test #c(-16.0d0 -4.0d0) #'+ #c(-16.0d0 -4.0d0)) (test #c(0d0 1d0) #'- #c(0d0 -1d0)) (test #c(1d0 3d0) #'- #c(-1d0 -3d0)) (test #c(-16.0d0 -4.0d0) #'* #c(-16.0d0 -4.0d0)) (test #c(-0.058823529411764705d0 0.014705882352941176d0) #'/ #c(-16d0 -4d0)) (test #c(1.94d0 301868863889/7) #'+ #c(3/5 5/7) #c(1.34d0 43124123412)) (test #c(8641975242/7 -3.4596d0) #'- #c(1234567890 0.0004d0) #c(-12/7 3.46d0)) (test #c(2944.315858312371d0 5.59002d13) #'* #c(-11/7 -1234d9) #c(-45.3d0 5/2147483647)) (test #c(1.9635384272224412d-8 -0.33333333317811176d0) #'/ #c(2147483647/3 -0.5d0) #c(128 2147483648.0d0)) (test #c(8.154945137073864d11 2.621232365490813d12) #'/ #c(-1.3d0 4312412654633) #c(3/2 7/15)) (test #c(0.003674737027278924d0 -257.6948748113586d0) #'/ #c(1.5d0 -432412) #c(1678 -567/31313)) (bool-test t #'= #c(1 2d0) #c(1 2)) (bool-test nil #'/= #c(1 2) #c(1d0 2d0)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; abs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 2147483648 #'abs -2147483648) (test 2147483647 #'abs -2147483647) (test 2147483647 #'abs 2147483647) (test 1 #'abs 1) (test 5/7 #'abs -5/7) (test 2147483648/2147483647 #'abs -2147483648/2147483647) (test 3.12d0 #'abs -3.12d0) (test 4312412341234124124123412 #'abs 4312412341234124124123412) (test 4312412341234124124123412 #'abs -4312412341234124124123412) (test 1.0 #'abs #c(1 0.0)) (test 11.40175425099138d0 #'abs #c(-11 3d0)) (test 4.47213595499958d0 #'abs #c(-4 -2)) (test 1.0 #'abs #c(0.0 -1.0)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sqrt ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 3.4641016151377544d0 #'sqrt 12) (test #c(0 12) #'sqrt -144) (test 6.429728792199102d18 #'sqrt 41341412341234123412490123470912347210) (test 41341412341234123412490123470912347210 #'sqrt 1709112374367945085349927261774254951456404621200206927501652414831594784100) (test 46340.95001184158d0 #'sqrt 2147483648) (test 0.7071067811865476d0 #'sqrt 0.5d0) (test 0 #'sqrt 0) (test 0d0 #'sqrt 0d0) (test 111.1106106544285d0 #'sqrt 12345.5678d0) (test #c(0 11.119982014373944d0) #'sqrt -123.654d0) (test 3/8 #'sqrt 9/64) (test #c(0 1.1832159566199232d0) #'sqrt -7/5) (test 514.7536007118473d0 #'sqrt 821974900428408092/3102128401119) (test 413412341293461238946192384612893/314212341412341246128361289 #'sqrt 170909763933741276657131032282211169869649489782500833989461829449/98729395495825697643724477479624921705328808513741521) ;; check for overflow (error-test #'sqrt 402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mod ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 5 #'mod 5 9) (test 4 #'mod -5 9) (test -4 #'mod 5 -9) (test -5 #'mod -5 -9) (test 2147483646 #'mod -2147483648 2147483647) (test -1 #'mod -2147483648 -2147483647) (test 1 #'mod 2147483648 2147483647) (test 0 #'mod -170909763933741276657131032282211169869649489782500833989461829449 413412341293461238946192384612893) (test -1709112374367945085349927261774254951415063208858972804089162291360682436890 #'mod 41341412341234123412490123470912347210 -1709112374367945085349927261774254951456404621200206927501652414831594784100) (test 9.666666666666666d0 #'mod -1/3 10d0) (test -9.666666666666666d0 #'mod 1/3 -10d0) (test -0.3333333333333333d0 #'mod -1/3 -10d0) (test 0.3333333333333333d0 #'mod 1/3 10d0) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; rem ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 2 #'rem 11 3) (test 2 #'rem 11 -3) (test -2 #'rem -11 3) (test -2 #'rem -11 -3) (test -1 #'rem -2147483648 2147483647) (test 0.1499999999999999d0 #'rem 1.35d0 1/5) (test -0.1499999999999999d0 #'rem -1.35d0 1/5) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gcd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 11 #'gcd 33 11) (test 7 #'gcd 91 -49) (test 4 #'gcd -4) (test 0 #'gcd) (test 11 #'gcd 3333 -33 1002001) (test 1 #'gcd -2147483648 2147483647) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; lcm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 1 #'lcm) (test 10 #'lcm 10) (test 5 #'lcm -5) (test 4611686016279904256 #'lcm -2147483648 2147483647) (test 0 #'lcm 0 5) (test 60 #'lcm 1 2 3 4 5 6) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; and ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test -1 #'logand) (test 0 #'logand 1 2) (test -2147483648 #'logand -2147483648 -1) (test 2147483647 #'logand 2147483647 -1) (test 2147479552 #'logand 8796093018112 2147483647) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; eqv ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test -1 #'logeqv) (test -4 #'logeqv 1 2) (test -2147483648 #'logeqv -2147483648 -1) (test 2147483647 #'logeqv 2147483647 -1) (test -8793945542656 #'logeqv 8796093018112 2147483647) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; or ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 0 #'logior) (test 3 #'logior 1 2) (test -1 #'logior -2147483648 -1) (test -1 #'logior 2147483647 -1) (test 8796093022207 #'logior 8796093018112 2147483647) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; xor ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test 0 #'logxor) (test 3 #'logxor 1 2) (test 2147483647 #'logxor -2147483648 -1) (test -2147483648 #'logxor 2147483647 -1) (test 8793945542655 #'logxor 8796093018112 2147483647) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; not ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test -1 #'lognot 0) (test 0 #'lognot -1) (test -2 #'lognot 1) (test 1 #'lognot -2) (test -3 #'lognot 2) (test 2 #'lognot -3) (test -2147483648 #'lognot 2147483647) (test 2147483647 #'lognot -2147483648) (test -8793945542656 #'lognot 8793945542655) (test -8796093018113 #'lognot 8796093018112) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; floor ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (div-test 1 1/2 #'floor 3/2) (div-test 1d0 1 #'ffloor 3 2) (div-test -2 2147483646 #'floor -2147483648 2147483647) (div-test 2147483648 0 #'floor -2147483648 -1) (div-test 17179869184 0 #'floor 18446744073709551616 1073741824) (div-test -17179869201 -1073741807 #'floor 18446744073709551616 -1073741823) (div-test 2147483648 0d0 #'floor -2147483648 -1d0) (div-test -2 2147483646/2147483647 #'floor -2147483648/2147483647) (div-test 32768 32768/2147483647 #'floor 2147483648/2147483647 65535/2147483647) (div-test -32769 -32767/2147483647 #'floor 2147483648/2147483647 -65535/2147483647) (div-test -32769 32767/2147483647 #'floor -2147483648/2147483647 65535/2147483647) (div-test 32768 -32768/2147483647 #'floor -2147483648/2147483647 -65535/2147483647) (div-test 2 0.5d0 #'floor 3d0 1.25d0) (div-test 2 1d0 #'floor 4d0 1.5d0) (div-test -3 -0.5d0 #'floor 4d0 -1.5d0) (div-test -3 0.5d0 #'floor -4d0 1.5d0) (div-test 2 -1d0 #'floor -4d0 -1.5d0) (div-test 1 2/91 #'floor 5/7 9/13) (div-test -2 -61/91 #'floor 5/7 -9/13) (div-test -2 61/91 #'floor -5/7 9/13) (div-test 1 -2/91 #'floor -5/7 -9/13) (div-test 1 0 #'floor 2147483648/2147483647 2147483648/2147483647) (div-test -1 0 #'floor 2147483648/2147483647 -2147483648/2147483647) (div-test -1 0 #'floor -2147483648/2147483647 2147483648/2147483647) (div-test 1 0 #'floor -2147483648/2147483647 -2147483648/2147483647) (div-test 9437 1416337955817765/144137437447079 #'floor 16324116304212832041/144137437447079 12) (div-test -9438 -313311293547183/144137437447079 #'floor 16324116304212832041/144137437447079 -12) (div-test -9438 313311293547183/144137437447079 #'floor -16324116304212832041/144137437447079 12) (div-test 9437 -1416337955817765/144137437447079 #'floor -16324116304212832041/144137437447079 -12) (div-test 8081 1138147903718848755797/4324123123412370 #'floor 2147483648 1148972348912638496123/4324123123412370) (div-test -8082 -1804074198964956721/720687187235395 #'floor 2147483648 -1148972348912638496123/4324123123412370) (div-test -8082 1804074198964956721/720687187235395 #'floor -2147483648 1148972348912638496123/4324123123412370) (div-test 8081 -1138147903718848755797/4324123123412370 #'floor -2147483648 -1148972348912638496123/4324123123412370) (div-test 0 1148972348912638496123/4324123123412370111 #'floor 1148972348912638496123/4324123123412370111 2147483648) (div-test -1 -9285982550494401861657948805/4324123123412370111 #'floor 1148972348912638496123/4324123123412370111 -2147483648) (div-test -1 9285982550494401861657948805/4324123123412370111 #'floor -1148972348912638496123/4324123123412370111 2147483648) (div-test 0 -1148972348912638496123/4324123123412370111 #'floor -1148972348912638496123/4324123123412370111 -2147483648) (div-test 0.0d0 1.0000000004656613d0 #'ffloor 2147483648/2147483647 2147483648d0) (div-test -1.0d0 -2.147483647d9 #'ffloor 2147483648/2147483647 -2147483648d0) (div-test -1.0d0 2.147483647d9 #'ffloor -2147483648/2147483647 2147483648d0) (div-test 0.0d0 -1.0000000004656613d0 #'ffloor -2147483648/2147483647 -2147483648d0) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ceiling ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (div-test 2 -1/2 #'ceiling 3/2) (div-test 2d0 -1 #'fceiling 3 2) (div-test -1 -1 #'ceiling -2147483648 2147483647) (div-test 2147483648 0 #'ceiling -2147483648 -1) (div-test 17179869184 0 #'ceiling 18446744073709551616 1073741824) (div-test -17179869200 16 #'ceiling 18446744073709551616 -1073741823) (div-test 2147483648 0d0 #'ceiling -2147483648 -1d0) (div-test -1 -1/2147483647 #'ceiling -2147483648/2147483647) (div-test 32769 -32767/2147483647 #'ceiling 2147483648/2147483647 65535/2147483647) (div-test -32768 32768/2147483647 #'ceiling 2147483648/2147483647 -65535/2147483647) (div-test -32768 -32768/2147483647 #'ceiling -2147483648/2147483647 65535/2147483647) (div-test 32769 32767/2147483647 #'ceiling -2147483648/2147483647 -65535/2147483647) (div-test 3 -0.75d0 #'ceiling 3d0 1.25d0) (div-test 3 -0.5d0 #'ceiling 4d0 1.5d0) (div-test -2 1d0 #'ceiling 4d0 -1.5d0) (div-test -2 -1d0 #'ceiling -4d0 1.5d0) (div-test 3 0.5d0 #'ceiling -4d0 -1.5d0) (div-test 2 -61/91 #'ceiling 5/7 9/13) (div-test -1 2/91 #'ceiling 5/7 -9/13) (div-test -1 -2/91 #'ceiling -5/7 9/13) (div-test 2 61/91 #'ceiling -5/7 -9/13) (div-test 1 0 #'ceiling 2147483648/2147483647 2147483648/2147483647) (div-test -1 0 #'ceiling 2147483648/2147483647 -2147483648/2147483647) (div-test -1 0 #'ceiling -2147483648/2147483647 2147483648/2147483647) (div-test 1 0 #'ceiling -2147483648/2147483647 -2147483648/2147483647) (div-test 9438 -313311293547183/144137437447079 #'ceiling 16324116304212832041/144137437447079 12) (div-test -9437 1416337955817765/144137437447079 #'ceiling 16324116304212832041/144137437447079 -12) (div-test -9437 -1416337955817765/144137437447079 #'ceiling -16324116304212832041/144137437447079 12) (div-test 9438 313311293547183/144137437447079 #'ceiling -16324116304212832041/144137437447079 -12) (div-test 8082 -1804074198964956721/720687187235395 #'ceiling 2147483648 1148972348912638496123/4324123123412370) (div-test -8081 1138147903718848755797/4324123123412370 #'ceiling 2147483648 -1148972348912638496123/4324123123412370) (div-test -8081 -1138147903718848755797/4324123123412370 #'ceiling -2147483648 1148972348912638496123/4324123123412370) (div-test 8082 1804074198964956721/720687187235395 #'ceiling -2147483648 -1148972348912638496123/4324123123412370) (div-test 1 -9285982550494401861657948805/4324123123412370111 #'ceiling 1148972348912638496123/4324123123412370111 2147483648) (div-test 0 1148972348912638496123/4324123123412370111 #'ceiling 1148972348912638496123/4324123123412370111 -2147483648) (div-test 0 -1148972348912638496123/4324123123412370111 #'ceiling -1148972348912638496123/4324123123412370111 2147483648) (div-test 1 9285982550494401861657948805/4324123123412370111 #'ceiling -1148972348912638496123/4324123123412370111 -2147483648) (div-test 1.0d0 -2.147483647d9 #'fceiling 2147483648/2147483647 2147483648d0) (div-test 0d0 1.0000000004656613d0 #'fceiling 2147483648/2147483647 -2147483648d0) (div-test 0d0 -1.0000000004656613d0 #'fceiling -2147483648/2147483647 2147483648d0) (div-test 1d0 2.147483647d9 #'fceiling -2147483648/2147483647 -2147483648d0) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; truncate ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (div-test 1 1/2 #'truncate 3/2) (div-test 1d0 1 #'ftruncate 3 2) (div-test -1 -1 #'truncate -2147483648 2147483647) (div-test 2147483648 0 #'truncate -2147483648 -1) (div-test 17179869184 0 #'truncate 18446744073709551616 1073741824) (div-test -17179869200 16 #'truncate 18446744073709551616 -1073741823) (div-test 2147483648 0d0 #'truncate -2147483648 -1d0) (div-test -1 -1/2147483647 #'truncate -2147483648/2147483647) (div-test 32768 32768/2147483647 #'truncate 2147483648/2147483647 65535/2147483647) (div-test -32768 32768/2147483647 #'truncate 2147483648/2147483647 -65535/2147483647) (div-test -32768 -32768/2147483647 #'truncate -2147483648/2147483647 65535/2147483647) (div-test 32768 -32768/2147483647 #'truncate -2147483648/2147483647 -65535/2147483647) (div-test 2 0.5d0 #'truncate 3d0 1.25d0) (div-test 2 1d0 #'truncate 4d0 1.5d0) (div-test -2 1d0 #'truncate 4d0 -1.5d0) (div-test -2 -1d0 #'truncate -4d0 1.5d0) (div-test 2 -1d0 #'truncate -4d0 -1.5d0) (div-test 1 2/91 #'truncate 5/7 9/13) (div-test -1 2/91 #'truncate 5/7 -9/13) (div-test -1 -2/91 #'truncate -5/7 9/13) (div-test 1 -2/91 #'truncate -5/7 -9/13) (div-test 1 0 #'truncate 2147483648/2147483647 2147483648/2147483647) (div-test -1 0 #'truncate 2147483648/2147483647 -2147483648/2147483647) (div-test -1 0 #'truncate -2147483648/2147483647 2147483648/2147483647) (div-test 1 0 #'truncate -2147483648/2147483647 -2147483648/2147483647) (div-test 9437 1416337955817765/144137437447079 #'truncate 16324116304212832041/144137437447079 12) (div-test -9437 1416337955817765/144137437447079 #'truncate 16324116304212832041/144137437447079 -12) (div-test -9437 -1416337955817765/144137437447079 #'truncate -16324116304212832041/144137437447079 12) (div-test 9437 -1416337955817765/144137437447079 #'truncate -16324116304212832041/144137437447079 -12) (div-test 8081 1138147903718848755797/4324123123412370 #'truncate 2147483648 1148972348912638496123/4324123123412370) (div-test -8081 1138147903718848755797/4324123123412370 #'truncate 2147483648 -1148972348912638496123/4324123123412370) (div-test -8081 -1138147903718848755797/4324123123412370 #'truncate -2147483648 1148972348912638496123/4324123123412370) (div-test 8081 -1138147903718848755797/4324123123412370 #'truncate -2147483648 -1148972348912638496123/4324123123412370) (div-test 0 1148972348912638496123/4324123123412370111 #'truncate 1148972348912638496123/4324123123412370111 2147483648) (div-test 0 1148972348912638496123/4324123123412370111 #'truncate 1148972348912638496123/4324123123412370111 -2147483648) (div-test 0 -1148972348912638496123/4324123123412370111 #'truncate -1148972348912638496123/4324123123412370111 2147483648) (div-test 0 -1148972348912638496123/4324123123412370111 #'truncate -1148972348912638496123/4324123123412370111 -2147483648) (div-test 0d0 1.0000000004656613d0 #'ftruncate 2147483648/2147483647 2147483648d0) (div-test 0d0 1.0000000004656613d0 #'ftruncate 2147483648/2147483647 -2147483648d0) (div-test 0d0 -1.0000000004656613d0 #'ftruncate -2147483648/2147483647 2147483648d0) (div-test 0d0 -1.0000000004656613d0 #'ftruncate -2147483648/2147483647 -2147483648d0) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; round ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (div-test 2 -1/2 #'round 3/2) (div-test 2d0 -1 #'fround 3 2) (div-test -1 -1 #'round -2147483648 2147483647) (div-test 2147483648 0 #'round -2147483648 -1) (div-test 17179869184 0 #'round 18446744073709551616 1073741824) (div-test -17179869200 16 #'round 18446744073709551616 -1073741823) (div-test 2147483648 0d0 #'round -2147483648 -1d0) (div-test -1 -1/2147483647 #'round -2147483648/2147483647) (div-test 32769 -32767/2147483647 #'round 2147483648/2147483647 65535/2147483647) (div-test -32769 -32767/2147483647 #'round 2147483648/2147483647 -65535/2147483647) (div-test -32769 32767/2147483647 #'round -2147483648/2147483647 65535/2147483647) (div-test 32769 32767/2147483647 #'round -2147483648/2147483647 -65535/2147483647) (div-test 2 0.5d0 #'round 3d0 1.25d0) (div-test 3 -0.5d0 #'round 4d0 1.5d0) (div-test -3 -0.5d0 #'round 4d0 -1.5d0) (div-test -3 0.5d0 #'round -4d0 1.5d0) (div-test 3 0.5d0 #'round -4d0 -1.5d0) (div-test 1 2/91 #'round 5/7 9/13) (div-test -1 2/91 #'round 5/7 -9/13) (div-test -1 -2/91 #'round -5/7 9/13) (div-test 1 -2/91 #'round -5/7 -9/13) (div-test 1 0 #'round 2147483648/2147483647 2147483648/2147483647) (div-test -1 0 #'round 2147483648/2147483647 -2147483648/2147483647) (div-test -1 0 #'round -2147483648/2147483647 2147483648/2147483647) (div-test 1 0 #'round -2147483648/2147483647 -2147483648/2147483647) (div-test 9438 -313311293547183/144137437447079 #'round 16324116304212832041/144137437447079 12) (div-test -9438 -313311293547183/144137437447079 #'round 16324116304212832041/144137437447079 -12) (div-test -9438 313311293547183/144137437447079 #'round -16324116304212832041/144137437447079 12) (div-test 9438 313311293547183/144137437447079 #'round -16324116304212832041/144137437447079 -12) (div-test 8082 -1804074198964956721/720687187235395 #'round 2147483648 1148972348912638496123/4324123123412370) (div-test -8082 -1804074198964956721/720687187235395 #'round 2147483648 -1148972348912638496123/4324123123412370) (div-test -8082 1804074198964956721/720687187235395 #'round -2147483648 1148972348912638496123/4324123123412370) (div-test 8082 1804074198964956721/720687187235395 #'round -2147483648 -1148972348912638496123/4324123123412370) (div-test 0 1148972348912638496123/4324123123412370111 #'round 1148972348912638496123/4324123123412370111 2147483648) (div-test 0 1148972348912638496123/4324123123412370111 #'round 1148972348912638496123/4324123123412370111 -2147483648) (div-test 0 -1148972348912638496123/4324123123412370111 #'round -1148972348912638496123/4324123123412370111 2147483648) (div-test 0 -1148972348912638496123/4324123123412370111 #'round -1148972348912638496123/4324123123412370111 -2147483648) (div-test 0d0 1.0000000004656613d0 #'fround 2147483648/2147483647 2147483648d0) (div-test 0d0 1.0000000004656613d0 #'fround 2147483648/2147483647 -2147483648d0) (div-test 0d0 -1.0000000004656613d0 #'fround -2147483648/2147483647 2147483648d0) (div-test 0d0 -1.0000000004656613d0 #'fround -2147483648/2147483647 -2147483648d0) (div-test 2 0.5d0 #'round 2.5d0) (div-test -2 -0.5d0 #'round -2.5d0) (div-test 5 0d0 #'round 2.5d0 0.5d0) (div-test -5 0d0 #'round 2.5d0 -0.5d0) (div-test -5 0d0 #'round 2.5d0 -0.5d0) (div-test -5 0d0 #'round -2.5d0 0.5d0) (div-test 5 0d0 #'round -2.5d0 -0.5d0) (div-test 1 -2/7 #'round 5/7) (div-test -1 2/7 #'round -5/7) (div-test 2 -1/2 #'round 3/2) (div-test -2 1/2 #'round -3/2) (div-test 2 1 #'round 30/2 7) (div-test -2 1 #'round 30/2 -7) (div-test -2 -1 #'round -30/2 7) (div-test 2 -1 #'round -30/2 -7) (div-test 1073741824 -1/2 #'round 2147483647/2) (div-test -1073741824 1/2 #'round -2147483647/2) (div-test 1 -2147483645/2 #'round 2147483647/2 2147483646) (div-test -1 -2147483645/2 #'round 2147483647/2 -2147483646) (div-test -1 2147483645/2 #'round -2147483647/2 2147483646) (div-test 1 -2147483645/2 #'round 2147483647/2 2147483646) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; misc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (test #c(5 -5) #'conjugate #c(5 5)) (test #c(5 5) #'conjugate #c(5 -5)) (test #c(-5 -5) #'conjugate #c(-5 5)) (test #c(-5 5) #'conjugate #c(-5 -5)) (test 1 #'denominator 10) (test 3 #'denominator 10/3) (test 3 #'denominator 1804074198964956721/3) (test 4324123123412370111 #'denominator -1148972348912638496123/4324123123412370111) (bool-test nil #'evenp -1) (bool-test t #'evenp -2147483648) (bool-test t #'evenp -4294967296) (bool-test nil #'evenp -4294967295) (test 0.5d0 #'float 1/2) (test 10.0d0 #'float 10) (test 4.978341823462786d22 #'float 49783418234627861238926) (test 1.845867531346429d12 #'float 643827946123846123984/348794231) (bool-test t #'floatp 0.3d0) (bool-test nil #'floatp 1/3) (test 0 #'imagpart 1) (test -5 #'imagpart #c(1 -5)) (bool-test t #'integerp 12) (bool-test nil #'integerp 1/2) (bool-test nil #'integerp :test) (bool-test nil #'integerp 0d0) (bool-test t #'integerp 49783418234627861238926) (test 3 #'isqrt 12) (test 46340 #'isqrt 2147483648) (test 46340 #'isqrt 2147483647) (test 25373764918 #'isqrt 643827946123846123984) (bool-test nil #'logtest 1 2) (bool-test t #'logtest 1 3) (bool-test t #'logtest 7 -1) (bool-test nil #'minusp 0) (bool-test nil #'minusp 2147483648) (bool-test t #'minusp -2147483648) (bool-test t #'minusp -1/4) (bool-test nil #'minusp 0.2d0) (bool-test nil #'minusp 0d0) (bool-test nil #'minusp 984723891462817946123897416) (bool-test t #'minusp -1148972348912638496123/4324123123412370111) (bool-test t #'numberp #c(1 2)) (bool-test t #'numberp -200) (bool-test nil #'numberp :test) (test 10 #'numerator 10) (test 10 #'numerator 10/3) (test 1804074198964956721 #'numerator 1804074198964956721/3) (test -1148972348912638496123 #'numerator -1148972348912638496123/4324123123412370111) (bool-test t #'oddp -1) (bool-test nil #'oddp -2147483648) (bool-test nil #'oddp -4294967296) (bool-test t #'oddp -4294967295) (bool-test nil #'plusp 0) (bool-test t #'plusp 2147483648) (bool-test nil #'plusp -2147483648) (bool-test nil #'plusp -1/4) (bool-test t #'plusp 0.2d0) (bool-test nil #'plusp 0d0) (bool-test t #'plusp 984723891462817946123897416) (bool-test nil #'plusp -1148972348912638496123/4324123123412370111) (test 1/4 #'rational 0.25d0) (test 5/2 #'rational 2.5d0) (test 1/8 #'rational 0.125d0) (test -5/8 #'rational -0.625d0) (test 524293/8 #'rational 65536.625d0) (test 17179869181/8 #'rational 2147483647.625d0) (bool-test t #'rationalp -3) (bool-test t #'rationalp 1/2) (bool-test t #'rationalp 1/2412341242424122412) (bool-test nil #'rationalp :test) (bool-test nil #'rationalp 0d0) (bool-test t #'rationalp 49783418234627861238926) (test -1 #'realpart #c(-1 0.5d0)) (test 1 #'signum 123/5) (test 0d0 #'signum 0d0) (test -1d0 #'signum -7.3d0) (bool-test nil #'zerop 1) (bool-test nil #'zerop 1/4312412341234123412) (bool-test nil #'zerop 0.000003d0) (bool-test t #'zerop 0) (bool-test t #'zerop 0d0) (bool-test t #'zerop #c(0 0d0)) (bool-test t #'= 10 #c(10 0d0)) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/0000775000000000000000000000000012472176532015736 5ustar x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/x11.c0000664000000000000000000004116312472175711016516 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/modules/x11.c,v 1.11tsi Exp $ */ #include #include #include "lisp/internal.h" #include "lisp/private.h" #include /* * Prototypes */ int x11LoadModule(void); LispObj *Lisp_XOpenDisplay(LispBuiltin *builtin); LispObj *Lisp_XCloseDisplay(LispBuiltin *builtin); LispObj *Lisp_XDefaultRootWindow(LispBuiltin *builtin); LispObj *Lisp_XDefaultScreen(LispBuiltin *builtin); LispObj *Lisp_XDefaultScreenOfDisplay(LispBuiltin *builtin); LispObj *Lisp_XBlackPixel(LispBuiltin *builtin); LispObj *Lisp_XBlackPixelOfScreen(LispBuiltin *builtin); LispObj *Lisp_XWidthOfScreen(LispBuiltin *builtin); LispObj *Lisp_XHeightOfScreen(LispBuiltin *builtin); LispObj *Lisp_XWhitePixel(LispBuiltin *builtin); LispObj *Lisp_XWhitePixelOfScreen(LispBuiltin *builtin); LispObj *Lisp_XDefaultGC(LispBuiltin *builtin); LispObj *Lisp_XDefaultGCOfScreen(LispBuiltin *builtin); LispObj *Lisp_XCreateSimpleWindow(LispBuiltin *builtin); LispObj *Lisp_XMapWindow(LispBuiltin *builtin); LispObj *Lisp_XDestroyWindow(LispBuiltin *builtin); LispObj *Lisp_XFlush(LispBuiltin *builtin); LispObj *Lisp_XRaiseWindow(LispBuiltin *builtin); LispObj *Lisp_XBell(LispBuiltin *builtin); LispObj *Lisp_XDrawLine(LispBuiltin *builtin); /* * Initialization */ static LispBuiltin lispbuiltins[] = { {LispFunction, Lisp_XOpenDisplay, "x-open-display &optional display-name"}, {LispFunction, Lisp_XCloseDisplay, "x-close-display display"}, {LispFunction, Lisp_XDefaultRootWindow, "x-default-root-window display"}, {LispFunction, Lisp_XDefaultScreen, "x-default-screen display"}, {LispFunction, Lisp_XDefaultScreenOfDisplay, "x-default-screen-of-display display"}, {LispFunction, Lisp_XBlackPixel, "x-black-pixel display &optional screen"}, {LispFunction, Lisp_XBlackPixelOfScreen, "x-black-pixel-of-screen screen"}, {LispFunction, Lisp_XWhitePixel, "x-white-pixel display &optional screen"}, {LispFunction, Lisp_XWhitePixelOfScreen, "x-white-pixel-of-screen screen"}, {LispFunction, Lisp_XDefaultGC, "x-default-gc display &optional screen"}, {LispFunction, Lisp_XDefaultGCOfScreen, "x-default-gc-of-screen screen"}, {LispFunction, Lisp_XCreateSimpleWindow, "x-create-simple-window display parent x y width height &optional border-width border background"}, {LispFunction, Lisp_XMapWindow, "x-map-window display window"}, {LispFunction, Lisp_XDestroyWindow, "X-DESTROY-WINDOW"}, {LispFunction, Lisp_XFlush, "x-flush display"}, {LispFunction, Lisp_XDrawLine, "x-draw-line display drawable gc x1 y1 x2 y2"}, {LispFunction, Lisp_XBell, "x-bell display &optional percent"}, {LispFunction, Lisp_XRaiseWindow, "x-raise-window display window"}, {LispFunction, Lisp_XWidthOfScreen, "x-width-of-screen screen"}, {LispFunction, Lisp_XHeightOfScreen, "x-height-of-screen screen"}, }; LispModuleData x11LispModuleData = { LISP_MODULE_VERSION, x11LoadModule }; static int x11Display_t, x11Screen_t, x11Window_t, x11GC_t; /* * Implementation */ int x11LoadModule(void) { int i; x11Display_t = LispRegisterOpaqueType("Display*"); x11Screen_t = LispRegisterOpaqueType("Screen*"); x11Window_t = LispRegisterOpaqueType("Window"); x11GC_t = LispRegisterOpaqueType("GC"); for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) LispAddBuiltinFunction(&lispbuiltins[i]); return (1); } LispObj * Lisp_XOpenDisplay(LispBuiltin *builtin) /* x-open-display &optional display-name */ { LispObj *display_name; char *dname; display_name = ARGUMENT(0); if (display_name == UNSPEC) dname = NULL; else { CHECK_STRING(display_name); dname = THESTR(display_name); } return (OPAQUE(XOpenDisplay(dname), x11Display_t)); } LispObj * Lisp_XCloseDisplay(LispBuiltin *builtin) /* x-close-display display */ { LispObj *display; display = ARGUMENT(0); if (!CHECKO(display, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(display)); XCloseDisplay((Display*)(display->data.opaque.data)); return (NIL); } LispObj * Lisp_XDefaultRootWindow(LispBuiltin *builtin) /* x-default-root-window display */ { LispObj *display; display = ARGUMENT(0); if (!CHECKO(display, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(display)); return (OPAQUE(DefaultRootWindow((Display*)(display->data.opaque.data)), x11Window_t)); } LispObj * Lisp_XDefaultScreen(LispBuiltin *builtin) /* x-default-screen display */ { LispObj *display; display = ARGUMENT(0); if (!CHECKO(display, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(display)); return (INTEGER(DefaultScreen((Display*)(display->data.opaque.data)))); } LispObj * Lisp_XDefaultScreenOfDisplay(LispBuiltin *builtin) /* x-default-screen-of-display display */ { LispObj *display; display = ARGUMENT(0); if (!CHECKO(display, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(display)); return (OPAQUE(DefaultScreenOfDisplay((Display*)(display->data.opaque.data)), x11Screen_t)); } LispObj * Lisp_XBlackPixel(LispBuiltin *builtin) /* x-black-pixel display &optional screen */ { Display *display; int screen; LispObj *odisplay, *oscreen; oscreen = ARGUMENT(1); odisplay = ARGUMENT(0); if (!CHECKO(odisplay, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(odisplay)); display = (Display*)(odisplay->data.opaque.data); if (oscreen == UNSPEC) screen = DefaultScreen(display); else { CHECK_INDEX(oscreen); screen = FIXNUM_VALUE(oscreen); } if (screen >= ScreenCount(display)) LispDestroy("%s: screen index %d too large, %d screens available", STRFUN(builtin), screen, ScreenCount(display)); return (INTEGER(BlackPixel(display, screen))); } LispObj * Lisp_XBlackPixelOfScreen(LispBuiltin *builtin) /* x-black-pixel-of-screen screen */ { LispObj *screen; screen = ARGUMENT(0); if (!CHECKO(screen, x11Screen_t)) LispDestroy("%s: cannot convert %s to Screen*", STRFUN(builtin), STROBJ(screen)); return (INTEGER(XBlackPixelOfScreen((Screen*)(screen->data.opaque.data)))); } LispObj * Lisp_XWhitePixel(LispBuiltin *builtin) /* x-white-pixel display &optional screen */ { Display *display; int screen; LispObj *odisplay, *oscreen; oscreen = ARGUMENT(1); odisplay = ARGUMENT(0); if (!CHECKO(odisplay, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(odisplay)); display = (Display*)(odisplay->data.opaque.data); if (oscreen == UNSPEC) screen = DefaultScreen(display); else { CHECK_FIXNUM(oscreen); screen = FIXNUM_VALUE(oscreen); } if (screen >= ScreenCount(display)) LispDestroy("%s: screen index %d too large, %d screens available", STRFUN(builtin), screen, ScreenCount(display)); return (INTEGER(WhitePixel(display, screen))); } LispObj * Lisp_XWhitePixelOfScreen(LispBuiltin *builtin) /* x-white-pixel-of-screen screen */ { LispObj *screen; screen = ARGUMENT(0); if (!CHECKO(screen, x11Screen_t)) LispDestroy("%s: cannot convert %s to Screen*", STRFUN(builtin), STROBJ(screen)); return (INTEGER(WhitePixelOfScreen((Screen*)(screen->data.opaque.data)))); } LispObj * Lisp_XDefaultGC(LispBuiltin *builtin) /* x-default-gc display &optional screen */ { Display *display; int screen; LispObj *odisplay, *oscreen; oscreen = ARGUMENT(1); odisplay = ARGUMENT(0); if (!CHECKO(odisplay, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(odisplay)); display = (Display*)(odisplay->data.opaque.data); if (oscreen == UNSPEC) screen = DefaultScreen(display); else { CHECK_FIXNUM(oscreen); screen = FIXNUM_VALUE(oscreen); } if (screen >= ScreenCount(display)) LispDestroy("%s: screen index %d too large, %d screens available", STRFUN(builtin), screen, ScreenCount(display)); return (OPAQUE(DefaultGC(display, screen), x11GC_t)); } LispObj * Lisp_XDefaultGCOfScreen(LispBuiltin *builtin) /* x-default-gc-of-screen screen */ { LispObj *screen; screen = ARGUMENT(0); if (!CHECKO(screen, x11Screen_t)) LispDestroy("%s: cannot convert %s to Screen*", STRFUN(builtin), STROBJ(screen)); return (OPAQUE(DefaultGCOfScreen((Screen*)(screen->data.opaque.data)), x11GC_t)); } LispObj * Lisp_XCreateSimpleWindow(LispBuiltin *builtin) /* x-create-simple-window display parent x y width height &optional border-width border background */ { Display *display; Window parent; int x, y; unsigned int width, height, border_width; unsigned long border, background; LispObj *odisplay, *oparent, *ox, *oy, *owidth, *oheight, *oborder_width, *oborder, *obackground; obackground = ARGUMENT(8); oborder = ARGUMENT(7); oborder_width = ARGUMENT(6); oheight = ARGUMENT(5); owidth = ARGUMENT(4); oy = ARGUMENT(3); ox = ARGUMENT(2); oparent = ARGUMENT(1); odisplay = ARGUMENT(0); if (!CHECKO(odisplay, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(odisplay)); display = (Display*)(odisplay->data.opaque.data); if (!CHECKO(oparent, x11Window_t)) LispDestroy("%s: cannot convert %s to Window", STRFUN(builtin), STROBJ(oparent)); parent = (Window)(oparent->data.opaque.data); CHECK_FIXNUM(ox); x = FIXNUM_VALUE(ox); CHECK_FIXNUM(oy); y = FIXNUM_VALUE(oy); CHECK_INDEX(owidth); width = FIXNUM_VALUE(owidth); CHECK_INDEX(oheight); height = FIXNUM_VALUE(oheight); /* check &OPTIONAL parameters */ if (oborder_width == UNSPEC) border_width = 1; else { CHECK_INDEX(oborder_width); border_width = FIXNUM_VALUE(oborder_width); } if (oborder == UNSPEC) border = BlackPixel(display, DefaultScreen(display)); else { CHECK_LONGINT(oborder); border = LONGINT_VALUE(oborder); } if (obackground == UNSPEC) background = WhitePixel(display, DefaultScreen(display)); else { CHECK_LONGINT(obackground); background = LONGINT_VALUE(obackground); } return (OPAQUE( XCreateSimpleWindow(display, parent, x, y, width, height, border_width, border, background), x11Window_t)); } LispObj * Lisp_XMapWindow(LispBuiltin *builtin) /* x-map-window display window */ { Display *display; Window window; LispObj *odisplay, *owindow; owindow = ARGUMENT(1); odisplay = ARGUMENT(0); if (!CHECKO(odisplay, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(odisplay)); display = (Display*)(odisplay->data.opaque.data); if (!CHECKO(owindow, x11Window_t)) LispDestroy("%s: cannot convert %s to Window", STRFUN(builtin), STROBJ(owindow)); window = (Window)(owindow->data.opaque.data); XMapWindow(display, window); return (owindow); } LispObj * Lisp_XDestroyWindow(LispBuiltin *builtin) /* x-destroy-window display window */ { Display *display; Window window; LispObj *odisplay, *owindow; owindow = ARGUMENT(1); odisplay = ARGUMENT(0); if (!CHECKO(odisplay, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(odisplay)); display = (Display*)(odisplay->data.opaque.data); if (!CHECKO(owindow, x11Window_t)) LispDestroy("%s: cannot convert %s to Window", STRFUN(builtin), STROBJ(owindow)); window = (Window)(owindow->data.opaque.data); XDestroyWindow(display, window); return (NIL); } LispObj * Lisp_XFlush(LispBuiltin *builtin) /* x-flush display */ { Display *display; LispObj *odisplay; odisplay = ARGUMENT(0); if (!CHECKO(odisplay, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(odisplay)); display = (Display*)(odisplay->data.opaque.data); XFlush(display); return (odisplay); } LispObj * Lisp_XDrawLine(LispBuiltin *builtin) /* x-draw-line display drawable gc x1 y1 x2 y2 */ { Display *display; Drawable drawable; GC gc; int x1, y1, x2, y2; LispObj *odisplay, *odrawable, *ogc, *ox1, *oy1, *ox2, *oy2; oy2 = ARGUMENT(6); ox2 = ARGUMENT(5); oy1 = ARGUMENT(4); ox1 = ARGUMENT(3); ogc = ARGUMENT(2); odrawable = ARGUMENT(1); odisplay = ARGUMENT(0); if (!CHECKO(odisplay, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(odisplay)); display = (Display*)(odisplay->data.opaque.data); /* XXX correct check when drawing to pixmaps implemented */ if (!CHECKO(odrawable, x11Window_t)) LispDestroy("%s: cannot convert %s to Drawable", STRFUN(builtin), STROBJ(odrawable)); drawable = (Drawable)(odrawable->data.opaque.data); if (!CHECKO(ogc, x11GC_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(ogc)); gc = (GC)(ogc->data.opaque.data); CHECK_FIXNUM(ox1); x1 = FIXNUM_VALUE(ox1); CHECK_FIXNUM(oy1); y1 = FIXNUM_VALUE(oy1); CHECK_FIXNUM(ox2); x2 = FIXNUM_VALUE(ox2); CHECK_FIXNUM(oy2); y2 = FIXNUM_VALUE(oy2); XDrawLine(display, drawable, gc, x1, y1, x2, y2); return (odrawable); } LispObj * Lisp_XBell(LispBuiltin *builtin) /* x-bell &optional percent */ { Display *display; int percent; LispObj *odisplay, *opercent; opercent = ARGUMENT(1); odisplay = ARGUMENT(0); if (!CHECKO(odisplay, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(odisplay)); display = (Display*)(odisplay->data.opaque.data); if (opercent == UNSPEC) percent = 0; else { CHECK_FIXNUM(opercent); percent = FIXNUM_VALUE(opercent); } if (percent < -100 || percent > 100) LispDestroy("%s: percent value %d out of range -100 to 100", STRFUN(builtin), percent); XBell(display, percent); return (odisplay); } LispObj * Lisp_XRaiseWindow(LispBuiltin *builtin) /* x-raise-window display window */ { Display *display; Window window; LispObj *odisplay, *owindow; owindow = ARGUMENT(1); odisplay = ARGUMENT(0); if (!CHECKO(odisplay, x11Display_t)) LispDestroy("%s: cannot convert %s to Display*", STRFUN(builtin), STROBJ(odisplay)); display = (Display*)(odisplay->data.opaque.data); if (!CHECKO(owindow, x11Window_t)) LispDestroy("%s: cannot convert %s to Window", STRFUN(builtin), STROBJ(owindow)); window = (Window)(owindow->data.opaque.data); XRaiseWindow(display, window); return (owindow); } LispObj * Lisp_XWidthOfScreen(LispBuiltin *builtin) /* x-width-of-screen screen */ { LispObj *screen; screen = ARGUMENT(0); if (!CHECKO(screen, x11Screen_t)) LispDestroy("%s: cannot convert %s to Screen*", STRFUN(builtin), STROBJ(screen)); return (FIXNUM(WidthOfScreen((Screen*)(screen->data.opaque.data)))); } LispObj * Lisp_XHeightOfScreen(LispBuiltin *builtin) /* x-height-of-screen screen */ { LispObj *screen; screen = ARGUMENT(0); if (!CHECKO(screen, x11Screen_t)) LispDestroy("%s: cannot convert %s to Screen*", STRFUN(builtin), STROBJ(screen)); return (FIXNUM(HeightOfScreen((Screen*)(screen->data.opaque.data)))); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/xaw.c0000664000000000000000000004535612472175711016714 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/modules/xaw.c,v 1.15tsi Exp $ */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "lisp/internal.h" #include "lisp/private.h" /* * Types */ typedef struct { LispObj *object; void *data; } WidgetData; /* * Prototypes */ int xawLoadModule(void); void LispXawCleanupCallback(Widget, XtPointer, XtPointer); /* until a better/smarter interface be written... */ LispObj *Lisp_XawCoerceToListReturnStruct(LispBuiltin*); LispObj *Lisp_XawScrollbarCoerceToReal(LispBuiltin*); LispObj *Lisp_XawFormDoLayout(LispBuiltin*); LispObj *Lisp_XawListChange(LispBuiltin*); LispObj *Lisp_XawListHighlight(LispBuiltin*); LispObj *Lisp_XawListUnhighlight(LispBuiltin*); LispObj *Lisp_XawTextGetSource(LispBuiltin*); LispObj *Lisp_XawTextLastPosition(LispBuiltin*); LispObj *Lisp_XawTextReplace(LispBuiltin*); LispObj *Lisp_XawTextSearch(LispBuiltin*); LispObj *Lisp_XawTextGetInsertionPoint(LispBuiltin*); LispObj *Lisp_XawTextSetInsertionPoint(LispBuiltin*); LispObj *Lisp_XawScrollbarSetThumb(LispBuiltin*); /* * Initialization */ static LispBuiltin lispbuiltins[] = { {LispFunction, Lisp_XawCoerceToListReturnStruct, "xaw-coerce-to-list-return-struct opaque"}, {LispFunction, Lisp_XawScrollbarCoerceToReal, "xaw-scrollbar-coerce-to-real opaque"}, {LispFunction, Lisp_XawScrollbarSetThumb, "xaw-scrollbar-set-thumb widget top &optional shown"}, {LispFunction, Lisp_XawFormDoLayout, "xaw-form-do-layout widget force"}, {LispFunction, Lisp_XawListChange, "xaw-list-change widget list &optional longest resize"}, {LispFunction, Lisp_XawListHighlight, "xaw-list-highlight widget index"}, {LispFunction, Lisp_XawListUnhighlight, "xaw-list-unhighlight widget"}, {LispFunction, Lisp_XawTextGetSource, "xaw-text-get-source widget"}, {LispFunction, Lisp_XawTextLastPosition, "xaw-text-last-position widget"}, {LispFunction, Lisp_XawTextReplace, "xaw-text-replace widget left right text"}, {LispFunction, Lisp_XawTextSearch, "xaw-text-search widget direction text"}, {LispFunction, Lisp_XawTextGetInsertionPoint, "xaw-text-get-insertion-point widget"}, {LispFunction, Lisp_XawTextSetInsertionPoint, "xaw-text-set-insertion-point widget position"}, }; LispModuleData xawLispModuleData = { LISP_MODULE_VERSION, xawLoadModule }; static int xawWidget_t, xawWidgetClass_t, xawListReturnStruct_t, xawFloatp_t; static WidgetData **list_data; static int num_list_data; /* * Implementation */ int xawLoadModule(void) { int i; char *fname = "XAW-LOAD-MODULE"; xawWidget_t = LispRegisterOpaqueType("Widget"); xawWidgetClass_t = LispRegisterOpaqueType("WidgetClass"); xawListReturnStruct_t = LispRegisterOpaqueType("XawListReturnStruct"); xawFloatp_t = LispRegisterOpaqueType("float*"); LispExecute("(DEFSTRUCT XAW-LIST-RETURN-STRUCT STRING INDEX)\n"); GCDisable(); (void)LispSetVariable(ATOM2("ASCII-SINK-OBJECT-CLASS"), OPAQUE(asciiSinkObjectClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("ASCII-SRC-OBJECT-CLASS"), OPAQUE(asciiSinkObjectClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("ASCII-TEXT-WIDGET-CLASS"), OPAQUE(asciiTextWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("BOX-WIDGET-CLASS"), OPAQUE(boxWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("COMMAND-WIDGET-CLASS"), OPAQUE(commandWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("DIALOG-WIDGET-CLASS"), OPAQUE(dialogWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("FORM-WIDGET-CLASS"), OPAQUE(formWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("GRIP-WIDGET-CLASS"), OPAQUE(gripWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("LABEL-WIDGET-CLASS"), OPAQUE(labelWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("LIST-WIDGET-CLASS"), OPAQUE(listWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("MENU-BUTTON-WIDGET-CLASS"), OPAQUE(menuButtonWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("MULTI-SINK-OBJEC-TCLASS"), OPAQUE(multiSinkObjectClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("MULTI-SRC-OBJECT-CLASS"), OPAQUE(multiSrcObjectClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("PANED-WIDGET-CLASS"), OPAQUE(panedWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("PANNER-WIDGET-CLASS"), OPAQUE(pannerWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("PORTHOLE-WIDGET-CLASS"), OPAQUE(portholeWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("REPEATER-WIDGET-CLASS"), OPAQUE(repeaterWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("SCROLLBAR-WIDGET-CLASS"), OPAQUE(scrollbarWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("SIMPLE-MENU-WIDGET-CLASS"), OPAQUE(simpleMenuWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("SIMPLE-WIDGET-CLASS"), OPAQUE(simpleWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("SME-BSB-OBJECT-CLASS"), OPAQUE(smeBSBObjectClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("SME-LINE-OBJECT-CLASS"), OPAQUE(smeLineObjectClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("SME-OBJECT-CLASS"), OPAQUE(smeObjectClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("STRIP-CHART-WIDGET-CLASS"), OPAQUE(stripChartWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("TEXT-WIDGET-CLASS"), OPAQUE(textWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("TEXT-SINKOBJECT-CLASS"), OPAQUE(textSinkObjectClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("TEXT-SRC-OBJECT-CLASS"), OPAQUE(textSrcObjectClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("TIP-WIDGET-CLASS"), OPAQUE(tipWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("TOGGLE-WIDGET-CLASS"), OPAQUE(toggleWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("TREE-WIDGET-CLASS"), OPAQUE(treeWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("VIEWPORT-WIDGET-CLASS"), OPAQUE(viewportWidgetClass, xawWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("VENDOR-SHELL-WIDGET-CLASS"), OPAQUE(vendorShellWidgetClass, xawWidgetClass_t), fname, 0); /* return codes of XawTextReplace */ (void)LispSetVariable(ATOM2("XAW-REPLACE-ERROR"), INTEGER(XawReplaceError), fname, 0); (void)LispSetVariable(ATOM2("XAW-EDIT-DONE"), INTEGER(XawEditDone), fname, 0); (void)LispSetVariable(ATOM2("XAW-EDIT-ERROR"), INTEGER(XawEditError), fname, 0); (void)LispSetVariable(ATOM2("XAW-POSITION-ERROR"), INTEGER(XawPositionError), fname, 0); /* return code of XawTextSearch */ (void)LispSetVariable(ATOM2("XAW-TEXT-SEARCH-ERROR"), INTEGER(XawTextSearchError), fname, 0); /* enum XawTextScanDirection */ (void)LispSetVariable(ATOM2("XAWSD-LEFT"), INTEGER(XawsdLeft), fname, 0); (void)LispSetVariable(ATOM2("XAWSD-RIGHT"), INTEGER(XawsdRight), fname, 0); GCEnable(); for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) LispAddBuiltinFunction(&lispbuiltins[i]); return (1); } void LispXawCleanupCallback(Widget w, XtPointer user_data, XtPointer call_data) { WidgetData *data = (WidgetData*)user_data; UPROTECT(CAR(data->object), data->object); XtFree((XtPointer)data->data); XtFree((XtPointer)data); } LispObj * Lisp_XawCoerceToListReturnStruct(LispBuiltin *builtin) /* xaw-coerce-to-list-return-struct opaque */ { LispObj *result, *code, *ocod = COD; XawListReturnStruct *retlist; LispObj *opaque; opaque = ARGUMENT(0); if (!CHECKO(opaque, xawListReturnStruct_t)) LispDestroy("%s: cannot convert %s to XawListReturnStruct", STRFUN(builtin), STROBJ(opaque)); retlist = (XawListReturnStruct*)(opaque->data.opaque.data); GCDisable(); code = CONS(ATOM("MAKE-XAW-LIST-RETURN-STRUCT"), CONS(KEYWORD("STRING"), CONS(STRING(retlist->string), CONS(KEYWORD("INDEX"), CONS(INTEGER(retlist->list_index), NIL))))); COD = CONS(code, COD); GCEnable(); result = EVAL(code); COD = ocod; return (result); } LispObj * Lisp_XawScrollbarCoerceToReal(LispBuiltin *builtin) /* xaw-scrollbar-coerce-to-real opaque */ { float *floatp; double real; LispObj *opaque; opaque = ARGUMENT(0); if (!CHECKO(opaque, xawFloatp_t)) LispDestroy("%s: cannot convert %s to float*", STRFUN(builtin), STROBJ(opaque)); floatp = (float*)(opaque->data.opaque.data); real = *floatp; return (DFLOAT(real)); } LispObj * Lisp_XawFormDoLayout(LispBuiltin *builtin) /* xaw-form-do-layout widget force */ { int force; LispObj *owidget, *oforce; oforce = ARGUMENT(1); owidget = ARGUMENT(0); if (!CHECKO(owidget, xawWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); force = oforce != NIL; XawFormDoLayout((Widget)(owidget->data.opaque.data), force); return (oforce); } LispObj * Lisp_XawTextGetSource(LispBuiltin *builtin) /* xaw-text-get-source widget */ { LispObj *owidget; owidget = ARGUMENT(0); if (!CHECKO(owidget, xawWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); return (OPAQUE(XawTextGetSource((Widget)(owidget->data.opaque.data)), xawWidget_t)); } LispObj * Lisp_XawTextLastPosition(LispBuiltin *builtin) /* xaw-text-last-position widget */ { LispObj *owidget; owidget = ARGUMENT(0); if (!CHECKO(owidget, xawWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); return (FIXNUM(XawTextLastPosition((Widget)(owidget->data.opaque.data)))); } LispObj * Lisp_XawTextGetInsertionPoint(LispBuiltin *builtin) /* xaw-text-get-insertion-point widget */ { LispObj *owidget; owidget = ARGUMENT(0); if (!CHECKO(owidget, xawWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); return (FIXNUM(XawTextGetInsertionPoint((Widget)(owidget->data.opaque.data)))); } LispObj * Lisp_XawTextSetInsertionPoint(LispBuiltin *builtin) /* xaw-text-set-insertion-point widget position */ { Widget widget; XawTextPosition position; LispObj *owidget, *oposition; oposition = ARGUMENT(1); owidget = ARGUMENT(0); if (!CHECKO(owidget, xawWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); widget = (Widget)(owidget->data.opaque.data); CHECK_INDEX(oposition); position = (XawTextPosition)FIXNUM_VALUE(oposition); XawTextSetInsertionPoint(widget, position); return (oposition); } LispObj * Lisp_XawTextReplace(LispBuiltin *builtin) /* xaw-text-replace widget left right text */ { Widget widget; XawTextPosition left, right; XawTextBlock block; LispObj *owidget, *oleft, *oright, *otext; otext = ARGUMENT(3); oright = ARGUMENT(2); oleft = ARGUMENT(1); owidget = ARGUMENT(0); if (!CHECKO(owidget, xawWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); widget = (Widget)(owidget->data.opaque.data); CHECK_INDEX(oleft); left = (XawTextPosition)FIXNUM_VALUE(oleft); CHECK_INDEX(oright); right = (XawTextPosition)FIXNUM_VALUE(oright); CHECK_STRING(otext); block.firstPos = 0; block.ptr = THESTR(otext); block.length = strlen(block.ptr); block.format = FMT8BIT; return (FIXNUM(XawTextReplace(widget, left, right, &block))); } LispObj * Lisp_XawTextSearch(LispBuiltin *builtin) /* xaw-text-search widget direction text */ { Widget widget; XawTextScanDirection direction; XawTextBlock block; LispObj *owidget, *odirection, *otext; otext = ARGUMENT(2); odirection = ARGUMENT(1); owidget = ARGUMENT(0); if (!CHECKO(owidget, xawWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); widget = (Widget)(owidget->data.opaque.data); CHECK_INDEX(odirection); direction = (XawTextPosition)FIXNUM_VALUE(odirection); if (direction != XawsdLeft && direction != XawsdRight) LispDestroy("%s: %d does not fit in XawTextScanDirection", STRFUN(builtin), direction); CHECK_STRING(otext); block.firstPos = 0; block.ptr = THESTR(otext); block.length = strlen(block.ptr); block.format = FMT8BIT; return (FIXNUM(XawTextSearch(widget, direction, &block))); } LispObj * Lisp_XawListChange(LispBuiltin *builtin) /* xaw-list-change widget list &optional longest resize */ { Widget widget; String *list; int i, nitems; int longest; Boolean resize; LispObj *object; WidgetData *data; LispObj *owidget, *olist, *olongest, *oresize; oresize = ARGUMENT(3); olongest = ARGUMENT(2); olist = ARGUMENT(1); owidget = ARGUMENT(0); if (!CHECKO(owidget, xawWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); widget = (Widget)(owidget->data.opaque.data); CHECK_LIST(olist); for (nitems = 0, object = olist; CONSP(object); ++nitems, object = CDR(object)) CHECK_STRING(CAR(object)); if (olongest != UNSPEC) { CHECK_INDEX(olongest); longest = FIXNUM_VALUE(olongest); } else XtVaGetValues(widget, XtNlongest, &longest, NULL, 0); resize = oresize != UNSPEC && oresize != NIL; /* No errors in arguments, build string list */ list = (String*)XtMalloc(sizeof(String) * nitems); for (i = 0, object = olist; CONSP(object); i++, object = CDR(object)) list[i] = THESTR(CAR(object)); /* Check if xaw-list-change was already called * for this widget and free previous data */ for (i = 0; i < num_list_data; i++) if ((Widget)CAR(list_data[i]->object)->data.opaque.data == widget) { XtRemoveCallback(widget, XtNdestroyCallback, LispXawCleanupCallback, list_data[i]); LispXawCleanupCallback(widget, list_data[i], NULL); break; } if (i >= num_list_data) { ++num_list_data; list_data = (WidgetData**)XtRealloc((XtPointer)list_data, sizeof(WidgetData*) * num_list_data); } data = (WidgetData*)XtMalloc(sizeof(WidgetData)); data->data = list; list_data[i] = data; data->object = CONS(owidget, olist); PROTECT(owidget, data->object); XtAddCallback(widget, XtNdestroyCallback, LispXawCleanupCallback, data); XawListChange(widget, list, nitems, longest, resize); return (olist); } LispObj * Lisp_XawListHighlight(LispBuiltin *builtin) /* xaw-list-highlight widget index */ { Widget widget; int position; LispObj *owidget, *oindex; oindex = ARGUMENT(1); owidget = ARGUMENT(0); if (!CHECKO(owidget, xawWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); widget = (Widget)(owidget->data.opaque.data); CHECK_INDEX(oindex); position = FIXNUM_VALUE(oindex); XawListHighlight(widget, position); return (oindex); } LispObj * Lisp_XawListUnhighlight(LispBuiltin *builtin) /* xaw-list-unhighlight widget */ { LispObj *owidget; owidget = ARGUMENT(0); if (!CHECKO(owidget, xawWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); XawListUnhighlight((Widget)(owidget->data.opaque.data)); return (NIL); } LispObj * Lisp_XawScrollbarSetThumb(LispBuiltin *builtin) /* xaw-scrollbar-set-thumb widget top &optional shown */ { Widget widget; double top, shown; LispObj *owidget, *otop, *oshown; oshown = ARGUMENT(2); otop = ARGUMENT(1); owidget = ARGUMENT(0); if (!CHECKO(owidget, xawWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); widget = (Widget)(owidget->data.opaque.data); CHECK_DFLOAT(otop); top = DFLOAT_VALUE(otop); if (oshown == UNSPEC) shown = 1.0; else { CHECK_DFLOAT(oshown); shown = DFLOAT_VALUE(oshown); } XawScrollbarSetThumb(widget, top, shown); return (oshown == UNSPEC ? DFLOAT(shown) : oshown); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/0000775000000000000000000000000012472176532017735 5ustar x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/perl.lsp0000664000000000000000000004146012472175711021422 0ustar ;; Copyright (c) 2007,2008 Paulo Cesar Pereira de Andrade ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice (including the next ;; paragraph) shall be included in all copies or substantial portions of the ;; Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ;; DEALINGS IN THE SOFTWARE. ;; ;; Author: Paulo Cesar Pereira de Andrade ;; ;; Perl syntax and indentation mode ;; Based on the C/C++ and Lisp modes. Attempting to make simple ;; syntax/indentation rules, that should work correctly with most ;; perl code. ;; *cont-indent* is somewhat buggy, that if pressing C-A,Tab, will ;; not generate the same output as when normally typing the expression. ;; This is because the parser doesn't search for a matching ';', '{', ;; '[' or '(' to know where the expression starts. The C mode has the ;; same problem. Example: ;; a + ;; b; <-- if pressing C-A,Tab will align "b;" with "a +" ;; Maybe most of the code here, and some code in the C mode could be ;; merged to have a single "default mode" parser for languages that ;; basically only depend on { and } for indentation. (require "syntax") (require "indent") (in-package "XEDIT") ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= (defsynprop *prop-string-escape* "string-escape" :font "*lucidatypewriter-bold-r*-12-*" :foreground "RoyalBlue2" :underline t) (defsynprop *prop-string-keyword-bold* "string-variable-bold" :font "*lucidatypewriter-bold-r*-12-*" :foreground "RoyalBlue4") (defsynprop *prop-string-keyword* "string-variable" :font "*lucidatypewriter-medium-r*-12-*" :foreground "RoyalBlue4") (defsynprop *prop-constant-escape* "constant-escape" :font "*lucidatypewriter-medium-r*-12-*" :foreground "VioletRed3" :underline t) (defsynprop *prop-regex* "regex" :font "*courier-medium-o*-12-*" :foreground "black") (defsynprop *prop-shell* "shell" :font "*lucidatypewriter-medium-r*-12-*" :foreground "red3") (defsynprop *prop-shell-escape* "shell-escape" :font "*lucidatypewriter-bold-r*-12-*" :foreground "red3" :underline t) (defsynprop *prop-documentation* "documentation" :font "fixed" :foreground "black" :background "rgb:e/e/e" ) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= (defsynoptions *perl-DEFAULT-style* ;; Positive number. Basic indentation (:indentation . 4) ;; Boolean. Add one indentation level to continuations? (:cont-indent . t) ;; Boolean. Move cursor to the indent column after pressing ? (:newline-indent . t) ;; Boolean. Set to T if tabs shouldn't be used to fill indentation. (:emulate-tabs . nil) ;; Boolean. Only calculate indentation after pressing ? ;; This may be useful if the parser does not always ;; do what the user expects... (:only-newline-indent . nil) ;; Boolean. Remove extra spaces from previous line. ;; This should default to T when newline-indent is not NIL. (:trim-blank-lines . t) ;; Boolean. If this hash-table entry is set, no indentation is done. ;; Useful to temporarily disable indentation. (:disable-indent . nil)) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= (defvar *perl-mode-options* *perl-DEFAULT-style*) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ;; Parenthesis are usually not required, just distinguish as: ;; expression: code without an ending ';' ;; statement: code ending in a ';' ;; block: code enclosed in '{' and '}' ;; In Perl a simpler logic can be used, unlikely the C mode, as in ;; perl braces are mandatory (defindent *perl-mode-indent* :main ;; this must be the first token (indtoken "^\\s*" :indent :code (or *offset* (setq *offset* (+ *ind-offset* *ind-length*)))) ;; this may cause some other patterns to fail, due to matching single \' (indtoken "(&?(\\w+)|&(\\w+)?)'\\w+" :expression) ;; special variables (indtoken "\\$(\\d|^\\u|[][0-9!#$*()_@<>?/|,\"'])" :expression) ;; ignore comments (indtoken "#.*$" nil) ;; treat regex as expressions to avoid confusing parser (indtoken "m?/([^/]|\\\\/)+/\\w*" :expression) (indtoken "m\\{[^}]+\\}\\w*" :expression) (indtoken "m<[^>]+>\\w*" :expression) (indtoken "(s|tr)/[^/]+/([^/]|\\\\/)*/\\w*" :expression) (indtoken "//" :expression :nospec t) ;; fast resolve deferences to expressions (indtoken "[$@%&*]?\\{\\$?\\S+\\}" :expression) (indtoken "($%@*)?\\w+" :expression) (indtoken ";" :semi :nospec t) (indinit (braces 0)) (indtoken "{" :obrace :nospec t :code (decf braces)) (indtoken "}" :cbrace :nospec t :code (incf braces)) (indinit (parens&bracks 0)) (indtoken ")" :cparen :nospec t :code (incf parens&bracks)) (indtoken "(" :oparen :nospec t :code (decf parens&bracks)) (indtoken "]" :cbrack :nospec t :code (incf parens&bracks)) (indtoken "[" :obrack :nospec t :code (decf parens&bracks)) ;; if in the same line, reduce now, this must be done because the ;; delimiters are identical (indtoken "'([^\\']|\\\\.)*'" :expression) (indtoken "\"([^\\\"]|\\\\.)*\"" :expression) (indtoken "\"" :cstring1 :nospec t :begin :string1) (indtoken "'" :cstring2 :nospec t :begin :string2) ;; This must be the last rule (indtoken "\\s*$" :eol) (indtable :string1 ;; Ignore escaped characters (indtoken "\\." nil) ;; Return to the toplevel when the start of the string is found (indtoken "\"" :ostring1 :nospec t :switch -1)) (indtable :string2 (indtoken "\\." nil) (indtoken "'" :ostring2 :nospec t :switch -1)) ;; This avoids some problems with *cont-indent* adding an indentation ;; level to an expression after an empty line (indreduce nil t ((:indent :eol))) ;; Reduce to a single expression token (indreduce :expression t ((:indent :expression) (:expression :eol) (:expression :parens) (:expression :bracks) (:expression :expression) ;; multiline strings (:ostring1 (not :ostring1) :cstring1) (:ostring2 (not :ostring2) :cstring2) ;; parenthesis and brackets (:oparen (not :oparen) :cparen) (:obrack (not :obrack) :cbrack))) ;; Statements end in a semicollon (indreduce :statement t ((:semi) (:indent :semi) (:expression :statement) (:statement :eol) ;; Doesn't necessarily end in a semicollon (:expression :block))) (indreduce :block t ((:obrace (not :obrace) :cbrace) (:block :eol))) (indreduce :obrace (< *ind-offset* *ind-start*) ((:indent :obrace)) (setq *indent* (offset-indentation (+ *ind-offset* *ind-length*) :resolve t)) (indent-macro-reject-left)) ;; Try to do an smart indentation on open parenthesis and brackets (indreduce :parens t ((:oparen (not :oparen) :cparen)) (when (and (< *ind-offset* *ind-start*) (> (+ *ind-offset* *ind-length*) *ind-start*)) (setq *indent* (1+ (offset-indentation *ind-offset* :align t))) (indent-macro-reject-left))) (indreduce :bracks t ((:obrack (not :obrack) :cbrack)) (when (and (< *ind-offset* *ind-start*) (> (+ *ind-offset* *ind-length*) *ind-start*)) (setq *indent* (1+ (offset-indentation *ind-offset* :align t))) (indent-macro-reject-left))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Assuming previous lines have correct indentation, try to ;; fast resolve brace indentation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Line ended with an open brace (indreduce :obrace (< *ind-offset* *ind-start*) ((:expression :obrace)) (setq *indent* (offset-indentation *ind-offset* :resolve t)) (indent-macro-reject-left)) ;; Line starts with an open brace (indreduce nil (< *ind-offset* *ind-start* (+ *ind-offset* *ind-length*)) ;; Just set initial indentation ((:indent :obrace)) (setq *indent* (- (offset-indentation *ind-offset* :resolve t) *base-indent*)) (indent-macro-reject-left)) (indresolve :statement (when (< *ind-offset* *ind-start*) (while (> braces 0) (setq *indent* (- *indent* *base-indent*) braces (1- braces))))) (indresolve :obrace (and (< *ind-offset* *ind-start*) (incf *indent* *base-indent*))) (indresolve :cbrace (decf *indent* *base-indent*)) (indresolve :expression (and *cont-indent* (> *indent* 0) (zerop parens&bracks) (< *ind-offset* *ind-start*) (> (+ *ind-offset* *ind-length*) *ind-start*) (incf *indent* *base-indent*))) (indresolve (:oparen :obrack) (and (< *ind-offset* *ind-start*) (setq *indent* (1+ (offset-indentation *ind-offset* :align t))))) ) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= (defun perl-offset-indent (&aux char (point (point))) ;; Skip spaces forward (while (member (setq char (char-after point)) indent-spaces) (incf point)) (if (member char '(#\})) (1+ point) point)) (compile 'perl-offset-indent) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= (defun perl-should-indent (options &aux char point start offset) (when (hash-table-p options) ;; check if previous line has extra spaces (and (gethash :trim-blank-lines options) (indent-clear-empty-line)) ;; indentation disabled? (and (gethash :disable-indent options) (return-from perl-should-indent)) (setq point (point) char (char-before point) start (scan point :eol :left)) ;; if at bol and should indent only when starting a line (and (gethash :only-newline-indent options) (return-from perl-should-indent (= point start))) ;; at the start of a line (and (= point start) (return-from perl-should-indent (gethash :newline-indent options))) ;; if first character (and (= point (1+ start)) (return-from perl-should-indent t)) ;; check if is the first non-blank character in a new line (when (and (gethash :cont-indent options) (= point (scan point :eol :right)) (alphanumericp char)) (setq offset (1- point)) (while (and (> offset start) (member (char-before offset) indent-spaces)) (decf offset)) ;; line has only one character with possible spaces before it (and (<= offset start) (return-from perl-should-indent t))) ;; if one of these was typed, should check indentation (if (member char '(#\})) (return-from perl-should-indent t)) ) ;; Should not indent nil) (compile 'perl-should-indent) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= (defun perl-indent (syntax syntable) (let* ((options (syntax-options syntax)) *base-indent* *cont-indent*) (or (perl-should-indent options) (return-from perl-indent)) (setq *base-indent* (gethash :indentation options 4) *cont-indent* (gethash :cont-indent options t)) (indent-macro *perl-mode-indent* (perl-offset-indent) (gethash :emulate-tabs options)))) (compile 'perl-indent) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ;; some example macros to easily add new patterns for strings and possibly ;; regex or other patterns (defmacro perl-q-string-token (token) `(syntoken (string-concat "\\") :property *prop-keyword*) ;; pseudo keywords (syntoken (string-concat "\\<(" "BEGIN|END|bless|blessed|defined|delete|eval|local|my|our|" "package|require|undef|use" ")\\>") :property *prop-preprocessor*) ;; this may cause some other patterns to fail, due to matching single \' (syntoken "(&?(\\w+)|&(\\w+)?)'\\w+" :property *prop-preprocessor*) ;; numbers (syntoken (string-concat "\\<(" ;; Integers "(\\d+|0x\\x+)|" ;; Floats "\\d+\\.?\\d*(e[+-]?\\d+)?" ")\\>") :icase t :property *prop-number*) ;; special variables (syntoken "\\$(\\d|^\\u|[][0-9!#$*()_@<>?/|,\"'])" :property *prop-keyword*) ;; also match variables (syntable :inside-string nil nil ;; escaped characters ;; XXX This pattern was matching the empty string and entering an ;; infinite loop in code like: #| ---%<--- " <-- *** if an backslash is added it fails. Inverting a"; *** the pattern fixed the problem, but was the wrong ---%<--- *** solution. Note that C-G stops the interpreter, and *** special care must be taken with patterns matching *** empty strings. |# (syntoken "\\\\\\d{3}|\\\\." :property *prop-string-escape*) (syntoken "(\\{\\$|\\$\\{)" :property *prop-string-keyword-bold* :begin :string-varbrace) (syntoken "[$@]" :property *prop-string-keyword-bold* :begin :string-variable) (syntoken "\\$(\\d|^\\u|[][0-9!#$*()_@<>?/|,\"'])" :property *prop-string-keyword-bold*)) ;; variables insided strings (syntable :string-variable *prop-string-keyword* nil (syntoken "\\w+" :switch -1)) (syntable :string-varbrace *prop-string-keyword* nil (syntoken "}" :nospec t :property *prop-string-keyword-bold* :switch -1) (synaugment :inside-string)) ;; comments (syntoken "#.*$" :property *prop-comment*) ;; regex (syntoken "(\\]+>\\w*" :property *prop-regex*) (syntoken "\\<(s|tr)/[^/]+/([^/]|\\\\/)*/\\w*":property *prop-regex*) ;; just to avoid confusing the parser on something like split //, ... (syntoken "//" :nospec t :property *prop-regex*) ;; strings (syntoken "\"" :nospec t :contained t :begin :string) (syntable :string *prop-string* #'default-indent (syntoken "\"" :nospec t :switch -1) (synaugment :inside-string)) ;; more strings (perl-q-string-token "{") (perl-q-string-table "{" "}") (perl-q-string-token "[") (perl-q-string-table "[" "]") (perl-q-string-token "(") (perl-q-string-table "(" ")") (perl-q-string-token "/") (perl-q-string-table "/" "/") ;; yet more strings (syntoken "'" :nospec t :contained t :begin :constant) (syntable :constant *prop-constant* #'default-indent (syntoken "'" :nospec t :switch -1) (syntoken "\\\\." :property *prop-string-escape*)) ;; shell commands (syntoken "`" :nospec t :contained t :begin :shell) (syntable :shell *prop-shell* #'default-indent (syntoken "`" :nospec t :switch -1) (synaugment :inside-string)) ;; punctuation (syntoken "[][$@%(){}/*+:;=<>,&!|^~\\.?-]" :property *prop-punctuation*) (syntoken "\\" :property *prop-punctuation*) ;; primitive faked heredoc support, doesn't match the proper string, just ;; expects an uppercase identifier in a single line (syntoken "<<\"[A-Z][A-Z0-9_]+\"" :property *prop-string* :begin :heredoc) (syntoken "<<'[A-Z][A-Z0-9_]+'" :property *prop-constant* :begin :heredoc) (syntoken "<<[A-Z][A-Z0-9_]+" :property *prop-preprocessor* :begin :heredoc) (syntable :heredoc *prop-documentation* #'default-indent (syntoken "^[A-Z][A-Z0-9_]+$" :switch -1)) (syntoken "^=(pod|item|over|head\\d)\\>.*$" :property *prop-documentation* :begin :info) (syntable :info *prop-documentation* nil (syntoken "^=cut\\>.*$" :switch -1) (syntoken "^.*$")) (syntoken "^(__END__|__DATA__)$" :property *prop-documentation* :begin :documentation) (syntoken "__\\u+__" :property *prop-preprocessor*) (syntable :documentation *prop-documentation* nil (syntoken "^.*$")) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/rpm.lsp0000664000000000000000000001304312472175711021252 0ustar ;; ;; Copyright (c) 2003 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/rpm.lsp,v 1.1 2003/01/16 03:50:46 paulo Exp $ ;; (require "syntax") (in-package "XEDIT") ;; Only for testing, unifinished, good for viewing but too slow for real use... #| (defsynprop *prop-rpm-special* "rpm-special" :font "*courier-bold-r*-12-*" :foreground "NavyBlue" ) (defsynprop *prop-rpm-escape* "rpm-escape" :font "*lucidatypewriter-medium-r*-12-*" :foreground "Red3") ;; main package is implicit (defsyntax *rpm-mode* :package nil nil nil (syntable :sections nil nil (syntoken "^%package" :icase t :switch :package ;; XXX :begin :package was added just to test finishing and ;; starting a new syntax-table, unfortunately if using it ;; this way, frequently the entire file will be reparsed ;; at every character typed. ;; TODO study these cases and implement code to avoid it, ;; the easiest way is limiting the number of backtracked lines, ;; the screen contents sometimes could not correctly reflect ;; file contents in this case... :begin :package :property *prop-rpm-special*) (syntoken "^%(build|setup|install|pre|preun|post|postun)\\>" :icase t :property *prop-rpm-special* :switch :package :begin :shell) ;; %changelog, XXX no rules to return to the toplevel (syntoken "^%changelog\\>" :icase t :switch :package :begin :changelog :property *prop-rpm-special*) (syntable :changelog nil nil ;; ignore if escaped (syntoken "%%") ;; "warn" if not escaped (syntoken "%" :property *prop-control*) ;; emails (syntoken "<[a-z0-9_-]+@[a-z0-9_-]+\\.\\w+(\\.\\w+)?>" :icase t :property *prop-string*) ) ;; comments (syntoken "#" :contained t :nospec t :begin :comment) (syntable :comment *prop-comment* nil ;; some macros are expanded even when inside comments, and may ;; cause surprises, "warn" about it (syntoken "%\\{?\\w+\\}?" :property *prop-rpm-special*) (syntoken "$" :switch -1) ) (synaugment :global) ) ;; may appear anywhere (syntable :global nil nil ;; preprocessor like commands (syntoken "^%(define|if|ifarch|else|endif)\\>" :icase t :property *prop-preprocessor*) ;; variables (syntoken "%\\{.*\\}" :property *prop-constant*) ) ;; example: "Group: ..." or "Group(pt_BR): ..." (syntoken "^\\w+(\\(\\w+\\))?:" :property *prop-keyword*) ;; for sections with shell commands (syntable :shell nil nil (syntoken "\\<(if|then|elif|else|fi|for|do|done|case|esac|while|until)\\>" :property *prop-keyword*) (syntable :strings nil nil (syntoken "\"" :nospec t :begin :string :contained t) (syntable :string *prop-string* nil (syntoken "\\$\\(?\\w+\\)?" :property *prop-constant*) (syntoken "\\\\.") (syntoken "\"" :nospec t :switch -1) ) (syntoken "\'" :nospec t :begin :constant :contained t) (syntable :constant *prop-constant* nil (syntoken "\\\\.") (syntoken "\'" :nospec t :switch -1) ) (syntoken "\`" :nospec t :begin :escape :contained t) (syntable :escape *prop-rpm-escape* nil (syntoken "\\$\\(?\\w+\\)?" :property *prop-constant*) (syntoken "\\\\.") (syntoken "\`" :nospec t :switch -1) ) ) (synaugment :strings :sections) ) (synaugment :sections) ) |# (defsyntax *rpm-mode* :package nil nil nil ;; commands, macro definitions, etc (syntoken "^\\s*%\\s*\\w+" :property *prop-keyword*) ;; rpm "variables" (syntoken "%\\{.*\\}" :property *prop-constant*) ;; package info, example: "Group: ...", "Group(pt_BR): ...", etc. (syntoken "^\\w+(\\(\\w+\\))?:" :property *prop-preprocessor*) ;; comments (syntoken "#" :contained t :nospec t :begin :comment) (syntable :comment *prop-comment* nil ;; some macros are expanded even when inside comments, and may ;; cause surprises, "warn" about it (syntoken "%define\\>" :property *prop-control*) (syntoken "%\\{?\\w+\\}?" :property *prop-string*) (syntoken "$" :switch -1) ) ;; emails (syntoken "?" :icase t :property *prop-string*) ;; links (syntoken "\\<(http|ftp)://\\S+" :property *prop-string*) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/auto.lsp0000664000000000000000000000762512472175711021435 0ustar ;; Copyright (c) 2007,2008 Paulo Cesar Pereira de Andrade ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice (including the next ;; paragraph) shall be included in all copies or substantial portions of the ;; Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ;; DEALINGS IN THE SOFTWARE. ;; ;; Author: Paulo Cesar Pereira de Andrade ;; ;; Mode for editing autoconf/automake m4 files (require "syntax") (in-package "XEDIT") (defsynprop *prop-macro* "macro" :font "*courier-bold-r*-12-*" :foreground "green4") (defsynprop *prop-separator* "separator" :font "*courier-bold-r*-12-*" :foreground "Red3") (defsynprop *prop-variable* "variable" :font "*lucidatypewriter-medium-r*-12-*" :foreground "Gold4") (defsynprop *prop-escape* "escape" :font "*lucidatypewriter-medium-r*-12-*" :foreground "Red3") (defsyntax *auto-mode* :main nil nil nil ;; dont consider dnl a macro call at top level (syntoken "(#.*|\\.*))" :property *prop-comment*) ;; shell keywords (syntoken (string-concat "\\<(" "if|then|else|elif|else|fi|case|in|esac|do|done" ")\\>") :property *prop-keyword*) ;; toplevel no arguments macro (syntoken "^[a-zA-Z0-9_]+$" :property *prop-macro*) (syntable :string *prop-string* nil ;; ignore escaped characters (syntoken "\\\\.") (syntoken "\"" :nospec t :switch -1) (synaugment :variables)) (syntable :constant *prop-constant* nil (syntoken "\\\\.") (syntoken "'" :nospec t :switch -1) (synaugment :variables)) (syntable :escape *prop-escape* nil (syntoken "\\\\.") (syntoken "`" :nospec t :switch -1) (synaugment :variables)) (syntable :quoted-string *prop-string* nil (syntoken "\\\"" :nospec t :switch -1)) (syntable :macro *prop-default* nil (syntoken "," :property *prop-separator*) (syntoken "[" :nospec t :property *prop-separator* :begin :quoted) (syntable :quoted *prop-default* nil ;; allow nesting (syntoken "[" :nospec t :property *prop-separator* :begin :quoted) (syntoken "]" :nospec t :property *prop-separator* :switch -1) (synaugment :shared :comments :variables)) (syntoken ")" :nospec t :property *prop-macro* :switch -1) (synaugment :shared :quotes :variables :comments)) (syntable :shared nil nil (syntoken "[a-zA-Z0-9_]+\\(" :property *prop-macro* :begin :macro) ;; variable assignment (syntoken "[a-zA-Z0-9_-]+=" :property *prop-keyword*)) (syntable :quotes nil nil (syntoken "\"" :nospec t :begin :string :contained t) (syntoken "'" :nospec t :begin :constant :contained t) (syntoken "`" :nospec t :begin :escape :contained t) (syntoken "\\\"" :nospec t :begin :quoted-string :contained t)) (syntable :variables nil nil (syntoken "\\$[a-zA-Z0-9_-]+" :property *prop-variable*) (syntoken "\\$\\{[a-zA-Z0-9_-]+\\}" :property *prop-variable*) (syntoken "\\$\\([a-zA-Z0-9_-]+\\)" :property *prop-variable*)) (syntable :comments nil nil (syntoken "(#.*|\\.*))" :property *prop-comment*)) (synaugment :shared :quotes :variables)) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/sh.lsp0000664000000000000000000000762712472175711021101 0ustar ;; ;; Copyright (c) 2003 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/sh.lsp,v 1.1 2003/01/16 03:50:46 paulo Exp $ ;; (require "syntax") (require "indent") (in-package "XEDIT") (defsynprop *prop-escape* "escape" :font "*lucidatypewriter-medium-r*-12-*" :foreground "Red3") (defsynprop *prop-variable* "variable" :font "*lucidatypewriter-medium-r*-12-*" :foreground "Gold4") (defsynprop *prop-backslash* "backslash" :font "*courier-bold-r*-12-*" :foreground "green4") ;; XXX it would be interesting if "here-documents" could be parsed ;; just searching for "<<\s*EOF\\>" and then for "^EOF\\>" should ;; handle most cases, but would be a hack... (defsyntax *sh-mode* :main nil #'default-indent nil ;; keywords and common commands/builtins (syntoken "\\<(if|then|elif|else|fi|case|in|esac|for|do|done|while|until|break|continue|eval|exit|exec|test|echo|cd|shift|local|return)\\>" :property *prop-keyword*) ; comments (syntoken "#.*$" :property *prop-comment*) ;; punctuation (syntoken "[][;:*?(){}<>&!|$#]+" :property *prop-punctuation*) ;; variable declaration (syntoken "\\w+=" :property *prop-preprocessor*) ;; numbers (syntoken "\\<\\d+\\>" :property *prop-number*) ;; escaped characters at toplevel (syntoken "\\\\." :property *prop-backslash*) ;; single quote (syntoken "'" :nospec t :contained t :begin :single) (syntable :single *prop-constant* nil ;; do nothing, escaped characters (syntoken "\\\\.") (syntoken "'" :nospec t :switch -1) ) ;; double quote (syntoken "\"" :nospec t :contained t :begin :double) (syntable :double *prop-string* #'default-indent ;; escaped characters (syntoken "\\\\." :property *prop-backslash*) (syntoken "\"" :nospec t :switch -1) ;; rule to start escape (syntoken "`" :nospec t :contained t :begin :escape) ;; ignore single quote, required because escape is augmented (syntoken "'" :nospec t) (synaugment :escape :variable) ) ;; escaped commands (syntoken "`" :nospec t :contained t :begin :escape) (syntable :escape *prop-escape* #'default-indent ;; escaped characters (syntoken "\\\\." :property *prop-backslash*) (syntoken "`" :nospec t :switch -1) ;; rule to start double quote inside escape (syntoken "\"" :nospec t :contained t :begin :double) ;; rule to start single quote (syntoken "'" :nospec t :contained t :begin :single) (synaugment :double :variable) ) (syntable :variable nil nil (syntoken "\\$\\w+" :property *prop-variable*) ) (synaugment :variable) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/xconf.lsp0000664000000000000000000000462012472175711021572 0ustar ;; ;; Copyright (c) 2003 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86$ ;; (require "syntax") (require "indent") (in-package "XEDIT") (defsyntax *xconf-mode* :main nil #'default-indent nil ;; section start (syntoken "\\<(Section|SubSection)\\>" :property *prop-keyword* :icase t :begin :section) ;; just for fun, highlight the section name differently (syntable :section *prop-constant* #'default-indent (syntoken "\"" :nospec t :begin :name) (syntable :name *prop-constant* nil ;; ignore escaped characters (syntoken "\\\\.") (syntoken "\"" :nospec t :switch -2) ) ) ;; section end (syntoken "\\<(EndSection|EndSubSection)\\>" :property *prop-keyword* :icase t) ;; numeric options (syntoken "\\<\\d+(\\.\\d+)?\\>" :property *prop-number*) ;; comments (syntoken "#.*$" :property *prop-comment*) ;; strings (syntoken "\"" :nospec t :begin :string :contained t) (syntable :string *prop-string* #'default-indent ;; ignore escaped characters (syntoken "\\\\.") (syntoken "\"" :nospec t :switch -1) ) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/imake.lsp0000664000000000000000000001072012472175711021541 0ustar ;; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/imake.lsp,v 1.2 2002/10/06 17:11:48 paulo Exp $ ;; (require "syntax") (in-package "XEDIT") (defsynprop *prop-shell* "shell" :font "*courier-bold-r*-12-*" :foreground "Red4" ) (defsynprop *prop-variable* "variable" :font "*courier-medium-r*-12-*" :foreground "Red3" ) ;; The syntax-highlight definition does not try to flag errors, just show ;; tabs in the start of lines for better visualization. (defsynprop *prop-tabulation* "tabulation" :font "*courier-medium-r*-12-*" :background "Gray90" ) (defsynprop *prop-xcomm* "xcomm" :font "*courier-medium-o*-12-*" :foreground "SkyBlue4" ) (defsyntax *imake-mode* :main nil nil nil (syntoken "^\\s*XCOMM\\W?.*$" :property *prop-xcomm*) (syntoken "^\\t+" :property *prop-tabulation*) (syntoken "$(" :nospec t :begin :shell :property *prop-shell*) (syntoken "[][(){};$<=>&@/\\,.:~!|*?'`+-]" :property *prop-shell*) ;; Preprocessor start rule. (syntoken "^\\s*#\\s*\\w+" :begin :preprocessor :contained t) ;; Comment start rule. (syntoken "/*" :nospec t :begin :comment :contained t) ;; String start rule. (syntoken "\"" :begin :string :nospec t :contained t) ;; Quoted string start rule. (syntoken "\\\"" :begin :quoted-string :nospec t :contained t) (syntable :shell *prop-variable* nil (syntoken ")" :nospec t :property *prop-shell* :switch -1) ) ;; Rules for comments. (syntable :comment *prop-comment* nil ;; Match nested comments as an error. (syntoken "/*" :nospec t :property *prop-error*) (syntoken "XXX|TODO|FIXME" :property *prop-annotation*) ;; Rule to finish a comment. (syntoken "*/" :nospec t :switch -1) ) ;; Rules for preprocessor. (syntable :preprocessor *prop-preprocessor* nil ;; Preprocessor includes comments. (syntoken "/*" :nospec t :begin :comment :contained t) ;; Visualization help, show tabs in the start of lines. (syntoken "^\\t+" :property *prop-tabulation*) ;; Ignore lines finishing with a backslash. (syntoken "\\\\$") ;; Return to previous state if end of line found. (syntoken ".?$" :switch -1) ) ;; Rules for strings. (syntable :string *prop-string* nil ;; Ignore escaped characters, this includes \". (syntoken "\\\\.") ;; Ignore continuation in the next line. (syntoken "\\\\$") ;; Rule to finish a string. (syntoken "\"" :nospec t :switch -1) ;; Don't allow strings continuing in the next line. (syntoken ".?$" :begin :error) ) ;; Rules for quoted strings. (syntable :quoted-string *prop-constant* nil ;; Rule to finish the quoted string. (syntoken "\\\"" :nospec t :switch -1) ;; Ignore escaped characters (syntoken "\\\\.") ;; Ignore continuation in the next line. (syntoken "\\\\$") ;; Don't allow strings continuing in the next line. (syntoken ".?$" :begin :error) ) (syntable :error *prop-error* nil (syntoken "^.*$" :switch -2) ) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/make.lsp0000664000000000000000000000673312472175711021401 0ustar ;; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/make.lsp,v 1.2 2002/10/06 17:11:48 paulo Exp $ ;; (require "syntax") (in-package "XEDIT") (defsynprop *prop-shell* "shell" :font "*courier-bold-r*-12-*" :foreground "Red4" ) (defsynprop *prop-variable* "variable" :font "*courier-medium-r*-12-*" :foreground "Red3" ) ;; The syntax-highlight definition does not try to flag errors, just show ;; tabs in the start of lines for better visualization. (defsynprop *prop-tabulation* "tabulation" :font "*courier-medium-r*-12-*" :background "Gray90" ) (defsyntax *make-mode* :main nil nil nil (syntoken "^\\t+" :property *prop-tabulation*) (syntoken "^\\.\\w+" :property *prop-keyword*) (syntoken "$(" :nospec t :begin :shell :property *prop-shell*) (syntoken "[][(){};$<=>&@/\\,.:~!|*?'`+-]" :property *prop-shell*) ;; Preprocessor start rule. (syntoken "#.*" :property *prop-comment*) ;; String start rule. (syntoken "\"" :begin :string :nospec t :contained t) ;; Quoted string start rule. (syntoken "\\\"" :begin :quoted-string :nospec t :contained t) (syntable :shell *prop-variable* nil (syntoken ")" :nospec t :property *prop-shell* :switch -1) ) ;; Rules for strings. (syntable :string *prop-string* nil ;; Ignore escaped characters, this includes \". (syntoken "\\\\.") ;; Ignore continuation in the next line. (syntoken "\\\\$") ;; Rule to finish a string. (syntoken "\"" :nospec t :switch -1) ;; Don't allow strings continuing in the next line. (syntoken ".?$" :begin :error) ) ;; Rules for quoted strings. (syntable :quoted-string *prop-constant* nil ;; Rule to finish the quoted string. (syntoken "\\\"" :nospec t :switch -1) ;; Ignore escaped characters (syntoken "\\\\.") ;; Ignore continuation in the next line. (syntoken "\\\\$") ;; Don't allow strings continuing in the next line. (syntoken ".?$" :begin :error) ) (syntable :error *prop-error* nil (syntoken "^.*$" :switch -2) ) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/python.lsp0000664000000000000000000002426512472175711022005 0ustar ;; Copyright (c) 2008 Paulo Cesar Pereira de Andrade ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice (including the next ;; paragraph) shall be included in all copies or substantial portions of the ;; Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ;; DEALINGS IN THE SOFTWARE. ;; ;; Author: Paulo Cesar Pereira de Andrade ;; (require "syntax") (require "indent") (in-package "XEDIT") ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= (defsynprop *prop-indent* "indent" :font "*courier-medium-r*-12-*" :background "Gray92") ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= (defsynoptions *python-DEFAULT-options* ;; Positive number. Basic indentation (:indentation . 4) ;; Boolean. Move cursor to the indent column after pressing ? (:newline-indent . t) ;; Boolean. Set to T if tabs shouldn't be used to fill indentation. (:emulate-tabs . t) ;; Boolean. Only calculate indentation after pressing ? ;; This may be useful if the parser does not always ;; do what the user expects... (:only-newline-indent . nil) ;; Boolean. Remove extra spaces from previous line. ;; This should default to T when newline-indent is not NIL. (:trim-blank-lines . nil) ;; Boolean. If this hash-table entry is set, no indentation is done. ;; Useful to temporarily disable indentation. (:disable-indent . nil)) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ;; Not doing "special" indentation of multiline ( because it is attempting ;; to do a "smart" indentation and usually don't read more then one line ;; back to resolve indentation. ;; Code for multiline { and [, usually declaring vector/hash like variables ;; should be working properly. ;; Note that the indent lisp hook is only run on character additions, so ;; it doesn't do a "smart" tabbing when pressing backspace, but it will ;; properly align to the "closest tab stop" when typping a character. (defindent *python-mode-indent* :main ;; this must be the first token (indtoken "^\\s*" :indent :code (or *offset* (setq *offset* (+ *ind-offset* *ind-length*)))) ;; ignore comments (indtoken "#.*$" nil) (indtoken ":" :collon :nospec t) ;; don't directly match {}, [], () strings, and : (indtoken "[a-zA-Z0-9+*/%^&<>=.,|!~-]+" :expression) ;; if in the same line, reduce now, as delimiters are identical (indtoken "'([^\\']|\\\\.)*'" :expression) (indtoken "\"([^\\\"]|\\\\.)*\"" :expression) ;; otherwise, use a table (indtoken "\"" :cstring :nospec t :begin :string) (indtoken "'" :cconstant :nospec t :begin :constant) (indtoken "\"\"\"" :cstring3 :nospec t :begin :string3) (indtoken "'''" :cconstant :nospec t :begin :constant3) (indinit (braces 0)) (indtoken "}" :cbrace :nospec t :code (incf braces)) (indtoken "{" :obrace :nospec t :code (decf braces)) (indtoken ")" :cparen :nospec t :code (incf braces)) (indtoken "(" :oparen :nospec t :code (decf braces)) (indtoken "]" :cbrack :nospec t :code (incf braces)) (indtoken "[" :obrack :nospec t :code (decf braces)) ;; This must be the last token (indtoken "$" :eol) (indtable :string ;; Ignore escaped characters (indtoken "\\." nil) ;; Return to the toplevel when the start of the string is found (indtoken "\"" :ostring :nospec t :switch -1)) (indtable :constant (indtoken "\\." nil) (indtoken "'" :oconstant :nospec t :switch -1)) (indtable :string3 (indtoken "\"\"\"" :ostring3 :nospec t :switch -1)) (indtable :constant3 (indtoken "'''" :oconstant3 :nospec t :switch -1)) ;; Reduce what isn't reduced in regex pattern match (indreduce :expression t ((:expression :expression) ;; multiline strings (:ostring (not :ostring) :cstring) (:oconstant (not :oconstant) :cconstant) (:ostring3 (not :ostring3) :cstring3) (:oconstant3 (not :oconstant3) :cconstant3) ;; braces, parenthesis and brackets (:obrace (not :obrace) :cbrace) (:oparen (not :oparen) :cparen) (:obrack (not :obrack) :cbrack))) ;; This should be the most common exit point; ;; just copy previous line indentation. (indreduce :align (< *ind-offset* *ind-start*) ((:indent :eol) (:indent :expression :eol)) (setq *indent* (offset-indentation *offset* :resolve t)) ;; If cursor is not in an indentation tab, assume user is trying to align ;; to another block, and just use the resolve code to round it down (unless (/= (mod *indent* *base-indent*) 0) ;; else use "previous-line" indentation. (setq *indent* (offset-indentation *ind-offset* :resolve t))) (indent-macro-reject-left)) ;; This should be second most common exit point; ;; add one indentation level. (indreduce :align (< *ind-offset* *ind-start*) ((:indent :expression :collon :eol)) (setq *indent* (+ *base-indent* (offset-indentation *ind-offset* :resolve t))) (indent-macro-reject-left)) (indresolve :align (setq *indent* (- *indent* (mod *indent* *base-indent*)))) ;; Calculate special indentation for [ and { (indresolve (:obrack :obrace) (and (< *ind-offset* *ind-start*) (setq *indent* (+ *base-indent* (offset-indentation *ind-offset* :resolve t))))) (indresolve (:cbrack :cbrace) (setq *indent* (- (offset-indentation *ind-offset* :resolve t) (if (>= *ind-offset* *ind-start*) *base-indent* 0)))) ) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= (defun python-offset-indent (&aux char (point (point))) ;; Skip spaces forward (while (member (setq char (char-after point)) indent-spaces) (incf point)) point) (compile 'python-offset-indent) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= (defun python-should-indent (options &aux point start end offset) (when (hash-table-p options) ;; check if previous line has extra spaces (and (gethash :trim-blank-lines options) (indent-clear-empty-line)) ;; indentation disabled? (and (gethash :disable-indent options) (return-from python-should-indent)) (setq point (point) start (scan point :eol :left) end (scan point :eol :right)) ;; if at bol and should indent only when starting a line (and (gethash :only-newline-indent options) (return-from python-should-indent (= point start))) ;; at the start of a line (and (= point start) (return-from python-should-indent (gethash :newline-indent options))) ;; if first character (and (= point (1+ start)) (return-from python-should-indent t)) (setq offset start) (while (and (< offset end) (member (char-after offset) indent-spaces)) (incf offset)) ;; cursor is at first character in line, with possible spaces before it (return-from python-should-indent (or (= offset end) (= offset (1- point)))) ) ;; Should not indent nil) (compile 'python-should-indent) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= (defun python-indent (syntax syntable) (let* ((options (syntax-options syntax)) *base-indent*) (or (python-should-indent options) (return-from python-indent)) (setq *base-indent* (gethash :indentation options 4)) (indent-macro *python-mode-indent* (python-offset-indent) (gethash :emulate-tabs options)))) (compile 'python-indent) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= (defvar *python-mode-options* *python-DEFAULT-options*) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= (defsyntax *python-mode* :main nil #'python-indent *python-mode-options* ;; keywords (syntoken (string-concat "\\<(" "and|break|class|continue|def|del|enumerate|except|False|for|" "elif|else|if|in|is|len|None|not|or|pass|print|raise|range|" "return|self|True|try|type|while|yield" ")\\>") :property *prop-keyword*) (syntoken "^\\s+" :property *prop-indent*) ;; preprocessor like (syntoken (string-concat "\\<(" "from|import" ")\\>") :property *prop-preprocessor*) ;; namespaces/accessors (syntoken "(\\w+\\.)+" :property *prop-preprocessor*) ;; more preprocessor like (syntoken "\\<__[a-zA-Z0-9]+__\\>" :property *prop-keyword*) ;; numbers (syntoken (string-concat "\\<(" ;; Integers "(\\d+|0x\\x+)L?|" ;; Floats "\\d+\\.?\\d*(e[+-]?\\d+)?" ")\\>") :icase t :property *prop-number*) ;; comments (syntoken "#.*" :property *prop-comment*) ;; punctuation (syntoken "[][(){}+*/%^&<>=.,|!~:-]+" :property *prop-punctuation*) ;; constant or constant like (syntoken "'" :nospec t :property *prop-constant* :begin :constant) (syntoken "'''" :nospec t :property *prop-constant* :begin :constant3) ;; strings (syntoken "\"" :nospec t :property *prop-string* :begin :string) (syntoken "\"\"\"" :nospec t :property *prop-string* :begin :string3) (syntable :constant *prop-constant* nil (syntoken "\\\\.") (syntoken "'" :nospec t :switch -1)) (syntable :constant3 *prop-constant* nil (syntoken "'''" :nospec t :switch -1)) (syntable :string *prop-string* nil (syntoken "\\\\.") (syntoken "\"" :nospec t :switch -1)) (syntable :string3 *prop-string* nil (syntoken "\"\"\"" :nospec t :switch -1)) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/xlog.lsp0000664000000000000000000000702712472175711021432 0ustar ;; ;; Copyright (c) 2003 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/xlog.lsp,v 1.1 2003/01/16 06:25:51 paulo Exp $ ;; (require "syntax") (in-package "XEDIT") (defsynprop *prop-xlog-probe* "xlog-probe" :font "*courier-medium-r*-12-*" :background "rgb:c/f/c") (defsynprop *prop-xlog-config* "xlog-config" :font "*courier-medium-r*-12-*" :background "rgb:c/e/f") (defsynprop *prop-xlog-default* "xlog-default" :font "*courier-medium-r*-12-*" :background "rgb:e/c/f") (defsynprop *prop-xlog-warning* "xlog-warning" :font "*courier-bold-r*-12-*" :foreground "Red4" :background "Yellow1" ) (defsynprop *prop-xlog-error* "xlog-error" :font "*courier-bold-r*-12-*" :foreground "Yellow2" :background "Red3" ) (defsyntax *xlog-mode* :main nil nil nil ;; highlight version (syntoken "^XFree86 Version \\S+" :property *prop-annotation*) ;; release date (syntoken "^Release Date: " :property *prop-keyword* :begin :note) ;; highlight operating system description (syntoken "^Build Operating System: " :property *prop-keyword* :begin :note) (syntable :note *prop-annotation* nil (syntoken "$" :switch -1)) ;; don't highlight info lines (syntoken "^\\(II\\) " :property *prop-keyword*) ;; default lines (syntoken "^\\(==\\) " :property *prop-keyword* :begin :default) (syntable :default *prop-xlog-default* nil (syntoken "$" :switch -1)) ;; probe lines (syntoken "^\\(--\\) " :property *prop-keyword* :begin :probe) (syntable :probe *prop-xlog-probe* nil (syntoken "$" :switch -1)) ;; config lines (syntoken "^\\(\\*\\*\\) " :property *prop-keyword* :begin :config) (syntable :config *prop-xlog-config* nil (syntoken "$" :switch -1)) ;; warnings (syntoken "^\\(WW\\) " :property *prop-keyword* :begin :warning) (syntable :warning *prop-xlog-warning* nil (syntoken "$" :switch -1)) ;; errors (syntoken "^\\(EE\\) " :property *prop-keyword* :begin :error) (syntable :error *prop-xlog-error* nil (syntoken "$" :switch -1)) ;; command line and "uncommon" messages (syntoken "^\\(..\\) " :property *prop-control* :begin :warning) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/html.lsp0000664000000000000000000002450012472175711021420 0ustar ;; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/html.lsp,v 1.2 2002/09/22 18:41:27 paulo Exp $ ;; (require "syntax") (in-package "XEDIT") #| This is not a validation tool for html. It is possible to, using macros generate all combinations of text attributes, to properly handle ......... etc, as well as generating macros to automatically closing tags, but for now this file was built to work as an experience with the syntax highlight code. |# (defsynprop *prop-html-default* "default" :font "-*-lucida-medium-r-*-*-14-*-*-*-*-*-*-1" :foreground "Gray10") (defsynprop *prop-html-bold* "bold" :font "-*-lucida-bold-r-*-*-14-*-*-*-*-*-*-1" :foreground "Gray15") (defsynprop *prop-html-italic* "italic" :font "-*-lucida-medium-i-*-*-14-*-*-*-*-*-*-1" :foreground "Gray10") (defsynprop *prop-html-pre* "pre" :font "-*-courier-medium-r-*-*-14-*-*-*-*-*-*-1" :foreground "Gray10") (defsynprop *prop-html-link* "link" :font "-*-lucida-medium-r-*-*-14-*-*-*-*-*-*-1" :foreground "Blue" :underline "t") (defsynprop *prop-html-small* "small" :font "-*-lucida-medium-r-*-*-10-*-*-*-*-*-*-1" :foreground "Gray10") (defsynprop *prop-html-big* "big" :font "-*-lucida-medium-r-*-*-20-*-*-*-*-*-*-1" :foreground "Gray15") (defsynprop *prop-html-name* "name" :font "-*-lucida-bold-r-*-*-14-*-*-*-*-*-*-1" :foreground "Black" :background "rgb:e/f/e") (defsynprop *prop-html-h1* "h1" :font "-*-lucida-bold-r-*-*-20-*-*-*-*-*-*-1" :foreground "Gray15") (defsynprop *prop-html-h2* "h2" :font "-*-lucida-bold-r-*-*-17-*-*-*-*-*-*-1" :foreground "Gray15") (defsynprop *prop-html-h4* "h4" :font "-*-lucida-bold-r-*-*-12-*-*-*-*-*-*-1" :foreground "Gray15") (defsynprop *prop-html-h5* "h5" :font "-*-lucida-bold-r-*-*-10-*-*-*-*-*-*-1" :foreground "Gray15") (defsynprop *prop-html-li* "li" :font "-*-lucida-bold-r-*-*-8-*-*-*-*-*-*-1" :foreground "rgb:0/5/0" :underline t) (defsynprop *prop-html-hr* "hr" :font "-*-courier-bold-r-*-*-12-*-*-*-*-*-*-1" :foreground "rgb:0/5/0" :overstrike t) (defsynprop *prop-html-title* "title" :font "-*-lucida-medium-r-*-*-14-*-*-*-*-*-*-1" :foreground "Red3" :underline "t") (defsynprop *prop-html-tag* "tag" :font "-*-courier-medium-r-*-*-10-*-*-*-*-*-*-1" :foreground "green4") (defsynprop *prop-html-string* "string" :font "-*-lucida-medium-r-*-*-10-*-*-*-*-*-*-1" :foreground "RoyalBlue2") (defsynprop *prop-html-comment* "comment" :font "-*-courier-medium-o-*-*-10-*-*-*-*-*-*-1" :foreground "SlateBlue3") (defsynprop *prop-html-entity* "entity" :font "-*-lucida-medium-r-*-*-12-*-*-*-*-*-*-1" :foreground "Red4") (defsynprop *prop-html-unknown* "unknown" :font "-*-courier-bold-r-*-*-10-*-*-*-*-*-*-1" :foreground "yellow" :background "red") (defmacro html-syntoken (name) `(syntoken (string-concat "<" ,name "\\>") :icase t :contained t :begin (intern (string-concat ,name "$") 'keyword))) (defmacro html-syntable (name property) `(let ((label (intern (string-concat ,name "$") 'keyword)) (nested-label (intern (string (gensym)) 'keyword))) (syntable label *prop-html-tag* nil (synaugment :generic-tag) (syntoken ">" :nospec t :property *prop-html-tag* :begin nested-label) (syntable nested-label ,property nil (syntoken (string-concat "") :icase t :nospec t :property *prop-html-tag* :switch -2) (syntoken (string-concat "" :nospec t :switch -1)) (syntoken "&([a-zA-Z0-9_.-]+|#\\x\\x?);?" :property *prop-html-entity*) (syntoken "
  • " :nospec t :icase t :property *prop-html-li*) (syntoken "
    " :nospec t :icase t :property *prop-html-hr*) (syntoken "" :icase t :contained t :begin :tag) (syntoken "<(p|br)>" :icase t :property *prop-html-tag*) ;; If in the toplevel, unbalanced! ;; XXX When adding new nested tables, don't forget to update this pattern. (syntoken (string-concat "") :icase t :property *prop-html-unknown* :begin :unbalanced) (syntable :unbalanced *prop-html-unknown* nil (syntoken ">" :nospec t :switch :main) (synaugment :generic-tag) ) #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;; XXX ONLY add a rule for "html", "head" and "body" if you want to do a ;; more complete check for common errors. If you add those rules, it will ;; reparse the entire file at every character typed (unless there are ;; errors in which case the parser resets the state). ;; For visualization only that would be OK... ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||# (html-syntoken "b") (html-syntable "b" *prop-html-bold*) (html-syntoken "strong") (html-syntable "strong" *prop-html-bold*) (html-syntoken "i") (html-syntable "i" *prop-html-italic*) (html-syntoken "em") (html-syntable "em" *prop-html-italic*) (html-syntoken "address") (html-syntable "address" *prop-html-italic*) (html-syntoken "pre") (html-syntable "pre" *prop-html-pre*) (html-syntoken "code") (html-syntable "code" *prop-html-pre*) (html-syntoken "tt") (html-syntable "tt" *prop-html-pre*) (html-syntoken "small") (html-syntable "small" *prop-html-small*) (html-syntoken "big") (html-syntable "big" *prop-html-big*) ;; Cannot hack html-syntoken and html-syntable to handle this, ;; as the option to " :icase t :contained t :begin :a) (syntable :a *prop-html-tag* nil ;; Tag is open (syntoken "\\" :icase t :begin :a-href) (syntoken "\\" :icase t :begin :a-name) (syntoken "<" :nospec t :property *prop-html-unknown* :switch -2) (synaugment :generic-tag) (syntoken ">" :nospec t :begin :a-generic-text) (syntable :a-href *prop-html-tag* nil (syntoken ">" :nospec t :begin :a-href-text) (synaugment :generic-tag) (syntable :a-href-text *prop-html-link* nil (syntoken "" :icase t :nospec t :property *prop-html-tag* :switch -3) (syntoken "" :nospec t :begin :a-name-text) (synaugment :generic-tag) (syntable :a-name-text *prop-html-name* nil (syntoken "" :icase t :nospec t :property *prop-html-tag* :switch -3) (syntoken "" :icase t :nospec t :property *prop-html-tag* :switch -2) (syntoken " and
    should be in a special table, to not require ;; and ending tag. ;; XXX Maybe should also add a table for

    . (html-syntoken "dt") (html-syntable "dt" nil) (html-syntoken "dd") (html-syntable "dd" nil) (html-syntoken "span") (html-syntable "span" nil) (html-syntoken "div") (html-syntable "div" nil) (html-syntoken "menu") (html-syntable "menu" nil) (html-syntoken "h1") (html-syntable "h1" *prop-html-h1*) (html-syntoken "h2") (html-syntable "h2" *prop-html-h2*) (html-syntoken "h3") (html-syntable "h3" *prop-html-bold*) (html-syntoken "h4") (html-syntable "h4" *prop-html-h4*) (html-syntoken "h5") (html-syntable "h5" *prop-html-h5*) (html-syntoken "title") (html-syntable "title" *prop-html-title*) (html-syntoken "font") (html-syntable "font" *prop-control*) (syntoken "<" :nospec t :contained t :begin :tag) (syntable :generic-tag *prop-html-tag* nil (syntoken "\"" :nospec t :contained t :begin :string) (syntoken "<" :nospec t :property *prop-html-unknown*) ) (syntable :tag *prop-html-tag* nil (syntoken ">" :nospec t :switch -1) (synaugment :generic-tag) ) ;; Tag ended in a newline, common practice... (syntable :continued-end-tag *prop-html-tag* nil (syntoken ">" :nospec t :switch -3) (synaugment :generic-tag) ) (syntable :continued-nested-end-tag *prop-html-tag* nil (syntoken ">" :nospec t :switch -4) (synaugment :generic-tag) ) (syntable :string *prop-html-string* nil (syntoken "\\\\.") (syntoken "\"" :nospec t :switch -1) ) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/c.lsp0000664000000000000000000007262312472175711020707 0ustar ;; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/c.lsp,v 1.27 2004/01/12 17:53:20 paulo Exp $ ;; (require "syntax") (require "indent") (in-package "XEDIT") (defsynprop *prop-format* "format" :font "*lucidatypewriter-medium-r*-12-*" :foreground "RoyalBlue2" :underline t ) (defsynoptions *c-DEFAULT-style* ;; Positive number. Basic indentation. (:indentation . 4) ;; Boolean. Support for GNU style indentation. (:brace-indent . nil) ;; Boolean. Add one indentation level to case and default? (:case-indent . t) ;; Boolean. Remove one indentation level for labels? (:label-dedent . t) ;; Boolean. Add one indentation level to continuations? (:cont-indent . t) ;; Boolean. Move cursor to the indent column after pressing ? (:newline-indent . t) ;; Boolean. Set to T if tabs shouldn't be used to fill indentation. (:emulate-tabs . nil) ;; Boolean. Force a newline before braces? (:newline-before-brace . nil) ;; Boolean. Force a newline after braces? (:newline-after-brace . nil) ;; Boolean. Force a newline after semicolons? (:newline-after-semi . nil) ;; Boolean. Only calculate indentation after pressing ? ;; This may be useful if the parser does not always ;; do what the user expects... (:only-newline-indent . nil) ;; Boolean. Remove extra spaces from previous line. ;; This should default to T when newline-indent is not NIL. (:trim-blank-lines . t) ;; Boolean. If this hash-table entry is set, no indentation is done. ;; Useful to temporarily disable indentation. (:disable-indent . nil) ) ;; BSD like style (defsynoptions *c-BSD-style* (:indentation . 8) (:brace-indent . nil) (:case-indent . nil) (:label-dedent . t) (:cont-indent . t) (:newline-indent . t) (:emulate-tabs . nil) (:newline-before-brace . nil) (:newline-after-brace . t) (:newline-after-semi . t) (:trim-blank-lines . t) ) ;; GNU like style (defsynoptions *c-GNU-style* (:indentation . 2) (:brace-indent . t) (:case-indent . nil) (:label-dedent . t) (:cont-indent . t) (:newline-indent . nil) (:emulate-tabs . nil) (:newline-before-brace . t) (:newline-after-brace . t) (:newline-after-semi . t) (:trim-blank-lines . nil) ) ;; K&R like style (defsynoptions *c-K&R-style* (:indentation . 5) (:brace-indent . nil) (:case-indent . nil) (:label-dedent . t) (:cont-indent . t) (:newline-indent . t) (:emulate-tabs . t) (:newline-before-brace . t) (:newline-after-brace . t) (:newline-after-semi . t) (:trim-blank-lines . t) ) (defvar *c-styles* '( ("xedit" . *c-DEFAULT-style*) ("BSD" . *c-BSD-style*) ("GNU" . *c-GNU-style*) ("K&R" . *c-K&R-style*) )) (defvar *c-mode-options* *c-DEFAULT-style*) ; (setq *c-mode-options* *c-gnu-style*) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; This is a very lazy "pattern matcher" for the C language. ;; If the syntax in the code is not correct, it may get confused, and ;; because it is "lazy" some wrong constructs will be recognized as ;; correct when reducing patterns. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defindent *c-mode-indent* :main ;; this must be the first token (indtoken "^\\s*" :start-of-line) (indtoken "\\" :c-case) (indtoken "\\" :c-default) (indtoken "\\" :do) (indtoken "\\" :c-if) (indtoken "\\" :c-else) (indtoken "\\" :c-for) (indtoken "\\" :c-switch) (indtoken "\\" :c-while) ;; Match identifiers and numbers as an expression (indtoken "\\w+" :expression) (indtoken ";" :semi :nospec t) (indtoken "," :comma :nospec t) (indtoken ":" :collon :nospec t) ;; Ignore spaces before collon, this avoids dedenting ternary ;; and bitfield definitions as the parser does not distinguish ;; labels from those, another option would be to use the pattern ;; "\\w+:", but this way should properly handle labels generated ;; by macros, example: `MACRO_LABEL(value):' (indtoken "\\s+:" nil) (indinit (c-braces 0)) (indtoken "{" :obrace :nospec t :code (decf c-braces) ) (indtoken "}" :cbrace :nospec t :begin :braces :code (incf c-braces) ) (indtable :braces (indtoken "{" :obrace :nospec t :switch -1 :code (decf c-braces) ) (indtoken "}" :cbrace :nospec t :begin :braces :code (incf c-braces) ) ) (indinit (c-bra 0)) (indtoken ")" :cparen :nospec t :code (incf c-bra)) (indtoken "(" :oparen :nospec t :code (decf c-bra)) (indtoken "]" :cbrack :nospec t :code (incf c-bra)) (indtoken "[" :obrack :nospec t :code (decf c-bra)) (indtoken "\\\\$" :continuation) ;; C++ style comment, disallow other tokens to match inside comment (indtoken "//.*$" nil) (indtoken "#" :hash :nospec t) ;; if in the same line, reduce now, this must be done because the ;; delimiters are identical (indtoken "'([^\\']|\\\\.)*'" :expression) (indtoken "\"([^\\\"]|\\\\.)*\"" :expression) (indtoken "\"" :cstring :nospec t :begin :string) (indtoken "'" :cconstant :nospec t :begin :constant) (indtoken "*/" :ccomment :nospec t :begin :comment) ;; this must be the last token (indtoken "$" :end-of-line) (indtable :string ;; Ignore escaped characters (indtoken "\\." nil) ;; Return to the toplevel when the start of the string is found (indtoken "\"" :ostring :nospec t :switch -1) ) (indtable :constant ;; Ignore escaped characters (indtoken "\\." nil) ;; Return to the toplevel when the start of the character is found (indtoken "'" :oconstant :nospec t :switch -1) ) (indtable :comment (indtoken "/*" :ocomment :nospec t :switch -1) ) ;; "Complex" statements (indinit (c-complex 0) (c-cases 0)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Order of reduce rules here is important, process comment, ;; continuations, preprocessor and set states when an eol is found. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indinit (c-offset (point-max)) (c-prev-offset c-offset) ) (indreduce :indent t ((:start-of-line)) (and (= *ind-start* *ind-offset*) (setq *offset* (+ *ind-offset* *ind-length*) ) ) (setq c-prev-offset c-offset c-offset *ind-offset* ) ) ;; Delete comments (indreduce nil t ((:ocomment nil :ccomment)) ) ;; Join in a single token to simplify removal of possible multiline ;; preprocessor directives (indinit c-continuation) (indreduce :continuation t ((:continuation :end-of-line)) (setq c-continuation t) ) (indreduce :eol t ((:end-of-line)) ;; Anything after the eol offset is safe to parse now (setq c-continuation nil) ) ;; Delete blank lines (indreduce nil t ((:indent :eol)) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Preprocessor ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indreduce nil (>= *ind-offset* *ind-start*) ((:indent :hash)) (setq *indent* 0) (indent-macro-reject-left) ) (indreduce nil t ((:indent :hash nil :eol)) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Expressions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indreduce :expression t ;; Reduce to a single expression ((:expression :parens) (:expression :bracks) (:expression :expression) ;; These may be multiline (:ostring (not :ostring) :cstring) (:oconstant (not :oconstant) :cconstant) ) ) (indreduce :expression t ((:expression :eol :indent :expression) (:expression :eol :expression) ) ) (indreduce :exp-comma t ((:expression :comma) ) ) ;; A semicollon, start a statement (indreduce :stat t ((:semi)) ) ;; Expression following (possibly empty) statement (indreduce :stat t (((or :expression :exp-comma) :stat)) ) ;; Multiline statements (indreduce :stat t (((or :expression :exp-comma) :eol :indent :stat) ;; rule below may have removed the :indent ((or :expression :exp-comma) :eol :stat) ) ) (indinit c-exp-indent) ;; XXX This rule avoids parsing large amounts of code (indreduce :stat t ;; Eat eol if following expression ((:indent :stat :eol) (:indent :stat) ) (if (or (null c-exp-indent) (/= (cdar c-exp-indent) (+ *ind-offset* *ind-length*)) ) ;; A new statement, i.e. not just joining a multiline one (push (cons (offset-indentation *ind-offset* :resolve t) (+ *ind-offset* *ind-length*) ) c-exp-indent ) ;; Update start of statement (rplaca (car c-exp-indent) (offset-indentation *ind-offset* :resolve t) ) ) (when (consp (cdr c-exp-indent)) (if (and (zerop c-complex) (zerop c-cases) (zerop c-bra) (= (caar c-exp-indent) (caadr c-exp-indent)) ) ;; Two statements with the same indentation (progn (setq *indent* (caar c-exp-indent)) (indent-macro-reject-left) ) ;; Different indentation or complex state (progn (rplacd c-exp-indent nil) (setq c-complex 0) ) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Handle braces ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indreduce :stat ;; If block finishes before current line, group as a statement (< (+ *ind-offset* *ind-length*) *ind-start*) ((:obrace (not :obrace) :cbrace)) ) (indreduce :obrace ;; If not in the first line (< *ind-offset* *ind-start*) ;; If the opening { is the first non blank char in the line ((:indent :obrace)) (setq *indent* (offset-indentation (+ *ind-offset* *ind-length*))) ;; XXX This may be the starting brace of a switch (setq c-case-flag nil) (indent-macro-reject-left) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Labels ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; XXX this frequently doesn't do what is expected, should redefine ;; some rules, as it frequently will dedent while typing something ;; like test ? exp1 : exp2 ;; ^ dedents here because it reduces everything ;; before ':' to a single :expression token. (indreduce :label t ((:indent :expression :collon :eol)) (when (and *label-dedent* (>= *ind-offset* *ind-start*)) (setq *indent* (- (offset-indentation *ind-offset* :resolve t) *base-indent*) ) (indent-macro-reject-left) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Handle if ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indreduce :if t ((:c-if :parens) ) (incf c-complex) ) (indreduce :else t ((:c-else)) (incf c-complex) ) ;; Join (indreduce :else-if t ((:else :if) (:else :eol :indent :if) ) (incf c-complex) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Handle for ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Join with the parentheses (indreduce :for t ((:c-for :parens) ) (incf c-complex) ) ;; Before current line, simplify (indreduce :stat (< (+ *ind-offset* *ind-length*) *ind-point*) ((:for :stat) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Handle while and do ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indreduce :while t ((:c-while :parens) ) (incf c-complex) ) (indreduce :stat t ((:do :stat :while) (:while :stat) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Handle switch ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indinit c-case-flag) (indreduce :switch t ((:c-switch :parens) ) ) ;; Transform in a statement (indreduce :stat (< (+ *ind-offset* *ind-length*) *ind-start*) ((:switch :stat) ;; Do it now or some rule may stop parsing, and calculate ;; a wrong indentation for nested switches (:switch :eol :indent :stat) ) ) ;; An open switch (indreduce :obrace (and (<= c-braces 0) (> *ind-start* *ind-offset*) ) ((:indent :switch :obrace) ) (setq *indent* (offset-indentation *ind-offset* :resolve t) c-case-flag nil ) (indent-macro-reject-left) ) (indreduce :obrace (and (<= c-braces 0) (> *ind-start* *ind-offset*) ) ((:indent :switch :eol :indent :obrace) ) (setq *indent* (- (offset-indentation *ind-offset* :resolve t) *base-indent*) c-case-flag nil ) (and *brace-indent* (incf *indent* *base-indent*)) (indent-macro-reject-left) ) ;; Before current line (indreduce :case (and (or (not *case-indent*) (prog1 c-case-flag (setq c-case-flag t)) ) (<= c-braces 0) (< *ind-offset* *ind-start*) ) ((:indent :case) ) (setq *indent* (offset-indentation *ind-offset* :resolve t) c-case-flag nil ) (indent-macro-reject-left) ) (indreduce :case t ((:c-case :expression :collon) (:c-default :collon) ;; Assume that it is yet being edited, or adjusting indentation (:c-case) (:c-default) ) (and (>= *ind-offset* *ind-start*) (incf c-cases) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Handle parentheses and brackets ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Reduce matches (indreduce :parens t ((:oparen (not :oparen) :cparen)) (when (and (< *ind-offset* *ind-start*) (> (+ *ind-offset* *ind-length*) *ind-start*) ) (setq *indent* (1+ (offset-indentation *ind-offset* :align t))) (indent-macro-reject-left) ) ) (indreduce :bracks t ((:obrack (not :obrack) :cbrack)) (when (and (< *ind-offset* *ind-start*) (> (+ *ind-offset* *ind-length*) *ind-start*) ) (setq *indent* (1+ (offset-indentation *ind-offset* :align t))) (indent-macro-reject-left) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Assuming previous lines have correct indentation, this allows ;; resolving the indentation fastly ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Line ended with an open brace (indreduce :obrace (< *ind-offset* *ind-start*) ((:indent (or :for :while :if :else-if :else :do) :obrace) ) (setq *indent* (offset-indentation *ind-offset* :resolve t)) (indent-macro-reject-left) ) ;; Adjust indentation level if current line starts with an open brace (indreduce nil (< *ind-offset* *ind-start* (+ *ind-offset* *ind-length*)) ;; Just set initial indentation ((:indent (or :for :while :if :else-if :else :do) :eol :indent :obrace) ) (setq *indent* (- (offset-indentation *ind-offset* :resolve t) *base-indent*) ) (and *brace-indent* (incf *indent* *base-indent*)) (indent-macro-reject-left) ) ;; Previous rule failed, current line does not start with an open brace (indreduce :flow ;; first statement is in current line (and (<= c-braces 0) (> (+ *ind-offset* *ind-length*) *ind-start* *ind-offset*) ) ((:indent (or :for :while :if :else-if :else :do) :eol :indent) ) (setq *indent* (offset-indentation *ind-offset* :resolve t)) (indent-macro-reject-left) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Simplify, remove old (:eol :indent) ;; This must be the last rule, to avoid not matching the ;; rules for fast calculation of indentation above ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indreduce nil (> *ind-offset* c-prev-offset) ((:eol :indent)) ) (indinit (c-flow 0)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; If ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indinit c-if-flow) (indresolve :if (and (< *ind-offset* *ind-start*) (push c-flow c-if-flow) (incf *indent* *base-indent*) (incf c-flow) ) ) (indresolve (:else-if :else) (when c-if-flow (while (< c-flow (car c-if-flow)) (incf *indent* *base-indent*) (incf c-flow) ) (or (eq *ind-token* :else-if) (pop c-if-flow)) ) (and (< *ind-offset* *ind-start*) (incf *indent* *base-indent*) (incf c-flow) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; For/while/do ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indinit c-do-flow) (indresolve (:for :while :do) (if (eq *ind-token* :do) (and (< *ind-offset* *ind-start*) (push c-flow c-do-flow)) (when (and c-do-flow (eq *ind-token* :while)) (while (< c-flow (car c-do-flow)) (incf *indent* *base-indent*) (incf c-flow) ) (pop c-do-flow) ) ) (and (< *ind-offset* *ind-start*) (incf *indent* *base-indent*) (incf c-flow) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Switch ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indresolve :switch (setq c-case-flag nil) ) (indresolve (:case :c-case) (if (< *ind-offset* *ind-start*) (or c-case-flag (setq *indent* (+ (offset-indentation *ind-offset* :resolve t) *base-indent* ) ) ) (if c-case-flag (and (= (decf c-cases) 0) (decf *indent* *base-indent*) ) (or *case-indent* (decf *indent* *base-indent*) ) ) ) (setq c-case-flag t) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Braces/flow control ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indresolve :flow (incf *indent* *base-indent*) ) (indresolve :obrace (and (< *ind-offset* *ind-start*) (incf *indent* *base-indent*) ) ) (indresolve :cbrace (decf *indent* *base-indent*) (and *case-indent* c-case-flag (decf *indent* *base-indent*) (setq c-case-flag nil) ) (and (not *offset*) (>= *ind-offset* *ind-start*) (setq *offset* *ind-offset*) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Statements ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indresolve :stat (when (< *ind-offset* *ind-start*) (while (> c-flow 0) (setq *indent* (- *indent* *base-indent*) c-flow (1- c-flow) ) ) ) (and *cont-indent* (< *ind-offset* *ind-start*) (> (+ *ind-offset* *ind-length*) *ind-start*) (incf *indent* *base-indent*) ) ) (indresolve :expression (and *cont-indent* (zerop c-bra) (> *indent* 0) (< *ind-offset* *ind-start*) (> (+ *ind-offset* *ind-length*) *ind-start*) (incf *indent* *base-indent*) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Open ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indresolve (:oparen :obrack) (and (< *ind-offset* *ind-start*) (setq *indent* (1+ (offset-indentation *ind-offset* :align t))) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Find a "good" offset to start parsing backwards, so that it should ;; always generate the same results. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun c-offset-indent (&aux char (point (point))) ;; Skip spaces forward (while (member (setq char (char-after point)) indent-spaces) (incf point) ) (or (characterp char) (return-from c-offset-indent point)) ;; Skip word chars (when (alphanumericp char) (while (and (setq char (char-after point)) (alphanumericp char)) (incf point) ) (or (characterp char) (return-from c-offset-indent point)) ;; Skip spaces forward (while (member (setq char (char-after point)) indent-spaces) (incf point) ) (or (characterp char) (return-from c-offset-indent point)) ) ;; don't include " or ' to avoid parsing strings "inverted" (if (member char '(#\Newline #\" #\')) point (1+ point)) ) (compile 'c-offset-indent) (defun c-should-indent (options) (when (hash-table-p options) ;; check if previous line has extra spaces (and (gethash :trim-blank-lines options) (indent-clear-empty-line) ) ;; indentation disabled? (and (gethash :disable-indent options) (return-from c-should-indent) ) (let* ( (point (point)) (start (scan point :eol :left)) (char (char-before point)) offset match text ) ;; at the start of an empty file (or (characterp char) (return-from c-should-indent) ) ;; if at bol and should indent only when starting a line (and (gethash :only-newline-indent options) (return-from c-should-indent (= point start)) ) (and (char= char #\;) (gethash :newline-after-semi options) (return-from c-should-indent t) ) ;; if one of these was typed, must check indentation (and (member char '(#\{ #\} #\: #\] #\) #\#)) (return-from c-should-indent t) ) ;; at the start of a line (and (= point start) (return-from c-should-indent (gethash :newline-indent options)) ) ;; if first character (and (= point (1+ start)) (return-from c-should-indent t) ) ;; check if is the first non-blank character in a new line (when (and (gethash :cont-indent options) (= point (scan point :eol :right)) (alphanumericp char) ) (setq offset (1- point)) (while (and (> offset start) (member (char-before offset) indent-spaces) ) (decf offset) ) ;; line has only one character with possible spaces before it (and (<= offset start) (return-from c-should-indent t) ) ) ;; check for keywords that change indentation (when (alphanumericp char) (setq offset (1- point)) (while (and (alphanumericp (char-before offset)) (> offset start) ) (decf offset) ) (setq text (read-text offset (- point offset)) match (re-exec #.(re-comp "(case|else|while)\\w?\\>") text) ) (and (consp match) (return-from c-should-indent (<= (- (caar match) offset) 2)) ) ) ) ) ;; Should not indent nil ) (compile 'c-should-indent) (defun c-indent-check (syntax syntable options &aux start point char left brace change) (setq point (point) char (char-before point) left point brace (member char '(#\{ #\})) ) (when (and brace (gethash :newline-before-brace options)) (setq start (scan point :eol :left)) (while (and (> (decf left) start) (member (char-before left) indent-spaces) ) ;; skip blanks ) (when (> left start) (replace-text left left (string #\Newline)) (c-indent syntax syntable) (setq change t) ) ) (when (or (and brace (not change) (gethash :newline-after-brace options)) (and (char= char #\;) (gethash :newline-after-semi options)) ) (setq left (point)) (replace-text left left (string #\Newline)) (goto-char (1+ left)) (c-indent syntax syntable) ) ) (defun c-indent (syntax syntable) (let* ( (options (syntax-options syntax)) *base-indent* *brace-indent* *case-indent* *label-dedent* *cont-indent* ) (or (c-should-indent options) (return-from c-indent)) (setq *base-indent* (gethash :indentation options 4) *brace-indent* (gethash :brace-indent options nil) *case-indent* (gethash :case-indent options t) *label-dedent* (gethash :label-dedent options t) *cont-indent* (gethash :cont-indent options t) ) (indent-macro *c-mode-indent* (c-offset-indent) (gethash :emulate-tabs options) ) (c-indent-check syntax syntable options) ) ) (compile 'c-indent) (defsyntax *c-mode* :main nil #'c-indent *c-mode-options* ;; All recognized C keywords. (syntoken (string-concat "\\<(" "asm|auto|break|case|catch|char|class|const|continue|default|" "delete|do|double|else|enum|extern|float|for|friend|goto|if|" "inline|int|long|new|operator|private|protected|public|register|" "return|short|signed|sizeof|static|struct|switch|template|this|" "throw|try|typedef|union|unsigned|virtual|void|volatile|while" ")\\>") :property *prop-keyword*) ;; Numbers, this is optional, comment this rule if xedit is ;; too slow to load c files. (syntoken (string-concat "\\<(" ;; Integers "(\\d+|0x\\x+)(u|ul|ull|l|ll|lu|llu)?|" ;; Floats "\\d+\\.?\\d*(e[+-]?\\d+)?[lf]?" ")\\>") :icase t :property *prop-number* ) ;; String start rule. (syntoken "\"" :nospec t :begin :string :contained t) ;; Character start rule. (syntoken "'" :nospec t :begin :character :contained t) ;; Preprocessor start rule. (syntoken "^\\s*#\\s*\\w+" :begin :preprocessor :contained t) ;; Comment start rule. (syntoken "/*" :nospec t :begin :comment :contained t) ;; C++ style comments. (syntoken "//.*" :property *prop-comment*) ;; Punctuation, this is also optional, comment this rule if xedit is ;; too slow to load c files. (syntoken "[][(){}/*+:;=<>,&.!%|^~?-][][(){}*+:;=<>,&.!%|^~?-]?" :property *prop-punctuation*) ;; Rules for comments. (syntable :comment *prop-comment* #'default-indent ;; Match nested comments as an error. (syntoken "/*" :nospec t :property *prop-error*) (syntoken "XXX|TODO|FIXME" :property *prop-annotation*) ;; Rule to finish a comment. (syntoken "*/" :nospec t :switch -1) ) ;; Rules for strings. (syntable :string *prop-string* #'default-indent ;; Ignore escaped characters, this includes \". (syntoken "\\\\.") ;; Match, most, printf arguments. (syntoken "%%|%([+-]?\\d+)?(l?[deEfgiouxX]|[cdeEfgiopsuxX])" :property *prop-format*) ;; Ignore continuation in the next line. (syntoken "\\\\$") ;; Rule to finish a string. (syntoken "\"" :nospec t :switch -1) ;; Don't allow strings continuing in the next line. (syntoken ".?$" :begin :error) ) ;; Rules for characters. (syntable :character *prop-constant* nil ;; Ignore escaped characters, this includes \'. (syntoken "\\\\.") ;; Ignore continuation in the next line. (syntoken "\\\\$") ;; Rule to finish a character constant. (syntoken "'" :nospec t :switch -1) ;; Don't allow constants continuing in the next line. (syntoken ".?$" :begin :error) ) ;; Rules for preprocessor. (syntable :preprocessor *prop-preprocessor* #'default-indent ;; Preprocessor includes comments. (syntoken "/*" :nospec t :begin :comment :contained t) ;; Ignore strings and constants in the same line and finishes table ;; This is kind hackish, but must be done because the current parser ;; will not flag eol. Maybe it could be extended to properly handle ;; and have an internal flag to tell it to pass again if there ;; is a regex that can match eol on an empty string. ;; A test is already done (but at compile time) to not allow patterns ;; that match an empty string (but allow patterns matching ;; bol, eol or both on an empty string). (syntoken "\"([^\\\"]|\\\\.)*\"$" :property *prop-string* :switch -1) (syntoken "'([^']|\\\\.)*'$" :property *prop-constant* :switch -1) ;; Ignore strings and constants in the same line (syntoken "\"([^\\\"]|\\\\.)*\"" :property *prop-string*) (syntoken "'([^']|\\\\.)*'" :property *prop-constant*) ;; Ignore lines finishing with a backslash. (syntoken "\\\\$") ;; multiline strings (syntoken "\"" :nospec t :begin :string) ;; multiline constants (syntoken "'" :nospec t :begin :character) ;; C++ style comments (syntoken "//.*$" :property *prop-comment* :switch -1) ;; Return to previous state if end of line found. (syntoken ".?$" :switch -1) ) (syntable :error *prop-error* nil (syntoken "^.*$" :switch -2) ) ;; You may also want to comment this rule if the parsing is ;; noticeably slow. (syntoken "\\c" :property *prop-control*) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/xrdb.lsp0000664000000000000000000000720312472175711021414 0ustar ;; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/xrdb.lsp,v 1.2 2002/10/06 17:11:48 paulo Exp $ ;; (require "syntax") (in-package "XEDIT") (defsynprop *prop-xrdb-comment* "xrdb-comment" :font "*courier-medium-o*-12-*" :foreground "sienna" ) (defsynprop *prop-xrdb-special* "format" :font "*lucidatypewriter-medium-r*-12-*" :foreground "RoyalBlue4" ) (defsynprop *prop-xrdb-punctuation* "punctuation" :font "-*-courier-bold-r-*-*-14-*-*-*-*-*-*-1" :foreground "OrangeRed4" ) (defsyntax *xrdb-mode* :main nil nil nil (syntoken "^\\s*!.*" :property *prop-xrdb-comment*) (syntoken "^\\s*#.*" :property *prop-preprocessor*) (syntoken "\\*|\\.|\\?" :property *prop-xrdb-punctuation* :begin :resource) (syntoken "." :nospec t :begin :resource) ;; Extra comments (syntoken "/*" :nospec t :begin :comment :contained t) (syntable :comment *prop-comment* nil (syntoken "/*" :nospec t :property *prop-error*) ;; Rule to finish a comment. (syntoken "*/" :nospec t :switch -1) ) (syntable :resource nil nil (syntoken "\\*|\\.|\\?" :property *prop-xrdb-punctuation*) (syntoken ":\\s*" :property *prop-xrdb-punctuation* :begin :value) ) (syntable :value *prop-string* nil (syntoken "\\\\$" :property *prop-constant*) ;; If the pattern ends at a newline, must switch to the previous state. ;; Not sure yet how to better handle this. The parser does not detect ;; eol because it is a match to the empty string. A possible hack ;; would be to check if the pattern string ends in a "$", but probably ;; better in this case to have a syntoken option, to tell the parser ;; an eol may exist. (syntoken (string-concat "(" "\\d+|" ;; numbers "(#\\x+|rgb:\\x+/\\x+/\\x+)|" ;; color spec "#\\w+" ;; translation table ")$") :property *prop-xrdb-special* :switch -2) (syntoken "(\\\\n?|\")$" :property *prop-constant* :switch -2) ;; XXX Cut&paste of the above, only without the match to eol (syntoken (string-concat "(" "\\d+|" "(#\\x+|rgb:\\x+/\\x+/\\x+)|" "#\\w+" ")") :property *prop-xrdb-special*) (syntoken "(\\\\n?|\")" :property *prop-constant*) (syntoken "/*" :nospec t :begin :comment :contained t) (syntoken ".?$" :switch -2) ) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/lisp.lsp0000664000000000000000000002651112472175711021427 0ustar ;; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/lisp.lsp,v 1.9 2003/01/30 02:46:26 paulo Exp $ ;; (require "syntax") (require "indent") (in-package "XEDIT") (defsynprop *prop-special* "special" :font "*courier-bold-r*-12-*" :foreground "NavyBlue" ) (defsynprop *prop-quote* "quote" :font "*courier-bold-r*-12-*" :foreground "Red4" ) (defsynprop *prop-package* "package" :font "*lucidatypewriter-medium-r*-12-*" :foreground "Gold4" ) (defsynprop *prop-unreadable* "unreadable" :font "*courier-medium-r*-12-*" :foreground "Gray25" :underline t ) (defsynoptions *lisp-DEFAULT-style* ;; Positive number. Basic indentation. (:indentation . 2) ;; Boolean. Move cursor to the indent column after pressing ? (:newline-indent . t) ;; Boolean. Use spaces instead of tabs to fill indentation? (:emulate-tabs . nil) ;; Boolean. Remove extra spaces from previous line. ;; This should default to T when newline-indent is not NIL. (:trim-blank-lines . t) ;; Boolean. If this hash-table entry is set, no indentation is done. ;; Useful to temporarily disable indentation. (:disable-indent . nil) ) (defvar *lisp-mode-options* *lisp-DEFAULT-style*) (defindent *lisp-mode-indent* :main ;; this must be the first token (indtoken "^\\s*" :indent :code (or *offset* (setq *offset* (+ *ind-offset* *ind-length*)))) ;; ignore single line comments (indtoken ";.*$" nil) ;; multiline comments (indtoken "|#" :comment :nospec t :begin :comment) ;; characters (indtoken "#\\\\(\\W|\\w+(-\\w+)?)" :character) ;; numbers (indtoken (string-concat "(\\<|[+-])\\d+(" ;; integers "(\\>|\\.(\\s|$))|" ;; ratios "/\\d+\\>|" ;;floats "\\.?\\d*([SsFfDdLlEe][+-]?\\d+)?\\>" ")") :number) ;; symbols, with optional package (indtoken (string-concat ;; optional package name and ending ':' "([A-Za-z_0-9%-]+:)?" ;; internal symbol if after package name, or keyword ":?" ;; symbol name "[][{}A-Za-z_0-9!$%&/<=>^~*+-]+") :symbol) ;; strings in the same line (indtoken "\"([^\\\"]|\\\\.)*\"" :string) ;; multiline strings (indtoken "\"" :cstring :nospec t :begin :string) ;; "quoted" symbols in the same line (indtoken "\\|([^\\|]|\\\\.)*\\|" :symbol) ;; multiline (indtoken "|" :csymbol :nospec t :begin :symbol) (indtoken "#" :hash :nospec t) (indinit (parens 0)) (indtoken "(" :oparen :nospec t :code (incf parens)) (indtoken ")" :cparen :nospec t :code (decf parens)) (indtable :comment ;; multiline comments can nest (indtoken "|#" nil :nospec t :begin :comment) (indtoken "#|" nil :nospec t :switch -1)) (indtable :string ;; Ignore escaped characters (indtoken "\\." nil) ;; Return to the toplevel when the start of the string is found (indtoken "\"" :ostring :nospec t :switch -1)) (indtable :symbol ;; Ignore escaped characters (indtoken "\\." nil) ;; Return to the toplevel when the start of the symbol is found (indtoken "|" :osymbol :nospec t :switch -1)) ;; ignore comments (indreduce nil t ((:comment))) ;; reduce multiline strings (indreduce :string t ((:ostring (not :ostring) :cstring))) ;; reduce multiline symbols (indreduce :symbol t ((:osymbol (not :osymbol) :csymbol))) ;; reduce basic types, don't care if inside list or not (indreduce :element t ((:number) (:string) (:character) (:element :element) (:indent :element))) (indreduce :symbol t ((:symbol :symbol) (:symbol :element) (:indent :symbol))) ;; the "real" indentation value, to make easier parsing code like: ;; (foo (bar (baz (blah ;; ^ ^ ;; | | ;; indent | ;; effective indentation to be used (indinit (indent 0)) ;; indentation values of opening parenthesis. (indinit stack) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; if before current line and open parenthesis >= 0, use indentation ;; of current line to calculate relative indentation. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (indreduce :oparen ;; simple list? (and (>= parens 0) (< *ind-offset* *ind-start*)) ((:indent :oparen)) (setq *indent* (offset-indentation (+ *ind-offset* *ind-length*) :resolve t) indent *indent*) (indent-macro-reject-left)) ;; reduce list if there isn't indentation change (indreduce :element t ((:oparen (not :oparen) :cparen))) (indresolve :oparen (setq *indent* (offset-indentation (+ *ind-offset* *ind-length* -1 *base-indent*) :align t)) (push *indent* stack) (incf indent *base-indent*) (if (< *indent* indent) (setq *indent* indent))) (indresolve :cparen (decf indent *base-indent*) (setq *indent* (pop stack)) (if (null stack) (setq *indent* indent) (setq *indent* (car stack)))) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Find a "good" offset to start parsing backwards, so that it should ;; always generate the same results. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun lisp-offset-indent (&aux char (point (scan (point) :eol :left))) ;; skip spaces (while (member (setq char (char-after point)) indent-spaces) (incf point)) (if (member char '(#\))) (1+ point) point)) (defun lisp-should-indent (options &aux char point start) (when (hash-table-p options) ;; check if previous line has extra spaces (and (gethash :trim-blank-lines options) (indent-clear-empty-line)) ;; indentation disabled? (and (gethash :disable-indent options) (return-from lisp-should-indent)) (setq point (point) char (char-before (point)) start (scan point :eol :left)) ;; at the start of a line (and (= point start) (return-from lisp-should-indent (gethash :newline-indent options))) ;; if first character (and (= point (1+ start)) (return-from lisp-should-indent t)) ;; if closing parenthesis and first nonblank char (when (and (characterp char) (char= char #\))) (decf point) (while (and (> point start) (member (char-before point) indent-spaces)) (decf point)) (return-from lisp-should-indent (<= point start))) ) ;; should not indent nil) (defun lisp-indent (syntax syntable) (let* ((options (syntax-options syntax)) *base-indent*) (or (lisp-should-indent options) (return-from lisp-indent)) (setq *base-indent* (gethash :indentation options 2)) (indent-macro *lisp-mode-indent* (lisp-offset-indent) (gethash :emulate-tabs options)))) (compile 'lisp-indent) (defsyntax *lisp-mode* :main nil #'lisp-indent *lisp-mode-options* ;; highlight car and parenthesis (syntoken "\\(+\\s*[][{}A-Za-z_0-9!$%&/<=>?^~*:+-]*\\)*" :property *prop-keyword*) (syntoken "\\)+" :property *prop-keyword*) ;; nil and t (syntoken "\\<(nil|t)\\>" :icase t :property *prop-special*) (syntoken "|" :nospec t :begin :unreadable :contained t) ;; keywords (syntoken ":[][{}A-Za-z_0-9!$%&/<=>^~+-]+" :property *prop-constant*) ;; special symbol. (syntoken "\\*[][{}A-Za-z_0-9!$%&7=?^~+-]+\\*" :property *prop-special*) ;; special identifiers (syntoken "&(aux|key|optional|rest)\\>" :icase t :property *prop-constant*) ;; numbers (syntoken ;; since lisp is very liberal in what can be a symbol, this pattern ;; will not always work as expected, since \< and \> will not properly ;; work for all characters that may be in a symbol name (string-concat "(\\<|[+-])\\d+(" ;; integers "(\\>|\\.(\\s|$))|" ;; ratios "/\\d+\\>|" ;;floats "\\.?\\d*([SsFfDdLlEe][+-]?\\d+)?\\>" ")") :property *prop-number*) ;; characters (syntoken "#\\\\(\\W|\\w+(-\\w+)?)" :property *prop-constant*) ;; quotes (syntoken "[`'.]|,@?" :property *prop-quote*) ;; package names (syntoken "[A-Za-z_0-9%-]+::?" :property *prop-package*) ;; read time evaluation (syntoken "#\\d+#" :property *prop-preprocessor*) (syntoken "#([+'cCsS-]|\\d+[aA=])?" :begin :preprocessor :contained t) (syntoken "\\c" :property *prop-control*) ;; symbols, do nothing, just resolve conflicting matches (syntoken "[][{}A-Za-z_0-9!$%&/<=>^~*+-]+") (syntable :simple-comment *prop-comment* nil (syntoken "$" :switch -1) (syntoken "XXX|FIXME|TODO" :property *prop-annotation*)) (syntable :comment *prop-comment* nil ;; comments can nest (syntoken "#|" :nospec t :begin :comment) ;; return to previous state (syntoken "|#" :nospec t :switch -1) (syntoken "XXX|FIXME|TODO" :property *prop-annotation*)) (syntable :unreadable *prop-unreadable* nil ;; ignore escaped characters (syntoken "\\\\.") (syntoken "|" :nospec t :switch -1)) (syntable :string *prop-string* nil ;; ignore escaped characters (syntoken "\\\\.") (syntoken "\"" :nospec t :switch -1)) (syntable :preprocessor *prop-preprocessor* nil ;; a symbol (syntoken "[][{}A-Za-z_0-9!$%&/<=>^~:*+-]+" :switch -1) ;; conditional expression (syntoken "(" :nospec t :begin :preprocessor-expression :contained t) (syntable :preprocessor-expression *prop-preprocessor* nil ;; recursive (syntoken "(" :nospec t :begin :preprocessor-recursive :contained t) (syntoken ")" :nospec t :switch -2) (syntable :preprocessor-recursive *prop-preprocessor* nil (syntoken "(" :nospec t :begin :preprocessor-recursive :contained t) (syntoken ")" :nospec t :switch -1) (synaugment :comments-and-strings)) (synaugment :comments-and-strings)) (synaugment :comments-and-strings)) (syntable :comments-and-strings nil nil (syntoken "\"" :nospec t :begin :string :contained t) (syntoken "#|" :nospec t :begin :comment :contained t) (syntoken ";" :begin :simple-comment :contained t)) (synaugment :comments-and-strings) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/man.lsp0000664000000000000000000001004712472175711021230 0ustar ;; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/man.lsp,v 1.2 2002/10/06 17:11:48 paulo Exp $ ;; (require "syntax") (in-package "XEDIT") (defsynprop *prop-man-b* "b" :font "*courier-bold-r*-12-*" :foreground "gray12" ) (defsynprop *prop-man-i* "i" :font "*courier-medium-o*-12-*" :foreground "black" ) (defsynprop *prop-man-bi* "bi" :font "*courier-bold-o*-12-*" :foreground "gray20" ) (defsynprop *prop-man-th* "th" :font "-*-courier-*-*-*-*-18-*-*-*-*-*-*-1" :foreground "Red3" ) (defsynprop *prop-man-sh* "sh" :font "-*-courier-*-*-*-*-14-*-*-*-*-*-*-1" :foreground "OrangeRed3" ) (defsynprop *prop-man-ss* "ss" :font "-*-courier-*-*-*-*-12-*-*-*-*-*-*-1" :foreground "Gold4" ) (defsynprop *prop-man-escape* "escape" :font "*lucidatypewriter-medium-r*-12-*" :foreground "RoyalBlue4" ) (defsynprop *prop-man-string* "string" :font "*lucidatypewriter-bold-r*-12-*" :foreground "RoyalBlue3" ; :underline t ) (defmacro man-syntoken (pattern) `(syntoken (string-concat "^\\.(" ,pattern ")(\\s+|$)") :icase t ; :contained t :property *prop-preprocessor* :begin (intern (string ,pattern) 'keyword))) (defmacro man-syntable (pattern property) `(syntable (intern (string ,pattern) 'keyword) ,property nil (syntoken "$" :switch -1) (synaugment :extras))) (defsyntax *man-mode* :main nil nil nil (syntoken "^\\.\\\\\".*" :property *prop-comment*) (man-syntoken "b|br|nm") (man-syntable "b|br|nm" *prop-man-b*) (man-syntoken "i|ir|ri|ip") (man-syntable "i|ir|ri|ip" *prop-man-i*) (man-syntoken "th|dt") (man-syntable "th|dt" *prop-man-th*) (man-syntoken "sh") (man-syntable "sh" *prop-man-sh*) (man-syntoken "ss") (man-syntable "ss" *prop-man-ss*) (man-syntoken "bi") (man-syntable "bi" *prop-man-bi*) ;; Anything not matched... (syntoken "^\\.[a-z][a-z](\\s+|$)" :icase t :property *prop-preprocessor*) (syntable :extras nil nil (syntoken "\\<__\\l+__\\>" :property *prop-constant*) (syntoken "\\\\fB" :property *prop-preprocessor* :begin :b) (syntoken "\\\\fI" :property *prop-preprocessor* :begin :i) (syntoken "\\\\f\\u" :property *prop-preprocessor*) (syntoken "\\\\\\*?." :property *prop-man-escape*) (syntoken "\"" :property *prop-man-string*) (syntable :i *prop-man-i* nil (syntoken "$" :switch :main) (syntoken "\\\\f\\u" :property *prop-preprocessor* :switch -1) ) (syntable :b *prop-man-b* nil (syntoken "$" :switch :main) (syntoken "\\\\f\\u" :property *prop-preprocessor* :switch -1) ) ) (synaugment :extras) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/sgml.lsp0000664000000000000000000003020212472175711021412 0ustar ;; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/sgml.lsp,v 1.2 2002/10/06 17:11:48 paulo Exp $ ;; (require "syntax") (in-package "XEDIT") ;; Default property the text is shown. (defsynprop *prop-sgml-default* "default" :font "-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-1" :foreground "Gray10" ) (defsynprop *prop-sgml-default-short* "default-short" :font "-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-1" :foreground "Gray10" :underline t ) ;; Large font. (defsynprop *prop-sgml-sect* "sect" :font "-*-helvetica-bold-r-*-*-17-*-*-*-*-*-*-1" :foreground "Gray20" ) ;; Monospaced property. (defsynprop *prop-sgml-tt* "tt" :font "-*-courier-medium-r-*-*-12-*-*-*-*-*-*-1" :foreground "Black" ) ;; Italic property. (defsynprop *prop-sgml-it* "it" :font "-*-helvetica-medium-o-*-*-12-*-*-*-*-*-*-1" :foreground "Black" ) ;; Bold font property. (defsynprop *prop-sgml-bf* "bf" :font "-*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-1" :foreground "Gray10" ) ;; Looks like a link... (defsynprop *prop-sgml-link* "link" :font "-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-1" :foreground "blue" :underline t ) ;; Monospaced, also looks like a link... (defsynprop *prop-sgml-email* "email" :font "-*-courier-medium-r-*-*-12-*-*-*-*-*-*-1" :foreground "blue" :underline t ) ;; Another monospaced property, (defsynprop *prop-sgml-screen* "screen" :font "-*-fixed-*-*-*-*-*-*-*-*-*-*-*-1" :foreground "Gray10" ) (defsynprop *prop-sgml-maybe-entity* "maybe-entity" :font "*lucidatypewriter-medium-r*-12-*" :foreground "VioletRed4" :background "LightYellow" ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; The macros sgml-syntoken and sgml-syntable allows creating rules for ;; matching text inside tags in the format: ;; or or ;; any-text ;; ;; The generated rules don't allow things like: < tag> or ;; ;; This could also be done as a normal definition, with a starting rule like: ;; "<(tag1|tag2|tag3)\\>" ;; and an ending rule like: ;; "" ;; But is implemented in way that will fail on purpose for things like: ;; any text ;; ;; NOTE: These definitions aren't cheap in the time required to process the ;; file, and are just adaptations/tests with the syntax-highlight code, ;; probably it is better to avoid using it in other syntax definitions. ;; NOTE2: It cannot be defined as a single macro because it is required to ;; generate 2 entries in the main SGML syntax highlight definition, ;; or, should generate the entire definition from a macro; you will ;; need to type the tag name twice, but shouldn't be a problem if ;; you are using sgml :-) ;; XXX: Maybe the syntax-highlight code could save the starting match and ;; apply a regex generated at run-time to check for the ending tag, ;; but this probably would make the parser too slow, better to have ;; a specialized parser if that is required... ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro sgml-syntoken (name) `(syntoken (string-concat "<" ,name "\\>") :icase t :contained t :begin (intern (string-concat ,name "$") 'keyword)) ) (defmacro sgml-syntable (name property) `(let ( (label (intern (string-concat ,name "$") 'keyword)) (nested-label (intern (string (gensym)) 'keyword)) ) (syntable label *prop-preprocessor* nil ;; tag is still open, process any options (synaugment :generic-tag) (syntoken ">" :nospec t :property *prop-preprocessor* :begin nested-label) ;; Generate a nested table that includes everything, and only ;; returns when the closing tag is found. (syntable nested-label ,property nil (syntoken (string-concat "") :icase t :nospec t :property *prop-preprocessor* :switch -2) (synaugment :main) ) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Generate tokens for tags that don't require and ending tag. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro sgml-syntable-simple (name property) `(let ( (label (intern (string-concat ,name "$") 'keyword)) (nested-label (intern (string (gensym)) 'keyword)) ) (syntable label *prop-preprocessor* nil ;; tag is still open, process any options (synaugment :generic-tag) (syntoken ">" :nospec t :property *prop-preprocessor* :begin nested-label) ;; Generate a nested table that finishes whenever an unmatched ;; start or end tag is found. (syntable nested-label ,property nil (syntoken "" :icase t :nospec t :property *prop-preprocessor* :switch :main) (synaugment :main) ) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Define some macros to generate tokens for tags in the format: ;; " :property *prop-control* :switch :main) ) ) ;; The main SGML syntax table (defsyntax *sgml-mode* :main *prop-sgml-default* nil nil ;; Comments (syntoken "" :nospec t :switch -1) ) ;; Entities (syntoken "&[a-zA-Z0-9_.-]+;" :property *prop-constant*) ;; Probably an entity, missing ending `;' (syntoken "&[a-zA-Z0-9_.-]+" :property *prop-sgml-maybe-entity*) ;; Strings (syntable :string *prop-string* nil ;; Ignore escaped characters. (syntoken "\\\\.") ;; Rule to finish the string. (syntoken "\"" :nospec t :switch -1) ) ;; Links (syntable :link *prop-preprocessor* nil ;; No link string following "url=" (syntoken ">" :nospec t :property *prop-control* :switch -1) (syntoken "\"" :nospec t :contained t :begin :link-string) (syntable :link-string *prop-sgml-link* nil ;; Ignore escaped characters. (syntoken "\\\\.") ;; Rule to finish the link, note that returns two levels. (syntoken "\"" :nospec t :switch -2) ) ) ;; "Special" tag (syntoken "" :nospec t :switch -1) (syntable :brackets *prop-sgml-default* nil (syntoken "]" :nospec t :property *prop-preprocessor* :switch -1) ;; Allow nesting. (syntoken "[" :nospec t :property *prop-preprocessor* :begin :brackets) ;; Entities. (syntoken "%[a-zA-Z0-9_.-]+;?" :property *prop-annotation*) ;; Allow everything inside the brackets (synaugment :main) ) ;; Don't use generic tag tokens, only create a rule for strings (syntoken "\"" :nospec t :begin :string :contained t) ;; Allow everything inside the "special" tag (synaugment :main) ) ;; Some "short" tags (sgml-syntoken-short "tt") (sgml-syntable-short "tt" *prop-sgml-tt*) (sgml-syntoken-short "it") (sgml-syntable-short "it" *prop-sgml-it*) (sgml-syntoken-short "bf") (sgml-syntable-short "bf" *prop-sgml-bf*) (sgml-syntoken-short "em") (sgml-syntable-short "em" *prop-sgml-bf*) ;; Short tag (syntoken "<\\w+/" :property *prop-preprocessor* :begin :short-tag) (syntable :short-tag *prop-sgml-default-short* nil (syntoken "/" :nospec t :property *prop-preprocessor* :switch -1) (syntoken "" :property *prop-control* :switch -1) ) ;; Don't allow spaces, this may and may not be the start of a tag, ;; but the syntax-highlight definition is not specialized... (syntoken "<([^/a-zA-Z]|$)" :property *prop-control*) ;; Some tags that require an end tag (sgml-syntoken "tt") (sgml-syntable "tt" *prop-sgml-tt*) (sgml-syntoken "code") (sgml-syntable "code" *prop-sgml-tt*) (sgml-syntoken "tag") (sgml-syntable "tag" *prop-sgml-tt*) (sgml-syntoken "verb") (sgml-syntable "verb" *prop-sgml-tt*) (sgml-syntoken "programlisting") (sgml-syntable "programlisting" *prop-sgml-tt*) (sgml-syntoken "it") (sgml-syntable "it" *prop-sgml-it*) (sgml-syntoken "bf") (sgml-syntable "bf" *prop-sgml-bf*) (sgml-syntoken "em") (sgml-syntable "em" *prop-sgml-bf*) (sgml-syntoken "mail") (sgml-syntable "mail" *prop-sgml-email*) (sgml-syntoken "email") (sgml-syntable "email" *prop-sgml-email*) (sgml-syntoken "screen") (sgml-syntable "screen" *prop-sgml-screen*) (sgml-syntoken "tscreen") (sgml-syntable "tscreen" *prop-sgml-screen*) ;; Helper for tags that don't need an ending one. ;; NOTE: Since the parser is not specialized, if the tag is ;; folowed by one that has a special property defined here, ;; it may not be detected, i.e. put a

    after the ;; and it will work. (syntable :simple-nested-tag *prop-preprocessor* nil ;; tag is still open, process any options (synaugment :generic-tag) (syntoken ">" :nospec t :property *prop-preprocessor* :switch -3) ) (sgml-syntoken "sect") (sgml-syntable-simple "sect" *prop-sgml-sect*) (sgml-syntoken "sect1") (sgml-syntable-simple "sect1" *prop-sgml-sect*) (sgml-syntoken "sect2") (sgml-syntable-simple "sect2" *prop-sgml-sect*) ;; Generic tags (syntoken "<" :nospec t :contained t :begin :tag) ;; Table :generic-tag is defined to be augmented, no rule to finish it. (syntable :generic-tag *prop-preprocessor* nil ;; Start string (syntoken "\"" :nospec t :begin :string :contained t) ;; Start url link (syntoken "url=" :nospec t :begin :link) ;; Cannot nest (syntoken "<" :nospec t :property *prop-control*) ) (syntable :tag *prop-preprocessor* nil ;; Finish the tag (syntoken ">" :nospec t :switch -1) ;; Import generic definitions (synaugment :generic-tag) ) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/progmodes/patch.lsp0000664000000000000000000000424412472175711021556 0ustar ;; ;; Copyright (c) 2003 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86$ ;; (require "syntax") (require "indent") (in-package "XEDIT") (defsyntax *patch-mode* :main nil #'default-indent nil ;; "normal" diff (syntoken "^(\\d+d\\d+|\\d+a\\d+,\\d+)$" :property *prop-keyword*) (syntoken "^<.*" :property *prop-constant*) (syntoken "^>.*" :property *prop-preprocessor*) ;; context diff (syntoken "^\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*" :property *prop-string*) (syntoken "^\\*\\*\\* \\d+,\\d+ \\*\\*\\*\\*" :property *prop-comment*) (syntoken "^--- \\d+,\\d+ ----" :property *prop-comment*) ;; headers (syntoken "^(---|\\+\\+\\+|\\*\\*\\*).*" :property *prop-keyword*) (syntoken "^@@ .*" :property *prop-comment*) (syntoken "^-.*" :property *prop-constant*) (syntoken "^\\+.*" :property *prop-preprocessor*) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/xedit.lsp0000664000000000000000000004374112472175711017602 0ustar ;; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XdotOrg: xc/programs/xedit/lisp/modules/xedit.lsp,v 1.2 2004/04/23 19:54:45 eich Exp $ ;; $XFree86: xc/programs/xedit/lisp/modules/xedit.lsp,v 1.9 2003/01/16 03:50:46 paulo Exp $ ;; (provide "xedit") #+debug (make-package "XEDIT" :use '("LISP" "EXT")) (in-package "XEDIT") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; TODO The user should be able to define *auto-modes* prior to the ;; initialization here in a configuration file, since defvar only binds ;; the variable if it is unbound or doesn't have a value defined. ;; *auto-modes* is a list of conses where every car is compiled ;; to a regexp to match the name of the file being loaded. The caddr is ;; either a string, a pathname, or a syntax-p. ;; When loading a file, if the regexp in the car matches, it will check ;; the caddr value, and if it is a: ;; string: executes (load "progmodes/.lsp") ;; pathname: executes (load ) ;; syntax-p: does nothing, already loaded ;; ;; If it fails to load the file, or the returned value is not a ;; syntax-p, the entry is removed. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defvar *auto-modes* '( ("\\.(c|cc|C|cxx|cpp|h|hpp|bm|xbm|xpm|y|h\\.in)$" "C/C++" "c" . *c-mode*) ("\\.(l|li?sp|scm)$" "Lisp/Scheme" "lisp" . *lisp-mode*) ("\\.sh$" "Unix shell" "sh" . *sh-mode*) ("\\.(diff|patch)" "Patch file" "patch" . *patch-mode*) ("/[Mm]akefile.*|\\.mk$" "Makefile" "make" . *make-mode*) ("\\.(ac|in|m4)$" "Autotools" "auto" . *auto-mode*) ("\\.spec$" "RPM spec" "rpm" . *rpm-mode*) ("\\.(pl|pm|ph)$" "Perl" "perl" . *perl-mode*) ("\\.(py)$" "Python" "python". *python-mode*) ("\\.(sgml?|dtd)$" "SGML" "sgml" . *sgml-mode*) ("\\.html?$" "HTML" "html" . *html-mode*) ("\\.(man|\\d)$" "Man page" "man" . *man-mode*) ("app-defaults/\\w+|\\u[A-Za-z0-9_-]+\\.ad" "X resource" "xrdb" . *xrdb-mode*) ("\\<(XF86Config|xorg.conf)[^/]*" "XF86Config" "xconf" . *xconf-mode*) ("\\<(XFree86|Xorg)\\.\\d+\\.log(\\..*|$)" "XFree86 log" "xlog" . *xlog-mode*) ("Imakefile|(\\.(cf|rules|tmpl|def)$)" "X imake" "imake" . *imake-mode*) )) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Compile the regexps in the *auto-modes* list. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (dolist (mode *auto-modes*) (rplaca mode (re-comp (car mode) :nosub t)) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Find the progmode associated with the given filename. ;; Returns nil if nothing matches. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun auto-mode (filename &optional symbol &aux syntax) (if (and symbol (symbolp symbol)) (if (boundp symbol) (return-from auto-mode (symbol-value symbol)) (setq syntax (cddr (find symbol *auto-modes* :key #'cdddr))) ) ;; symbol optional argument is not a symbol (do* ( (mode *auto-modes* (cdr mode)) (regex (caar mode) (caar mode)) ) ((endp mode)) ;; only wants to know if the regex match. (when (listp (re-exec regex filename :count 0)) (setq syntax (cddar mode) symbol (cdr syntax)) (return) ) ) ) ;; if file was already loaded (if (and symbol (boundp symbol)) (return-from auto-mode (symbol-value symbol)) ) (when (consp syntax) ;; point to the syntax file specification (setq syntax (car syntax)) ;; try to load the syntax definition file (if (stringp syntax) (load (string-concat (namestring *default-pathname-defaults*) "progmodes/" syntax ".lsp" ) ) (load syntax) ) (and symbol (boundp symbol) (symbol-value symbol)) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Data types. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; The main syntax structure, normally, only one should exist per ;; syntax highlight module. ;; The structure is defined here so it is not required to load all ;; the extra data associated with syntax-highlight at initialization ;; time, and will never be loaded if no syntax-highlight mode is ;; defined to the files being edited. (defstruct syntax name ;; A unique string to identify the syntax mode. ;; Should be the name of the language/file type. options ;; A hash table of options specified for the ;; language. ;; Field(s) defined at "compile time" labels ;; Not exactly a list of labels, but all syntax ;; tables for the module. quark ;; A XrmQuark associated with the XawTextPropertyList ;; used by this syntax mode. token-count ;; Number of distinct syntoken structures in ;; the syntax table. ) ;; Xlfd description, used when combining properties. ;; Field names are self descriptive. ;; XXX Fields should be initialized as strings, but fields ;; that have an integer value should be allowed to ;; be initialized as such. ;; Combining properties in supported in Xaw, but not yet in the ;; syntax highlight code interface. Combining properties allow easier ;; implementation for markup languages, for example: ;; bolditalic ;; would render "bold" using a bold version of the default font, ;; and "italic" using a bold and italic version of the default font (defstruct xlfd foundry family weight slant setwidth addstyle pixel-size point-size res-x res-y spacing avgwidth registry encoding ) ;; At some time this structure should also hold information for at least: ;; o fontset ;; o foreground pixmap ;; o background pixmap ;; XXX This is also a TODO in Xaw. (defstruct synprop quark ;; XrmQuark identifier of the XawTextProperty ;; structure. This field is filled when "compiling" ;; the syntax-table. name ;; String name of property, must be unique per ;; property list. font ;; Optional font string name of property. foreground ;; Optional string representation of foreground color. background ;; Optional string representation of background color. xlfd ;; Optional xlfd structure, when combining properties. ;; Currently combining properties logic not implemented, ;; but fonts may be specified using the xlfd definition. ;; Boolean properties. underline ;; Draw a line below the text. overstrike ;; Draw a line over the text. ;; XXX Are these working in Xaw? subscript ;; Align text to the bottom of the line. superscript ;; Align text to the top of the line. ;; Note: subscript and superscript only have effect when the text ;; line has different height fonts displayed. ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Utility macro, to create a "special" variable holding ;; a synprop structure. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro defsynprop (variable name &key font foreground background xlfd underline overstrike subscript superscript) `(progn (proclaim '(special ,variable)) (setq ,variable (make-synprop :name ,name :font ,font :foreground ,foreground :background ,background :xlfd ,xlfd :underline ,underline :overstrike ,overstrike :subscript ,subscript :superscript ,superscript ) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Convert a synprop structure to a string in the format ;; expected by Xaw. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun synprop-to-string (synprop &aux values booleans xlfd) (if (setq xlfd (synprop-xlfd synprop)) (dolist (element `( ("foundry" ,(xlfd-foundry xlfd)) ("family" ,(xlfd-family xlfd)) ("weight" ,(xlfd-weight xlfd)) ("slant" ,(xlfd-slant xlfd)) ("setwidth" ,(xlfd-setwidth xlfd)) ("addstyle" ,(xlfd-addstyle xlfd)) ("pixelsize" ,(xlfd-pixel-size xlfd)) ("pointsize" ,(xlfd-point-size xlfd)) ("resx" ,(xlfd-res-x xlfd)) ("resy" ,(xlfd-res-y xlfd)) ("spacing" ,(xlfd-spacing xlfd)) ("avgwidth" ,(xlfd-avgwidth xlfd)) ("registry" ,(xlfd-registry xlfd)) ("encoding" ,(xlfd-encoding xlfd)) ) ) (if (cadr element) (setq values (append values element)) ) ) ) (dolist (element `( ("font" ,(synprop-font synprop)) ("foreground" ,(synprop-foreground synprop)) ("background" ,(synprop-background synprop)) ) ) (if (cadr element) (setq values (append values element)) ) ) ;; Boolean attributes. These can be specified in the format ;; =, but do a nicer output as the format ;; is accepted. (dolist (element `( ("underline" ,(synprop-underline synprop)) ("overstrike" ,(synprop-overstrike synprop)) ("subscript" ,(synprop-subscript synprop)) ("superscript" ,(synprop-superscript synprop)) ) ) (if (cadr element) (setq booleans (append booleans element)) ) ) ;; Play with format conditionals, list iteration, and goto, to ;; make resulting string. (format nil "~A~:[~;?~]~:[~3*~;~A=~A~{&~A=~A~}~]~:[~;&~]~:[~2*~;~A~{&~A~*~}~]" (synprop-name synprop) ;; ~A (or values booleans) ;; ~:[~;?~] values ;; ~:[ (car values) (cadr values) (cddr values) ;; ~A=~A~{&~A=~A~} (and values booleans) ;; ~:[~;&~] booleans ;; ~:[ (car booleans) (cddr booleans) ;; ~A~{&~A~*~} ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Use xedit protocol to create a XawTextPropertyList with the ;; given arguments. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun compile-syntax-property-list (name properties &aux string-properties quark) ;; Create a string representation of the properties. (dolist (property properties) (setq string-properties (append string-properties (list (synprop-to-string property)) ) ) ) (setq string-properties (case (length string-properties) (0 "") (1 (car string-properties)) (t (format nil "~A~{,~A~}" (car string-properties) (cdr string-properties) ) ) ) ) #+debug (format *output* "~Cconvert-property-list ~S ~S~%" *escape* name string-properties ) (setq quark #-debug (convert-property-list name string-properties) #+debug 0) ;; Store the quark for properties not yet "initialized". ;; XXX This is just a call to Xrm{Perm,}StringToQuark, and should ;; be made available if there were a wrapper/interface to ;; that Xlib function. (dolist (property properties) (unless (integerp (synprop-quark property)) #+debug (format *output* "~Cxrm-string-to-quark ~S~%" *escape* (synprop-name property) ) (setf (synprop-quark property) #-debug (xrm-string-to-quark (synprop-name property)) #+debug 0 ) ) ) quark ) #+debug (progn (defconstant *escape* #\$) (defconstant *output* *standard-output*) ;; Recognized identifiers for wrap mode. (defconstant *wrap-modes* '(:never :line :word)) ;; Recognized identifiers for justification. (defconstant *justifications* '(:left :right :center :full)) ;; XawTextScanType (defconstant *scan-type* '(:positions :white-space :eol :paragraph :all :alpha-numeric)) ;; XawTextScanDirection (defconstant *scan-direction* '(:left :right)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Debugging version of xedit functions. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun clear-entities (left right) (format *output* "~Cclear-entities ~D ~D~%" *escape* left right)) (defun add-entity (offset length identifier) (format *output* "~Cadd-entity ~D ~D ~D~%" *escape* offset length identifier)) (defun background (&optional (value nil specified)) (if specified (format *output* "~Cset-background ~S~%" *escape* value) (format *output* "~Cget-background~%" *escape*))) (defun foreground (&optional (value nil specified)) (if specified (format *output* "~Cset-foreground ~S~%" *escape* value) (format *output* "~Cget-foreground~%" *escape*))) (defun font (&optional (value nil specified)) (if specified (format *output* "~Cset-font ~S~%" *escape* value) (format *output* "~Cget-font~%" *escape*))) (defun point (&optional (value nil specified)) (if specified (format *output* "~Cset-point ~D~%" *escape* value) (format *output* "~Cget-point~%" *escape*))) (defun point-min () (format *output* "~Cpoint-min~%" *escape*)) (defun point-max () (format *output* "~Cpoint-max~%" *escape*)) (defun property-list (&optional (quark nil specified)) (format *output* "~property-list ~D~%" *escape* quark)) (defun insert (string) (format *output* "~Cinsert ~S~%" *escape* string)) (defun read-text (offset length) (format *output* "~Cread-text ~D ~D~%" *escape* offset length)) (defun replace-text (left right string) (format *output* "~Creplace-text ~D ~D ~S~%" *escape* left right string)) (defun scan (offset type direction &key (count 1) include) (unless (setq type (position type *scan-type*)) (error "SCAN: type must be one of ~A, not ~A" *scan-type* type)) (unless (setq direction (position direction *scan-direction*)) (error "SCAN: direction must be one of ~A, not ~A" *scan-direction* direction)) (format *output* "~Cscan ~D ~D ~D ~D ~D~%" *escape* offset type direction count (if include 1 0))) (defun search-forward (string &optional case-sensitive) (format *output* "~Csearch-forward ~S ~D~%" *escape* string (if case-sensitive 1 0))) (defun search-backward (string &optional case-sensitive) (format *output* "~Csearch-backward ~S ~D~%" *escape* string (if case-sensitive 1 0))) (defun wrap-mode (&optional (value nil specified)) (if specified (progn (unless (member value *wrap-modes*) (error "WRAP-MODE: argument must be one of ~A, not ~A" *wrap-modes* value)) (format *output* "~Cset-wrap-mode ~S~%" *escape* (string value))) (format *output* "~Cget-wrap-mode~%" *escape*))) (defun auto-fill (&optional (value nil specified)) (if specified (format *output* "~Cset-auto-fill ~S~%" *escape* (if value "true" "false")) (format *output* "~Cget-auto-fill~%" *escape*))) (defun justification (&optional (value nil specified)) (if specified (progn (unless (member value *justifications*) (error "JUSTIFICATION: argument must be one of ~A, not ~A" *justifications* value)) (format *output* "~Cset-justification ~S~%" *escape* (string value))) (format *output* "~Cget-justification~%" *escape*))) (defun left-column (&optional (value nil specified)) (if specified (format *output* "~Cset-left-column ~D~%" *escape* value) (format *output* "~Cget-left-column~%" *escape*))) (defun right-column (&optional (value nil specified)) (if specified (format *output* "~Cset-right-column ~D~%" *escape* value) (format *output* "~Cget-right-column~%" *escape*))) (defun vertical-scrollbar (&optional (value nil specified)) (if specified (format *output* "~Cset-vert-scrollbar ~S~%" *escape* (if value "always" "never")) (format *output* "~Cget-vert-scrollbar~%" *escape*))) (defun horizontal-scrollbar (&optional (value nil specified)) (if specified (format *output* "~Cset-horiz-scrollbar ~S~%" *escape* (if value "always" "never")) (format *output* "~Cget-horiz-scrollbar~%" *escape*))) #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| (defun create-buffer (name) (format *output* "~Ccreate-buffer ~S~%" *escape* name)) (defun remove-buffer (name) (format *output* "~Cremove-buffer ~S~%" *escape* name)) (defun buffer-name (&optional (value nil specified)) (if specified (format *output* "~Cset-buffer-name ~S~%" *escape* value) (format *output* "~Cget-buffer-name~%" *escape*))) (defun buffer-filename (&optional (value nil specified)) (if specified (format *output* "~Cset-buffer-filename ~S~%" *escape* (namestring value)) (format *output* "~Cget-buffer-filename~%" *escape*))) (defun current-buffer (&optional (value nil specified)) (if specified (format *output* "~Cset-current-buffer ~S~%" *escape* value) (format *output* "~Cget-current-buffer~%" *escape*))) (defun other-buffer (&optional (value nil specified)) (if specified (format *output* "~Cset-other-buffer ~S~%" *escape* value) (format *output* "~Cget-other-buffer~%" *escape*))) |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||# ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/syntax.lsp0000664000000000000000000011277712472175711020021 0ustar ;; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/modules/syntax.lsp,v 1.11 2003/01/16 03:50:46 paulo Exp $ ;; (provide "syntax") (require "xedit") (in-package "XEDIT") (defvar *syntax-symbols* '( syntax-highlight defsyntax defsynprop synprop-p syntax-p syntable syntoken synaugment *prop-default* *prop-keyword* *prop-number* *prop-string* *prop-constant* *prop-comment* *prop-preprocessor* *prop-punctuation* *prop-error* *prop-annotation* )) (export *syntax-symbols*) (in-package "USER") (dolist (symbol xedit::*syntax-symbols*) (import symbol) ) (in-package "XEDIT") (makunbound '*syntax-symbols*) #| TODO: o Add a command to match without increment the offset in the input, this may be useful for example in a case like: some-table match "<" switch -1 match "<" <- the table already eated this, so it won't be matched. This must be carefully checked at compile time, such instruction should be in a token that returns or starts a new one, and even then, may need runtime check to make sure it won't enter an infinite loop. o Allow combining properties, this is supported in Xaw, and could allow some very interesting effects for complex documents. o Maybe have an separated function/loop for tables that don't have tokens that start/switch to another table, and/or have the contained attribute set. This could allow running considerably faster. o Do a better handling of interactive edition for tokens that start and end with the same pattern, as an example strings, if the user types '"', it will parse up to the end of the file, "inverting" all strings. o Allow generic code to be run once a match is found, such code could handle some defined variables and take decisions based on the parser state. This should be detected at compile time, to maybe run a different parser for such syntax tables, due to the extra time building the environment to call the code. This would be useful to "really" parse documents with complex syntax, for example, a man page source file. o Add command to change current default property without initializing a new state. o Fix problems matching EOL. Since EOL is an empty string match, if there is a rule to match only EOL, but some other rule matches up to the end of the input, the match to EOL will not be recognized. Currently the only way to handle this is to have a nested table that always returns once a match is found, so that it will restart the match loop code even if the input is at EOL. One possible solution would be to add the ending newline to the input, and then instead of matching "$", should match "\\n". o XXX Usage of the variable newline-property must be reviewed in function syntax-highlight, if the text property has a background attribute, visual effect will look "strange", will paint a square with the background attribute at the end of every line in the matched text. |# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Some annotations to later write documentation for the module... ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #| The current interface logic should be easy to understand for people that have written lex scanners before. It has some extended semantics, that could be translated to stacked BEGIN() statements in lex, but currently does not have rules for matches in the format RE/TRAILING, as well as code attached to rules (the biggest difference) and/or things like REJECT and unput(). Also, at least currently, it is *really* quite slower than lex. MATCHING RULES -------------- When two tokens are matched at the same input offset, the longest token is used, if the length is the same, the first definition is used. For example: token1 => int token2 => [A-Za-z]+ input => integer Token1 matches "int" and token2 matches "integer", but since token2 is longer, it is used. But in the case: token1 => int token2 => [A-Za-z]+ input => int Both, token1 and token2 match "int", since token1 is defined first, it is used. |# ;; Initialize some default properties that may be shared in syntax ;; highlight definitions. Use of these default properties is encouraged, ;; so that "tokens" will be shown identically when editing program ;; sources in different programming languages. (defsynprop *prop-default* "default" :font "*courier-medium-r*-12-*" :foreground "black") (defsynprop *prop-keyword* "keyword" :font "*courier-bold-r*-12-*" :foreground "gray12") (defsynprop *prop-number* "number" :font "*courier-bold-r*-12-*" :foreground "OrangeRed3") (defsynprop *prop-string* "string" :font "*lucidatypewriter-medium-r*-12-*" :foreground "RoyalBlue2") (defsynprop *prop-constant* "constant" :font "*lucidatypewriter-medium-r*-12-*" :foreground "VioletRed3") (defsynprop *prop-comment* "comment" :font "*courier-medium-o*-12-*" :foreground "SlateBlue3") (defsynprop *prop-preprocessor* "preprocessor" :font "*courier-medium-r*-12-*" :foreground "green4") (defsynprop *prop-punctuation* "punctuation" :font "*courier-bold-r*-12-*" :foreground "gray12") ;; Control characters, not always errors... (defsynprop *prop-control* "control" :font "*courier-bold-r*-12-*" :foreground "yellow2" :background "red3") (defsynprop *prop-error* "error" :font "*new century schoolbook-bold*-24-*" :foreground "yellow" :background "red") (defsynprop *prop-annotation* "annotation" :font "*courier-medium-r*-12-*" :foreground "black" :background "PaleGreen") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; The "main" definition of the syntax highlight coding interface. ;; Creates a "special" variable with the given name, associating to ;; it an already compiled syntax table. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro defsyntax (variable label property indent options &rest lists) `(if (boundp ',variable) ,variable (progn (proclaim '(special ,variable)) (setq ,variable (compile-syntax-table (string ',variable) ,options (syntable ,label ,property ,indent ,@lists) ) ) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Just a wrapper to create a hash-table and bound it to a symbol. ;; Example of call: ;; (defsynoptions *my-syntax-options* ;; (:indent . 8) ;; (:indent-option-1 . 1) ;; (:indent-option-2 . 2) ;; ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro defsynoptions (variable &rest options) `(if (boundp ',variable) ,variable (progn (proclaim '(special ,variable)) (setq ,variable (make-hash-table :initial-contents ',options)) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; These definitions should be "private". ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defstruct syntoken regex ;; A compiled regexp. property ;; NIL for default, or a synprop structure. contained ;; Only used when switch/begin is not NIL. Values: ;; NIL -> just switch to or begin new ;; syntax table. ;; (not NIL) -> apply syntoken property ;; (or default one) to matched ;; text *after* switching to or ;; beginning a new syntax table. switch ;; Values for switch are: ;; NIL -> do nothing ;; A keyword -> switch to the syntax table ;; identified by the keyword. ;; A negative integer -> Pop the stack ;; - times. ;; A common value is -1, ;; to switch to the previous ;; state, but some times ;; it is desired to return ;; two or more times in ;; in the stack. ;; NOTE: This is actually a jump, the stack is ;; popped until the named syntax table is found, ;; if the stack becomes empty, a new state is ;; implicitly created. begin ;; NIL or a keyword (like switch), but instead of ;; popping the stack, it pushes the current syntax ;; table to the stack and sets a new current one. ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Just a wrapper to make-syntoken. ;; TODO: Add support for structure constructors. ;; XXX: Note that the NOSUB only works with the xedit regex, it ;; will still return the match offsets, but will ignore subexpressions, ;; that is, parenthesis are used only for grouping. ;; TODO: Create a new version of the re-exec call that returns ;; offsets in the format ( . ) and not ;; (( . ) ... ( . )). Only the global result ;; is expected/used, so there is no reason to allocate more than one ;; cons cell per call. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun syntoken (pattern &key icase nospec property contained switch begin (nosub t) &aux (regex (re-comp pattern :icase icase :nospec nospec :nosub nosub) ) check) ;; Don't allow a regex that matches the null string enter the ;; syntax table list. (if (consp (setq check (re-exec regex "" :noteol t :notbol t))) #+xedit (error "SYNTOKEN: regex matches empty string ~S" regex) #-xedit () ) (make-syntoken :regex regex :property property :contained contained :switch switch :begin begin ) ) ;; This structure is defined only to do some type checking, it just ;; holds a list of keywords. (defstruct synaugment labels ;; List of keywords labeling syntax tables. ) (defstruct syntable label ;; A keyword naming this syntax table. property ;; NIL or a default synprop structure. indent ;; Indentation function for the syntax table. tokens ;; A list of syntoken structures. tables ;; A list of syntable structures. augments ;; A list of synaugment structures, used only ;; at "compile time", so that a table can be ;; used before it's definition. bol ;; One of the tokens match the empty string at ;; the start of a line (loop optimization hint). ;; Field filled at "link" time. eol ;; Same comments as bol, but in this case, for ;; the empty string at the end of a line. ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Just call make-syntable, but sorts the elements by type, allowing ;; a cleaner code when defining the syntax highlight rules. ;; XXX Same comments as for syntoken about the use of a constructor for ;; structures. TODO: when/if clos is implemented in the interpreter. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun syntable (label default-property indent &rest definitions) ;; Check for possible errors in the arguments. (unless (keywordp label) (error "SYNTABLE: ~A is not a keyword" label) ) (unless (or (null default-property) (synprop-p default-property) ) (error "SYNTABLE: ~A is an invalid text property" default-property ) ) ;; Don't allow unknown data in the definition list. ;; XXX typecase should be added to the interpreter, and since ;; the code is traversing the entire list, it could build ;; now the arguments to make-syntable. (dolist (item definitions) (unless (or ;; Allow NIL in the definition list, so that one ;; can put conditionals in the syntax definition, ;; and if the conditional is false, fill the slot ;; with a NIL value. (atom item) (syntoken-p item) (syntable-p item) (synaugment-p item) ) (error "SYNTABLE: invalid syntax table argument ~A" item) ) ) ;; Build the syntax table. (make-syntable :label label :property default-property :indent indent :tokens (remove-if-not #'syntoken-p definitions) :tables (remove-if-not #'syntable-p definitions) :augments (remove-if-not #'synaugment-p definitions) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Just to do a "preliminary" error checking, every element must be a ;; a keyword, and also check for reserved names. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun synaugment (&rest keywords) (dolist (keyword keywords) (unless (keywordp keyword) (error "SYNAUGMENT: bad syntax table label ~A" keyword) ) ) (make-synaugment :labels keywords) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Recursive compile utility function. ;; Returns a cons in the format: ;; car => List of all syntoken structures ;; (including child tables). ;; cdr => List of all child syntable structures. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun list-syntable-elements (table &aux result sub-result) (setq result (cons (syntable-tokens table) (syntable-tables table)) ) ;; For every child syntax table. (dolist (child (syntable-tables table)) ;; Recursively call list-syntable-elements. (setq sub-result (list-syntable-elements child)) (rplaca result (append (car result) (car sub-result))) (rplacd result (append (cdr result) (cdr sub-result))) ) ;; Return the pair of nested tokens and tables. result ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Append tokens of the augment list to the tokens of the specified ;; syntax table. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun compile-syntax-augment-list (table table-list &aux labels augment tokens) ;; Create a list of all augment tables. (dolist (augment (syntable-augments table)) (setq labels (append labels (synaugment-labels augment))) ) ;; Remove duplicates and references to "itself", ;; without warnings? (setq labels (remove (syntable-label table) (remove-duplicates labels :from-end t) ) ) ;; Check if the specified syntax tables exists! (dolist (label labels) (unless (setq augment (car (member label table-list :key #'syntable-label)) ) (error "COMPILE-SYNTAX-AUGMENT-LIST: Cannot augment ~A in ~A" label (syntable-label table) ) ) ;; Increase list of tokens. (setq tokens (append tokens (syntable-tokens augment))) ) ;; Store the tokens in the augment list. They will be added ;; to the syntax table in the second pass. (setf (syntable-augments table) tokens) ;; Recurse on every child table. (dolist (child (syntable-tables table)) (compile-syntax-augment-list child table-list) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Just add the augmented tokens to the token list, recursing on ;; every child syntax table. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun link-syntax-augment-table (table) (setf (syntable-tokens table) ;; When augmenting a table, duplicated tokens or different tokens ;; that use the same regex pattern should be common. (remove-duplicates (nconc (syntable-tokens table) (syntable-augments table)) :key #'syntoken-regex :test #'equal :from-end t ) ;; Don't need to keep this list anymore. (syntable-augments table) () ) ;; Check if one of the tokens match the empty string at the ;; start or end of a text line. XXX The fields bol and eol ;; are expected to be initialized to NIL. (dolist (token (syntable-tokens table)) (when (consp (re-exec (syntoken-regex token) "" :noteol t)) (setf (syntable-bol table) t) (return) ) ) (dolist (token (syntable-tokens table)) (when (consp (re-exec (syntoken-regex token) "" :notbol t)) (setf (syntable-eol table) t) (return) ) ) (dolist (child (syntable-tables table)) (link-syntax-augment-table child) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; "Compile" the main structure of the syntax highlight code. ;; Variables "switches" and "begins" are used only for error checking. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun compile-syntax-table (name options main-table &aux syntax elements switches begins tables properties) (unless (stringp name) (error "COMPILE-SYNTAX-TABLE: ~A is not a string" name) ) (setq elements (list-syntable-elements main-table) switches (remove-if #'null (car elements) :key #'syntoken-switch ) begins (remove-if-not #'keywordp (car elements) :key #'syntoken-begin ) ;; The "main-table" isn't in the list, because ;; list-syntable-elements includes only the child tables; ;; this is done to avoid the need of removing duplicates here. tables (cons main-table (cdr elements)) ) ;; Check for typos in the keywords, or for not defined syntax tables. (dolist (item (mapcar #'syntoken-switch switches)) (unless (or (and (integerp item) (minusp item) ) (member item tables :key #'syntable-label) ) (error "COMPILE-SYNTAX-TABLE: SWITCH ~A cannot be matched" item ) ) ) (dolist (item (mapcar #'syntoken-begin begins)) (unless (member item tables :key #'syntable-label) (error "COMPILE-SYNTAX-TABLE: BEGIN ~A cannot be matched" item ) ) ) ;; Create a list of all properties used by the syntax. (setq properties (delete-duplicates ;; Remove explicitly set to "default" properties. (remove nil (append ;; List all properties in the syntoken list. (mapcar #'syntoken-property (car elements) ) ;; List all properties in the syntable list. (mapcar #'syntable-property tables ) ) ) :test #'string= :key #'synprop-name ) ) ;; Provide a default property if none specified. (unless (member "default" properties :test #'string= :key #'synprop-name ) (setq properties (append (list *prop-default*) properties)) ) ;; Now that a list of all nested syntax tables is known, compile the ;; augment list. Note that even the main-table can be augmented to ;; include tokens of one of it's children. ;; Adding the tokens of the augment tables must be done in ;; two passes, or it may cause surprises due to "inherited" ;; tokens, as the augment table was processed first, and ;; increased it's token list. (compile-syntax-augment-list main-table tables) ;; Now just append the augmented tokens to the table's token list. (link-syntax-augment-table main-table) ;; Change all syntoken switch and begin fields to point to the ;; syntable. (dolist (item switches) (if (keywordp (syntoken-switch item)) ;; A switch may be relative, check if a keyword ;; was specified. (setf (syntoken-switch item) (car (member (syntoken-switch item) tables :key #'syntable-label ) ) ) ) ) (dolist (item begins) (setf (syntoken-begin item) (car (member (syntoken-begin item) tables :key #'syntable-label ) ) ) ) ;; Don't need to add a entity for default properties (dolist (item (car elements)) (and (syntoken-property item) (string= (synprop-name (syntoken-property item)) "default") (setf (syntoken-property item) ()) ) ) (dolist (item tables) (and (syntable-property item) (string= (synprop-name (syntable-property item)) "default") (setf (syntable-property item) ()) ) ) (setq syntax (make-syntax :name name :options options :labels tables :quark (compile-syntax-property-list name properties ) :token-count (length (car elements)) ) ) ;; Ready to run! ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Loop applying the specifed syntax table to the text. ;; XXX This function needs a review. Should compile the regex patterns ;; with newline sensitive match (and scan the entire file), and keep a ;; cache of matched tokens (that may be at a very longer offset), and, ;; when the match is removed from the cache, readd the token to the ;; token-list; if the token does not match, it will not be in the cache, ;; but should be removed from the token-list. If properly implemented, it ;; should be somewhat like 4 times faster, but I would not be surprised ;; if it becames even faster. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun syntax-highlight (*syntax* &optional (*from* (point-min)) (*to* (point-max)) interactive &aux #+debug (*line-number* 0) stream indent-table ) ;; Make sure the property list is in use. ;; The interactive flag is only set after loading the file. (or interactive (property-list (syntax-quark *syntax*)) ) #+debug (setq *from* 0 *to* 0) #-debug (and (>= *from* *to*) (return-from syntax-highlight (values *from* nil))) ;; Remove any existing properties from the text. (clear-entities *from* (1+ *to*)) (setq stream #-debug (make-string-input-stream (read-text *from* (- *to* *from*))) #+debug *standard-input* ) (prog* ( ;; Used to check if end of file found but syntax stack did ;; not finish. (point-max (point-max)) ;; Used in interactive mode, to return the syntax table ;; where the cursor is located. (point (point)) ;; The current stack of states. stack ;; The current syntable. (syntax-table (car (syntax-labels *syntax*))) ;; The current syntable's default property. (default-property (syntable-property syntax-table)) ;; Add this property to newlines as a hint to the interactive ;; callback, so that it knows from where to restart parsing. newline-property ;; The tokens in the current syntax table that may match, ;; i.e. the items in this list are not in nomatch. token-list ;; A pointer to the syntable token list, if token-list is ;; eq to this value, cannot change it inplace. current-token-list ;; Help to avoid allocating too many new object cells, and ;; optmizes a bit time in [n]?set-difference. ;; This optimizes only the processing of one line of text ;; as nomatch must be rebuilt when reading a new line of text. token-list-stack ;; Matches for the current list of tokens. matches ;; Line of text. line ;; Length of the text line. length ;; A inverse cache, don't call re-exec when the regex is ;; already known to not match. nomatch ;; Use cache as a list of matches to avoid repetitive ;; unnecessary calls to re-exec. ;; cache is a list in which every element has the format: ;; (token . (start . end)) ;; Line of text. cache ;; Used just to avoid a function call at every re-exec call. notbol match start left right result property ;; Beginig a new syntax table? begin ;; Switching to another syntax table? switch ;; Property flag when changing the current syntax table. contained ;; Flag to know if syntax table has changed. change ;; Variables used when removing invalid elements from the ;; the cache. item from to ) ;----------------------------------------------------------------------- :read #+debug-verbose (format t "** Entering :READ stack length is ~D~%" (length stack)) #+debug (format t "~%[~D]> " (incf *line-number*)) ;; If input has finished, return. (unless (setq line (read-line stream nil nil)) (when (and ;; If a nested syntax table wasn't finished (consp stack) (< (setq *to* (scan *from* :eol :right)) point-max ) ) (setq line (read-text *from* (- *to* *from*))) (clear-entities *from* (1+ *to*)) (go :again) ) #-debug (close stream) (return) ) ;------------------------------------------------------------------------ :again (setq start 0 length (length line) token-list (syntable-tokens syntax-table) current-token-list token-list token-list-stack () nomatch () cache () ) ;; If empty line, and current table does not have matches for ;; the empty string at start or end of a text line. (when (and (= length 0) (not (syntable-eol syntax-table)) (not (syntable-bol syntax-table))) #+debug-verbose (format t "Empty line and table has no match to bol or eol~%") (and newline-property (add-entity *from* 1 (synprop-quark newline-property))) (go :update) ) ;------------------------------------------------------------------------ :loop #+debug-verbose (format t "** Entering :LOOP at offset ~D in table ~A, cache has ~D items~%" start (syntable-label syntax-table) (length cache)) (setq notbol (> start 0)) ;; For every token that may match. (dolist (token (setq token-list (if (eq token-list current-token-list) (set-difference token-list nomatch :test #'eq) (nset-difference token-list nomatch :test #'eq) ) ) ) ;; Try to fetch match from cache. (if (setq match (member token cache :test #'eq :key #'car)) ;; Match is in the cache. (progn ;; Match must be moved to the beginning of the ;; matches list, as a match from another syntax ;; table may be also in the cache, but before ;; the match for the current token. #+debug-verbose (format t "cached: {~A:~S} ~A~%" (cdar match) (subseq line (cadar match) (cddar match)) (syntoken-regex token)) ;; Remove the match from the cache. (if (eq match cache) ;; This could be changed to only set "matches" ;; if it is not the first element of cache, ;; but is unsafe, because other tokens may ;; be added to "matches", and will end up ;; before when joining "matches" and "cache". (progn (setq cache (cdr cache)) (rplacd match matches) (setq matches match)) (progn (if (= (length match) 1) (progn (rplacd (last cache 2) nil) (rplacd match matches) (setq matches match)) (progn (setq matches (cons (car match) matches)) (rplaca match (cadr match)) (rplacd match (cddr match))) ) ) ) ;; Exit loop if the all the remaining ;; input was matched. (when (and (= start (cadar match)) (= length (cddar match)) ) #+debug-verbose (format t "Rest of line match~%") (return) ) ) ;; Not in the cache, call re-exec. (if (consp (setq match (re-exec (syntoken-regex token) line :start start :notbol notbol))) ;; Match found. (progn #+debug-verbose (format t "Adding to cache: {~A:~S} ~A~%" (car match) (subseq line (caar match) (cdar match)) (syntoken-regex token)) ;; Only the first pair is used. (setq match (car match)) (cond ( (or (null matches) ;; No overlap and after most ;; recent match. (>= (car match) (cddar matches)) ;; No overlap and before most ;; recent match. (<= (cdr match) (cadar matches)) ) (setq matches (cons (cons token match) matches) ) ) ( (or ;; Overlap, but start before most ;; recent match. (< (car match) (cadar matches)) (and ;; Same offset as most recent ;; match, but is longer. (= (car match) (cadar matches)) (> (cdr match) (cddar matches)) ) ) (rplaca (car matches) token) (rplacd (car matches) match) #+debug-verbose (format t "Replaced most recent match~%") ) (t #+debug-verbose (format t "Ignored~%") ;; XXX The interpreter does not yet implement ;; implicit tagbody in dolist, just comment ;; the go call in that case. (Will just do ;; an unecessary test...) (go :ignored) ) ) ;; Exit loop if the all the remaining ;; input was matched. (when (and (= start (car match)) (= length (cdr match))) #+debug-verbose (format t "Rest of line match~%") (return)) ) ;; Match not found. (progn #+debug-verbose (format t "Adding to nomatch: ~A~%" (syntoken-regex token)) (setq nomatch (cons token nomatch))) ) ) :ignored ) ;; Add matches to the beginning of the cache list. (setq ;; Put matches with smaller offset first. cache (stable-sort (nconc (nreverse matches) cache) #'< :key #'cadr) ;; Make sure that when the match loop is reentered, this ;; variable is NIL. matches () ) ;; While the first entry in the cache is not from the current table. (until (or (null cache) (member (caar cache) token-list :test #'eq)) #+debug-verbose (format t "Not in the current table, removing {~A:~S} ~A~%" (cdar cache) (subseq line (cadar cache) (cddar cache)) (syntoken-regex (caar cache))) (setq cache (cdr cache)) ) ;; If nothing was matched in the entire/remaining line. (unless cache (when default-property (if (or (null result) (> start (cadar result)) (not (eq (cddar result) default-property))) (setq result (cons (cons start (cons length default-property)) result ) ) (rplaca (cdar result) length) ) ) #+debug-verbose (format t "No match until end of line~%") ;; Result already known, and there is no syntax table ;; change, bypass :PARSE. (and interactive (null indent-table) (<= 0 (- point *from*) length) (setq indent-table syntax-table)) (go :process) ) #+debug-verbose (format t "Removing first candidate from cache {~A:~S} ~A~%" (cdar cache) (subseq line (cadar cache) (cddar cache)) (syntoken-regex (caar cache)) ) ;; Prepare to choose best match. (setq match (car cache) left (cadr match) right (cddr match) cache (cdr cache) ) ;; First element can be safely removed now. ;; If there is only one, skip loop below. (or cache (go :parse)) ;; Remove elements of cache that must be discarded. (setq item (car cache) from (cadr item) to (cddr item) ) (loop (if (or ;; If everything removed from the cache. (null item) ;; Or next item is at a longer offset than the ;; end of current match. (>= from right) ) (return) ) (and ;; If another match at the same offset. (= left from) ;; And if this match is longer than the current one. (> to right) (member (car item) token-list :test #'eq) (setq match item right to ) ) #+debug-verbose (format t "Removing from cache {~A:~S} ~A~%" (cdar cache) (subseq line from to) (syntoken-regex (caar cache))) (setq cache (cdr cache) item (car cache) from (cadr item) to (cddr item) ) ) ;----------------------------------------------------------------------- :parse #+debug-verbose (format t "** Entering :PARSE~%") (setq ;; Change match value to the syntoken. match (car match) begin (syntoken-begin match) switch (syntoken-switch match) contained (syntoken-contained match) change (or begin switch) ) ;; Check for unmatched leading text. (when (and default-property (> left start)) #+debug-verbose (format t "No match in {(~D . ~D):~S}~%" start left (subseq line start left) ) (if (or (null result) (> start (cadar result)) (not (eq (cddar result) default-property))) (setq result (cons (cons start (cons left default-property)) result ) ) (rplaca (cdar result) left) ) ) ;; If the syntax table is not changed, ;; or if the new table requires that the ;; current default property be used. (unless (and change contained) (and (> right left) (setq property (or ;; If token specifies the property. (syntoken-property match) default-property ) ) ;; Add matched text. (if (or (null result) (> left (cadar result)) (not (eq (cddar result) property)) ) (setq result (cons (cons left (cons right property)) result ) ) (rplaca (cdar result) right) ) ) #+debug-verbose (format t "(0)Match found for {(~D . ~D):~S}~%" left right (subseq line left right) ) ) ;; Update start offset in the input now! (and interactive (null indent-table) (<= start (- point *from*) right) (setq indent-table syntax-table)) (setq start right) ;; When changing the current syntax table. (when change (when switch (if (numberp switch) ;; If returning to a previous state. ;; Don't generate an error if the stack ;; becomes empty? (while (< switch 0) (setq syntax-table (pop stack) token-list (pop token-list-stack) switch (1+ switch) ) ) ;; Else, not to a previous state, but ;; returning to a named syntax table, ;; search for it in the stack. (while (and (setq token-list (pop token-list-stack) syntax-table (pop stack) ) (not (eq switch syntax-table)) ) ;; Empty loop. ) ) ;; If no match found while popping ;; the stack. (unless syntax-table ;; Return to the topmost syntax table. (setq syntax-table (car (syntax-labels *syntax*)) ) ) #+debug-verbose (format t "switching to ~A offset: ~D~%" (syntable-label syntax-table) start ) (if (null token-list) (setq token-list (syntable-tokens syntax-table)) ) ) (when begin ;; Save state for a possible ;; :SWITCH later. (setq stack (cons syntax-table stack) token-list-stack (cons token-list token-list-stack) token-list (syntable-tokens begin) syntax-table begin ) #+debug-verbose (format t "begining ~A offset: ~D~%" (syntable-label syntax-table) start ) ) ;; Change current syntax table. (setq default-property (syntable-property syntax-table) current-token-list (syntable-tokens syntax-table) ) ;; Set newline property, to help interactive callback ;; Only need to have a defined value, for now don't care ;; about wich value is being used, neither if there is ;; a value to be set. (if (null stack) (setq newline-property nil) (or newline-property (setq newline-property default-property) (setq newline-property (syntoken-property match)) ) ) ;; If processing of text was deferred. (when contained (and (> right left) (setq property (or (syntoken-property match) default-property ) ) ;; Add matched text with the updated property. (if (or (null result) (> left (cadar result)) (not (eq (cddar result) property)) ) (setq result (cons (cons left (cons right property)) result ) ) (rplaca (cdar result) right) ) ) #+debug-verbose (format t "(1)Match found for {(~D . ~D):~S}~%" left right (subseq line left right) ) ) (go :loop) ) ;----------------------------------------------------------------------- ;; Wait for the end of the line to process, so that ;; it is possible to join sequential matches with the ;; same text property. (and (or cache (< start length)) (go :loop)) :process #+debug-verbose (format t "** Entering :PROCESS~%") (if result (progn ;; If the last property was at the end of the line, ;; there are nested syntax tables, and there is a ;; default property, include the newline in the property, ;; as a hint to the interactive callback. (and newline-property (if (and (eq (cddar result) newline-property) (= length (cadar result)) ) (rplaca (cdar result) (1+ length)) (setq result (cons (cons length (cons (1+ length) newline-property)) result ) ) ) ) ;; Result was created in reversed order. (nreverse result) (dolist (item result) (setq left (car item) right (cadr item) property (cddr item)) ;; Use the information. (add-entity (+ *from* left) (- right left) (synprop-quark property)) ) ) (and newline-property (add-entity (+ *from* length) 1 (synprop-quark newline-property)) ) ) ;------------------------------------------------------------------------ :update ;; Prepare for new matches. (setq result nil ;; Update offset to read text. ;; Add 1 for the skipped newline. *from* (+ *from* length 1) ) (go :read) ) #+debug (terpri) (values *to* indent-table) ) (compile 'syntax-highlight) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/indent.lsp0000664000000000000000000010621212472175711017737 0ustar ; ;; Copyright (c) 2002 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/modules/indent.lsp,v 1.6 2003/01/16 03:50:46 paulo Exp $ ;; (provide "indent") (require "xedit") (in-package "XEDIT") (defconstant indent-spaces '(#\Tab #\Space)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; The final indentation function. ;; Parameters: ;; indent ;; Number of spaces to insert ;; offset ;; Offset to where indentation should be added ;; no-tabs ;; If set, tabs aren't inserted ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun indent-text (indent offset &optional no-tabs &aux start line length index current tabs spaces string barrier base result (point (point)) ) ;; Initialize (setq start (scan offset :eol :left) line (read-text start (- offset start)) length (length line) index (1- length) current 0 base 0 ) (and (minusp indent) (setq indent 0)) ;; Skip any spaces after offset, "paranoia check" (while (member (char-after offset) indent-spaces) (incf offset) ) ;; Check if there are only spaces before `offset' and the line `start' (while (and (>= index 0) (member (char line index) indent-spaces)) (decf index) ) ;; `index' will be zero if there are only spaces in the `line' (setq barrier (+ start (incf index))) ;; Calculate `base' unmodifiable indentation, if any (dotimes (i index) (if (char= (char line i) #\Tab) (incf base (- 8 (rem base 8))) (incf base) ) ) ;; If any non blank character would need to be deleted (and (> base indent) (return-from indent-text nil)) ;; Calculate `current' indentation (setq current base) (while (< index length) (if (char= (char line index) #\Tab) (incf current (- 8 (rem current 8))) (incf current) ) (incf index) ) ;; Maybe could also "optimize" the indentation even if it is already ;; correct, removing spaces "inside" tabs. (when (/= indent current) (if no-tabs (setq length (- indent base) result (+ barrier length) string (make-string length :initial-element #\Space) ) (progn (multiple-value-setq (tabs spaces) (floor (- indent base) 8)) (setq length (+ tabs spaces) result (+ barrier length) string (make-string length :initial-element #\Tab) ) (fill string #\Space :start tabs) ) ) (replace-text barrier offset string) (and (>= offset point) (>= point barrier) (goto-char result)) ) ) (compile 'indent-text) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Helper function, returns indentation of a given offset ;; If `align' is set, stop once a non blank character is seen, that ;; is, use `offset' only as a line identifier ;; If `resolve' is set, it means that the offset is just a hint, it ;; maybe anywhere in the line ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun offset-indentation (offset &key resolve align &aux char line (start (scan offset :eol :left)) (indent 0)) (if resolve (loop (if (characterp (setq char (char-after start))) (if (char= char #\Tab) (incf indent (- 8 (rem indent 8))) ;; Not a tab, check if is a space (if (char= char #\Space) (incf indent) ;; Not a tab neither a space (return indent) ) ) ;; EOF found (return indent) ) ;; Increment offset to check next character (incf start) ) (progn (setq line (read-text start (- offset start))) (dotimes (i (length line) indent) (if (char= (setq char (char line i)) #\Tab) (incf indent (- 8 (rem indent 8))) (progn (or align (member char indent-spaces) (return indent) ) (incf indent) ) ) ) ) ) ) (compile 'offset-indentation) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; A default/fallback indentation function, just copy indentation ;; of previous line. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun default-indent (syntax syntable) (let ( (offset (scan (point) :eol :left)) start left right ) syntable ;; XXX hack to not generate warning about unused ;; variable, should be temporary (until unused ;; variables can be declared as such) (if (or ;; if indentation is disabled (and (hash-table-p (syntax-options syntax)) (gethash :disable-indent (syntax-options syntax)) ) ;; or if not at the start of a new line (> (scan offset :eol :right) offset) ) (return-from default-indent) ) (setq left offset) (loop (setq start left left (scan start :eol :left :count 2) right (scan left :eol :right) ) ;; if start of file reached (and (>= left start) (return)) (when (setq start (position-if-not #'(lambda (char) (member char indent-spaces)) (read-text left (- right left)) ) ) ;; indent the current line (indent-text (offset-indentation (+ left start) :align t) offset) (return) ) ) ) ) (compile 'default-indent) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Helper function ;; Clear line before cursor if it is empty ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun indent-clear-empty-line (&aux left offset right line index) (setq offset (scan (point) :eol :left) left (scan offset :eol :left :count 2) right (scan left :eol :right) ) ;; If not at the first line in the file and line is not already empty (when (and (/= offset left) (/= left right)) (setq line (read-text left (- right left)) index (1- (length line)) ) (while (and (>= index 0) (member (char line index) indent-spaces)) (decf index) ) ;; If line was only spaces (and (minusp index) (replace-text left right "")) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Macro to be called whenever an indentation rule decides that ;; the parser is done. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro indent-macro-terminate (&optional result) `(return-from ind-terminate-block ,result) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Like indent-terminate, but "rejects" the input for the current line ;; and terminates the loop. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro indent-macro-reject (&optional result) `(progn (setq ind-state ind-prev-state) (return-from ind-terminate-block ,result) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Like indent-reject, but "rejects" anything before the current token ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro indent-macro-reject-left (&optional result) `(progn (setq ind-state ind-matches) (return-from ind-terminate-block ,result) ) ) (defstruct indtoken regex ;; a string, character or regex token ;; the resulting token, nil or a keyword begin ;; begin a new table switch ;; switch to another table ;; begin and switch fields are used like the ones for the syntax highlight ;; syntoken structure. label ;; filed at compile time code ;; code to execute when it matches ) (defstruct indtable label ;; a keyword, name of the table tokens ;; list of indtoken structures tables ;; list of indtable structures augments ;; augment list ) (defstruct indaugment labels ;; list of keywords labeling tables ) (defstruct indinit variables ;; list of variables and optional initialization ;; Format of variables must be suitable to LET*, example of call: ;; (indinit ;; var1 ;; initialized to NIL ;; (var2 (afun)) ;; initialized to the value returned by AFUN ;; ) ) (defstruct indreduce token ;; reduced token rules ;; list of rules label ;; unique label associated with rule, this ;; field is automatically filled in the ;; compilation process. this field exists ;; to allow several indreduce definitions ;; that result in the same token check ;; FORM evaluated, if T apply reduce rule code ;; PROGN to be called when a rule matches ) ;; NOTE, unlike "reduce" rules, "resolve" rules cannot be duplicated (defstruct indresolve match ;; the matched token (or a list of tokens) code ;; PROGN to apply for this token ) (defstruct indent reduces ;; list of indreduce structures tables ;; list of indtable structures inits ;; initialization list resolves ;; list of indresolve structures token-code ;; code to execute when a token matches check-code ;; code to execute before applying a reduce rule reduce-code ;; code to execute after reduce rule resolve-code ;; code to execute when matching a token ) (defmacro defindent (variable label &rest lists) `(if (boundp ',variable) ,variable (progn (proclaim '(special ,variable)) (setq ,variable (compile-indent-table ,label ,@lists)) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Create an indent token. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro indtoken (pattern token &key icase nospec begin switch code (nosub t)) (setq pattern (re-comp (eval pattern) :icase icase :nospec nospec :nosub nosub)) (when (consp (re-exec pattern "" :notbol t :noteol t)) (error "INDTOKEN: regex ~A matches empty string" pattern) ) ;; result of macro, return token structure (make-indtoken :regex pattern :token token :begin begin :switch switch :code code ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Create an indentation table. Basically a list of indentation tokens. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun indtable (label &rest definitions) ;; check for simple errors (unless (keywordp label) (error "INDTABLE: ~A is not a keyword" label) ) (dolist (item definitions) (unless (or (atom item) (indtoken-p item) (indtable-p item) (indaugment-p item) ) (error "INDTABLE: invalid indent table argument ~A" item) ) ) ;; return indent table structure (make-indtable :label label :tokens (remove-if-not #'indtoken-p definitions) :tables (remove-if-not #'indtable-p definitions) :augments (remove-if-not #'indaugment-p definitions) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Add identifier to list of augment tables. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun indaugment (&rest keywords) (dolist (keyword keywords) (unless (keywordp keyword) (error "INDAUGMENT: bad indent table label ~A" keyword) ) ) ;; return augment list structure (make-indaugment :labels keywords) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Add variables to initialization list ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro indinit (&rest variables) (make-indinit :variables variables) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Create a "reduction rule" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro indreduce (token check rules &rest code &aux nullp consp) ;; check for simple errors (unless (or (keywordp token) (null token)) (error "INDREDUCE: ~A is not a keyword" token) ) (dolist (rule rules) (or (listp rule) (error "INDREDUCE: invalid indent rule ~A" rule)) ;; XXX This test is not enough, maybe should add some sort of ;; runtime check to avoid circularity. (and (eq token (car rule)) (null (cdr rule)) (error "INDREDUCE: ~A reduces to ~A" token) ) (dolist (item rule) (and (or nullp consp) (not (keywordp item)) (error "INDREDUCE: a keyword must special pattern") ) (if (consp item) (progn (unless (or (and (eq (car item) 'not) (keywordp (cadr item)) (null (cddr item)) ) (and (eq (car item) 'or) (null (member-if-not #'keywordp (cdr item))) ) ) (error "INDREDUCE: syntax error parsing ~A" item) ) (setq consp t) ) (progn (setq nullp (null item) consp nil) (unless (or (keywordp item) nullp (eq item t)) (error "INDREDUCE: ~A is not a keyword" item) ) ) ) ) ; (and consp ; (error "INDREDUCE: pattern must be followed by keyword") ; ) ) ;; result of macro, return indent reduce structure (make-indreduce :token token :check check :rules (remove-if #'null rules) :code code ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Create a "resolve rule" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro indresolve (match &rest code) ;; check for simple errors (if (consp match) (dolist (token match) (or (keywordp token) (error "INDRESOLVE: ~A is not a keyword" token)) ) (or (keywordp match) (error "INDRESOLVE: ~A is not a keyword" match)) ) ;; result of macro, return indent resolve structure (make-indresolve :match match :code code ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Helper function for compile-indent-table. Returns a list of all ;; tables and tokens for a given table, including tokens and tables ;; of children. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun list-indtable-elements (table &aux result sub-result) (setq result (cons (indtable-tokens table) (indtable-tables table))) (dolist (child (indtable-tables table)) (setq sub-result (list-indtable-elements child)) (rplaca result (append (car result) (car sub-result))) (rplacd result (append (cdr result) (cdr sub-result))) ) ;; Return pair of all nested tokens and tables result ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; First pass adding augumented tokens to a table, done in two passes ;; to respect inheritance order. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun compile-indent-augment-list (table table-list &aux labels augment tokens) ;; Create a list of all augment tables. (dolist (augment (indtable-augments table)) (setq labels (append labels (indaugment-labels augment))) ) ;; Remove duplicates and references to "itself", without warnings? (setq labels (remove (indtable-label table) (remove-duplicates labels :from-end t)) ) ;; Check if the specified indent tables exists! (dolist (label labels) (unless (setq augment (car (member label table-list :key #'indtable-label))) (error "COMPILE-INDENT-AUGMENT-LIST: Cannot augment ~A in ~A" label (indtable-label table) ) ) ;; Increase list of tokens. (setq tokens (append tokens (indtable-tokens augment))) ) ;; Store the tokens in the augment list. They will be added ;; to the indent table in the second pass. (setf (indtable-augments table) tokens) ;; Recurse on every child table. (dolist (child (indtable-tables table)) (compile-indent-augment-list child table-list) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Last pass adding augmented tokens to a table. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun link-indent-augment-list (table) (setf (indtable-tokens table) (remove-duplicates (nconc (indtable-tokens table) (indtable-augments table)) :key #'indtoken-regex :test #'equal :from-end t ) ;; Don't need to keep this list anymore. (indtable-augments table) () ) (dolist (child (indtable-tables table)) (link-indent-augment-list child) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Compile the indent reduction rules ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun compile-indent-reduces (reduces &aux need label check rules reduce check-code reduce-code) (dolist (item reduces) (setq label (indreduce-label item) check (indreduce-check item) rules (indreduce-rules item) reduce (indreduce-code item) need (and rules (not label) (or reduce (null check) (not (constantp check)) ) ) ) (when need (and (null label) (setq label (intern (string (gensym)) 'keyword))) (setf (indreduce-label item) label) (and (or (null check) (not (constantp check)) ) (setq check (list (list 'eq '*ind-label* label) check) check-code (nconc check-code (list check)) ) ) (and reduce (setq reduce (cons (list 'eq '*ind-label* label) reduce) reduce-code (nconc reduce-code (list reduce)) ) ) ) ) ;; XXX Instead of using COND, could/should use CASE ;; TODO Implement a smart CASE in the bytecode compiler, if ;; possible, should generate a hashtable, or a table ;; of indexes (for example when all elements in the cases ;; are characters) and then jump directly to the code. (if check-code (setq check-code (cons 'cond (nconc check-code '((t t))))) (setq check-code t) ) (and reduce-code (setq reduce-code (cons 'cond reduce-code))) (values check-code reduce-code) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Compile the indent resolve code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun compile-indent-resolves (resolves &aux match resolve resolve-code) (and (/= (length resolves) (length (remove-duplicates resolves :key #'indresolve-match)) ) ;; XXX Could do a more complete job and tell what is wrong... (error "COMPILE-INDENT-RESOLVES: duplicated labels") ) (dolist (item resolves) (when (setq resolve (indresolve-code item)) (setq match (indresolve-match item) resolve (cons (if (listp match) (list 'member '*ind-token* `',match :test `#'eq) (list 'eq '*ind-token* match) ) resolve ) resolve-code (nconc resolve-code (list resolve)) ) ) ) (and resolve-code (cons 'cond resolve-code)) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Create an indentation table ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun compile-indent-table (name &rest lists &aux main elements switches begins tables symbols label code token-code check-code reduce-code (inits (remove-if-not #'indinit-p lists)) (reduces (remove-if-not #'indreduce-p lists)) (resolves (remove-if-not #'indresolve-p lists)) ) (setq lists (delete-if #'(lambda (object) (or (indinit-p object) (indreduce-p object) (indresolve-p object) ) ) lists) main (apply #'indtable name lists) elements (list-indtable-elements main) switches (remove-if #'null (car elements) :key #'indtoken-switch) begins (remove-if #'null (car elements) :key #'indtoken-begin) tables (cons main (cdr elements)) ) ;; Check for typos in the keywords, or for not defined indent tables. (dolist (item (mapcar #'indtoken-switch switches)) (unless (or (and (integerp item) (minusp item)) (member item tables :key #'indtable-label) ) (error "COMPILE-INDENT-TABLE: SWITCH ~A cannot be matched" item) ) ) (dolist (item (mapcar #'indtoken-begin begins)) (unless (member item tables :key #'indtable-label) (error "COMPILE-INDENT-TABLE: BEGIN ~A cannot be matched" item) ) ) ;; Build augment list. (compile-indent-augment-list main tables) (link-indent-augment-list main) ;; Change switch and begin fields to point to the indent table (dolist (item switches) (if (keywordp (indtoken-switch item)) (setf (indtoken-switch item) (car (member (indtoken-switch item) tables :key #'indtable-label)) ) ) ) (dolist (item begins) (setf (indtoken-begin item) (car (member (indtoken-begin item) tables :key #'indtable-label)) ) ) ;; Build initialization list (dolist (init inits) (setq symbols (nconc symbols (indinit-variables init))) ) ;; Build token code (dolist (item (car elements)) (when (setq code (indtoken-code item)) (setf label (intern (string (gensym)) 'keyword) (indtoken-label item) label code (list (list 'eq '*ind-label* label) code) token-code (nconc token-code (list code)) ) ) ) (multiple-value-setq (check-code reduce-code) (compile-indent-reduces reduces) ) (make-indent :tables tables :inits symbols :reduces reduces :resolves resolves :token-code (and token-code (cons 'cond token-code)) :check-code check-code :reduce-code reduce-code :resolve-code (compile-indent-resolves resolves) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Search rule-pattern in match-pattern ;; Returns offset of match, and it's length, if any ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun indent-search-rule (rule-pattern match-pattern &aux start rule rulep matchp test offset length) (if (member-if-not #'keywordp rule-pattern) ;; rule has wildcards (progn (setq rulep rule-pattern matchp match-pattern start match-pattern ) (loop (setq rule (car rulep)) (cond ;; Special pattern ((consp rule) (if (eq (car rule) 'not) (progn (setq test (cadr rule) rulep (cdr rulep) rule (car rulep) ) (while (and ;; something to match matchp ;; NOT match is true (not (eq (car matchp) test)) ;; next match is not true (not (eq (car matchp) rule)) ) (setq matchp (cdr matchp)) ) (if (eq (car matchp) rule) ;; rule matched (setq matchp (cdr matchp) rulep (cdr rulep) ) ;; failed (setq rulep rule-pattern matchp (cdr start) start matchp ) ) ) ;; (eq (car rule) 'or) (progn (if (member (car matchp) (cdr rule) :test #'eq) (setq rulep (cdr rulep) matchp (cdr matchp)) ;; failed (progn ;; end of match found! (and (null matchp) (return)) ;; reset search (setq rulep rule-pattern matchp (cdr start) start matchp ) ) ) ) ) ) ;; Skip until end of match-pattern or rule is found ((null rule) (setq rulep (cdr rulep)) ;; If matches everything (if (null rulep) (progn (setq matchp nil) (return)) ;; If next token cannot be matched (unless (setq matchp (member (car rulep) matchp :test #'eq) ) (setq rulep rule-pattern) (return) ) ) (setq rulep (cdr rulep) matchp (cdr matchp)) ) ;; Matched ((eq rule t) ;; If there isn't a rule to skip (and (null matchp) (return)) (setq rulep (cdr rulep) matchp (cdr matchp)) ) ;; Matched ((eq rule (car matchp)) (setq rulep (cdr rulep) matchp (cdr matchp)) ) ;; No match (t ;; end of match found! (and (null matchp) (return)) ;; reset search (setq rulep rule-pattern matchp (cdr start) start matchp ) ) ) ;; if everything matched (or rulep (return)) ) ;; All rules matched (unless rulep ;; Calculate offset and length of match (setq offset 0 length 0) (until (eq match-pattern start) (setq offset (1+ offset) match-pattern (cdr match-pattern) ) ) (until (eq match-pattern matchp) (setq length (1+ length) match-pattern (cdr match-pattern) ) ) ) ) ;; no wildcards (and (setq offset (search rule-pattern match-pattern :test #'eq)) (setq length (length rule-pattern)) ) ) (values offset length) ) (compile 'indent-search-rule) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Indentation parser ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro indent-macro (ind-definition ind-offset &optional ind-no-tabs) `(prog* ( ;; Current indentation table (ind-table (car (indent-tables ,ind-definition))) ;; The parser rules (ind-reduces (indent-reduces ,ind-definition)) ;; Token list for the table (ind-tokens (indtable-tokens ind-table)) ;; Stack of nested tables/states ind-stack ;; indentation to be used (*indent* 0) ;; offset to apply indentation *offset* ;; Number of lines read (*ind-lines* 1) ;; Matched token *ind-token* ;; list of tokens after current match, should not be changed *ind-token-list* ;; label associated with rule *ind-label* ;; offset of match *ind-offset* ;; length of match *ind-length* ;; insert position (*ind-point* (point)) (ind-from (scan ,ind-offset :eol :left)) (ind-to ,ind-offset) (ind-line (read-text ind-from (- ind-to ind-from))) ;; start of current line (*ind-start* ind-from) ;; State information ind-state ;; For use with (indent-macro-reject) ind-prev-state ;; Matches for the current line ind-matches ;; Matched tokens not yet used ind-cache ;; Pattern being tested ind-token ;; Used when searching for a regex ind-match ;; Table to change ind-change ;; Length of ind-line (ind-length (length ind-line)) ;; Don't parse after this offset (ind-end ind-length) ;; Temporary variables used during loops ind-left ind-right ind-tleft ind-tright ;; Set when start of file is found ind-startp ;; Flag for regex search (ind-noteol (< ind-to (scan ind-from :eol :right))) ;; Initialization variables expanded here ,@(indent-inits (eval ind-definition)) ) ;; Initial input already read (go :ind-loop) ;; Just to avoid a warning about unused variable, as this ;; variable is somewhat redundant as code should already ;; know before entering indent parser, but useful inside ;; indent macros. *ind-point* ;------------------------------------------------------------------------ ; Read a text line :ind-read (setq ind-to ind-from ind-from (scan ind-from :eol :left :count 2) ) ;; If start of file reached (and (= ind-to ind-from) (setq ind-startp t) (go :ind-process)) (setq *ind-lines* (1+ *ind-lines*) ind-to (scan ind-from :eol :right) ind-line (read-text ind-from (- ind-to ind-from)) ind-length (length ind-line) ind-end ind-length ind-noteol nil ind-cache nil ind-prev-state ind-state ) ;------------------------------------------------------------------------ ; Loop parsing backwards :ind-loop (setq ind-matches nil) (dolist (token ind-tokens) ;; Prepare to loop (setq ind-token (indtoken-regex token) ind-left 0 ) ;; While the pattern matches (loop (setq ind-right ind-left) (if (consp (setq ind-match (re-exec ind-token ind-line :start ind-left :end ind-end :notbol (> ind-left 0) :noteol ind-noteol ) ) ) ;; Remember about match (setq ind-match (car ind-match) ind-left (cdr ind-match) ind-matches (cons (cons token ind-match) ind-matches) ) ;; No match (return) ) ;; matched an empty string (and (= ind-left ind-right) (incf ind-left)) ;; matched a single eol or bol (and (>= ind-left ind-end) (return)) ) ) ;; Add new matches to cache (when ind-matches (setq ind-cache (stable-sort (nconc (nreverse ind-matches) ind-cache) #'< :key #'cadr ) ) ) ;; If nothing in the cache (or ind-cache (go :ind-process)) (setq ind-left (cadar ind-cache) ind-right (cddar ind-cache) ind-matches (cdr ind-cache) ) ;; If only one element in the cache (or ind-matches (go :ind-parse)) (setq ind-tleft (cadar ind-matches) ind-tright (cddar ind-matches) ) ;; Remove overlaps (loop (if (or (>= ind-tleft ind-right) (<= ind-tright ind-left)) ;; No overlap (progn (setq ind-left ind-tleft ind-right ind-tright ind-matches (cdr ind-matches) ) ;; If everything checked (or ind-matches (return)) ) ;; Overlap found (progn (if (consp (cdr ind-matches)) ;; There are yet items to be checked (progn (rplaca ind-matches (cadr ind-matches)) (rplacd ind-matches (cddr ind-matches)) ) ;; Last item (progn (rplacd (last ind-cache 2) nil) (return) ) ) ) ) ;; Prepare for next check (setq ind-tleft (cadar ind-matches) ind-tright (cddar ind-matches) ) ) ;------------------------------------------------------------------------ ; Process the matched tokens :ind-parse (setq ind-cache (nreverse ind-cache)) :ind-parse-loop (or (setq ind-match (car ind-cache)) (go :ind-process)) (setq ind-cache (cdr ind-cache) ind-token (car ind-match) ) (or (member ind-token ind-tokens :test #'eq) (go :ind-parse-loop) ) ;; If a state should be added (when (setq ind-change (indtoken-token ind-token)) (setq ind-left (cadr ind-match) ind-right (cddr ind-match) *ind-offset* (+ ind-from ind-left) *ind-length* (- ind-right ind-left) ind-state (cons (cons ind-change (cons *ind-offset* *ind-length*)) ind-state ) *ind-label* (indtoken-label ind-token) ) ;; Expand token code ,(indent-token-code (eval ind-definition)) ) ;; Check if needs to switch to another table (when (setq ind-change (indtoken-switch ind-token)) ;; Need to switch to a previous table (if (integerp ind-change) ;; Relative switch (while (and ind-stack (minusp ind-change)) (setq ind-table (pop ind-stack) ind-change (1+ ind-change) ) ) ;; Search table in the stack (until (or (null ind-stack) (eq (setq ind-table (pop ind-stack)) ind-change ) ) ) ) ;; If no match or stack became empty (and (null ind-table) (setq ind-table (car (indent-tables ,ind-definition)) ) ) ) ;; Check if needs to start a new table ;; XXX use ind-tleft to reduce number of local variables (when (setq ind-tleft (indtoken-begin ind-token)) (setq ind-change ind-tleft ind-stack (cons ind-table ind-stack) ind-table ind-change ) ) ;; If current "indent pattern table" changed (when ind-change (setq ind-tokens (indtable-tokens ind-table) ind-cache (nreverse ind-cache) ind-end (cadr ind-match) ind-noteol (> ind-length ind-end) ) (go :ind-loop) ) (and ind-cache (go :ind-parse-loop)) ;------------------------------------------------------------------------ ; Everything checked, process result :ind-process ;; If stack is not empty, don't apply rules (and ind-stack (not ind-startp) (go :ind-read)) (block ind-terminate-block (setq ind-cache nil ind-tleft 0 ind-change (mapcar #'car ind-state)) (dolist (entry ind-reduces) (setq *ind-token* (indreduce-token entry) *ind-label* (indreduce-label entry) ) (dolist (rule (indreduce-rules entry)) (loop ;; Check if reduction can be applied (or (multiple-value-setq (ind-match ind-length) (indent-search-rule rule ind-change) ) (return) ) (setq ;; First element matched ind-matches (nthcdr ind-match ind-state) ;; Offset of match *ind-offset* (cadar ind-matches) *ind-token-list* (nthcdr ind-match ind-change) ;; Length of match, note that *ind-length* ;; Will be transformed to zero bellow if ;; the rule is deleting entries. *ind-length* (if (> ind-length 1) (progn (setq ;; XXX using ind-tright, to reduce ;; number of local variables... ind-tright (nth (1- ind-length) ind-matches) ind-right (+ (cadr ind-tright) (cddr ind-tright) ) ) (- ind-right *ind-offset*) ) (cddar ind-matches) ) ) ;; XXX using ind-tleft as a counter, to reduce ;; number of used variables... (and (>= (incf ind-tleft) 1000) ;; Should never apply so many reduce rules on ;; every iteration, if needs to, something is ;; wrong in the indentation definition... (error "~D INDREDUCE iterations, ~ now checking (~A ~A)" ind-tleft *ind-token* rule ) ) ;; Check if should apply the reduction (or ;; Expand check code ,(indent-check-code (eval ind-definition)) (return) ) (if (null *ind-token*) ;; Remove match (progn (setq *ind-length* 0) (if (= ind-match 0) ;; Matched the first entry (setq ind-state (nthcdr ind-length ind-matches) ) (progn (setq ind-matches (nthcdr (1- ind-match) ind-state) ) (rplacd ind-matches (nthcdr (1+ ind-length) ind-matches) ) ) ) ) ;; Substitute/simplify (progn (rplaca (car ind-matches) *ind-token*) (when (> ind-length 1) (rplacd (cdar ind-matches) *ind-length*) (rplacd ind-matches (nthcdr ind-length ind-matches) ) ) ) ) (setq ind-cache t ind-change (mapcar #'car ind-state) ) ;; Expand reduce code ,(indent-reduce-code (eval ind-definition)) ) ) ) ;; ind-cache will be T if at least one change was done (and ind-cache (go :ind-process)) ;; Start of file reached (or ind-startp (go :ind-read)) ) ;; end of ind-terminate-block (block ind-terminate-block (setq *ind-token-list* (mapcar #'car ind-state)) (dolist (item ind-state) (setq *ind-token* (car item) *ind-offset* (cadr item) *ind-length* (cddr item) ) ;; Expand resolve code ,(indent-resolve-code (eval ind-definition)) (setq *ind-token-list* (cdr *ind-token-list*)) ) ) (and (integerp *indent*) (integerp *offset*) (indent-text *indent* *offset* ,ind-no-tabs) ) ) ) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/xt.c0000664000000000000000000013332412472175711016541 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/modules/xt.c,v 1.20tsi Exp $ */ #include #include #include #include #include #include #include "lisp/internal.h" #include "lisp/private.h" /* * Types */ typedef struct { XrmQuark qname; XrmQuark qtype; Cardinal size; } ResourceInfo; typedef struct { WidgetClass widget_class; ResourceInfo **resources; Cardinal num_resources; Cardinal num_cons_resources; } ResourceList; typedef struct { Arg *args; Cardinal num_args; } Resources; typedef struct { LispObj *data; /* data is => (list* widget callback argument) */ } CallbackArgs; /* * Prototypes */ int xtLoadModule(void); void LispXtCleanupCallback(Widget, XtPointer, XtPointer); void LispXtCallback(Widget, XtPointer, XtPointer); void LispXtInputCallback(XtPointer, int*, XtInputId*); /* a hack... */ LispObj *Lisp_XtCoerceToWidgetList(LispBuiltin*); LispObj *Lisp_XtAddCallback(LispBuiltin*); LispObj *Lisp_XtAppInitialize(LispBuiltin*); LispObj *Lisp_XtAppMainLoop(LispBuiltin*); LispObj *Lisp_XtAppAddInput(LispBuiltin*); LispObj *Lisp_XtAppPending(LispBuiltin*); LispObj *Lisp_XtAppProcessEvent(LispBuiltin*); LispObj *Lisp_XtCreateWidget(LispBuiltin*); LispObj *Lisp_XtCreateManagedWidget(LispBuiltin*); LispObj *Lisp_XtCreatePopupShell(LispBuiltin*); LispObj *Lisp_XtDestroyWidget(LispBuiltin*); LispObj *Lisp_XtGetKeyboardFocusWidget(LispBuiltin*); LispObj *Lisp_XtGetValues(LispBuiltin*); LispObj *Lisp_XtManageChild(LispBuiltin*); LispObj *Lisp_XtUnmanageChild(LispBuiltin*); LispObj *Lisp_XtSetMappedWhenManaged(LispBuiltin*); LispObj *Lisp_XtMapWidget(LispBuiltin*); LispObj *Lisp_XtName(LispBuiltin*); LispObj *Lisp_XtParent(LispBuiltin*); LispObj *Lisp_XtUnmapWidget(LispBuiltin*); LispObj *Lisp_XtPopup(LispBuiltin*); LispObj *Lisp_XtPopdown(LispBuiltin*); LispObj *Lisp_XtIsRealized(LispBuiltin*); LispObj *Lisp_XtRealizeWidget(LispBuiltin*); LispObj *Lisp_XtUnrealizeWidget(LispBuiltin*); LispObj *Lisp_XtRemoveInput(LispBuiltin*); LispObj *Lisp_XtSetSensitive(LispBuiltin*); LispObj *Lisp_XtSetValues(LispBuiltin*); LispObj *Lisp_XtWidgetToApplicationContext(LispBuiltin*); LispObj *Lisp_XtDisplay(LispBuiltin*); LispObj *Lisp_XtDisplayOfObject(LispBuiltin*); LispObj *Lisp_XtScreen(LispBuiltin*); LispObj *Lisp_XtScreenOfObject(LispBuiltin*); LispObj *Lisp_XtSetKeyboardFocus(LispBuiltin*); LispObj *Lisp_XtWindow(LispBuiltin*); LispObj *Lisp_XtWindowOfObject(LispBuiltin*); LispObj *Lisp_XtAddGrab(LispBuiltin*); LispObj *Lisp_XtRemoveGrab(LispBuiltin*); LispObj *Lisp_XtAppGetExitFlag(LispBuiltin*); LispObj *Lisp_XtAppSetExitFlag(LispBuiltin*); LispObj *LispXtCreateWidget(LispBuiltin*, int); static Resources *LispConvertResources(LispObj*, Widget, ResourceList*, ResourceList*); static void LispFreeResources(Resources*); static int bcmp_action_resource(_Xconst void*, _Xconst void*); static ResourceInfo *GetResourceInfo(char*, ResourceList*, ResourceList*); static ResourceList *GetResourceList(WidgetClass); static int bcmp_action_resource_list(_Xconst void*, _Xconst void*); static ResourceList *FindResourceList(WidgetClass); static int qcmp_action_resource_list(_Xconst void*, _Xconst void*); static ResourceList *CreateResourceList(WidgetClass); static int qcmp_action_resource(_Xconst void*, _Xconst void*); static void BindResourceList(ResourceList*); static void PopdownAction(Widget, XEvent*, String*, Cardinal*); static void QuitAction(Widget, XEvent*, String*, Cardinal*); /* * Initialization */ static LispBuiltin lispbuiltins[] = { {LispFunction, Lisp_XtCoerceToWidgetList, "xt-coerce-to-widget-list number opaque"}, {LispFunction, Lisp_XtAddGrab, "xt-add-grab widget exclusive spring-loaded"}, {LispFunction, Lisp_XtAddCallback, "xt-add-callback widget callback-name callback &optional client-data"}, {LispFunction, Lisp_XtAppAddInput, "xt-app-add-input app-context fileno condition function &optional client-data"}, {LispFunction, Lisp_XtAppInitialize, "xt-app-initialize app-context-return application-class &optional options fallback-resources"}, {LispFunction, Lisp_XtAppPending, "xt-app-pending app-context"}, {LispFunction, Lisp_XtAppMainLoop, "xt-app-main-loop app-context"}, {LispFunction, Lisp_XtAppProcessEvent, "xt-app-process-event app-context &optional mask"}, {LispFunction, Lisp_XtAppGetExitFlag, "xt-app-get-exit-flag app-context"}, {LispFunction, Lisp_XtAppSetExitFlag, "xt-app-set-exit-flag app-context"}, {LispFunction, Lisp_XtCreateManagedWidget, "xt-create-managed-widget name widget-class parent &optional arguments"}, {LispFunction, Lisp_XtCreateWidget, "xt-create-widget name widget-class parent &optional arguments"}, {LispFunction, Lisp_XtCreatePopupShell, "xt-create-popup-shell name widget-class parent &optional arguments"}, {LispFunction, Lisp_XtDestroyWidget, "xt-destroy-widget widget"}, {LispFunction, Lisp_XtGetKeyboardFocusWidget, "xt-get-keyboard-focus-widget widget"}, {LispFunction, Lisp_XtGetValues, "xt-get-values widget arguments"}, {LispFunction, Lisp_XtManageChild, "xt-manage-child widget"}, {LispFunction, Lisp_XtName, "xt-name widget"}, {LispFunction, Lisp_XtUnmanageChild, "xt-unmanage-child widget"}, {LispFunction, Lisp_XtMapWidget, "xt-map-widget widget"}, {LispFunction, Lisp_XtUnmapWidget, "xt-unmap-widget widget"}, {LispFunction, Lisp_XtSetMappedWhenManaged, "xt-set-mapped-when-managed widget map-when-managed"}, {LispFunction, Lisp_XtParent, "xt-parent widget"}, {LispFunction, Lisp_XtPopup, "xt-popup widget grab-kind"}, {LispFunction, Lisp_XtPopdown, "xt-popdown widget"}, {LispFunction, Lisp_XtIsRealized, "xt-is-realized widget"}, {LispFunction, Lisp_XtRealizeWidget, "xt-realize-widget widget"}, {LispFunction, Lisp_XtUnrealizeWidget, "xt-unrealize-widget widget"}, {LispFunction, Lisp_XtRemoveInput, "xt-remove-input input"}, {LispFunction, Lisp_XtRemoveGrab, "xt-remove-grab widget"}, {LispFunction, Lisp_XtSetKeyboardFocus, "xt-set-keyboard-focus widget descendant"}, {LispFunction, Lisp_XtSetSensitive, "xt-set-sensitive widget sensitive"}, {LispFunction, Lisp_XtSetValues, "xt-set-values widget arguments"}, {LispFunction, Lisp_XtWidgetToApplicationContext, "xt-widget-to-application-context widget"}, {LispFunction, Lisp_XtDisplay, "xt-display widget"}, {LispFunction, Lisp_XtDisplayOfObject, "xt-display-of-object object"}, {LispFunction, Lisp_XtScreen, "xt-screen widget"}, {LispFunction, Lisp_XtScreenOfObject, "xt-screen-of-object object"}, {LispFunction, Lisp_XtWindow, "xt-window widget"}, {LispFunction, Lisp_XtWindowOfObject, "xt-window-of-object object"}, }; LispModuleData xtLispModuleData = { LISP_MODULE_VERSION, xtLoadModule, }; static ResourceList **resource_list; static Cardinal num_resource_list; static Atom delete_window; static int xtAppContext_t, xtWidget_t, xtWidgetClass_t, xtWidgetList_t, xtInputId_t, xtDisplay_t, xtScreen_t, xtWindow_t; static XtActionsRec actions[] = { {"xt-popdown", PopdownAction}, {"xt-quit", QuitAction}, }; static XrmQuark qCardinal, qInt, qString, qWidget, qFloat; static CallbackArgs **input_list; static Cardinal num_input_list, size_input_list; /* * Implementation */ int xtLoadModule(void) { int i; char *fname = "XT-LOAD-MODULE"; xtAppContext_t = LispRegisterOpaqueType("XtAppContext"); xtWidget_t = LispRegisterOpaqueType("Widget"); xtWidgetClass_t = LispRegisterOpaqueType("WidgetClass"); xtWidgetList_t = LispRegisterOpaqueType("WidgetList"); xtInputId_t = LispRegisterOpaqueType("XtInputId"); xtDisplay_t = LispRegisterOpaqueType("Display*"); xtScreen_t = LispRegisterOpaqueType("Screen*"); xtWindow_t = LispRegisterOpaqueType("Window"); LispExecute("(DEFSTRUCT XT-WIDGET-LIST NUM-CHILDREN CHILDREN)\n"); GCDisable(); (void)LispSetVariable(ATOM2("CORE-WIDGET-CLASS"), OPAQUE(coreWidgetClass, xtWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("COMPOSITE-WIDGET-CLASS"), OPAQUE(compositeWidgetClass, xtWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("CONSTRAINT-WIDGET-CLASS"), OPAQUE(constraintWidgetClass, xtWidgetClass_t), fname, 0); (void)LispSetVariable(ATOM2("TRANSIENT-SHELL-WIDGET-CLASS"), OPAQUE(transientShellWidgetClass, xtWidgetClass_t), fname, 0); /* parameters for XtPopup */ (void)LispSetVariable(ATOM2("XT-GRAB-EXCLUSIVE"), INTEGER(XtGrabExclusive), fname, 0); (void)LispSetVariable(ATOM2("XT-GRAB-NONE"), INTEGER(XtGrabNone), fname, 0); (void)LispSetVariable(ATOM2("XT-GRAB-NONE-EXCLUSIVE"), INTEGER(XtGrabNonexclusive), fname, 0); /* parameters for XtAppProcessEvent */ (void)LispSetVariable(ATOM2("XT-IM-XEVENT"), INTEGER(XtIMXEvent), fname, 0); (void)LispSetVariable(ATOM2("XT-IM-TIMER"), INTEGER(XtIMTimer), fname, 0); (void)LispSetVariable(ATOM2("XT-IM-ALTERNATE-INPUT"), INTEGER(XtIMAlternateInput), fname, 0); (void)LispSetVariable(ATOM2("XT-IM-SIGNAL"), INTEGER(XtIMSignal), fname, 0); (void)LispSetVariable(ATOM2("XT-IM-ALL"), INTEGER(XtIMAll), fname, 0); /* parameters for XtAppAddInput */ (void)LispSetVariable(ATOM2("XT-INPUT-READ-MASK"), INTEGER(XtInputReadMask), fname, 0); (void)LispSetVariable(ATOM2("XT-INPUT-WRITE-MASK"), INTEGER(XtInputWriteMask), fname, 0); (void)LispSetVariable(ATOM2("XT-INPUT-EXCEPT-MASK"), INTEGER(XtInputExceptMask), fname, 0); GCEnable(); qCardinal = XrmPermStringToQuark(XtRCardinal); qInt = XrmPermStringToQuark(XtRInt); qString = XrmPermStringToQuark(XtRString); qWidget = XrmPermStringToQuark(XtRWidget); qFloat = XrmPermStringToQuark(XtRFloat); for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) LispAddBuiltinFunction(&lispbuiltins[i]); return (1); } void LispXtCallback(Widget w, XtPointer user_data, XtPointer call_data) { CallbackArgs *args = (CallbackArgs*)user_data; LispObj *code, *ocod = COD; GCDisable(); /* callback name */ /* reall caller */ code = CONS(CDR(CDR(args->data)), CONS(OPAQUE(w, xtWidget_t), CONS(CAR(CDR(args->data)), CONS(OPAQUE(call_data, 0), NIL)))); /* user arguments */ COD = CONS(code, COD); GCEnable(); (void)EVAL(code); COD = ocod; } void LispXtCleanupCallback(Widget w, XtPointer user_data, XtPointer call_data) { CallbackArgs *args = (CallbackArgs*)user_data; UPROTECT(CAR(args->data), args->data); XtFree((XtPointer)args); } void LispXtInputCallback(XtPointer closure, int *source, XtInputId *id) { CallbackArgs *args = (CallbackArgs*)closure; LispObj *code, *ocod = COD; GCDisable(); /* callback name */ /* user arguments */ code = CONS(CDR(CDR(args->data)), CONS(CAR(CDR(args->data)), CONS(INTEGER(*source), CONS(CAR(args->data), NIL)))); /* input source */ /* input id */ COD = CONS(code, COD); GCEnable(); (void)EVAL(code); COD = ocod; } LispObj * Lisp_XtCoerceToWidgetList(LispBuiltin *builtin) /* xt-coerce-to-widget-list number opaque */ { int i; WidgetList children; Cardinal num_children; LispObj *cons, *widget_list, *result; LispObj *onumber, *opaque; opaque = ARGUMENT(1); onumber = ARGUMENT(0); CHECK_INDEX(onumber); num_children = FIXNUM_VALUE(onumber); if (!CHECKO(opaque, xtWidgetList_t)) LispDestroy("%s: cannot convert %s to WidgetList", STRFUN(builtin), STROBJ(opaque)); children = (WidgetList)(opaque->data.opaque.data); GCDisable(); widget_list = cons = NIL; for (i = 0; i < num_children; i++) { result = CONS(OPAQUE(children[i], xtWidget_t), NIL); if (widget_list == NIL) widget_list = cons = result; else { RPLACD(cons, result); cons = CDR(cons); } } result = APPLY(ATOM("MAKE-XT-WIDGET-LIST"), CONS(KEYWORD("NUM-CHILDREN"), CONS(INTEGER(num_children), CONS(KEYWORD("CHILDREN"), CONS(widget_list, NIL))))); GCEnable(); return (result); } LispObj * Lisp_XtAddCallback(LispBuiltin *builtin) /* xt-add-callback widget callback-name callback &optional client-data */ { CallbackArgs *arguments; LispObj *data; LispObj *widget, *callback_name, *callback, *client_data; client_data = ARGUMENT(3); callback = ARGUMENT(2); callback_name = ARGUMENT(1); widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); CHECK_STRING(callback_name); if (!SYMBOLP(callback) && callback->type != LispLambda_t) LispDestroy("%s: %s cannot be used as a callback", STRFUN(builtin), STROBJ(callback)); if (client_data == UNSPEC) client_data = NIL; data = CONS(widget, CONS(client_data, callback)); PROTECT(widget, data); arguments = XtNew(CallbackArgs); arguments->data = data; XtAddCallback((Widget)(widget->data.opaque.data), THESTR(callback_name), LispXtCallback, (XtPointer)arguments); XtAddCallback((Widget)(widget->data.opaque.data), XtNdestroyCallback, LispXtCleanupCallback, (XtPointer)arguments); return (client_data); } LispObj * Lisp_XtAppAddInput(LispBuiltin *builtin) /* xt-app-add-input app-context fileno condition function &optional client-data */ { LispObj *data, *input; XtAppContext appcon; int source, condition; CallbackArgs *arguments; XtInputId id; LispObj *app_context, *fileno, *ocondition, *function, *client_data; client_data = ARGUMENT(4); function = ARGUMENT(3); ocondition = ARGUMENT(2); fileno = ARGUMENT(1); app_context = ARGUMENT(0); if (!CHECKO(app_context, xtAppContext_t)) LispDestroy("%s: cannot convert %s to XtAppContext", STRFUN(builtin), STROBJ(app_context)); appcon = (XtAppContext)(app_context->data.opaque.data); CHECK_LONGINT(fileno); source = LONGINT_VALUE(fileno); CHECK_FIXNUM(ocondition); condition = FIXNUM_VALUE(ocondition); if (!SYMBOLP(function) && function->type != LispLambda_t) LispDestroy("%s: %s cannot be used as a callback", STRFUN(builtin), STROBJ(function)); /* client data optional */ if (client_data == UNSPEC) client_data = NIL; data = CONS(NIL, CONS(client_data, function)); arguments = XtNew(CallbackArgs); arguments->data = data; id = XtAppAddInput(appcon, source, (XtPointer)condition, LispXtInputCallback, (XtPointer)arguments); GCDisable(); input = OPAQUE(id, xtInputId_t); GCEnable(); RPLACA(data, input); PROTECT(input, data); if (num_input_list + 1 >= size_input_list) { ++size_input_list; input_list = (CallbackArgs**) XtRealloc((XtPointer)input_list, sizeof(CallbackArgs*) * size_input_list); } input_list[num_input_list++] = arguments; return (input); } LispObj * Lisp_XtRemoveInput(LispBuiltin *builtin) /* xt-remove-input input */ { int i; XtInputId id; CallbackArgs *args; LispObj *input; input = ARGUMENT(0); if (!CHECKO(input, xtInputId_t)) LispDestroy("%s: cannot convert %s to XtInputId", STRFUN(builtin), STROBJ(input)); id = (XtInputId)(input->data.opaque.data); for (i = 0; i < num_input_list; i++) { args = input_list[i]; if (id == (XtInputId)(CAR(args->data)->data.opaque.data)) { UPROTECT(CAR(args->data), args->data); XtFree((XtPointer)args); if (i + 1 < num_input_list) memmove(input_list + i, input_list + i + 1, sizeof(CallbackArgs*) * (num_input_list - i - 1)); --num_input_list; XtRemoveInput(id); return (T); } } return (NIL); } LispObj * Lisp_XtAppInitialize(LispBuiltin *builtin) /* xt-app-initialize app-context-return application-class &optional options fallback-resources */ { XtAppContext appcon; Widget shell; int zero = 0; Resources *resources = NULL; String *fallback = NULL; LispObj *app_context_return, *application_class, *options, *fallback_resources; fallback_resources = ARGUMENT(3); options = ARGUMENT(2); application_class = ARGUMENT(1); app_context_return = ARGUMENT(0); CHECK_SYMBOL(app_context_return); CHECK_STRING(application_class); CHECK_LIST(options); /* check fallback resources, if given */ if (fallback_resources != UNSPEC) { LispObj *string; int count; CHECK_CONS(fallback_resources); for (string = fallback_resources, count = 0; CONSP(string); string = CDR(string), count++) CHECK_STRING(CAR(string)); /* fallback resources was correctly specified */ fallback = LispMalloc(sizeof(String) * (count + 1)); for (string = fallback_resources, count = 0; CONSP(string); string = CDR(string), count++) fallback[count] = THESTR(CAR(string)); fallback[count] = NULL; } shell = XtAppInitialize(&appcon, THESTR(application_class), NULL, 0, &zero, NULL, fallback, NULL, 0); if (fallback) LispFree(fallback); (void)LispSetVariable(app_context_return, OPAQUE(appcon, xtAppContext_t), STRFUN(builtin), 0); XtAppAddActions(appcon, actions, XtNumber(actions)); if (options != UNSPEC) { resources = LispConvertResources(options, shell, GetResourceList(XtClass(shell)), NULL); if (resources) { XtSetValues(shell, resources->args, resources->num_args); LispFreeResources(resources); } } return (OPAQUE(shell, xtWidget_t)); } LispObj * Lisp_XtAppMainLoop(LispBuiltin *builtin) /* xt-app-main-loop app-context */ { LispObj *app_context; app_context = ARGUMENT(0); if (!CHECKO(app_context, xtAppContext_t)) LispDestroy("%s: cannot convert %s to XtAppContext", STRFUN(builtin), STROBJ(app_context)); XtAppMainLoop((XtAppContext)(app_context->data.opaque.data)); return (NIL); } LispObj * Lisp_XtAppPending(LispBuiltin *builtin) /* xt-app-pending app-context */ { LispObj *app_context; app_context = ARGUMENT(0); if (!CHECKO(app_context, xtAppContext_t)) LispDestroy("%s: cannot convert %s to XtAppContext", STRFUN(builtin), STROBJ(app_context)); return (INTEGER( XtAppPending((XtAppContext)(app_context->data.opaque.data)))); } LispObj * Lisp_XtAppProcessEvent(LispBuiltin *builtin) /* xt-app-process-event app-context &optional mask */ { XtInputMask mask; XtAppContext appcon; LispObj *app_context, *omask; omask = ARGUMENT(1); app_context = ARGUMENT(0); if (!CHECKO(app_context, xtAppContext_t)) LispDestroy("%s: cannot convert %s to XtAppContext", STRFUN(builtin), STROBJ(app_context)); appcon = (XtAppContext)(app_context->data.opaque.data); if (omask == UNSPEC) mask = XtIMAll; else { CHECK_FIXNUM(omask); mask = FIXNUM_VALUE(omask); } if (mask != (mask & XtIMAll)) LispDestroy("%s: %ld does not fit in XtInputMask %ld", STRFUN(builtin), (long)mask, (long)XtIMAll); if (mask) XtAppProcessEvent(appcon, mask); return (omask == NIL ? FIXNUM(mask) : omask); } LispObj * Lisp_XtRealizeWidget(LispBuiltin *builtin) /* xt-realize-widget widget */ { Widget widget; LispObj *owidget; owidget = ARGUMENT(0); if (!CHECKO(owidget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); widget = (Widget)(owidget->data.opaque.data); XtRealizeWidget(widget); if (XtIsSubclass(widget, shellWidgetClass)) { if (!delete_window) delete_window = XInternAtom(XtDisplay(widget), "WM_DELETE_WINDOW", False); (void)XSetWMProtocols(XtDisplay(widget), XtWindow(widget), &delete_window, 1); } return (owidget); } LispObj * Lisp_XtUnrealizeWidget(LispBuiltin *builtin) /* xt-unrealize-widget widget */ { LispObj *widget; widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); XtUnrealizeWidget((Widget)(widget->data.opaque.data)); return (widget); } LispObj * Lisp_XtIsRealized(LispBuiltin *builtin) /* xt-is-realized widget */ { LispObj *widget; widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); return (XtIsRealized((Widget)(widget->data.opaque.data)) ? T : NIL); } LispObj * Lisp_XtDestroyWidget(LispBuiltin *builtin) /* xt-destroy-widget widget */ { LispObj *widget; widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); XtDestroyWidget((Widget)(widget->data.opaque.data)); return (NIL); } #define UNMANAGED 0 #define MANAGED 1 #define SHELL 2 LispObj * Lisp_XtCreateWidget(LispBuiltin *builtin) /* xt-create-widget name widget-class parent &optional arguments */ { return (LispXtCreateWidget(builtin, UNMANAGED)); } LispObj * Lisp_XtCreateManagedWidget(LispBuiltin *builtin) /* xt-create-managed-widget name widget-class parent &optional arguments */ { return (LispXtCreateWidget(builtin, MANAGED)); } LispObj * Lisp_XtCreatePopupShell(LispBuiltin *builtin) /* xt-create-popup-shell name widget-class parent &optional arguments */ { return (LispXtCreateWidget(builtin, SHELL)); } LispObj * LispXtCreateWidget(LispBuiltin *builtin, int options) /* xt-create-widget name widget-class parent &optional arguments xt-create-managed-widget name widget-class parent &optional arguments xt-create-popup-shell name widget-class parent &optional arguments */ { char *name; WidgetClass widget_class; Widget widget, parent; Resources *resources = NULL; LispObj *oname, *owidget_class, *oparent, *arguments; arguments = ARGUMENT(3); oparent = ARGUMENT(2); owidget_class = ARGUMENT(1); oname = ARGUMENT(0); CHECK_STRING(oname); name = THESTR(oname); if (!CHECKO(owidget_class, xtWidgetClass_t)) LispDestroy("%s: cannot convert %s to WidgetClass", STRFUN(builtin), STROBJ(owidget_class)); widget_class = (WidgetClass)(owidget_class->data.opaque.data); if (!CHECKO(oparent, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(oparent)); parent = (Widget)(oparent->data.opaque.data); if (arguments == UNSPEC) arguments = NIL; CHECK_LIST(arguments); if (options == SHELL) widget = XtCreatePopupShell(name, widget_class, parent, NULL, 0); else widget = XtCreateWidget(name, widget_class, parent, NULL, 0); if (arguments == NIL) resources = NULL; else { resources = LispConvertResources(arguments, widget, GetResourceList(widget_class), GetResourceList(XtClass(parent))); XtSetValues(widget, resources->args, resources->num_args); } if (options == MANAGED) XtManageChild(widget); if (resources) LispFreeResources(resources); return (OPAQUE(widget, xtWidget_t)); } LispObj * Lisp_XtGetKeyboardFocusWidget(LispBuiltin *builtin) /* xt-get-keyboard-focus-widget widget */ { LispObj *widget; widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); return (OPAQUE(XtGetKeyboardFocusWidget((Widget)(widget->data.opaque.data)), xtWidget_t)); } LispObj * Lisp_XtGetValues(LispBuiltin *builtin) /* xt-get-values widget arguments */ { Arg args[1]; Widget widget; ResourceList *rlist, *plist; ResourceInfo *resource; LispObj *list, *object = NIL, *result, *cons = NIL; char c1; short c2; int c4; #ifdef LONG64 long c8; #endif LispObj *owidget, *arguments; arguments = ARGUMENT(1); owidget = ARGUMENT(0); if (arguments == NIL) return (NIL); if (!CHECKO(owidget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); widget = (Widget)(owidget->data.opaque.data); CHECK_CONS(arguments); rlist = GetResourceList(XtClass(widget)); plist = XtParent(widget) ? GetResourceList(XtClass(XtParent(widget))) : NULL; GCDisable(); result = NIL; for (list = arguments; CONSP(list); list = CDR(list)) { CHECK_STRING(CAR(list)); if ((resource = GetResourceInfo(THESTR(CAR(list)), rlist, plist)) == NULL) { int i; Widget child; for (i = 0; i < rlist->num_resources; i++) { if (rlist->resources[i]->qtype == qWidget) { XtSetArg(args[0], XrmQuarkToString(rlist->resources[i]->qname), &child); XtGetValues(widget, args, 1); if (child && XtParent(child) == widget) { resource = GetResourceInfo(THESTR(CAR(list)), GetResourceList(XtClass(child)), NULL); if (resource) break; } } } if (resource == NULL) { LispMessage("%s: resource %s not available", STRFUN(builtin), THESTR(CAR(list))); continue; } } switch (resource->size) { case 1: XtSetArg(args[0], THESTR(CAR(list)), &c1); break; case 2: XtSetArg(args[0], THESTR(CAR(list)), &c2); break; case 4: XtSetArg(args[0], THESTR(CAR(list)), &c4); break; #ifdef LONG64 case 1: XtSetArg(args[0], THESTR(CAR(list)), &c8); break; #endif } XtGetValues(widget, args, 1); /* special resources */ if (resource->qtype == qString) { #ifdef LONG64 object = CONS(CAR(list), STRING((char*)c8)); #else object = CONS(CAR(list), STRING((char*)c4)); #endif } else if (resource->qtype == qCardinal || resource->qtype == qInt) { #ifdef LONG64 if (sizeof(int) == 8) object = CONS(CAR(list), INTEGER(c8)); else #endif object = CONS(CAR(list), INTEGER(c4)); } else { switch (resource->size) { case 1: object = CONS(CAR(list), OPAQUE(c1, 0)); break; case 2: object = CONS(CAR(list), OPAQUE(c2, 0)); break; case 4: object = CONS(CAR(list), OPAQUE(c4, 0)); break; #ifdef LONG64 case 8: object = CONS(CAR(list), OPAQUE(c8, 0)); break; #endif } } if (result == NIL) result = cons = CONS(object, NIL); else { RPLACD(cons, CONS(object, NIL)); cons = CDR(cons); } } GCEnable(); return (result); } LispObj * Lisp_XtManageChild(LispBuiltin *builtin) /* xt-manage-child widget */ { LispObj *widget; widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); XtManageChild((Widget)(widget->data.opaque.data)); return (widget); } LispObj * Lisp_XtUnmanageChild(LispBuiltin *builtin) /* xt-unmanage-child widget */ { LispObj *widget; widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); XtUnmanageChild((Widget)(widget->data.opaque.data)); return (widget); } LispObj * Lisp_XtMapWidget(LispBuiltin *builtin) /* xt-map-widget widget */ { LispObj *widget; widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); XtMapWidget((Widget)(widget->data.opaque.data)); return (widget); } LispObj * Lisp_XtUnmapWidget(LispBuiltin *builtin) /* xt-unmap-widget widget */ { LispObj *widget; widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); XtUnmapWidget((Widget)(widget->data.opaque.data)); return (widget); } LispObj * Lisp_XtSetMappedWhenManaged(LispBuiltin *builtin) /* xt-set-mapped-when-managed widget map-when-managed */ { LispObj *widget, *map_when_managed; map_when_managed = ARGUMENT(1); widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); XtSetMappedWhenManaged((Widget)(widget->data.opaque.data), map_when_managed != NIL); return (map_when_managed); } LispObj * Lisp_XtPopup(LispBuiltin *builtin) /* xt-popup widget grab-kind */ { XtGrabKind kind; LispObj *widget, *grab_kind; grab_kind = ARGUMENT(1); widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); CHECK_INDEX(grab_kind); kind = (XtGrabKind)FIXNUM_VALUE(grab_kind); if (kind != XtGrabExclusive && kind != XtGrabNone && kind != XtGrabNonexclusive) LispDestroy("%s: %d does not fit in XtGrabKind", STRFUN(builtin), kind); XtPopup((Widget)(widget->data.opaque.data), kind); return (grab_kind); } LispObj * Lisp_XtPopdown(LispBuiltin *builtin) /* xt-popdown widget */ { LispObj *widget; widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); XtPopdown((Widget)(widget->data.opaque.data)); return (widget); } LispObj * Lisp_XtSetKeyboardFocus(LispBuiltin *builtin) /* xt-set-keyboard-focus widget descendant */ { LispObj *widget, *descendant; descendant = ARGUMENT(1); widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); if (!CHECKO(descendant, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(descendant)); XtSetKeyboardFocus((Widget)(widget->data.opaque.data), (Widget)(descendant->data.opaque.data)); return (widget); } LispObj * Lisp_XtSetSensitive(LispBuiltin *builtin) /* xt-set-sensitive widget sensitive */ { LispObj *widget, *sensitive; sensitive = ARGUMENT(1); widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); XtSetSensitive((Widget)(widget->data.opaque.data), sensitive != NIL); return (sensitive); } LispObj * Lisp_XtSetValues(LispBuiltin *builtin) /* xt-set-values widget arguments */ { Widget widget; Resources *resources; LispObj *owidget, *arguments; arguments = ARGUMENT(1); owidget = ARGUMENT(0); if (arguments == NIL) return (owidget); if (!CHECKO(owidget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); widget = (Widget)(owidget->data.opaque.data); CHECK_CONS(arguments); resources = LispConvertResources(arguments, widget, GetResourceList(XtClass(widget)), XtParent(widget) ? GetResourceList(XtClass(XtParent(widget))) : NULL); XtSetValues(widget, resources->args, resources->num_args); LispFreeResources(resources); return (owidget); } LispObj * Lisp_XtWidgetToApplicationContext(LispBuiltin *builtin) /* xt-widget-to-application-context widget */ { Widget widget; XtAppContext appcon; LispObj *owidget; owidget = ARGUMENT(0); if (!CHECKO(owidget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); widget = (Widget)(owidget->data.opaque.data); appcon = XtWidgetToApplicationContext(widget); return (OPAQUE(appcon, xtAppContext_t)); } LispObj * Lisp_XtDisplay(LispBuiltin *builtin) /* xt-display widget */ { Widget widget; Display *display; LispObj *owidget; owidget = ARGUMENT(0); if (!CHECKO(owidget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); widget = (Widget)(owidget->data.opaque.data); display = XtDisplay(widget); return (OPAQUE(display, xtDisplay_t)); } LispObj * Lisp_XtDisplayOfObject(LispBuiltin *builtin) /* xt-display-of-object object */ { Widget widget; Display *display; LispObj *object; object = ARGUMENT(0); if (!CHECKO(object, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(object)); widget = (Widget)(object->data.opaque.data); display = XtDisplayOfObject(widget); return (OPAQUE(display, xtDisplay_t)); } LispObj * Lisp_XtScreen(LispBuiltin *builtin) /* xt-screen widget */ { Widget widget; Screen *screen; LispObj *owidget; owidget = ARGUMENT(0); if (!CHECKO(owidget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); widget = (Widget)(owidget->data.opaque.data); screen = XtScreen(widget); return (OPAQUE(screen, xtScreen_t)); } LispObj * Lisp_XtScreenOfObject(LispBuiltin *builtin) /* xt-screen-of-object object */ { Widget widget; Screen *screen; LispObj *object; object = ARGUMENT(0); if (!CHECKO(object, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(object)); widget = (Widget)(object->data.opaque.data); screen = XtScreenOfObject(widget); return (OPAQUE(screen, xtScreen_t)); } LispObj * Lisp_XtWindow(LispBuiltin *builtin) /* xt-window widget */ { Widget widget; Window window; LispObj *owidget; owidget = ARGUMENT(0); if (!CHECKO(owidget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); widget = (Widget)(owidget->data.opaque.data); window = XtWindow(widget); return (OPAQUE(window, xtWindow_t)); } LispObj * Lisp_XtWindowOfObject(LispBuiltin *builtin) /* xt-window-of-object widget */ { Widget widget; Window window; LispObj *object; object = ARGUMENT(0); if (!CHECKO(object, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(object)); widget = (Widget)(object->data.opaque.data); window = XtWindowOfObject(widget); return (OPAQUE(window, xtWindow_t)); } LispObj * Lisp_XtAddGrab(LispBuiltin *builtin) /* xt-add-grab widget exclusive spring-loaded */ { Widget widget; Bool exclusive, spring_loaded; LispObj *owidget, *oexclusive, *ospring_loaded; ospring_loaded = ARGUMENT(2); oexclusive = ARGUMENT(1); owidget = ARGUMENT(0); if (!CHECKO(owidget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(owidget)); widget = (Widget)(owidget->data.opaque.data); exclusive = oexclusive != NIL; spring_loaded = ospring_loaded != NIL; XtAddGrab(widget, exclusive, spring_loaded); return (T); } LispObj * Lisp_XtRemoveGrab(LispBuiltin *builtin) /* xt-remove-grab widget */ { LispObj *widget; widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); XtRemoveGrab((Widget)(widget->data.opaque.data)); return (NIL); } LispObj * Lisp_XtName(LispBuiltin *builtin) /* xt-name widget */ { LispObj *widget; widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); return (STRING(XtName((Widget)(widget->data.opaque.data)))); } LispObj * Lisp_XtParent(LispBuiltin *builtin) /* xt-parent widget */ { LispObj *widget; widget = ARGUMENT(0); if (!CHECKO(widget, xtWidget_t)) LispDestroy("%s: cannot convert %s to Widget", STRFUN(builtin), STROBJ(widget)); return (OPAQUE(XtParent((Widget)widget->data.opaque.data), xtWidget_t)); } LispObj * Lisp_XtAppGetExitFlag(LispBuiltin *builtin) /* xt-app-get-exit-flag app-context */ { LispObj *app_context; app_context = ARGUMENT(0); if (!CHECKO(app_context, xtAppContext_t)) LispDestroy("%s: cannot convert %s to XtAppContext", STRFUN(builtin), STROBJ(app_context)); return (XtAppGetExitFlag((XtAppContext)(app_context->data.opaque.data)) ? T : NIL); } LispObj * Lisp_XtAppSetExitFlag(LispBuiltin *builtin) /* xt-app-get-exit-flag app-context */ { LispObj *app_context; app_context = ARGUMENT(0); if (!CHECKO(app_context, xtAppContext_t)) LispDestroy("%s: cannot convert %s to XtAppContext", STRFUN(builtin), STROBJ(app_context)); XtAppSetExitFlag((XtAppContext)(app_context->data.opaque.data)); return (T); } static Resources * LispConvertResources(LispObj *list, Widget widget, ResourceList *rlist, ResourceList *plist) { char c1; short c2; int c4; #ifdef LONG64 long c8; #endif XrmValue from, to; LispObj *arg, *val; ResourceInfo *resource; char *fname = "XT-CONVERT-RESOURCES"; Resources *resources = (Resources*)XtCalloc(1, sizeof(Resources)); for (; CONSP(list); list = CDR(list)) { if (!CONSP(CAR(list))) { XtFree((XtPointer)resources); LispDestroy("%s: %s is not a cons", fname, STROBJ(CAR(list))); } arg = CAR(CAR(list)); val = CDR(CAR(list)); if (!STRINGP(arg)) { XtFree((XtPointer)resources); LispDestroy("%s: %s is not a string", fname, STROBJ(arg)); } if ((resource = GetResourceInfo(THESTR(arg), rlist, plist)) == NULL) { int i; Arg args[1]; Widget child; for (i = 0; i < rlist->num_resources; i++) { if (rlist->resources[i]->qtype == qWidget) { XtSetArg(args[0], XrmQuarkToString(rlist->resources[i]->qname), &child); XtGetValues(widget, args, 1); if (child && XtParent(child) == widget) { resource = GetResourceInfo(THESTR(arg), GetResourceList(XtClass(child)), NULL); if (resource) break; } } } if (resource == NULL) { LispMessage("%s: resource %s not available", fname, THESTR(arg)); continue; } } if (LONGINTP(val) || DFLOATP(val) || OPAQUEP(val)) { resources->args = (Arg*) XtRealloc((XtPointer)resources->args, sizeof(Arg) * (resources->num_args + 1)); if (!OPAQUEP(val)) { float fvalue; if (DFLOATP(val)) fvalue = DFLOAT_VALUE(val); else fvalue = LONGINT_VALUE(val); if (resource->qtype == qFloat) { XtSetArg(resources->args[resources->num_args], XrmQuarkToString(resource->qname), fvalue); } else XtSetArg(resources->args[resources->num_args], XrmQuarkToString(resource->qname), (int)fvalue); } else XtSetArg(resources->args[resources->num_args], XrmQuarkToString(resource->qname), val->data.opaque.data); ++resources->num_args; continue; } else if (val == NIL) { /* XXX assume it is a pointer or a boolean */ #ifdef DEBUG LispWarning("%s: assuming %s is a pointer or boolean", fname, XrmQuarkToString(resource->qname)); #endif resources->args = (Arg*) XtRealloc((XtPointer)resources->args, sizeof(Arg) * (resources->num_args + 1)); XtSetArg(resources->args[resources->num_args], XrmQuarkToString(resource->qname), NULL); ++resources->num_args; continue; } else if (val == T) { /* XXX assume it is a boolean */ #ifdef DEBUG LispWarning("%s: assuming %s is a boolean", fname, XrmQuarkToString(resource->qname)); #endif resources->args = (Arg*) XtRealloc((XtPointer)resources->args, sizeof(Arg) * (resources->num_args + 1)); XtSetArg(resources->args[resources->num_args], XrmQuarkToString(resource->qname), True); ++resources->num_args; continue; } else if (!STRINGP(val)) { XtFree((XtPointer)resources); LispDestroy("%s: resource value must be string, number or opaque, not %s", fname, STROBJ(val)); } from.size = val == NIL ? 1 : strlen(THESTR(val)) + 1; from.addr = val == NIL ? "" : THESTR(val); switch (to.size = resource->size) { case 1: to.addr = (XtPointer)&c1; break; case 2: to.addr = (XtPointer)&c2; break; case 4: to.addr = (XtPointer)&c4; break; #ifdef LONG64 case 8: to.addr = (XtPointer)&c8; break; #endif default: LispWarning("%s: bad resource size %d for %s", fname, to.size, THESTR(arg)); continue; } if (qString == resource->qtype) #ifdef LONG64 c8 = (long)from.addr; #else c4 = (long)from.addr; #endif else if (!XtConvertAndStore(widget, XtRString, &from, XrmQuarkToString(resource->qtype), &to)) /* The type converter already have printed an error message */ continue; resources->args = (Arg*) XtRealloc((XtPointer)resources->args, sizeof(Arg) * (resources->num_args + 1)); switch (to.size) { case 1: XtSetArg(resources->args[resources->num_args], XrmQuarkToString(resource->qname), c1); break; case 2: XtSetArg(resources->args[resources->num_args], XrmQuarkToString(resource->qname), c2); break; case 4: XtSetArg(resources->args[resources->num_args], XrmQuarkToString(resource->qname), c4); break; #ifdef LONG64 case 8: XtSetArg(resources->args[resources->num_args], XrmQuarkToString(resource->qname), c8); break; #endif } ++resources->num_args; } return (resources); } static void LispFreeResources(Resources *resources) { if (resources) { XtFree((XtPointer)resources->args); XtFree((XtPointer)resources); } } static int bcmp_action_resource(_Xconst void *string, _Xconst void *resource) { return (strcmp((String)string, XrmQuarkToString((*(ResourceInfo**)resource)->qname))); } static ResourceInfo * GetResourceInfo(char *name, ResourceList *rlist, ResourceList *plist) { ResourceInfo **resource = NULL; if (rlist->resources) resource = (ResourceInfo**) bsearch(name, rlist->resources, rlist->num_resources, sizeof(ResourceInfo*), bcmp_action_resource); if (resource == NULL && plist) { resource = (ResourceInfo**) bsearch(name, &plist->resources[plist->num_resources], plist->num_cons_resources, sizeof(ResourceInfo*), bcmp_action_resource); } return (resource ? *resource : NULL); } static ResourceList * GetResourceList(WidgetClass wc) { ResourceList *list; if ((list = FindResourceList(wc)) == NULL) list = CreateResourceList(wc); return (list); } static int bcmp_action_resource_list(_Xconst void *wc, _Xconst void *list) { return ((char*)wc - (char*)((*(ResourceList**)list)->widget_class)); } static ResourceList * FindResourceList(WidgetClass wc) { ResourceList **list; if (!resource_list) return (NULL); list = (ResourceList**) bsearch(wc, resource_list, num_resource_list, sizeof(ResourceList*), bcmp_action_resource_list); return (list ? *list : NULL); } static int qcmp_action_resource_list(_Xconst void *left, _Xconst void *right) { return ((char*)((*(ResourceList**)left)->widget_class) - (char*)((*(ResourceList**)right)->widget_class)); } static ResourceList * CreateResourceList(WidgetClass wc) { ResourceList *list; list = (ResourceList*)XtMalloc(sizeof(ResourceList)); list->widget_class = wc; list->num_resources = list->num_cons_resources = 0; list->resources = NULL; resource_list = (ResourceList**) XtRealloc((XtPointer)resource_list, sizeof(ResourceList*) * (num_resource_list + 1)); resource_list[num_resource_list++] = list; qsort(resource_list, num_resource_list, sizeof(ResourceList*), qcmp_action_resource_list); BindResourceList(list); return (list); } static int qcmp_action_resource(_Xconst void *left, _Xconst void *right) { return (strcmp(XrmQuarkToString((*(ResourceInfo**)left)->qname), XrmQuarkToString((*(ResourceInfo**)right)->qname))); } static void BindResourceList(ResourceList *list) { XtResourceList xt_list, cons_list; Cardinal i, num_xt, num_cons; XtGetResourceList(list->widget_class, &xt_list, &num_xt); XtGetConstraintResourceList(list->widget_class, &cons_list, &num_cons); list->num_resources = num_xt; list->num_cons_resources = num_cons; list->resources = (ResourceInfo**) XtMalloc(sizeof(ResourceInfo*) * (num_xt + num_cons)); for (i = 0; i < num_xt; i++) { list->resources[i] = (ResourceInfo*)XtMalloc(sizeof(ResourceInfo)); list->resources[i]->qname = XrmPermStringToQuark(xt_list[i].resource_name); list->resources[i]->qtype = XrmPermStringToQuark(xt_list[i].resource_type); list->resources[i]->size = xt_list[i].resource_size; } for (; i < num_xt + num_cons; i++) { list->resources[i] = (ResourceInfo*)XtMalloc(sizeof(ResourceInfo)); list->resources[i]->qname = XrmPermStringToQuark(cons_list[i - num_xt].resource_name); list->resources[i]->qtype = XrmPermStringToQuark(cons_list[i - num_xt].resource_type); list->resources[i]->size = cons_list[i - num_xt].resource_size; } XtFree((XtPointer)xt_list); if (cons_list) XtFree((XtPointer)cons_list); qsort(list->resources, list->num_resources, sizeof(ResourceInfo*), qcmp_action_resource); if (num_cons) qsort(&list->resources[num_xt], list->num_cons_resources, sizeof(ResourceInfo*), qcmp_action_resource); } /*ARGSUSED*/ static void PopdownAction(Widget w, XEvent *event, String *params, Cardinal *num_params) { XtPopdown(w); } /*ARGSUSED*/ static void QuitAction(Widget w, XEvent *event, String *params, Cardinal *num_params) { XtAppSetExitFlag(XtWidgetToApplicationContext(w)); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/lisp.lsp0000664000000000000000000001717512472175711017436 0ustar ;; ;; Copyright (c) 2001 by The XFree86 Project, Inc. ;; ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), ;; to deal in the Software without restriction, including without limitation ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, ;; and/or sell copies of the Software, and to permit persons to whom the ;; Software is furnished to do so, subject to the following conditions: ;; ;; The above copyright notice and this permission notice shall be included in ;; all copies or substantial portions of the Software. ;; ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;; SOFTWARE. ;; ;; Except as contained in this notice, the name of the XFree86 Project shall ;; not be used in advertising or otherwise to promote the sale, use or other ;; dealings in this Software without prior written authorization from the ;; XFree86 Project. ;; ;; Author: Paulo César Pereira de Andrade ;; ;; ;; $XFree86: xc/programs/xedit/lisp/modules/lisp.lsp,v 1.9 2002/12/04 05:28:01 paulo Exp $ ;; (provide "lisp") (in-package "LISP") (export '( second third fourth fifth sixth seventh eighth ninth tenth pathname merge-pathnames logtest signum alphanumericp copy-seq push pop prog prog* with-open-file with-output-to-string )) (defun second (a) (nth 1 a)) (defun third (a) (nth 2 a)) (defun fourth (a) (nth 3 a)) (defun fifth (a) (nth 4 a)) (defun sixth (a) (nth 5 a)) (defun seventh (a) (nth 6 a)) (defun eighth (a) (nth 7 a)) (defun ninth (a) (nth 8 a)) (defun tenth (a) (nth 9 a)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; pathnames ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun pathname (filename) (values (parse-namestring filename))) (defun merge-pathnames (pathname &optional defaults default-version) (if (null default-version) (parse-namestring pathname nil defaults) (parse-namestring pathname nil (make-pathname :defaults defaults :version default-version)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; math ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun logtest (integer1 integer2) (not (zerop (logand integer1 integer2)))) (defun signum (number) (if (zerop number) number (/ number (abs number)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; misc functions/macros ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun alphanumericp (char) (or (alpha-char-p char) (not (null (digit-char-p char))))) (defun copy-seq (sequence) (subseq sequence 0)) (defmacro prog (init &rest body) `(block nil (let ,init (tagbody ,@body)))) (defmacro prog* (init &rest body) `(block nil (let* ,init (tagbody ,@body)))) (defmacro with-open-file (file &rest body) `(let ((,(car file) (open ,@(cdr file)))) (unwind-protect (progn ,@body) (if ,(car file) (close ,(car file)))))) (defmacro with-output-to-string (stream &rest body) `(let ((,(car stream) (make-string-output-stream))) (unwind-protect (progn ,@body (get-output-stream-string ,(car stream))) (and ,(car stream) (close ,(car stream)))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; setf ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defsetf car (list) (value) `(progn (rplaca ,list ,value) ,value)) (defsetf cdr (list) (value) `(progn (rplacd ,list ,value) ,value)) (defsetf caar (list) (value) `(progn (rplaca (car ,list) ,value) ,value)) (defsetf cadr (list) (value) `(progn (rplaca (cdr ,list) ,value) ,value)) (defsetf cdar (list) (value) `(progn (rplacd (car ,list) ,value) ,value)) (defsetf cddr (list) (value) `(progn (rplacd (cdr ,list) ,value) ,value)) (defsetf caaar (list) (value) `(progn (rplaca (caar ,list) ,value) ,value)) (defsetf caadr (list) (value) `(progn (rplaca (cadr ,list) ,value) ,value)) (defsetf cadar (list) (value) `(progn (rplaca (cdar ,list) ,value) ,value)) (defsetf caddr (list) (value) `(progn (rplaca (cddr ,list) ,value) ,value)) (defsetf cdaar (list) (value) `(progn (rplacd (caar ,list) ,value) ,value)) (defsetf cdadr (list) (value) `(progn (rplacd (cadr ,list) ,value) ,value)) (defsetf cddar (list) (value) `(progn (rplacd (cdar ,list) ,value) ,value)) (defsetf cdddr (list) (value) `(progn (rplacd (cddr ,list) ,value) ,value)) (defsetf caaaar (list) (value) `(progn (rplaca (caaar ,list) ,value) ,value)) (defsetf caaadr (list) (value) `(progn (rplaca (caadr ,list) ,value) ,value)) (defsetf caadar (list) (value) `(progn (rplaca (cadar ,list) ,value) ,value)) (defsetf caaddr (list) (value) `(progn (rplaca (caddr ,list) ,value) ,value)) (defsetf cadaar (list) (value) `(progn (rplaca (cdaar ,list) ,value) ,value)) (defsetf cadadr (list) (value) `(progn (rplaca (cdadr ,list) ,value) ,value)) (defsetf caddar (list) (value) `(progn (rplaca (cddar ,list) ,value) ,value)) (defsetf cadddr (list) (value) `(progn (rplaca (cdddr ,list) ,value) ,value)) (defsetf cdaaar (list) (value) `(progn (rplacd (caaar ,list) ,value) ,value)) (defsetf cdaadr (list) (value) `(progn (rplacd (caadr ,list) ,value) ,value)) (defsetf cdadar (list) (value) `(progn (rplacd (cadar ,list) ,value) ,value)) (defsetf cdaddr (list) (value) `(progn (rplacd (caddr ,list) ,value) ,value)) (defsetf cddaar (list) (value) `(progn (rplacd (cdaar ,list) ,value) ,value)) (defsetf cddadr (list) (value) `(progn (rplacd (cdadr ,list) ,value) ,value)) (defsetf cdddar (list) (value) `(progn (rplacd (cddar ,list) ,value) ,value)) (defsetf cddddr (list) (value) `(progn (rplacd (cdddr ,list) ,value) ,value)) (defsetf first (list) (value) `(progn (rplaca ,list ,value) ,value)) (defsetf second (list) (value) `(progn (rplaca (nthcdr 1 ,list) ,value) ,value)) (defsetf third (list) (value) `(progn (rplaca (nthcdr 2 ,list) ,value) ,value)) (defsetf fourth (list) (value) `(progn (rplaca (nthcdr 3 ,list) ,value) ,value)) (defsetf fifth (list) (value) `(progn (rplaca (nthcdr 4 ,list) ,value) ,value)) (defsetf sixth (list) (value) `(progn (rplaca (nthcdr 5 ,list) ,value) ,value)) (defsetf seventh (list) (value) `(progn (rplaca (nthcdr 6 ,list) ,value) ,value)) (defsetf eighth (list) (value) `(progn (rplaca (nthcdr 7 ,list) ,value) ,value)) (defsetf ninth (list) (value) `(progn (rplaca (nthcdr 8 ,list) ,value) ,value)) (defsetf tenth (list) (value) `(progn (rplaca (nthcdr 9 ,list) ,value) ,value)) (defsetf rest (list) (value) `(progn (rplacd ,list ,value) ,value)) (defun lisp::nth-store (index list value) (rplaca (nthcdr index list) value) value) (defsetf nth lisp::nth-store) (defsetf aref (array &rest indices) (value) `(lisp::vector-store ,array ,@indices ,value)) (defsetf get (symbol key &optional default) (value) `(lisp::put ,symbol ,key ,value)) (defsetf symbol-plist lisp::set-symbol-plist) (defsetf gethash (key hash-table &optional default) (value) `(lisp::puthash ,key ,hash-table ,value)) (defsetf char lisp::char-store) (defsetf schar lisp::char-store) (defsetf elt lisp::elt-store) (defsetf svref lisp::elt-store) (defsetf documentation lisp::documentation-store) (defsetf symbol-value set) (defsetf subseq (sequence start &optional end) (value) `(progn (replace ,sequence ,value :start1 ,start :end1 ,end) ,value)) x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/modules/psql.c0000664000000000000000000005471612472175711017074 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/modules/psql.c,v 1.12tsi Exp $ */ #include #include #undef USE_SSL /* cannot get it to compile... */ #include #include #include "lisp/internal.h" #include "lisp/private.h" /* * Prototypes */ int psqlLoadModule(void); LispObj *Lisp_PQbackendPID(LispBuiltin*); LispObj *Lisp_PQclear(LispBuiltin*); LispObj *Lisp_PQconsumeInput(LispBuiltin*); LispObj *Lisp_PQdb(LispBuiltin*); LispObj *Lisp_PQerrorMessage(LispBuiltin*); LispObj *Lisp_PQexec(LispBuiltin*); LispObj *Lisp_PQfinish(LispBuiltin*); LispObj *Lisp_PQfname(LispBuiltin*); LispObj *Lisp_PQfnumber(LispBuiltin*); LispObj *Lisp_PQfsize(LispBuiltin*); LispObj *Lisp_PQftype(LispBuiltin*); LispObj *Lisp_PQgetlength(LispBuiltin*); LispObj *Lisp_PQgetvalue(LispBuiltin*); LispObj *Lisp_PQhost(LispBuiltin*); LispObj *Lisp_PQnfields(LispBuiltin*); LispObj *Lisp_PQnotifies(LispBuiltin*); LispObj *Lisp_PQntuples(LispBuiltin*); LispObj *Lisp_PQoptions(LispBuiltin*); LispObj *Lisp_PQpass(LispBuiltin*); LispObj *Lisp_PQport(LispBuiltin*); LispObj *Lisp_PQresultStatus(LispBuiltin*); LispObj *Lisp_PQsetdb(LispBuiltin*); LispObj *Lisp_PQsetdbLogin(LispBuiltin*); LispObj *Lisp_PQsocket(LispBuiltin*); LispObj *Lisp_PQstatus(LispBuiltin*); LispObj *Lisp_PQtty(LispBuiltin*); LispObj *Lisp_PQuser(LispBuiltin*); /* * Initialization */ static LispBuiltin lispbuiltins[] = { {LispFunction, Lisp_PQbackendPID, "pq-backend-pid connection"}, {LispFunction, Lisp_PQclear, "pq-clear result"}, {LispFunction, Lisp_PQconsumeInput, "pq-consume-input connection"}, {LispFunction, Lisp_PQdb, "pq-db connection"}, {LispFunction, Lisp_PQerrorMessage, "pq-error-message connection"}, {LispFunction, Lisp_PQexec, "pq-exec connection query"}, {LispFunction, Lisp_PQfinish, "pq-finish connection"}, {LispFunction, Lisp_PQfname, "pq-fname result field-number"}, {LispFunction, Lisp_PQfnumber, "pq-fnumber result field-name"}, {LispFunction, Lisp_PQfsize, "pq-fsize result field-number"}, {LispFunction, Lisp_PQftype, "pq-ftype result field-number"}, {LispFunction, Lisp_PQgetlength, "pq-getlength result tupple field-number"}, {LispFunction, Lisp_PQgetvalue, "pq-getvalue result tupple field-number &optional type"}, {LispFunction, Lisp_PQhost, "pq-host connection"}, {LispFunction, Lisp_PQnfields, "pq-nfields result"}, {LispFunction, Lisp_PQnotifies, "pq-notifies connection"}, {LispFunction, Lisp_PQntuples, "pq-ntuples result"}, {LispFunction, Lisp_PQoptions, "pq-options connection"}, {LispFunction, Lisp_PQpass, "pq-pass connection"}, {LispFunction, Lisp_PQport, "pq-port connection"}, {LispFunction, Lisp_PQresultStatus, "pq-result-status result"}, {LispFunction, Lisp_PQsetdb, "pq-setdb host port options tty dbname"}, {LispFunction, Lisp_PQsetdbLogin, "pq-setdb-login host port options tty dbname login password"}, {LispFunction, Lisp_PQsocket, "pq-socket connection"}, {LispFunction, Lisp_PQstatus, "pq-status connection"}, {LispFunction, Lisp_PQtty, "pq-tty connection"}, {LispFunction, Lisp_PQuser, "pq-user connection"}, }; LispModuleData psqlLispModuleData = { LISP_MODULE_VERSION, psqlLoadModule }; static int PGconn_t, PGresult_t; /* * Implementation */ int psqlLoadModule(void) { int i; char *fname = "PSQL-LOAD-MODULE"; PGconn_t = LispRegisterOpaqueType("PGconn*"); PGresult_t = LispRegisterOpaqueType("PGresult*"); GCDisable(); /* NOTE: Implemented just enough to make programming examples * (and my needs) work. * Completing this is an exercise to the reader, or may be implemented * when/if required. */ LispExecute("(DEFSTRUCT PG-NOTIFY RELNAME BE-PID)\n" "(DEFSTRUCT PG-POINT X Y)\n" "(DEFSTRUCT PG-BOX HIGH LOW)\n" "(DEFSTRUCT PG-POLYGON SIZE NUM-POINTS BOUNDBOX POINTS)\n"); /* enum ConnStatusType */ (void)LispSetVariable(ATOM2("PG-CONNECTION-OK"), REAL(CONNECTION_OK), fname, 0); (void)LispSetVariable(ATOM2("PG-CONNECTION-BAD"), REAL(CONNECTION_BAD), fname, 0); (void)LispSetVariable(ATOM2("PG-CONNECTION-STARTED"), REAL(CONNECTION_STARTED), fname, 0); (void)LispSetVariable(ATOM2("PG-CONNECTION-MADE"), REAL(CONNECTION_MADE), fname, 0); (void)LispSetVariable(ATOM2("PG-CONNECTION-AWAITING-RESPONSE"), REAL(CONNECTION_AWAITING_RESPONSE), fname, 0); (void)LispSetVariable(ATOM2("PG-CONNECTION-AUTH-OK"), REAL(CONNECTION_AUTH_OK), fname, 0); (void)LispSetVariable(ATOM2("PG-CONNECTION-SETENV"), REAL(CONNECTION_SETENV), fname, 0); /* enum ExecStatusType */ (void)LispSetVariable(ATOM2("PGRES-EMPTY-QUERY"), REAL(PGRES_EMPTY_QUERY), fname, 0); (void)LispSetVariable(ATOM2("PGRES-COMMAND-OK"), REAL(PGRES_COMMAND_OK), fname, 0); (void)LispSetVariable(ATOM2("PGRES-TUPLES-OK"), REAL(PGRES_TUPLES_OK), fname, 0); (void)LispSetVariable(ATOM2("PGRES-COPY-OUT"), REAL(PGRES_COPY_OUT), fname, 0); (void)LispSetVariable(ATOM2("PGRES-COPY-IN"), REAL(PGRES_COPY_IN), fname, 0); (void)LispSetVariable(ATOM2("PGRES-BAD-RESPONSE"), REAL(PGRES_BAD_RESPONSE), fname, 0); (void)LispSetVariable(ATOM2("PGRES-NONFATAL-ERROR"), REAL(PGRES_NONFATAL_ERROR), fname, 0); (void)LispSetVariable(ATOM2("PGRES-FATAL-ERROR"), REAL(PGRES_FATAL_ERROR), fname, 0); GCEnable(); for (i = 0; i < sizeof(lispbuiltins) / sizeof(lispbuiltins[0]); i++) LispAddBuiltinFunction(&lispbuiltins[i]); return (1); } LispObj * Lisp_PQbackendPID(LispBuiltin *builtin) /* pq-backend-pid connection */ { int pid; PGconn *conn; LispObj *connection; connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); pid = PQbackendPID(conn); return (INTEGER(pid)); } LispObj * Lisp_PQclear(LispBuiltin *builtin) /* pq-clear result */ { PGresult *res; LispObj *result; result = ARGUMENT(0); if (!CHECKO(result, PGresult_t)) LispDestroy("%s: cannot convert %s to PGresult*", STRFUN(builtin), STROBJ(result)); res = (PGresult*)(result->data.opaque.data); PQclear(res); return (NIL); } LispObj * Lisp_PQconsumeInput(LispBuiltin *builtin) /* pq-consume-input connection */ { int result; PGconn *conn; LispObj *connection; connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); result = PQconsumeInput(conn); return (INTEGER(result)); } LispObj * Lisp_PQdb(LispBuiltin *builtin) /* pq-db connection */ { char *string; PGconn *conn; LispObj *connection; connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); string = PQdb(conn); return (string ? STRING(string) : NIL); } LispObj * Lisp_PQerrorMessage(LispBuiltin *builtin) { char *string; PGconn *conn; LispObj *connection; connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); string = PQerrorMessage(conn); return (string ? STRING(string) : NIL); } LispObj * Lisp_PQexec(LispBuiltin *builtin) /* pq-exec connection query */ { PGconn *conn; PGresult *res; LispObj *connection, *query; query = ARGUMENT(1); connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); CHECK_STRING(query); res = PQexec(conn, THESTR(query)); return (res ? OPAQUE(res, PGresult_t) : NIL); } LispObj * Lisp_PQfinish(LispBuiltin *builtin) /* pq-finish connection */ { PGconn *conn; LispObj *connection; connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); PQfinish(conn); return (NIL); } LispObj * Lisp_PQfname(LispBuiltin *builtin) /* pq-fname result field-number */ { char *string; int field; PGresult *res; LispObj *result, *field_number; field_number = ARGUMENT(1); result = ARGUMENT(0); if (!CHECKO(result, PGresult_t)) LispDestroy("%s: cannot convert %s to PGresult*", STRFUN(builtin), STROBJ(result)); res = (PGresult*)(result->data.opaque.data); CHECK_INDEX(field_number); field = FIXNUM_VALUE(field_number); string = PQfname(res, field); return (string ? STRING(string) : NIL); } LispObj * Lisp_PQfnumber(LispBuiltin *builtin) /* pq-fnumber result field-name */ { int number; int field; PGresult *res; LispObj *result, *field_name; field_name = ARGUMENT(1); result = ARGUMENT(0); if (!CHECKO(result, PGresult_t)) LispDestroy("%s: cannot convert %s to PGresult*", STRFUN(builtin), STROBJ(result)); res = (PGresult*)(result->data.opaque.data); CHECK_STRING(field_name); number = PQfnumber(res, THESTR(field_name)); return (INTEGER(number)); } LispObj * Lisp_PQfsize(LispBuiltin *builtin) /* pq-fsize result field-number */ { int size, field; PGresult *res; LispObj *result, *field_number; field_number = ARGUMENT(1); result = ARGUMENT(0); if (!CHECKO(result, PGresult_t)) LispDestroy("%s: cannot convert %s to PGresult*", STRFUN(builtin), STROBJ(result)); res = (PGresult*)(result->data.opaque.data); CHECK_INDEX(field_number); field = FIXNUM_VALUE(field_number); size = PQfsize(res, field); return (INTEGER(size)); } LispObj * Lisp_PQftype(LispBuiltin *builtin) { Oid oid; int field; PGresult *res; LispObj *result, *field_number; field_number = ARGUMENT(1); result = ARGUMENT(0); if (!CHECKO(result, PGresult_t)) LispDestroy("%s: cannot convert %s to PGresult*", STRFUN(builtin), STROBJ(result)); res = (PGresult*)(result->data.opaque.data); CHECK_INDEX(field_number); field = FIXNUM_VALUE(field_number); oid = PQftype(res, field); return (INTEGER(oid)); } LispObj * Lisp_PQgetlength(LispBuiltin *builtin) /* pq-getlength result tupple field-number */ { PGresult *res; int tuple, field, length; LispObj *result, *otupple, *field_number; field_number = ARGUMENT(2); otupple = ARGUMENT(1); result = ARGUMENT(0); if (!CHECKO(result, PGresult_t)) LispDestroy("%s: cannot convert %s to PGresult*", STRFUN(builtin), STROBJ(result)); res = (PGresult*)(result->data.opaque.data); CHECK_INDEX(otupple); tuple = FIXNUM_VALUE(otupple); CHECK_INDEX(field_number); field = FIXNUM_VALUE(field_number); length = PQgetlength(res, tuple, field); return (INTEGER(length)); } LispObj * Lisp_PQgetvalue(LispBuiltin *builtin) /* pq-getvalue result tuple field &optional type-specifier */ { char *string; double real = 0.0; PGresult *res; int tuple, field, isint = 0, isreal = 0, integer; LispObj *result, *otupple, *field_number, *type; type = ARGUMENT(3); field_number = ARGUMENT(2); otupple = ARGUMENT(1); result = ARGUMENT(0); if (!CHECKO(result, PGresult_t)) LispDestroy("%s: cannot convert %s to PGresult*", STRFUN(builtin), STROBJ(result)); res = (PGresult*)(result->data.opaque.data); CHECK_INDEX(otupple); tuple = FIXNUM_VALUE(otupple); CHECK_INDEX(field_number); field = FIXNUM_VALUE(field_number); string = PQgetvalue(res, tuple, field); if (type != UNSPEC) { char *typestring; CHECK_SYMBOL(type); typestring = ATOMID(type); if (strcmp(typestring, "INT16") == 0) { integer = *(short*)string; isint = 1; goto simple_type; } else if (strcmp(typestring, "INT32") == 0) { integer = *(int*)string; isint = 1; goto simple_type; } else if (strcmp(typestring, "FLOAT") == 0) { real = *(float*)string; isreal = 1; goto simple_type; } else if (strcmp(typestring, "REAL") == 0) { real = *(double*)string; isreal = 1; goto simple_type; } else if (strcmp(typestring, "PG-POLYGON") == 0) goto polygon_type; else if (strcmp(typestring, "STRING") != 0) LispDestroy("%s: unknown type %s", STRFUN(builtin), typestring); } simple_type: return (isint ? INTEGER(integer) : isreal ? DFLOAT(real) : (string ? STRING(string) : NIL)); polygon_type: { LispObj *poly, *box, *p = NIL, *cdr, *obj; POLYGON *polygon; int i, size; size = PQgetlength(res, tuple, field); polygon = (POLYGON*)(string - sizeof(int)); GCDisable(); /* get polygon->boundbox */ cdr = EVAL(CONS(ATOM("MAKE-PG-POINT"), CONS(KEYWORD("X"), CONS(REAL(polygon->boundbox.high.x), CONS(KEYWORD("Y"), CONS(REAL(polygon->boundbox.high.y), NIL)))))); obj = EVAL(CONS(ATOM("MAKE-PG-POINT"), CONS(KEYWORD("X"), CONS(REAL(polygon->boundbox.low.x), CONS(KEYWORD("Y"), CONS(REAL(polygon->boundbox.low.y), NIL)))))); box = EVAL(CONS(ATOM("MAKE-PG-BOX"), CONS(KEYWORD("HIGH"), CONS(cdr, CONS(KEYWORD("LOW"), CONS(obj, NIL)))))); /* get polygon->p values */ for (i = 0; i < polygon->npts; i++) { obj = EVAL(CONS(ATOM("MAKE-PG-POINT"), CONS(KEYWORD("X"), CONS(REAL(polygon->p[i].x), CONS(KEYWORD("Y"), CONS(REAL(polygon->p[i].y), NIL)))))); if (i == 0) p = cdr = CONS(obj, NIL); else { RPLACD(cdr, CONS(obj, NIL)); cdr = CDR(cdr); } } /* make result */ poly = EVAL(CONS(ATOM("MAKE-PG-POLYGON"), CONS(KEYWORD("SIZE"), CONS(REAL(size), CONS(KEYWORD("NUM-POINTS"), CONS(REAL(polygon->npts), CONS(KEYWORD("BOUNDBOX"), CONS(box, CONS(KEYWORD("POINTS"), CONS(QUOTE(p), NIL)))))))))); GCEnable(); return (poly); } } LispObj * Lisp_PQhost(LispBuiltin *builtin) /* pq-host connection */ { char *string; PGconn *conn; LispObj *connection; connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); string = PQhost(conn); return (string ? STRING(string) : NIL); } LispObj * Lisp_PQnfields(LispBuiltin *builtin) /* pq-nfields result */ { int nfields; PGresult *res; LispObj *result; result = ARGUMENT(0); if (!CHECKO(result, PGresult_t)) LispDestroy("%s: cannot convert %s to PGresult*", STRFUN(builtin), STROBJ(result)); res = (PGresult*)(result->data.opaque.data); nfields = PQnfields(res); return (INTEGER(nfields)); } LispObj * Lisp_PQnotifies(LispBuiltin *builtin) /* pq-notifies connection */ { LispObj *result, *code, *cod = COD; PGconn *conn; PGnotify *notifies; LispObj *connection; connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); if ((notifies = PQnotifies(conn)) == NULL) return (NIL); GCDisable(); code = CONS(ATOM("MAKE-PG-NOTIFY"), CONS(KEYWORD("RELNAME"), CONS(STRING(notifies->relname), CONS(KEYWORD("BE-PID"), CONS(REAL(notifies->be_pid), NIL))))); COD = CONS(code, COD); GCEnable(); result = EVAL(code); COD = cod; free(notifies); return (result); } LispObj * Lisp_PQntuples(LispBuiltin *builtin) /* pq-ntuples result */ { int ntuples; PGresult *res; LispObj *result; result = ARGUMENT(0); if (!CHECKO(result, PGresult_t)) LispDestroy("%s: cannot convert %s to PGresult*", STRFUN(builtin), STROBJ(result)); res = (PGresult*)(result->data.opaque.data); ntuples = PQntuples(res); return (INTEGER(ntuples)); } LispObj * Lisp_PQoptions(LispBuiltin *builtin) /* pq-options connection */ { char *string; PGconn *conn; LispObj *connection; connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); string = PQoptions(conn); return (string ? STRING(string) : NIL); } LispObj * Lisp_PQpass(LispBuiltin *builtin) /* pq-pass connection */ { char *string; PGconn *conn; LispObj *connection; connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); string = PQpass(conn); return (string ? STRING(string) : NIL); } LispObj * Lisp_PQport(LispBuiltin *builtin) /* pq-port connection */ { char *string; PGconn *conn; LispObj *connection; connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); string = PQport(conn); return (string ? STRING(string) : NIL); } LispObj * Lisp_PQresultStatus(LispBuiltin *builtin) /* pq-result-status result */ { int status; PGresult *res; LispObj *result; result = ARGUMENT(0); if (!CHECKO(result, PGresult_t)) LispDestroy("%s: cannot convert %s to PGresult*", STRFUN(builtin), STROBJ(result)); res = (PGresult*)(result->data.opaque.data); status = PQresultStatus(res); return (INTEGER(status)); } LispObj * LispPQsetdb(LispBuiltin *builtin, int loginp) /* pq-setdb host port options tty dbname pq-setdb-login host port options tty dbname login password */ { PGconn *conn; char *host, *port, *options, *tty, *dbname, *login, *password; LispObj *ohost, *oport, *ooptions, *otty, *odbname, *ologin, *opassword; if (loginp) { opassword = ARGUMENT(6); ologin = ARGUMENT(5); } else opassword = ologin = NIL; odbname = ARGUMENT(4); otty = ARGUMENT(3); ooptions = ARGUMENT(2); oport = ARGUMENT(1); ohost = ARGUMENT(0); if (ohost != NIL) { CHECK_STRING(ohost); host = THESTR(ohost); } else host = NULL; if (oport != NIL) { CHECK_STRING(oport); port = THESTR(oport); } else port = NULL; if (ooptions != NIL) { CHECK_STRING(ooptions); options = THESTR(ooptions); } else options = NULL; if (otty != NIL) { CHECK_STRING(otty); tty = THESTR(otty); } else tty = NULL; if (odbname != NIL) { CHECK_STRING(odbname); dbname = THESTR(odbname); } else dbname = NULL; if (ologin != NIL) { CHECK_STRING(ologin); login = THESTR(ologin); } else login = NULL; if (opassword != NIL) { CHECK_STRING(opassword); password = THESTR(opassword); } else password = NULL; conn = PQsetdbLogin(host, port, options, tty, dbname, login, password); return (conn ? OPAQUE(conn, PGconn_t) : NIL); } LispObj * Lisp_PQsetdb(LispBuiltin *builtin) /* pq-setdb host port options tty dbname */ { return (LispPQsetdb(builtin, 0)); } LispObj * Lisp_PQsetdbLogin(LispBuiltin *builtin) /* pq-setdb-login host port options tty dbname login password */ { return (LispPQsetdb(builtin, 1)); } LispObj * Lisp_PQsocket(LispBuiltin *builtin) /* pq-socket connection */ { int sock; PGconn *conn; LispObj *connection; connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); sock = PQsocket(conn); return (INTEGER(sock)); } LispObj * Lisp_PQstatus(LispBuiltin *builtin) /* pq-status connection */ { int status; PGconn *conn; LispObj *connection; connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); status = PQstatus(conn); return (INTEGER(status)); } LispObj * Lisp_PQtty(LispBuiltin *builtin) /* pq-tty connection */ { char *string; PGconn *conn; LispObj *connection; connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); string = PQtty(conn); return (string ? STRING(string) : NIL); } LispObj * Lisp_PQuser(LispBuiltin *builtin) /* pq-user connection */ { char *string; PGconn *conn; LispObj *connection; connection = ARGUMENT(0); if (!CHECKO(connection, PGconn_t)) LispDestroy("%s: cannot convert %s to PGconn*", STRFUN(builtin), STROBJ(connection)); conn = (PGconn*)(connection->data.opaque.data); string = PQuser(conn); return (string ? STRING(string) : NIL); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/string.h0000664000000000000000000000760512472175711015753 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/string.h,v 1.11tsi Exp $ */ #ifndef Lisp_string_h #define Lisp_string_h #include "lisp/internal.h" LispObj *Lisp_AlphaCharP(LispBuiltin*); LispObj *Lisp_BothCaseP(LispBuiltin*); LispObj *Lisp_Char(LispBuiltin*); LispObj *Lisp_CharLess(LispBuiltin*); LispObj *Lisp_CharLessEqual(LispBuiltin*); LispObj *Lisp_CharEqual_(LispBuiltin*); LispObj *Lisp_CharGreater(LispBuiltin*); LispObj *Lisp_CharGreaterEqual(LispBuiltin*); LispObj *Lisp_CharNotEqual_(LispBuiltin*); LispObj *Lisp_CharLessp(LispBuiltin*); LispObj *Lisp_CharNotGreaterp(LispBuiltin*); LispObj *Lisp_CharEqual(LispBuiltin*); LispObj *Lisp_CharGreaterp(LispBuiltin*); LispObj *Lisp_CharNotLessp(LispBuiltin*); LispObj *Lisp_CharNotEqual(LispBuiltin*); LispObj *Lisp_Character(LispBuiltin*); LispObj *Lisp_Characterp(LispBuiltin*); LispObj *Lisp_CharDowncase(LispBuiltin*); LispObj *Lisp_CharInt(LispBuiltin*); LispObj *Lisp_CharUpcase(LispBuiltin*); LispObj *Lisp_DigitChar(LispBuiltin*); LispObj *Lisp_DigitCharP(LispBuiltin*); LispObj *Lisp_IntChar(LispBuiltin*); LispObj *Lisp_GraphicCharP(LispBuiltin*); LispObj *Lisp_LowerCaseP(LispBuiltin*); LispObj *Lisp_MakeString(LispBuiltin*); LispObj *Lisp_ParseInteger(LispBuiltin*); LispObj *Lisp_ReadFromString(LispBuiltin*); LispObj *Lisp_String(LispBuiltin*); LispObj *Lisp_Stringp(LispBuiltin*); LispObj *Lisp_StringTrim(LispBuiltin*); LispObj *Lisp_StringLeftTrim(LispBuiltin*); LispObj *Lisp_StringRightTrim(LispBuiltin*); LispObj *Lisp_NstringTrim(LispBuiltin*); LispObj *Lisp_NstringLeftTrim(LispBuiltin*); LispObj *Lisp_NstringRightTrim(LispBuiltin*); LispObj *Lisp_StringEqual_(LispBuiltin*); LispObj *Lisp_StringLess(LispBuiltin*); LispObj *Lisp_StringGreater(LispBuiltin*); LispObj *Lisp_StringLessEqual(LispBuiltin*); LispObj *Lisp_StringGreaterEqual(LispBuiltin*); LispObj *Lisp_StringNotEqual_(LispBuiltin*); LispObj *Lisp_StringEqual(LispBuiltin*); LispObj *Lisp_StringGreaterp(LispBuiltin*); LispObj *Lisp_StringLessp(LispBuiltin*); LispObj *Lisp_StringNotLessp(LispBuiltin*); LispObj *Lisp_StringNotGreaterp(LispBuiltin*); LispObj *Lisp_StringNotEqual(LispBuiltin*); LispObj *Lisp_NstringUpcase(LispBuiltin*); LispObj *Lisp_StringUpcase(LispBuiltin*); LispObj *Lisp_StringDowncase(LispBuiltin*); LispObj *Lisp_NstringDowncase(LispBuiltin*); LispObj *Lisp_StringCapitalize(LispBuiltin*); LispObj *Lisp_NstringCapitalize(LispBuiltin*); LispObj *Lisp_StringConcat(LispBuiltin*); LispObj *Lisp_UpperCaseP(LispBuiltin*); LispObj *Lisp_XeditCharStore(LispBuiltin*); #endif /* Lisp_string_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/package.c0000664000000000000000000004610312472175711016027 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/package.c,v 1.20tsi Exp $ */ #include "lisp/package.h" #include "lisp/private.h" /* * Prototypes */ static int LispDoSymbol(LispObj*, LispAtom*, int, int); static LispObj *LispReallyDoSymbols(LispBuiltin*, int, int); static LispObj *LispDoSymbols(LispBuiltin*, int, int); static LispObj *LispFindSymbol(LispBuiltin*, int); static LispObj *LispFindPackageOrDie(LispBuiltin*, LispObj*); static void LispDoExport(LispBuiltin*, LispObj*, LispObj*, int); static void LispDoImport(LispBuiltin*, LispObj*); /* * Initialization */ extern LispProperty *NOPROPERTY; static LispObj *Kinternal, *Kexternal, *Kinherited; /* * Implementation */ void LispPackageInit(void) { Kinternal = KEYWORD("INTERNAL"); Kexternal = KEYWORD("EXTERNAL"); Kinherited = KEYWORD("INHERITED"); } LispObj * LispFindPackageFromString(const char *string) { LispObj *list, *package, *nick; for (list = PACK; CONSP(list); list = CDR(list)) { package = CAR(list); if (strcmp(THESTR(package->data.package.name), string) == 0) return (package); for (nick = package->data.package.nicknames; CONSP(nick); nick = CDR(nick)) if (strcmp(THESTR(CAR(nick)), string) == 0) return (package); } return (NIL); } LispObj * LispFindPackage(LispObj *name) { char *string = NULL; if (PACKAGEP(name)) return (name); if (SYMBOLP(name)) string = ATOMID(name)->value; else if (STRINGP(name)) string = THESTR(name); else LispDestroy("FIND-PACKAGE: %s is not a string or symbol", STROBJ(name)); return (LispFindPackageFromString(string)); } int LispCheckAtomString(const char *string) { const char *ptr; if (*string == '\0') return (0); for (ptr = string; *ptr; ptr++) { if (islower(*ptr) || strchr("\"\\;#()`'|:", *ptr) || ((ptr == string || ptr[1] == '\0') && strchr(".,@", *ptr))) return (0); } return (1); } /* This function is used to avoid some namespace polution caused by the * way builtin functions are created, all function name arguments enter * the current package, but most of them do not have a property */ static int LispDoSymbol(LispObj *package, LispAtom *atom, int if_extern, int all_packages) { int dosymbol; /* condition 1: atom package is current package */ dosymbol = !all_packages || atom->package == package; if (dosymbol) { /* condition 2: intern and extern symbols or symbol is extern */ dosymbol = !if_extern || atom->ext; if (dosymbol) { /* condition 3: atom has properties or is in * the current package */ dosymbol = atom->property != NOPROPERTY || package == lisp__data.keyword || package == PACKAGE; } } return (dosymbol); } static LispObj * LispFindPackageOrDie(LispBuiltin *builtin, LispObj *name) { LispObj *package; package = LispFindPackage(name); if (package == NIL) LispDestroy("%s: package %s is not available", STRFUN(builtin), STROBJ(name)); return (package); } /* package must be of type LispPackage_t, symbol type is checked bypass lisp.c:LispExportSymbol() */ static void LispDoExport(LispBuiltin *builtin, LispObj *package, LispObj *symbol, int export) { CHECK_SYMBOL(symbol); if (!export) { if (package == lisp__data.keyword || symbol->data.atom->package == lisp__data.keyword) LispDestroy("%s: symbol %s cannot be unexported", STRFUN(builtin), STROBJ(symbol)); } if (package == PACKAGE) symbol->data.atom->ext = export ? 1 : 0; else { Atom_id string; LispAtom *atom; LispPackage *pack; string = ATOMID(symbol); pack = package->data.package.package; atom = (LispAtom *)hash_check(pack->atoms, string->value, string->length); if (atom) { atom->ext = export ? 1 : 0; return; } LispDestroy("%s: the symbol %s is not available in package %s", STRFUN(builtin), STROBJ(symbol), THESTR(package->data.package.name)); } } static void LispDoImport(LispBuiltin *builtin, LispObj *symbol) { CHECK_SYMBOL(symbol); LispImportSymbol(symbol); } static LispObj * LispReallyDoSymbols(LispBuiltin *builtin, int only_externs, int all_symbols) { int head = lisp__data.env.length; LispPackage *pack = NULL; LispAtom *atom; LispObj *variable, *package = NULL, *list, *code, *result_form; LispObj *init, *body; body = ARGUMENT(1); init = ARGUMENT(0); /* Prepare for loop */ CHECK_CONS(init); variable = CAR(init); CHECK_SYMBOL(variable); if (!all_symbols) { /* if all_symbols, a package name is not specified in the init form */ init = CDR(init); if (!CONSP(init)) LispDestroy("%s: missing package name", STRFUN(builtin)); /* Evaluate package specification */ package = EVAL(CAR(init)); if (!PACKAGEP(package)) package = LispFindPackageOrDie(builtin, package); pack = package->data.package.package; } result_form = NIL; init = CDR(init); if (CONSP(init)) result_form = init; /* Initialize iteration variable */ CHECK_CONSTANT(variable); LispAddVar(variable, NIL); ++lisp__data.env.head; for (list = PACK; CONSP(list); list = CDR(list)) { if (all_symbols) { package = CAR(list); pack = package->data.package.package; } /* Traverse the symbol list, executing body */ for (atom = (LispAtom *)hash_iter_first(pack->atoms); atom; atom = (LispAtom *)hash_iter_next(pack->atoms)) { /* Save pointer to next atom. If variable is removed, * predicatable result is only guaranteed if the bound * variable is removed. */ if (LispDoSymbol(package, atom, only_externs, all_symbols)) { LispSetVar(variable, atom->object); for (code = body; CONSP(code); code = CDR(code)) EVAL(CAR(code)); } } if (!all_symbols) break; } /* Variable is still bound */ for (code = result_form; CONSP(code); code = CDR(code)) EVAL(CAR(code)); lisp__data.env.head = lisp__data.env.length = head; return (NIL); } static LispObj * LispDoSymbols(LispBuiltin *builtin, int only_externs, int all_symbols) { int did_jump, *pdid_jump = &did_jump; LispObj *result, **presult = &result; LispBlock *block; *presult = NIL; *pdid_jump = 1; block = LispBeginBlock(NIL, LispBlockTag); if (setjmp(block->jmp) == 0) { *presult = LispReallyDoSymbols(builtin, only_externs, all_symbols); *pdid_jump = 0; } LispEndBlock(block); if (*pdid_jump) *presult = lisp__data.block.block_ret; return (*presult); } LispObj * LispFindSymbol(LispBuiltin *builtin, int intern) { char *ptr; LispAtom *atom; LispObj *symbol; LispPackage *pack; LispObj *string, *package; package = ARGUMENT(1); string = ARGUMENT(0); CHECK_STRING(string); if (package != UNSPEC) package = LispFindPackageOrDie(builtin, package); else package = PACKAGE; /* If got here, package is a LispPackage_t */ pack = package->data.package.package; /* Search symbol in specified package */ ptr = THESTR(string); RETURN_COUNT = 1; symbol = NULL; /* Fix for current behaviour where NIL and T aren't symbols... */ if (STRLEN(string) == 3 && memcmp(ptr, "NIL", 3) == 0) symbol = NIL; else if (STRLEN(string) == 1 && ptr[0] == 'T') symbol = T; if (symbol) { RETURN(0) = NIL; return (symbol); } atom = (LispAtom *)hash_check(pack->atoms, ptr, strlen(ptr)); if (atom) symbol = atom->object; if (symbol == NULL || symbol->data.atom->package == NULL) { RETURN(0) = NIL; if (intern) { /* symbol does not exist in the specified package, create a new * internal symbol */ if (package == PACKAGE) symbol = ATOM(ptr); else { LispPackage *savepack; LispObj *savepackage; /* Save package environment */ savepackage = PACKAGE; savepack = lisp__data.pack; /* Change package environment */ PACKAGE = package; lisp__data.pack = package->data.package.package; symbol = ATOM(ptr); /* Restore package environment */ PACKAGE = savepackage; lisp__data.pack = savepack; } symbol->data.atom->unreadable = !LispCheckAtomString(ptr); /* If symbol being create in the keyword package, make it external */ if (package == lisp__data.keyword) symbol->data.atom->ext = symbol->data.atom->constant = 1; } else symbol = NIL; } else { if (symbol->data.atom->package == package) RETURN(0) = symbol->data.atom->ext ? Kexternal : Kinternal; else RETURN(0) = Kinherited; } return (symbol); } LispObj * Lisp_DoAllSymbols(LispBuiltin *builtin) /* do-all-symbols init &rest body */ { return (LispDoSymbols(builtin, 0, 1)); } LispObj * Lisp_DoExternalSymbols(LispBuiltin *builtin) /* do-external-symbols init &rest body */ { return (LispDoSymbols(builtin, 1, 0)); } LispObj * Lisp_DoSymbols(LispBuiltin *builtin) /* do-symbols init &rest body */ { return (LispDoSymbols(builtin, 0, 0)); } LispObj * Lisp_FindAllSymbols(LispBuiltin *builtin) /* find-all-symbols string-or-symbol */ { GC_ENTER(); char *string = NULL; LispAtom *atom; LispPackage *pack; LispObj *list, *package, *result; int length = 0; LispObj *string_or_symbol; string_or_symbol = ARGUMENT(0); if (STRINGP(string_or_symbol)) { string = THESTR(string_or_symbol); length = STRLEN(string_or_symbol); } else if (SYMBOLP(string_or_symbol)) { string = ATOMID(string_or_symbol)->value; length = ATOMID(string_or_symbol)->length; } else LispDestroy("%s: %s is not a string or symbol", STRFUN(builtin), STROBJ(string_or_symbol)); result = NIL; /* Traverse all packages, searching for symbols matching specified string */ for (list = PACK; CONSP(list); list = CDR(list)) { package = CAR(list); pack = package->data.package.package; atom = (LispAtom *)hash_check(pack->atoms, string, length); if (atom && LispDoSymbol(package, atom, 0, 1)) { /* Return only one pointer to a matching symbol */ if (result == NIL) { result = CONS(atom->object, NIL); GC_PROTECT(result); } else { /* Put symbols defined first in the * beginning of the result list */ RPLACD(result, CONS(CAR(result), CDR(result))); RPLACA(result, atom->object); } } } GC_LEAVE(); return (result); } LispObj * Lisp_FindSymbol(LispBuiltin *builtin) /* find-symbol string &optional package */ { return (LispFindSymbol(builtin, 0)); } LispObj * Lisp_FindPackage(LispBuiltin *builtin) /* find-package name */ { LispObj *name; name = ARGUMENT(0); return (LispFindPackage(name)); } LispObj * Lisp_Export(LispBuiltin *builtin) /* export symbols &optional package */ { LispObj *list; LispObj *symbols, *package; package = ARGUMENT(1); symbols = ARGUMENT(0); /* If specified, make sure package is available */ if (package != UNSPEC) package = LispFindPackageOrDie(builtin, package); else package = PACKAGE; /* Export symbols */ if (CONSP(symbols)) { for (list = symbols; CONSP(list); list = CDR(list)) LispDoExport(builtin, package, CAR(list), 1); } else LispDoExport(builtin, package, symbols, 1); return (T); } LispObj * Lisp_Import(LispBuiltin *builtin) /* import symbols &optional package */ { int restore_package; LispPackage *savepack = NULL; LispObj *list, *savepackage = NULL; LispObj *symbols, *package; package = ARGUMENT(1); symbols = ARGUMENT(0); /* If specified, make sure package is available */ if (package != UNSPEC) package = LispFindPackageOrDie(builtin, package); else package = PACKAGE; restore_package = package != PACKAGE; if (restore_package) { /* Save package environment */ savepackage = PACKAGE; savepack = lisp__data.pack; /* Change package environment */ PACKAGE = package; lisp__data.pack = package->data.package.package; } /* Export symbols */ if (CONSP(symbols)) { for (list = symbols; CONSP(list); list = CDR(list)) LispDoImport(builtin, CAR(list)); } else LispDoImport(builtin, symbols); if (restore_package) { /* Restore package environment */ PACKAGE = savepackage; lisp__data.pack = savepack; } return (T); } LispObj * Lisp_InPackage(LispBuiltin *builtin) /* in-package name */ { LispObj *package; LispObj *name; name = ARGUMENT(0); package = LispFindPackageOrDie(builtin, name); /* Update pointer to package symbol table */ lisp__data.pack = package->data.package.package; PACKAGE = package; return (package); } LispObj * Lisp_Intern(LispBuiltin *builtin) /* intern string &optional package */ { return (LispFindSymbol(builtin, 1)); } LispObj * Lisp_ListAllPackages(LispBuiltin *builtin) /* list-all-packages */ { /* Maybe this should be read-only or a copy of the package list. * But, if properly implemented, it should be possible to (rplaca) * this variable from lisp code with no problems. Don't do it at home. */ return (PACK); } LispObj * Lisp_MakePackage(LispBuiltin *builtin) /* make-package package-name &key nicknames use */ { GC_ENTER(); LispObj *list, *package, *nicks, *cons, *savepackage; LispObj *package_name, *nicknames, *use; use = ARGUMENT(2); nicknames = ARGUMENT(1); package_name = ARGUMENT(0); /* Check if package already exists */ package = LispFindPackage(package_name); if (package != NIL) /* FIXME: this should be a correctable error */ LispDestroy("%s: package %s already defined", STRFUN(builtin), STROBJ(package_name)); /* Error checks done, package_name is either a symbol or string */ if (!XSTRINGP(package_name)) package_name = STRING(ATOMID(package_name)->value); GC_PROTECT(package_name); /* Check nicknames */ nicks = cons = NIL; for (list = nicknames; CONSP(list); list = CDR(list)) { package = LispFindPackage(CAR(list)); if (package != NIL) /* FIXME: this should be a correctable error */ LispDestroy("%s: nickname %s matches package %s", STRFUN(builtin), STROBJ(CAR(list)), THESTR(package->data.package.name)); /* Store all nicknames as strings */ package = CAR(list); if (!XSTRINGP(package)) package = STRING(ATOMID(package)->value); if (nicks == NIL) { nicks = cons = CONS(package, NIL); GC_PROTECT(nicks); } else { RPLACD(cons, CONS(package, NIL)); cons = CDR(cons); } } /* Check use list */ for (list = use; CONSP(list); list = CDR(list)) (void)LispFindPackageOrDie(builtin, CAR(list)); /* No errors, create new package */ package = LispNewPackage(package_name, nicks); /* Update list of packages */ PACK = CONS(package, PACK); /* No need for gc protection anymore */ GC_LEAVE(); /* Import symbols from use list */ savepackage = PACKAGE; /* Update pointer to package symbol table */ lisp__data.pack = package->data.package.package; PACKAGE = package; if (use != UNSPEC) { for (list = use; CONSP(list); list = CDR(list)) LispUsePackage(LispFindPackage(CAR(list))); } else LispUsePackage(lisp__data.lisp); /* Restore pointer to package symbol table */ lisp__data.pack = savepackage->data.package.package; PACKAGE = savepackage; return (package); } LispObj * Lisp_Packagep(LispBuiltin *builtin) /* packagep object */ { LispObj *object; object = ARGUMENT(0); return (PACKAGEP(object) ? T : NIL); } LispObj * Lisp_PackageName(LispBuiltin *builtin) /* package-name package */ { LispObj *package; package = ARGUMENT(0); package = LispFindPackageOrDie(builtin, package); return (package->data.package.name); } LispObj * Lisp_PackageNicknames(LispBuiltin *builtin) /* package-nicknames package */ { LispObj *package; package = ARGUMENT(0); package = LispFindPackageOrDie(builtin, package); return (package->data.package.nicknames); } LispObj * Lisp_PackageUseList(LispBuiltin *builtin) /* package-use-list package */ { /* If the variable returned by this function is expected to be changeable, * need to change the layout of the LispPackage structure. */ LispPackage *pack; LispObj *package, *use, *cons; package = ARGUMENT(0); package = LispFindPackageOrDie(builtin, package); use = cons = NIL; pack = package->data.package.package; if (pack->use.length) { GC_ENTER(); int i = pack->use.length - 1; use = cons = CONS(pack->use.pairs[i], NIL); GC_PROTECT(use); for (--i; i >= 0; i--) { RPLACD(cons, CONS(pack->use.pairs[i], NIL)); cons = CDR(cons); } GC_LEAVE(); } return (use); } LispObj * Lisp_PackageUsedByList(LispBuiltin *builtin) /* package-used-by-list package */ { GC_ENTER(); int i; LispPackage *pack; LispObj *package, *other, *used, *cons, *list; package = ARGUMENT(0); package = LispFindPackageOrDie(builtin, package); used = cons = NIL; for (list = PACK; CONSP(list); list = CDR(list)) { other = CAR(list); if (package == other) /* Surely package uses itself */ continue; pack = other->data.package.package; for (i = 0; i < pack->use.length; i++) { if (pack->use.pairs[i] == package) { if (used == NIL) { used = cons = CONS(other, NIL); GC_PROTECT(used); } else { RPLACD(cons, CONS(other, NIL)); cons = CDR(cons); } } } } GC_LEAVE(); return (used); } LispObj * Lisp_Unexport(LispBuiltin *builtin) /* unexport symbols &optional package */ { LispObj *list; LispObj *symbols, *package; package = ARGUMENT(1); symbols = ARGUMENT(0); /* If specified, make sure package is available */ if (package != UNSPEC) package = LispFindPackageOrDie(builtin, package); else package = PACKAGE; /* Export symbols */ if (CONSP(symbols)) { for (list = symbols; CONSP(list); list = CDR(list)) LispDoExport(builtin, package, CAR(list), 0); } else LispDoExport(builtin, package, symbols, 0); return (T); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/lsp.c0000664000000000000000000000437612472175711015240 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/lsp.c,v 1.7tsi Exp $ */ #include #include #include "lisp/lisp.h" #ifdef NEED_STRCASECMP int strcasecmp(const char *s1, const char *s2); int strncasecmp(const char *s1, const char *s2, size_t n); #endif #ifdef NEED_REALPATH #include #if defined(ISC) #ifndef MAXPATHLEN #define MAXPATHLEN 1024 #endif #endif char *realpath(const char *pathname, char resolvedname[MAXPATHLEN]); #endif int main(int argc, char *argv[]) { int i; LispBegin(); i = 1; if (argc > 1 && strcmp(argv[1], "-d") == 0) { LispDebug(1); ++i; } if (i < argc) { char buffer[2048]; for (; i < argc; i++) { snprintf(buffer, sizeof(buffer), "(load \"%s\" :if-does-not-exist :error)", argv[i]); LispExecute(buffer); } } else LispMachine(); LispEnd(); return (0); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/package.h0000664000000000000000000000474412472175711016041 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/package.h,v 1.7tsi Exp $ */ #ifndef Lisp_package_h #define Lisp_package_h #include "lisp/internal.h" void LispPackageInit(void); LispObj *LispFindPackage(LispObj*); LispObj *LispFindPackageFromString(const char*); /* returns 1 if string can safely be read back */ int LispCheckAtomString(const char*); LispObj *Lisp_DoAllSymbols(LispBuiltin*); LispObj *Lisp_DoExternalSymbols(LispBuiltin*); LispObj *Lisp_DoSymbols(LispBuiltin*); LispObj *Lisp_FindAllSymbols(LispBuiltin*); LispObj *Lisp_FindPackage(LispBuiltin*); LispObj *Lisp_FindSymbol(LispBuiltin*); LispObj *Lisp_Export(LispBuiltin*); LispObj *Lisp_Import(LispBuiltin*); LispObj *Lisp_InPackage(LispBuiltin*); LispObj *Lisp_Intern(LispBuiltin*); LispObj *Lisp_ListAllPackages(LispBuiltin*); LispObj *Lisp_MakePackage(LispBuiltin*); LispObj *Lisp_Packagep(LispBuiltin*); LispObj *Lisp_PackageName(LispBuiltin*); LispObj *Lisp_PackageNicknames(LispBuiltin*); LispObj *Lisp_PackageUseList(LispBuiltin*); LispObj *Lisp_PackageUsedByList(LispBuiltin*); LispObj *Lisp_Unexport(LispBuiltin*); #endif /* Lisp_package_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/re/0000775000000000000000000000000012472176532014674 5ustar x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/re/rep.h0000664000000000000000000002620412472175711015635 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/re/rep.h,v 1.2 2002/11/15 07:01:33 paulo Exp $ */ #include "re.h" #ifndef _rep_h #define _rep_h /* * Local defines */ #ifdef MIN #undef MIN #endif #define MIN(a, b) ((a) < (b) ? (a) : (b)) #ifdef MAX #undef MAX #endif #define MAX(a, b) ((a) > (b) ? (a) : (b)) /* This value can not be larger than 255, a depth value is the nesting of * repetition operations and alternatives. The number of nested parenthesis * does not matter, but a repetition on the pattern inside the parenthesis * does. Note also that you cannot have more than 9 parenthesis pairs in * an expression. * Depth is always at least 1. So for MAX_DEPTH 8, it is only allowed * 7 complex repetitions. A complex repetition is a dot followed by an * repetition operator. It is called a complex repetition because dot * matches anything but the empty string, so the engine needs to test * all possible combinations until the end of the string is found. * Repetitions like .* use one depth until the end of the string is found, * for example a.*b.*c.*d has depth 4, while a*b*c*d has depth 2. */ #define MAX_DEPTH 8 /* Minimum number of strings to generate a "large" string list, that is, * sort the strings and allocate 512 extra bytes to map the first string * with a given initial byte. */ #define LARGE_STL_COUNT 16 /* * Local types */ /* Intermediate compilation types declaration */ /* (r)egular (e)xpression (c)ompile (c)a(se) */ typedef struct _rec_cse rec_cse; /* (r)egular (e)xpression (c)ompile (r)a(ng)e */ typedef struct _rec_rng rec_rng; /* (r)egular (e)xpression (c)ompile (pat)tern */ typedef struct _rec_pat rec_pat; /* (r)egular (e)xpression (c)ompile (rep)etition */ typedef struct _rec_rep rec_rep; /* (r)egular (e)xpression (c)ompile (gr)ou(p) */ typedef struct _rec_grp rec_grp; /* (r)egular (e)xpression (c)ompile (alt)ernatives */ typedef struct _rec_alt rec_alt; /* Optimization types */ /* (r)egular (e)xpression (c)ompile (st)ring (l)ist */ typedef struct _rec_stl rec_stl; /* Final compilation and execution types */ /* (re)gular expression (inf)ormation */ typedef struct _re_inf re_inf; /* (re)gular expression (eng)ine */ typedef struct _re_eng re_eng; /* Codes used by the engine */ typedef enum { /* Grouping */ Re_Open, /* ( */ Re_Close, /* ) */ Re_Update, /* Like Re_Close, but is inside a loop */ /* Alternatives */ Re_Alt, /* Start alternative list, + next offset */ Re_AltNext, /* Next alternative, + next offset */ Re_AltDone, /* Finish alternative list */ /* Repetition */ Re_AnyTimes, /* * */ Re_Maybe, /* ? */ Re_AtLeast, /* +, at least one */ /* Repetition like */ Re_AnyAnyTimes, /* .* */ Re_AnyMaybe, /* .? */ Re_AnyAtLeast, /* .+ */ Re_AnyEatAnyTimes, /* Expression ends with .* */ Re_AnyEatMaybe, /* Expression ends with .? */ Re_AnyEatAtLeast, /* Expression ends with .+ */ /* Repetition with arguments */ Re_Exact, /* {e} */ Re_Min, /* {n,} */ Re_Max, /* {,m} */ Re_MinMax, /* {n,m} */ /* Repetition helper instruction */ Re_RepJump, /* Special code, go back to repetition */ Re_RepLongJump, /* Jump needs two bytes */ /* After the repetition data, all repetitions have an offset * to the code after the repetition */ /* Matching */ Re_Any, /* . */ Re_Odigit, /* \o */ Re_OdigitNot, /* \O */ Re_Digit, /* \d */ Re_DigitNot, /* \D */ Re_Xdigit, /* \x */ Re_XdigitNot, /* \x */ Re_Space, /* \s */ Re_SpaceNot, /* \S */ Re_Tab, /* \t */ Re_Newline, /* \n */ Re_Lower, /* \l */ Re_Upper, /* \u */ Re_Alnum, /* \w */ Re_AlnumNot, /* \W */ Re_Control, /* \c */ Re_ControlNot, /* \C */ Re_Bol, /* ^ */ Re_Eol, /* $ */ Re_Bow, /* \< */ Re_Eow, /* \> */ /* Range matching information */ Re_Range, /* + 256 bytes */ Re_RangeNot, /* + 256 bytes */ /* Matching with arguments */ Re_Literal, /* + character */ Re_CaseLiteral, /* + lower + upper */ Re_LiteralNot, /* + character */ Re_CaseLiteralNot, /* + lower + upper */ Re_String, /* + length + string */ Re_CaseString, /* + length + string in format lower-upper */ /* These are useful to start matching, or when RE_NOSPEC is used. */ Re_SearchLiteral, Re_SearchCaseLiteral, Re_SearchString, Re_SearchCaseString, Re_StringList, /* + total-length + lengths + strings */ Re_CaseStringList, /* + total-length + lengths + strings */ Re_LargeStringList, /* + total-length + lengths + map + strings */ Re_LargeCaseStringList, /* + total-length + lengths + map + strings */ /* Backreference */ Re_Backref, /* + reference number */ /* The last codes */ Re_DoneIf, /* Done if at end of input */ Re_MaybeDone, /* Done */ Re_Done /* If this code found, finished execution */ } ReCode; /* (r)egular (e)xpresssion (pat)rern (t)ype */ typedef enum _rec_pat_t { Rep_Literal = Re_Literal, Rep_CaseLiteral = Re_CaseLiteral, Rep_LiteralNot = Re_LiteralNot, Rep_CaseLiteralNot = Re_CaseLiteralNot, Rep_Range = Re_Range, Rep_RangeNot = Re_RangeNot, Rep_String = Re_String, Rep_CaseString = Re_CaseString, Rep_SearchLiteral = Re_SearchLiteral, Rep_SearchCaseLiteral = Re_SearchCaseLiteral, Rep_SearchString = Re_SearchString, Rep_SearchCaseString = Re_SearchCaseString, Rep_Any = Re_Any, Rep_AnyAnyTimes = Re_AnyAnyTimes, Rep_AnyEatAnyTimes = Re_AnyEatAnyTimes, Rep_AnyMaybe = Re_AnyMaybe, Rep_AnyEatMaybe = Re_AnyEatMaybe, Rep_AnyAtLeast = Re_AnyAtLeast, Rep_AnyEatAtLeast = Re_AnyEatAtLeast, Rep_Odigit = Re_Odigit, Rep_OdigitNot = Re_OdigitNot, Rep_Digit = Re_Digit, Rep_DigitNot = Re_DigitNot, Rep_Xdigit = Re_Xdigit, Rep_XdigitNot = Re_XdigitNot, Rep_Space = Re_Space, Rep_SpaceNot = Re_SpaceNot, Rep_Tab = Re_Tab, Rep_Newline = Re_Newline, Rep_Lower = Re_Lower, Rep_Upper = Re_Upper, Rep_Alnum = Re_Alnum, Rep_AlnumNot = Re_AlnumNot, Rep_Control = Re_Control, Rep_ControlNot = Re_ControlNot, Rep_Bol = Re_Bol, Rep_Eol = Re_Eol, Rep_Bow = Re_Bow, Rep_Eow = Re_Eow, Rep_Backref = Re_Backref, Rep_StringList = Re_StringList, Rep_Group = Re_Open } rec_pat_t; /* (r)egular (e)xpression (rep)etition (t)ype */ typedef enum _rec_rep_t { Rer_AnyTimes = Re_AnyTimes, Rer_AtLeast = Re_AtLeast, Rer_Maybe = Re_Maybe, Rer_Exact = Re_Exact, Rer_Min = Re_Min, Rer_Max = Re_Max, Rer_MinMax = Re_MinMax } rec_rep_t; /* Decide at re compilation time what is lowercase and what is uppercase */ struct _rec_cse { unsigned char lower; unsigned char upper; }; /* A rec_rng is used only during compilation, just a character map */ struct _rec_rng { unsigned char range[256]; }; /* A rec_pat is used only during compilation, and can be viewed as * a regular expression element like a match to any character, a match * to the beginning or end of the line, etc. * It is implemented as a linked list, and does not have nesting. * The data field can contain: * chr: the value of a single character to match. * cse: the upper and lower case value of a character to match. * rng: a character map to match or not match. * str: a simple string or a string where every two bytes * represents the character to match, in lower/upper * case sequence. * The rep field is not used for strings, strings are broken in the * last character in this case. That is, strings are just a concatenation * of several character matches. */ struct _rec_pat { rec_pat_t type; rec_pat *next, *prev; /* Linked list information */ union { unsigned char chr; rec_cse cse; rec_rng *rng; rec_grp *grp; unsigned char *str; rec_stl *stl; } data; rec_rep *rep; /* Pattern repetition information */ }; /* A rec_rep is used only during compilation, and can be viewed as: * * ? or * or + or {} or {,} or {,} or {,} * * where is "exact", is "minimum" and is "maximum". * In the compiled step it can also be just a NULL pointer, that * is actually equivalent to {1}. */ struct _rec_rep { rec_rep_t type; short mine; /* minimum or exact number of matches */ short maxc; /* maximum number of matches */ }; /* A rec_alt is used only during compilation, and can be viewed as: * * | * * where is any regular expression. The expressions are nested * using the grp field of the rec_pat structure. */ struct _rec_alt { rec_alt *next, *prev; /* Linked list information */ rec_pat *pat; }; /* A rec_grp is a place holder for expressions enclosed in parenthesis * and is linked to the compilation data by an rec_pat structure. */ struct _rec_grp { rec_pat *parent; /* Reference to parent pattern */ rec_alt *alt; /* The pattern information */ rec_alt *palt; /* Parent alternative */ rec_grp *pgrp; /* Nested groups */ int comp; /* (comp)lex repetition pattern inside group */ }; /* Optimization compilation types definition */ /* (r)egular (e)xpression (c)ompile (st)ring (l)ist (t)ype */ typedef enum { Resl_StringList = Re_StringList, Resl_CaseStringList = Re_CaseStringList } rec_stl_t; struct _rec_stl { rec_stl_t type; int nstrs; /* Number of strings in list */ int tlen; /* Total length of all strings */ unsigned char *lens; /* Vector of string lengths */ unsigned char **strs; /* The strings */ }; /* * Prototypes */ /* rep.c */ rec_alt *irec_comp(const char*, const char*, int, int*); void irec_free_alt(rec_alt*); /* reo.c */ int orec_comp(rec_alt*, int); void orec_free_stl(rec_stl*); #endif /* _rep_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/re/tests.txt0000664000000000000000000002160712472175711016603 0ustar # # Copyright (c) 2002 by The XFree86 Project, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # # Except as contained in this notice, the name of the XFree86 Project shall # not be used in advertising or otherwise to promote the sale, use or other # dealings in this Software without prior written authorization from the # XFree86 Project. # # Author: Paulo César Pereira de Andrade # # # $XFree86: xc/programs/xedit/lisp/re/tests.txt,v 1.1 2002/09/08 02:29:50 paulo Exp $ # Some tests for the library: # lines starting with # are comments # lines starting with / are a regular expression pattern # The pattern must end with / and may be followed by: # i -> ignore case # n -> create newline sensitive regex # lines starting with > are a string input to the last pattern # To test newline sensitive matching, add \n to the string. # lines starting with a number are the expected result # If more than one line, every subsequent line is the # value of an "subresult". # :NOMATCH means that the string input should not match # Simple string /abc/ >abc 0,3: abc >aaaaaaaaaaaaaaabc 14,17: abc >xxxxxxxxxxxxxxaaaaaaaaaaaaaaaaabcxx 30,33: abc # String list /abc|bcd|cde/ >abc 0,3: abc >aabc 1,4: abc >xxxbcdef 3,6: bcd >abdzzzcdabcde 8,11: abc >xxxxabdecdabdcde 13,16: cde # Complex string /a?bc|ab?c|abc?/ >abc 0,3: abc >xxxb :NOMATCH >xxxbc 3,5: bc >sssssab 5,7: ab # Another complex string /a*bc|ab*c|abc*/ >aaaaaaabc 0,9: aaaaaaabc >xaaaaaaabc 1,10: aaaaaaabc >xyzaaaaaaabc 3,12: aaaaaaabc >abbc 0,4: abbc >xxabbbbbc 2,9: abbbbbc >abcccccccccc 0,12: abcccccccccc >abccccccccccd 0,12: abcccccccccc >xxxxxxxaaaaaaaaaabbbbbbbbbbbccccccccccc 16,29: abbbbbbbbbbbc >xxxbbbbbbbbbc 11,13: bc # Another complex string /a+bc|ab+c|abc+/ >xxxbc :NOMATCH >xaaabc 1,6: aaabc >zzzzaaaaabbc 8,12: abbc >zzzzaaaabbbbbbcccc 7,15: abbbbbbc # Simple pattern /a.c/ >abc 0,3: abc >aaac 1,4: aac >xac :NOMATCH >xaac 1,4: aac >xxabc 2,5: abc >xxxaxc 3,6: axc # Another simple pattern /a*c/ >c 0,1: c >xxxxxxxxc 8,9: c >xxxxxxxcc 7,8: c >ac 0,2: ac >aaaac 0,5: aaaac >xac 1,3: ac >xxxaac 3,6: aac >xxac 2,4: ac >xxxxac 4,6: ac # Another simple pattern /a+c/ >xxaac 2,5: aac >xxxaaaac 3,8: aaaac >xaaaabac 6,8: ac >xxxc :NOMATCH >xxxxaaaaccc 4,9: aaaac # Another simple pattern /a{4}b/ >xabxxaabxxxaaabxxxxaaaab 19,24: aaaab >aaabaaaab 4,9: aaaab # Another simple pattern /a{4,}b/ >xxxaaaab 3,8: aaaab >zaaabzzzaaaaaaaaaaaaaaaab 8,25: aaaaaaaaaaaaaaaab # Another simple pattern /a{,4}b/ >b 0,1: b >xxxxxxxxb 8,9: b >xaaaaaaaaab 6,11: aaaab >xxxab 3,5: ab >aaaaaxaaab 6,10: aaab # Another simple pattern /a{2,4}b/ >xab :NOMATCH >xaab 1,4: aab >xaaab 1,5: aaab >xxaaaab 2,7: aaaab >xxxaaaaab 4,9: aaaab # Some simple grouping tests /foo(bar|baz)fee/ >feebarbazfoobarfee 9,18: foobarfee 12,15: bar >foofooobazfeefoobazfee 13,22: foobazfee /f(oo|ee)ba[rz]/ >barfoebaz :NOMATCH >bazfoobar 3,9: foobar 4,6: oo >barfeebaz 3,9: feebaz 4,6: ee /\<(int|char)\>/ >aint character int foo 15,18: int 15,18: int # Some complex repetitions /foo.*bar/ >barfoblaboofoobarfoobarfoobar 11,17: foobar /foo.+bar/ >foobar :NOMATCH >fobbarfooxbarfooybar 6,13: fooxbar /foo.?bar/ >xfoobar 1,7: foobar >xxfooxxbar :NOMATCH >yyyfootbar 3,10: footbar # Some nested complex repetitions /a.*b.*c/ >abc 0,3: abc >xxxxxxxxxabbbbbbbccaaaaabbbc 9,18: abbbbbbbc /a.+b.*c/ >xxxabc :NOMATCH >xxaxbbc 2,7: axbbc /a.+b.?c/ >xaabc 1,5: aabc >xxaabbc 2,7: aabbc # Very complex repetitions /(foo.*|bar)fee/ # XXX NOTE # This pattern does not return the correct offset for the group. # Support for this may and may not be added. >barfoofee 3,9: foofee >foobarfee 0,9: foobarfee >xxfobarfee 4,10: barfee >barfooooooobarfee 3,17: fooooooobarfee >xxfobarfeefoobar 4,10: barfee /(foo.+|bar)fee/ >barfoofee :NOMATCH >barfooxfee 3,10: fooxfee /(foo.?|bar)fee/ >foobar :NOMATCH >bafoofee 2,8:foofee >bafooofeebarfee 2,9: fooofee >bafoofeebarfee 2,8: foofee # Simple backreference /(a|b|c)\1/ >aa 0,2: aa 0,1: a /(a|b|c)(a|b|c)\1\2/ >acac 0,4: acac 0,1: a 1,2: c >xxxxacac 4,8: acac 4,5: a 5,6: c >xxacabacbcacbbacbcaaccabcaca 24,28: caca 24,25: c 25,26: a >xyabcccc 4,8: cccc 4,5: c 5,6: c # Complex backreference /(a*b)\1/ >xxxaaaaabaaaaab 3,15: aaaaabaaaaab 3,9: aaaaab /(ab+c)\1/ >xaaabbbcabbbc 3,13: abbbcabbbc 3,8: abbbc /(ab?c)\1/ >abcac :NOMATCH >abcacabcabc 5,11: abcabc 5,8: abc >abcacac 3,7: acac 3,5: acac # Very complex backreference /a(.*)b\1/ >xxxab 3,5: ab 4,4: >xxxxazzzbzzz 4,12: azzzbzzz 5,8: zzz # Case testing /abc/i >AbC 0,3: AbC /[0-9][a-z]+/i >xxx0aaZxYT9 3,10: 0aaZxYT /a.b/i >aaaaaaaaaaaxB 10,13: axB /a.*z/i >xxxAaaaaZ 3,9: AaaaaZ >xxaaaZaaa 2,6: aaaZ /\<(lambda|defun|defmacro)\>/i > (lambda 5,11: lambda 5,11: lambda /\<(nil|t)\>/i >it Nil 3,6: Nil 3,6: Nil /\<(begin|end)\>/i >beginning the ending EnD 21,24: EnD 21,24: EnD # Some newline tests /a.*/n >a\naaa 0,1:a >xyza\naa 3,4: a /a.+/n >a\naaa 2,5: aaa >xyza\naa 5,7: aa /a.?/n >a\naaa 0,1: a >xyza\naa 3,4: a # Newline tests envolving complex patterns /a.*b.*c/n >xxaa\nzyacb\nabc 11,14: abc >xxxab\nabc\nc 6,9: abc /a.+b.*c/n >ab\nbc\nabbc 6,10: abbc /a.?b.*c/n >ab\ncabbc\ncc 4,8: abbc /^foo$/n >bar\nfoobar\nfoo 11,14: foo # Not so complex test involving a newline... /^\s*#\s*(define|include)\s+.+/n >#define\n#include x 8,18: #include x 9,16: include # Check if large strings are working /xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/ >zzzxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzzz 3,259: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx /ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~/ >String here: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~/ 13,333: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890~ # Some complex repetitions not supported # Listed here only to make sure the library is not crashing on these # Repetitions that match an empty match, or an empty string cannot follow # a complex repetition. A complex repetition is: # .* or .+ or .? # .{...} is not supported. /(.*)(\d*)/ :BADRPT /(.*).(\d*)/ :BADRPT /(.*)\<(\d*)/ :BADRPT /(.*)\s(\d*)/ :BADRPT /(.*)\D(\d*)/ :BADRPT # This is a more clear pattern and partially works /(.*)\D(\d+)/ >abcW12 0,6: abcW12 0,3: abc 4,6: 12 >abcW12abcW12 0,6: abcW12 0,3: abc 4,6: 12 # This wasn't working in the previous version, but now with only minimal # matches supported, it works. >abcW12abcW12a 0,6: abcW12 0,3: abc 4,6: 12 # Note the minimal match /.*\d/ >a1a1a1aaaaaaa 0,2: a1 # Check match offsets /(.*)\d/ >a1a1a1aaaaaaa 0,2: a1 0,1: a /.*(\d)/ >a1a1a1aaaaaaa 0,2: a1 1,2: 1 /.*(\d+)/ :BADRPT # Regression fix, was matching empty string /\\\d{3}|\\./ >\\ :NOMATCH /\\.|\\\d{3}/ >\\ :NOMATCH x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/re/re.c0000664000000000000000000017430412472175711015455 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/re/re.c,v 1.8 2002/11/17 07:51:30 paulo Exp $ */ #include #include "rep.h" /* * Types */ /* Information used when generating the final form of the compiled re. */ struct _re_inf { rec_alt *alt; unsigned char *cod; long len; long spc; /* Start offset of special repetition instruction */ long sr[MAX_DEPTH]; /* Jump offset of special repetition instruction */ long sj[MAX_DEPTH]; /* Just a flag, to know if this nesting is for a special repetition */ char sp[MAX_DEPTH]; int bas; /* Alternatives/repetitions depth */ int par; /* Open parenthesis counter */ int ref; /* Backreference counter */ rec_pat *apat; /* Alternatives duplicate patterns * if a special repetition is found, * this is done to somewhat simplify * the bytecode engine and still allow * some complex (and time consuming) * patterns. */ int flags; int ecode; }; /* This structure is not associated with re_cod as it's data only matters * to the current match search. */ struct _re_eng { unsigned char *bas; /* Base string pointer */ unsigned char *str; /* String to search for pattern */ unsigned char *end; /* Where to stop searching */ unsigned char *cod; /* Pointer in the re_cod structure */ long off; /* Number of used entries in so/eo etc */ /* Match offset/nesting information */ long so[MAX_DEPTH]; /* (s)tart of (m)atch */ long eo[MAX_DEPTH]; /* (e)nd of (m)atch */ long sv[MAX_DEPTH]; /* (s)a(v)e match end offset */ long re[MAX_DEPTH]; /* (re)petition count */ long ss[MAX_DEPTH]; /* (s)ave (s)tart of match */ unsigned char *rcod[MAX_DEPTH]; /* restart position in regex code */ unsigned char *rstr[MAX_DEPTH]; /* restart position in string */ /* Group/backreference information */ long goff; long gso[9]; long geo[9]; }; /* * Prototypes */ static void reinit(void); static int rec_check(re_inf*, int); static int rec_code(re_inf*, ReCode); static int rec_byte(re_inf*, int); static int rec_byte_byte(re_inf*, int, int); static int rec_code_byte(re_inf*, ReCode, int); static int rec_length(re_inf*, int); static int rec_code_byte_byte(re_inf*, ReCode, int, int); static int rec_build_alt(re_inf*, rec_alt*); static int rec_build_pat(re_inf*, rec_pat*); static int rec_build_rng(re_inf*, rec_rng*); static int rec_build_grp(re_inf*, rec_grp*); static int rec_build_stl(re_inf*, rec_stl*); static int rec_build_rep(re_inf*, rec_rep*); static int rec_inc_spc(re_inf*); static int rec_dec_spc(re_inf*); static int rec_add_spc(re_inf*, int); static int rec_off_spc(re_inf*); static int rec_alt_spc(re_inf*, int); static int rec_rep_spc(re_inf*, int); #ifdef DEBUG static void redump(re_cod*); #endif /* * Initialization */ unsigned char re__alnum[256]; unsigned char re__odigit[256]; unsigned char re__ddigit[256]; unsigned char re__xdigit[256]; unsigned char re__control[256]; /* * Implementation */ int recomp(re_cod *preg, const char *pattern, int flags) { int i, ecode; re_inf inf; reinit(); preg->cod = NULL; inf.alt = irec_comp(pattern, flags & RE_PEND ? preg->re_endp : pattern + strlen(pattern), flags, &ecode); if (ecode != 0) return (ecode); inf.cod = NULL; inf.len = inf.spc = 0; inf.bas = 0; inf.par = 0; inf.ref = 0; inf.apat = NULL; inf.flags = flags; inf.ecode = 0; for (i = 0; i < MAX_DEPTH; i++) inf.sp[i] = 0; /* First byte is runtime modifier flags */ if (rec_byte(&inf, flags & (RE_NEWLINE | RE_NOSUB)) == 0 && rec_byte(&inf, 0xff) == 0 && rec_build_alt(&inf, inf.alt) == 0 && rec_rep_spc(&inf, 0) == 0 && rec_code(&inf, Re_Done) == 0) { /* Number of possible references, loops will not leave this * value correct, but it is cheap to read it from the second * byte, instead of adding several extra checks in the bytecode. */ if (inf.ref) inf.cod[1] = inf.ref - 1; preg->cod = inf.cod; /* Public structure member */ preg->re_nsub = inf.ref; } irec_free_alt(inf.alt); if (inf.ecode) free(inf.cod); #ifdef DEBUG else if (flags & RE_DUMP) redump(preg); #endif return (inf.ecode); } int reexec(const re_cod *preg, const char *string, int nmatch, re_mat pmat[], int flags) { unsigned char *ptr, *str, newline, nosub; int len, si, ci, bas, i, j, k, l, m; re_eng eng; if (preg == NULL || preg->cod == NULL || nmatch < 0 || ((flags & RE_STARTEND) && (pmat == NULL || pmat[0].rm_eo < pmat[0].rm_so))) return (RE_INVARG); eng.str = (unsigned char*)string; if (flags & RE_STARTEND) { eng.end = eng.str + pmat[0].rm_eo; eng.str += pmat[0].rm_so; } else eng.end = eng.str + strlen(string); eng.bas = eng.str; nosub = preg->cod[0] & RE_NOSUB; newline = preg->cod[0] & RE_NEWLINE; eng.cod = preg->cod + 2; if (!nosub && preg->cod[1] != 0xff) { for (i = 0; i <= preg->cod[1]; i++) { eng.gso[i] = 0; eng.geo[i] = -1; } } /* Setup to search for start of match from the first character */ eng.so[0] = 0; eng.eo[0] = eng.sv[0] = -1; eng.rcod[0] = eng.cod; eng.rstr[0] = eng.str + 1; eng.off = 0; eng.goff = -1; for (ci = si = 1;;) { reset: switch (*eng.cod) { /**************************************************** * One byte codes * ****************************************************/ case Re_Any: if (eng.str == eng.end || (newline && eng.str[0] == '\n')) goto fail; goto match; case Re_AnyEatAnyTimes: if (newline) { for (ptr = eng.str; ptr < eng.end; ptr++) { if (*ptr == '\n') break; } si = ptr - eng.str; } else si = eng.end - eng.str; goto match; case Re_AnyEatMaybe: si = eng.end > eng.str; if (newline && si && eng.str[0] == '\n') si = 0; goto match; case Re_AnyEatAtLeast: if (newline) { for (ptr = eng.str; ptr < eng.end; ptr++) { if (*ptr == '\n') break; } si = ptr - eng.str; } else si = eng.end - eng.str; if (si == 0) { si = 1; goto fail; } goto match; case Re_Odigit: if (eng.str >= eng.end) goto fail; if (re__odigit[eng.str[0]]) goto match; goto fail; case Re_OdigitNot: if (eng.str >= eng.end || re__odigit[eng.str[0]]) goto fail; goto match; case Re_Digit: if (eng.str >= eng.end) goto fail; if (re__ddigit[eng.str[0]]) goto match; goto fail; case Re_DigitNot: if (eng.str >= eng.end || re__ddigit[eng.str[0]]) goto fail; goto match; case Re_Xdigit: if (eng.str >= eng.end) goto fail; if (re__xdigit[eng.str[0]]) goto match; goto fail; case Re_XdigitNot: if (eng.str >= eng.end || re__xdigit[eng.str[0]]) goto fail; goto match; case Re_Space: if (eng.str >= eng.end) goto fail; if (eng.str[0] == ' ' || eng.str[0] == '\t') goto match; goto fail; case Re_SpaceNot: if (eng.str >= eng.end) goto fail; if (eng.str[0] != ' ' && eng.str[0] != '\t') goto match; goto fail; case Re_Tab: if (eng.str >= eng.end) goto fail; if (eng.str[0] == '\t') goto match; goto fail; case Re_Newline: if (eng.str >= eng.end) goto fail; if (eng.str[0] == '\n') goto match; goto fail; case Re_Lower: if (eng.str >= eng.end) goto fail; if (eng.str[0] >= 'a' && eng.str[0] <= 'z') goto match; goto fail; case Re_Upper: if (eng.str >= eng.end) goto fail; if (eng.str[0] >= 'A' && eng.str[0] <= 'Z') goto match; goto fail; case Re_Alnum: if (eng.str >= eng.end) goto fail; if (re__alnum[eng.str[0]]) goto match; goto fail; case Re_AlnumNot: if (eng.str >= eng.end) goto fail; if (re__alnum[eng.str[0]]) goto fail; goto match; case Re_Control: if (eng.str >= eng.end) goto fail; if (re__control[eng.str[0]]) goto match; goto fail; case Re_ControlNot: if (eng.str >= eng.end || re__control[eng.str[0]]) goto fail; goto match; /**************************************************** * One byte codes, match special emtpy strings * ****************************************************/ case Re_Bol: if (eng.str == eng.bas) { if ((flags & RE_NOTBOL)) { /* String does not start at the beginning of a line */ if (newline) goto fail; goto wont; } si = 0; goto match; } if (newline && eng.str[-1] == '\n') { si = 0; goto match; } goto fail; case Re_Eol: if (eng.str == eng.end) { if (flags & RE_NOTEOL) /* String does not finish at the end of a line */ goto wont; si = 0; goto match; } if (newline && eng.str[0] == '\n') { si = 0; goto match; } goto fail; case Re_Bow: if (eng.str >= eng.end || (eng.str > eng.bas && (re__alnum[eng.str[-1]]))) goto fail; if (re__alnum[eng.str[0]]) { si = 0; goto match; } goto fail; case Re_Eow: if (eng.str == eng.bas || (eng.str < eng.end && re__alnum[eng.str[0]])) goto fail; if (re__alnum[eng.str[-1]]) { si = 0; goto match; } goto fail; /**************************************************** * One byte code, one byte argument * ****************************************************/ case Re_Literal: if (eng.str >= eng.end) goto fail; if (eng.str[0] == eng.cod[1]) { ci = 2; goto match; } goto fail; case Re_LiteralNot: if (eng.str >= eng.end) goto fail; if (eng.str[0] != eng.cod[1]) { ci = 2; goto match; } goto fail; case Re_SearchLiteral: for (str = eng.str; str < eng.end; str++) { if (*str == eng.cod[1]) { ci = 2; eng.str = str; goto match; } } /* This bytecode only happens in the toplevel */ eng.so[0] = str - eng.bas; eng.str = str; goto fail; /**************************************************** * One byte code, two bytes argument * ****************************************************/ case Re_CaseLiteral: if (eng.str >= eng.end) goto fail; if (eng.str[0] == eng.cod[1] || eng.str[0] == eng.cod[2]) { ci = 3; goto match; } goto fail; case Re_CaseLiteralNot: if (eng.str >= eng.end) goto fail; if (eng.str[0] != eng.cod[1] && eng.str[0] != eng.cod[2]) { ci = 3; goto match; } goto fail; case Re_SearchCaseLiteral: for (str = eng.str; str < eng.end; str++) { if (*str == eng.cod[1] || *str == eng.cod[2]) { ci = 3; eng.str = str; goto match; } } eng.so[0] = str - eng.bas; eng.str = str; goto fail; /**************************************************** * One byte codes, two arguments, n bytes * ****************************************************/ case Re_String: len = eng.cod[1]; if (len & 0x80) { i = 3; len = (len & 0x7f) + (eng.cod[2] << 7); } else i = 2; if (eng.end - eng.str < len) goto fail; ptr = eng.cod + i; str = eng.str; for (k = len; k > 0; k--) { if (*ptr++ != *str++) goto fail; } ci = i + len; si = len; goto match; case Re_SearchString: len = eng.cod[1]; if (len & 0x80) { i = 3; len = (len & 0x7f) + (eng.cod[2] << 7); } else i = 2; for (str = eng.str; eng.end - str >= len; str = eng.str++) { for (ptr = eng.cod + i, str = eng.str, k = len; k > 0; k--) if (*ptr++ != *str++) break; if (k == 0) { /* Substring found */ ci = i + len; si = str - eng.str; goto match; } } eng.so[0] = eng.end - eng.bas; eng.str = eng.end; goto fail; case Re_CaseString: len = eng.cod[1]; if (len & 0x80) { i = 3; len = (len & 0x7f) + (eng.cod[2] << 7); } else i = 2; len >>= 1; /* Check if there are at least len/2 bytes left, string * is represented as two bytes, lower and upper case */ if (eng.end - eng.str < len) goto fail; ptr = eng.cod + i; str = eng.str; for (k = len; k > 0; str++, ptr += 2, k--) { if (*str != ptr[0] && *str != ptr[1]) goto fail; } ci = i + (len << 1); si = len; goto match; case Re_SearchCaseString: len = eng.cod[1]; if (len & 0x80) { i = 3; len = (len & 0x7f) + (eng.cod[2] << 7); } else i = 2; len >>= 1; for (str = eng.str; eng.end - str >= len; str = eng.str++) { for (ptr = eng.cod + i, str = eng.str, k = len; k > 0; k--, ptr += 2, str++) if (ptr[0] != str[0] && ptr[1] != str[0]) break; if (k == 0) { /* Substring found */ ci = i + (len << 1); si = str - eng.str; goto match; } } eng.so[0] = eng.end - eng.bas; eng.str = eng.end; goto fail; case Re_StringList: /* Number of strings */ k = eng.cod[1]; /* Where to jump after match */ bas = eng.cod[2] | (eng.cod[3] << 8); str = eng.str; ptr = eng.cod + k + 4; l = eng.end - eng.str; for (j = 0; j < k; j++) { len = eng.cod[j + 4]; if (len <= l) { for (i = 0; i < len; i++) if (ptr[i] != str[i]) goto next_stl; goto stl_match; } next_stl: ptr += len; } goto fail; stl_match: ci = bas; si = len; goto match; case Re_CaseStringList: /* Number of strings */ k = eng.cod[1]; /* Where to jump after match */ bas = eng.cod[2] | (eng.cod[3] << 8); str = eng.str; ptr = eng.cod + k + 4; l = eng.end - eng.str; for (j = 0; j < k; j++) { len = eng.cod[j + 4]; if ((len >> 1) <= l) { for (i = m = 0; i < len; m++, i += 2) if (ptr[i] != str[m] && ptr[i + 1] != str[m]) goto next_cstl; goto cstl_match; } next_cstl: ptr += len; } goto fail; cstl_match: ci = bas; si = len >> 1; goto match; case Re_LargeStringList: /* Where to jump after match */ bas = eng.cod[1] | (eng.cod[2] << 8); str = eng.str; /* First entry in index map */ ptr = eng.cod + 3; i = (int)str[0] << 1; j = ptr[i] | (ptr[i + 1] << 8); if (j == 0xffff) /* No entry with this byte */ goto fail; /* Bytes left in input */ l = eng.end - eng.str; /* First entry matching initial byte */ ptr += 512 + j; for (len = ptr[0]; str[0] == ptr[1]; ptr += len + 1, len = ptr[0]) { if (len <= l) { for (i = 1; i < len; i++) { if (ptr[i + 1] != str[i]) goto next_lstl; } ci = bas; si = len; goto match; } next_lstl:; } goto fail; case Re_LargeCaseStringList: /* Where to jump after match */ bas = eng.cod[1] | (eng.cod[2] << 8); str = eng.str; /* First entry in index map */ ptr = eng.cod + 3; i = (int)str[0] << 1; j = ptr[i] | (ptr[i + 1] << 8); if (j == 0xffff) /* No entry with this byte */ goto fail; /* Bytes left in input */ l = eng.end - eng.str; /* First entry matching initial byte */ ptr += 512 + j; for (len = ptr[0]; str[0] == ptr[1] || str[0] == ptr[2]; ptr += len + 1, len = ptr[0]) { if ((k = (len >> 1)) <= l) { for (i = 2, j = 1; i < len; i += 2, j++) { if (ptr[i + 1] != str[j] && ptr[i + 2] != str[j]) goto next_lcstl; } ci = bas; si = k; goto match; } next_lcstl:; } goto fail; /**************************************************** * Character range matching * ****************************************************/ case Re_Range: if (eng.str < eng.end && eng.cod[eng.str[0] + 1]) { ci = 257; goto match; } goto fail; case Re_RangeNot: if (eng.str >= eng.end || eng.cod[eng.str[0] + 1]) goto fail; ci = 257; goto match; /**************************************************** * Group handling * ****************************************************/ case Re_Open: if (++eng.goff >= 9) return (RE_ASSERT); eng.gso[eng.goff] = eng.str - eng.bas; ++eng.cod; continue; case Re_Close: eng.geo[eng.goff] = eng.str - eng.bas; ++eng.cod; continue; case Re_Update: bas = eng.cod[1]; eng.geo[eng.goff] = eng.str - eng.bas; eng.cod += 2; /* + Update + bas */ continue; /**************************************************** * Backreference * ****************************************************/ case Re_Backref: i = eng.cod[1]; j = eng.gso[i]; k = eng.geo[i]; len = k - j; if (k < j || eng.end - eng.str < len) goto fail; ptr = eng.bas + j; str = eng.str; for (l = len; l > 0; l--) { if (*ptr++ != *str++) goto fail; } ci = 2; si = len; goto match; /**************************************************** * Alternatives handling * ****************************************************/ case Re_Alt: bas = eng.off; if (++eng.off >= MAX_DEPTH) return (RE_ASSERT); /* Get offset of next alternative */ i = eng.cod[1] | (eng.cod[2] << 8); /* Setup for next alternative if the current fails */ eng.rcod[eng.off] = eng.cod + i + 1; /* + Alt */ /* If fail, test the next alternative in the same string */ eng.rstr[eng.off] = eng.str; /* Setup match offsets */ if (eng.so[bas] <= eng.eo[bas]) eng.so[eng.off] = eng.eo[bas]; else eng.so[eng.off] = eng.so[bas]; eng.sv[eng.off] = eng.eo[eng.off] = eng.so[eng.off] - 1; /* Save start of possible previous matches */ eng.ss[eng.off] = eng.so[bas]; /* Skip code */ eng.cod += 3; /* Go try the first alternative */ continue; case Re_AltNext: bas = eng.off - 1; /* Check if matched and if it is a better match */ if (eng.eo[eng.off] >= eng.so[eng.off] && eng.sv[eng.off] - eng.so[eng.off] < eng.eo[eng.off] - eng.so[eng.off]) eng.sv[eng.off] = eng.eo[eng.off]; /* Get offset of next alternative */ i = eng.cod[1] | (eng.cod[2] << 8); /* Setup for next alternative if the current fails */ eng.rcod[eng.off] = eng.cod + i + 1; /* + AltNext */ /* Setup match offset */ eng.eo[eng.off] = eng.so[eng.off] - 1; /* Reset string for next alternative */ eng.str = eng.rstr[eng.off]; /* Skip code */ eng.cod += 3; /* Go try the next alternative */ continue; case Re_AltDone: bas = eng.off - 1; /* Check if matched and if it is a better match */ if (eng.sv[eng.off] - eng.so[eng.off] < eng.eo[eng.off] - eng.so[eng.off]) eng.sv[eng.off] = eng.eo[eng.off]; /* If there is a match */ if (eng.sv[eng.off] >= eng.so[eng.off]) { eng.so[bas] = eng.ss[eng.off]; eng.eo[bas] = eng.sv[eng.off]; eng.str = eng.bas + eng.eo[bas]; /* Pop stack and skip code */ --eng.off; ++eng.cod; /* Go try next regular expression pattern */ continue; } /* Failed, reset string and pop stack */ eng.str = eng.rstr[eng.off]; --eng.off; goto fail; /**************************************************** * Repetition * ****************************************************/ /* Note that the repetition counter is not * updated for *, + and ? * it is easy to updated, but since it is not * really useful, code to do it was removed * to save a few cpu cicles. */ #define REPETITION_SETUP() \ if (++eng.off >= MAX_DEPTH) \ return (RE_ASSERT); \ \ /* Return here for recovery if match fail */ \ eng.rcod[eng.off] = eng.cod; \ \ /* Setup match offsets */ \ if (eng.so[bas] <= eng.eo[bas]) \ eng.so[eng.off] = eng.eo[bas]; \ else \ eng.so[eng.off] = eng.so[bas]; \ eng.ss[eng.off] = eng.so[bas]; \ eng.sv[eng.off] = eng.eo[eng.off] = eng.so[eng.off] - 1;\ \ /* Skip repetition instruction */ \ eng.cod += 4; case Re_AnyTimes: bas = eng.cod[1]; if (eng.off == bas) { /* First iteration */ REPETITION_SETUP(); } else { if (eng.eo[eng.off] >= eng.so[eng.off] && eng.eo[eng.off] > eng.sv[eng.off]) { /* Update offset of match */ eng.sv[eng.off] = eng.eo[eng.off]; /* Skip repetition instruction */ eng.cod += 4; } else { /* Match failed but it is ok */ len = eng.cod[2] | (eng.cod[3] << 8); eng.so[bas] = eng.ss[eng.off]; if (eng.sv[eng.off] >= eng.so[eng.off]) /* Something matched earlier, update */ eng.eo[bas] = eng.sv[eng.off]; else if (eng.eo[bas] < eng.so[bas]) /* Empty match */ eng.eo[bas] = eng.so[bas]; /* Try next pattern at correct offset */ eng.str = eng.bas + eng.eo[bas]; /* Pop stack and skip code */ --eng.off; eng.cod += len; } } continue; case Re_Maybe: bas = eng.cod[1]; if (eng.off == bas) { /* First iteration */ REPETITION_SETUP(); } else { /* Matched or first iteration is done */ len = eng.cod[2] | (eng.cod[3] << 8); eng.so[bas] = eng.ss[eng.off]; if (eng.eo[eng.off] > eng.so[eng.off]) { /* Something matched earlier, update */ eng.eo[bas] = eng.eo[eng.off]; eng.str = eng.bas + eng.eo[bas]; /* Don't need to update counter */ } else { /* Empty match */ if (eng.eo[bas] < eng.so[bas]) eng.eo[bas] = eng.so[bas]; /* Try next pattern at correct offset */ eng.str = eng.bas + eng.eo[bas]; } /* Pop stack */ --eng.off; /* Skip code */ eng.cod += len; } continue; case Re_AtLeast: bas = eng.cod[1]; if (eng.off == bas) { /* First iteration */ REPETITION_SETUP(); } else { if (eng.eo[eng.off] >= eng.so[eng.off] && eng.eo[eng.off] > eng.sv[eng.off]) { /* Update offset of match */ eng.sv[eng.off] = eng.eo[eng.off]; /* Skip repetition instruction */ eng.cod += 4; } else { /* Last try failed */ len = eng.cod[2] | (eng.cod[3] << 8); if (eng.sv[eng.off] >= eng.so[eng.off]) { /* Something matched earlier, update */ eng.so[bas] = eng.ss[eng.off]; eng.eo[bas] = eng.sv[eng.off]; eng.str = eng.bas + eng.eo[bas]; } else { /* Do it here, so that the fail label does * not need to do too expensive work for * simple patterns. */ eng.so[bas] = eng.str - eng.bas; /* Zero matches, pop stack and restart */ --eng.off; goto fail; } /* Pop stack and skip code */ --eng.off; eng.cod += len; } } continue; /**************************************************** * Repetition with arguments * ****************************************************/ case Re_Exact: #define COMPLEX_REPETITION_SETUP_0() \ i = eng.cod[1]; \ bas = eng.cod[2]; #define COMPLEX_REPETITION_SETUP() \ /* First iteration */ \ if (++eng.off >= MAX_DEPTH) \ return (RE_ASSERT); \ \ /* Remeber number or repetitions */ \ eng.re[eng.off] = 0; \ \ /* Return here for recovery if match fail */ \ eng.rcod[eng.off] = eng.cod; \ \ /* Setup match offsets */ \ if (eng.so[bas] <= eng.eo[bas]) \ eng.so[eng.off] = eng.eo[bas]; \ else \ eng.so[eng.off] = eng.so[bas]; \ eng.sv[eng.off] = eng.eo[eng.off] = eng.so[eng.off] - 1;\ eng.ss[eng.off] = eng.so[bas]; \ \ /* Skip repetition instruction */ \ eng.cod += 5; COMPLEX_REPETITION_SETUP_0(); if (eng.off == bas) { /* First iteration */ COMPLEX_REPETITION_SETUP(); } else { if (eng.eo[eng.off] >= eng.so[eng.off] && eng.eo[eng.off] > eng.sv[eng.off]) { /* Update offset of match */ eng.sv[eng.off] = eng.eo[eng.off]; /* Update repetition counter */ if (++eng.re[eng.off] == i) { /* Matched the required times */ eng.so[bas] = eng.ss[eng.off]; eng.eo[bas] = eng.sv[eng.off]; eng.str = eng.bas + eng.eo[bas]; /* Update code */ k = eng.cod[3] | (eng.cod[4] << 8); eng.cod += k; /* Pop stack and go for next pattern */ --eng.off; continue; } /* Skip repetition instruction */ eng.cod += 5; } else { /* Do it here, so that the fail label does * not need to do too expensive work for * simple patterns. */ eng.so[bas] = eng.str - eng.bas; /* Pop stack and restart */ --eng.off; goto fail; } } continue; case Re_Min: COMPLEX_REPETITION_SETUP_0(); if (eng.off == bas) { /* First iteration */ COMPLEX_REPETITION_SETUP(); } else { if (eng.eo[eng.off] >= eng.so[eng.off] && eng.eo[eng.off] > eng.sv[eng.off]) { /* Update offset of match */ eng.sv[eng.off] = eng.eo[eng.off]; /* Update repetition counter */ ++eng.re[eng.off]; /* Skip repetition instruction and try again */ eng.cod += 5; } else { /* Match failed! */ if (eng.re[eng.off] < i) { /* Do it here, so that the fail label does * not need to do too expensive work for * simple patterns. */ eng.so[bas] = eng.str - eng.bas; /* Didn't match required number of times */ --eng.off; goto fail; } else { /* Matched minimum number of times */ eng.eo[bas] = eng.sv[eng.off]; eng.str = eng.bas + eng.eo[bas]; k = eng.cod[3] | (eng.cod[4] << 8); /* Update code and pop stack */ eng.cod += k; --eng.off; } } } continue; case Re_Max: COMPLEX_REPETITION_SETUP_0(); if (eng.off == bas) { /* First iteration */ COMPLEX_REPETITION_SETUP(); } else { if (eng.eo[eng.off] >= eng.so[eng.off] && eng.eo[eng.off] > eng.sv[eng.off]) { /* Update offset of match */ eng.sv[eng.off] = eng.eo[eng.off]; /* Update repetition counter */ if (++eng.re[eng.off] == i) { /* Matched the maximum times */ eng.so[bas] = eng.ss[eng.off]; eng.eo[bas] = eng.sv[eng.off]; eng.str = eng.bas + eng.eo[bas]; k = eng.cod[3] | (eng.cod[4] << 8); /* Update code and pop stack */ eng.cod += k; --eng.off; continue; } /* Skip repetition instruction and try again */ eng.cod += 5; } else { /* No matches, but zero matches are ok */ k = eng.cod[3] | (eng.cod[4] << 8); if (eng.sv[eng.off] >= eng.so[eng.off]) { /* Something matched earlier, update */ eng.so[bas] = eng.ss[eng.off]; eng.eo[bas] = eng.sv[eng.off]; eng.str = eng.bas + eng.eo[bas]; } else { /* Empty match */ if (eng.eo[bas] < eng.so[bas]) eng.eo[bas] = eng.so[bas]; /* Try next pattern at correct offset */ eng.str = eng.bas + eng.eo[bas]; } /* Pop stack and update code */ --eng.off; eng.cod += k; } } continue; case Re_MinMax: bas = eng.cod[3]; if (eng.off == bas) { /* First iteration */ COMPLEX_REPETITION_SETUP(); } else { if (eng.eo[eng.off] >= eng.so[eng.off] && eng.eo[eng.off] > eng.sv[eng.off]) { /* Update offset of match */ eng.sv[eng.off] = eng.eo[eng.off]; /* Update repetition counter */ if (++eng.re[eng.off] == eng.cod[2]) { /* Matched the maximum times */ eng.so[bas] = eng.ss[eng.off]; eng.eo[bas] = eng.sv[eng.off]; eng.str = eng.bas + eng.eo[bas]; k = eng.cod[4] | (eng.cod[5] << 8); /* Update code and pop stack */ eng.cod += k; --eng.off; continue; } /* Skip repetition instruction and try again */ eng.cod += 6; } else { /* Match failed! */ if (eng.re[eng.off] < eng.cod[1]) { /* Do it here, so that the fail label does * not need to do too expensive work for * simple patterns. */ eng.so[bas] = eng.str - eng.bas; /* Didn't match required number of times */ --eng.off; goto fail; } else { /* Matched minimum number of times */ eng.so[bas] = eng.ss[eng.off]; eng.eo[bas] = eng.sv[eng.off]; eng.str = eng.bas + eng.eo[bas]; k = eng.cod[4] | (eng.cod[5] << 8); /* Update code and pop stack */ eng.cod += k; --eng.off; } } } continue; /**************************************************** * Special repetition handling * ****************************************************/ case Re_AnyAnyTimes: /* code(1) + bas(1) + gbas(1) + jump(2) */ bas = eng.cod[1]; if (eng.off == bas) { /* First iteration */ if (++eng.off >= MAX_DEPTH) return (RE_ASSERT); /* Return here for recovery if match fail */ eng.rcod[eng.off] = eng.cod; /* If fail, test the next pattern at the same point */ eng.rstr[eng.off] = eng.str; /* Setup match offsets */ eng.so[eng.off] = eng.str - eng.bas; eng.eo[eng.off] = eng.so[eng.off] - 1; if (newline) /* Use the repetition counter to store start of * skipped string, to later check if skipping a * newline. */ eng.re[eng.off] = eng.so[eng.off]; /* Save start of possible previous matches */ eng.ss[eng.off] = eng.so[bas]; /* Skip repetition instruction */ eng.cod += 5; } else { /* -1 as an unsigned char */ if (eng.cod[2] != 0xff) eng.goff = eng.cod[2]; else eng.goff = -1; if (newline) { ptr = eng.bas + eng.re[eng.off]; str = eng.bas + eng.so[eng.off]; for (; ptr < str; ptr++) if (*ptr == '\n') { eng.cod = eng.rcod[0]; eng.so[0] = ptr - eng.bas + 1; eng.eo[0] = eng.so[0] - 1; eng.rstr[0] = eng.str = ptr + 1; eng.off = 0; goto reset; } /* If looping, don't do too many noops */ eng.re[eng.off] = ptr - eng.bas; } if (eng.eo[eng.off] >= eng.so[eng.off]) { /* Note that this is only true if all possibly * nested special repetitions also matched. */ if (eng.goff >= 0) { if (eng.cod[5] == Re_Update) eng.gso[eng.goff] = eng.eo[bas] + (eng.so[bas] > eng.eo[bas]); else if (eng.geo[eng.goff] < eng.so[eng.off]) eng.geo[eng.goff] = eng.so[eng.off]; } /* Jump relative offset */ len = eng.cod[3] | (eng.cod[4] << 8); /* Restore offset from where started trying */ eng.so[bas] = eng.ss[eng.off]; eng.eo[bas] = eng.eo[eng.off]; /* Pop stack and skip code */ --eng.off; eng.cod += len; } else { /* Only give up if the entire string was scanned */ if (eng.str < eng.end) { /* Update restart point for next pattern */ eng.str = ++eng.rstr[eng.off]; /* Reset start of nested match */ eng.so[eng.off] = eng.str - eng.bas; /* Skip repetition instruction */ eng.cod += 5; } else { /* Entire string scanned and failed */ /* Jump relative offset */ len = eng.cod[3] | (eng.cod[4] << 8); /* Restore offset from where started trying */ eng.so[bas] = eng.ss[eng.off]; eng.eo[bas] = eng.ss[eng.off] - 1; /* Pop stack and skip code */ --eng.off; eng.cod += len; } } } continue; /* This is significantly different than matching .* * because it may need to restart several times since it is * possible to find too many false positives, for example: * a.*b => once one "a" is found, scan all * the remaining string searching for a "b" * a.?b => the string may have too many "a"s, but the * first occurrences of "a" may not be followed * by any-character and a "b" or a single "b". */ case Re_AnyMaybe: bas = eng.cod[1]; if (eng.off == bas) { /* First iteration */ if (++eng.off >= MAX_DEPTH) return (RE_ASSERT); /* Return here for recovery if match fail */ eng.rcod[eng.off] = eng.cod; /* First try without eating a byte */ eng.rstr[eng.off] = eng.str; /* Remember this is the first try if match fail */ eng.re[eng.off] = 0; /* Setup match offsets */ eng.so[eng.off] = eng.str - eng.bas; eng.eo[eng.off] = eng.so[eng.off] - 1; /* Save start of possible previous matches */ eng.ss[eng.off] = eng.so[bas]; /* Skip repetition instruction */ eng.cod += 5; } else { /* -1 as an unsigned char */ if (eng.cod[2] != 0xff) eng.goff = eng.cod[2]; else eng.goff = -1; if (eng.eo[eng.off] >= eng.so[eng.off]) { /* Something matched */ if (eng.goff >= 0) { if (eng.cod[5] == Re_Update) eng.gso[eng.goff] = eng.eo[bas] + (eng.so[bas] > eng.eo[bas]); else if (eng.geo[eng.goff] < eng.so[eng.off]) eng.geo[eng.goff] = eng.so[eng.off]; } /* Jump relative offset */ len = eng.cod[3] | (eng.cod[4] << 8); /* Update offset of match */ eng.eo[bas] = eng.eo[eng.off]; /* Pop stack and skip code */ --eng.off; eng.cod += len; } else if (eng.re[eng.off] == 0 && (!newline || eng.rstr[eng.off][1] != '\n')) { /* Try this time skiping a byte */ ++eng.re[eng.off]; /* Reset string, skip code and go try one time more */ eng.str = ++eng.rstr[eng.off]; eng.cod += 5; } else { /* Failed to match */ /* Update offsets */ eng.eo[bas] = eng.ss[eng.off]; eng.so[bas] = eng.eo[bas] + 1; eng.str = eng.rstr[eng.off] + (eng.re[eng.off] == 0); /* Pop stack and return to toplevel code */ --eng.off; if (eng.str >= eng.end) goto wont; eng.cod = eng.rcod[bas]; } } continue; /* .+ almost identical to .* but requires eating at least one byte */ case Re_AnyAtLeast: bas = eng.cod[1]; if (eng.off == bas) { /* First iteration */ if (++eng.off >= MAX_DEPTH) return (RE_ASSERT); /* Return here for recovery if match fail */ eng.rcod[eng.off] = eng.cod; /* Skip one byte for the restart string */ if (newline && eng.str[0] == '\n') { /* Cannot skip newline */ eng.cod = eng.rcod[0]; eng.rstr[0] = ++eng.str; eng.so[0] = eng.str - eng.bas; eng.eo[0] = eng.so[0] - 1; eng.off = 0; goto reset; } eng.rstr[eng.off] = ++eng.str; /* Setup match offsets */ eng.so[eng.off] = eng.str - eng.bas; eng.eo[eng.off] = eng.so[eng.off] - 1; if (newline) /* Use the repetition counter to store start of * skipped string, to later check if skipping a * newline. */ eng.re[eng.off] = eng.so[eng.off]; /* Save start of possible previous matches */ eng.ss[eng.off] = eng.so[bas]; /* Skip repetition instruction */ eng.cod += 5; } else { /* -1 as an unsigned char */ if (eng.cod[2] != 0xff) eng.goff = eng.cod[2]; else eng.goff = -1; if (newline) { ptr = eng.bas + eng.re[eng.off]; str = eng.bas + eng.so[eng.off]; for (; ptr < str; ptr++) if (*ptr == '\n') { eng.cod = eng.rcod[0]; eng.so[0] = ptr - eng.bas + 1; eng.eo[0] = eng.so[0] - 1; eng.rstr[0] = eng.str = ptr + 1; eng.off = 0; goto reset; } /* If looping, don't do too many noops */ eng.re[eng.off] = ptr - eng.bas; } if (eng.eo[eng.off] >= eng.so[eng.off]) { /* Note that this is only true if all possibly * nested special repetitions also matched. */ if (eng.goff >= 0) { if (eng.cod[5] == Re_Update) eng.gso[eng.goff] = eng.eo[bas] + (eng.so[bas] > eng.eo[bas]); else if (eng.geo[eng.goff] < eng.so[eng.off]) eng.geo[eng.goff] = eng.so[eng.off]; } /* Jump relative offset */ len = eng.cod[3] | (eng.cod[4] << 8); /* Restore offset from where started trying */ eng.so[bas] = eng.ss[eng.off]; eng.eo[bas] = eng.eo[eng.off]; /* Pop stack and skip code */ --eng.off; eng.cod += len; } else { /* Only give up if the entire string was scanned */ if (eng.str < eng.end) { /* Update restart point for next pattern */ eng.str = ++eng.rstr[eng.off]; /* Reset start of nested match */ eng.so[eng.off] = eng.str - eng.bas; /* Skip repetition instruction */ eng.cod += 5; } else { /* Entire string scanned and failed */ /* Jump relative offset */ len = eng.cod[3] | (eng.cod[4] << 8); /* Restore offset from where started trying */ eng.so[bas] = eng.ss[eng.off]; eng.eo[bas] = eng.ss[eng.off] - 1; /* Pop stack and skip code */ --eng.off; eng.cod += len; } } } continue; /**************************************************** * Repetition matched! * ****************************************************/ case Re_RepJump: /* eng.cod[1] is toplevel offset of repetition */ if (eng.off > eng.cod[1]) /* If still needs to try matches */ eng.cod -= eng.cod[2]; else eng.cod += 3; /* + RepJump + bas + len-size */ continue; case Re_RepLongJump: /* eng.cod[1] is toplevel offset of repetition */ if (eng.off > eng.cod[1]) /* If still needs to try matches */ eng.cod -= eng.cod[2] | (eng.cod[3] << 8); else eng.cod += 4; /* + RepLongJump + bas + len-size */ continue; /**************************************************** * Finished * ****************************************************/ case Re_DoneIf: if (eng.eo[eng.off] >= eng.so[eng.off]) { eng.so[0] = eng.ss[eng.off]; eng.eo[0] = eng.eo[eng.off]; goto done; } ++eng.cod; continue; case Re_MaybeDone: if (eng.eo[eng.off] >= eng.so[eng.off]) { eng.so[0] = eng.ss[eng.off]; eng.eo[0] = eng.eo[eng.off]; goto done; } ++eng.cod; continue; case Re_Done: goto done; default: /* Fatal internal error */ return (RE_ASSERT); } wont: /* Surely won't match */ if (eng.off == 0) { eng.eo[0] = eng.so[0] - 1; break; } fail: if (eng.off == 0) { /* If the entire string scanned */ if (++eng.str > eng.end) { eng.eo[0] = eng.so[0] - 1; break; } eng.goff = -1; /* Update start of possible match after restart */ if (eng.eo[0] >= eng.so[0]) { /* If first fail */ eng.str = eng.rstr[0]; ++eng.rstr[0]; eng.so[0] = eng.str - eng.bas; eng.eo[0] = eng.so[eng.off] - 1; } else /* Just trying at next byte */ ++eng.so[0]; } else /* Remember this match failed */ eng.eo[eng.off] = eng.so[eng.off] - 1; /* Restart code */ eng.cod = eng.rcod[eng.off]; continue; match: /* If first match */ if (eng.eo[eng.off] < eng.so[eng.off]) { if (eng.off == 0) eng.rstr[0] = eng.str + 1; eng.so[eng.off] = eng.eo[eng.off] = eng.str - eng.bas; } eng.eo[eng.off] += si; eng.cod += ci; eng.str += si; ci = si = 1; continue; done: break; } if (nmatch) { if (flags & RE_STARTEND) len = pmat[0].rm_so; else len = 0; if (!nosub) { if (preg->cod[1] != 0xff) eng.goff = preg->cod[1]; pmat[0].rm_so = eng.so[0]; pmat[0].rm_eo = eng.eo[0]; for (i = 1; i < nmatch; i++) { if (i - 1 <= eng.goff) { pmat[i].rm_so = eng.gso[i - 1]; pmat[i].rm_eo = eng.geo[i - 1]; } else { pmat[i].rm_so = 0; pmat[i].rm_eo = -1; } } if (len) { /* Update offsets, since the match was done in a substring */ j = eng.goff + 2 > nmatch ? nmatch : eng.goff + 2; for (i = 0; i < j; i++) { pmat[i].rm_so += len; pmat[i].rm_eo += len; } } } else { /* Already know these values, allow compiling the regex with * RE_NOSUB to use parenthesis only for grouping, but avoiding * the runtime overhead of keeping track of the subexpression * offsets. */ pmat[0].rm_so = eng.so[0] + len; pmat[0].rm_eo = eng.eo[0] + len; } } return (eng.so[0] <= eng.eo[0] ? 0 : RE_NOMATCH); } int reerror(int ecode, const re_cod *preg, char *ebuffer, int ebuffer_size) { static const char *errors[] = { "No error", "Failed to match", /* NOMATCH */ /* Errors not generated */ "Invalid regular expression", /* BADPAT */ "Invalid collating element", /* ECOLLATE */ "Invalid character class", /* ECTYPE */ "`\' applied to unescapable character", /* EESCAPE */ "Invalid backreference number", /* ESUBREG */ "Brackets `[ ]' not balanced", /* EBRACK */ "Parentheses `( )' not balanced", /* EPAREN */ "Braces `{ }' not balanced", /* EBRACE */ "Invalid repetition count(s) in `{ }'", /* BADBR */ "Invalid character range in `[ ]'", /* ERANGE */ "Out of memory", /* ESPACE */ "`?', `*', or `+' operand invalid", /* BADRPT */ "Empty (sub)expression", /* EMPTY */ "Assertion error - you found a bug", /* ASSERT */ "Invalid argument" /* INVARG */ }; const char *str; if (ecode >= 0 && ecode < sizeof(errors) / sizeof(errors[0])) str = errors[ecode]; else str = "Unknown error"; return (snprintf(ebuffer, ebuffer_size, "%s", str)); } void refree(re_cod *cod) { free(cod->cod); cod->cod = NULL; } static void reinit(void) { int i; static int first = 1; if (!first) return; first = 0; re__alnum['_'] = 1; for (i = '0'; i <= '7'; i++) re__alnum[i] = re__odigit[i] = re__ddigit[i] = re__xdigit[i] = 1; for (; i <= '9'; i++) re__alnum[i] = re__ddigit[i] = re__xdigit[i] = 1; for (i = 'a'; i <= 'f'; i++) re__alnum[i] = re__xdigit[i] = 1; for (; i <= 'z'; i++) re__alnum[i] = 1; for (i = 'A'; i <= 'F'; i++) re__alnum[i] = re__xdigit[i] = 1; for (; i <= 'Z'; i++) re__alnum[i] = 1; for (i = 1; i < 32; i++) re__control[i] = 1; re__control[127] = 1; /* Don't show tabs as control characters */ re__control['\t'] = 0; } static int rec_check(re_inf *inf, int count) { if (inf->len + count >= inf->spc) { int spc; unsigned char *cod; if ((spc = (count % 64)) != 0) spc = 64 - spc; spc += count + inf->spc; if ((cod = realloc(inf->cod, spc)) == NULL) return (inf->ecode = RE_ESPACE); inf->cod = cod; inf->spc = spc; } return (inf->ecode); } static int rec_code(re_inf *inf, ReCode code) { if (rec_check(inf, 1) == 0) inf->cod[inf->len++] = code; return (inf->ecode); } static int rec_byte(re_inf *inf, int value) { if (rec_check(inf, 1) == 0) inf->cod[inf->len++] = value; return (inf->ecode); } static int rec_code_byte(re_inf *inf, ReCode code, int value) { if (rec_check(inf, 2) == 0) { inf->cod[inf->len++] = code; inf->cod[inf->len++] = value; } return (inf->ecode); } static int rec_length(re_inf *inf, int length) { int lo, hi, two; if (length >= 16384) return (inf->ecode = RE_ESPACE); lo = length & 0xff; hi = length & 0xff00; two = ((length > 0x7f) != 0) + 1; if (two == 2) { hi <<= 1; hi |= (lo & 0x80) != 0; lo |= 0x80; } if (rec_check(inf, two) == 0) { inf->cod[inf->len++] = lo; if (two == 2) inf->cod[inf->len++] = hi >> 8; } return (inf->ecode); } static int rec_byte_byte(re_inf *inf, int value0, int value1) { if (rec_check(inf, 2) == 0) { inf->cod[inf->len++] = value0; inf->cod[inf->len++] = value1; } return (inf->ecode); } static int rec_code_byte_byte(re_inf *inf, ReCode code, int value0, int value1) { if (rec_check(inf, 3) == 0) { inf->cod[inf->len++] = code; inf->cod[inf->len++] = value0; inf->cod[inf->len++] = value1; } return (inf->ecode); } static int rec_build_alt(re_inf *inf, rec_alt *alt) { int offset, value, bas = inf->bas + 1; if (alt) { if (alt->next) { if (rec_inc_spc(inf)) return (inf->ecode); /* A real a list of alternatives */ rec_code(inf, Re_Alt); offset = inf->len; /* Remember current offset */ rec_byte_byte(inf, 0, 0); /* Reserve two bytes for retry address */ while (alt && inf->ecode == 0) { if (rec_build_pat(inf, alt->pat)) break; alt = alt->next; if (alt && inf->ecode == 0) { /* Handle (hyper)complex repetitions */ if (inf->bas != bas) { /* Duplicate patterns up to end of expression */ rec_build_pat(inf, inf->apat); /* Restore engine state for next alternative(s) */ rec_alt_spc(inf, bas - 1); } /* If the jump would be so long */ if ((value = inf->len - offset) >= 16384) { inf->ecode = RE_ESPACE; break; } inf->cod[offset] = value & 0xff; inf->cod[offset + 1] = (value & 0xff00) >> 8; rec_code(inf, Re_AltNext); offset = inf->len; rec_byte_byte(inf, 0, 0); } } if (inf->ecode == 0) { /* Handle (hyper)complex repetitions */ if (inf->bas != bas) { /* Duplicate patterns up to end of expression */ rec_build_pat(inf, inf->apat); /* Restore engine state for next alternative(s) */ rec_alt_spc(inf, bas - 1); } /* If the jump would be so long */ if ((value = inf->len - offset) >= 16384) return (inf->ecode = RE_ESPACE); inf->cod[offset] = value & 0xff; inf->cod[offset + 1] = (value & 0xff00) >> 8; /* Last jump is here */ rec_code(inf, Re_AltDone); } rec_dec_spc(inf); } else /* Single alternative */ rec_build_pat(inf, alt->pat); } return (inf->ecode); } static int rec_build_pat(re_inf *inf, rec_pat *pat) { rec_pat *apat; int length, offset = 0, distance, jump = 0, bas = 0; while (pat && inf->ecode == 0) { if (pat->rep) { bas = inf->bas; if (pat->type == Rep_Group && !inf->par && rec_code(inf, Re_Open)) return (inf->ecode); if (rec_inc_spc(inf)) return (inf->ecode); offset = inf->len; if (rec_build_rep(inf, pat->rep)) break; /* Reserve space to jump after repetition done */ jump = inf->len; rec_byte_byte(inf, 0, 0); } switch (pat->type) { case Rep_AnyAnyTimes: case Rep_AnyMaybe: case Rep_AnyAtLeast: if (rec_add_spc(inf, pat->type == Rep_AnyMaybe)) return (inf->ecode); if (rec_code(inf, (ReCode)pat->type) == 0 && rec_byte(inf, inf->bas - 1) == 0 && rec_byte(inf, inf->ref - 1) == 0) rec_off_spc(inf); break; case Rep_Literal: case Rep_LiteralNot: case Rep_SearchLiteral: rec_code_byte(inf, (ReCode)pat->type, pat->data.chr); break; case Rep_CaseLiteral: case Rep_CaseLiteralNot: case Rep_SearchCaseLiteral: rec_code_byte_byte(inf, (ReCode)pat->type, pat->data.cse.lower, pat->data.cse.upper); break; case Rep_Range: case Rep_RangeNot: if (rec_code(inf, (ReCode)pat->type) == 0) rec_build_rng(inf, pat->data.rng); break; case Rep_String: case Rep_SearchString: case Rep_CaseString: case Rep_SearchCaseString: rec_code(inf, (ReCode)pat->type); length = strlen((char*)pat->data.str); if (rec_length(inf, length) == 0 && rec_check(inf, length) == 0) { memcpy(inf->cod + inf->len, pat->data.str, length); inf->len += length; } break; case Rep_Any: case Rep_AnyEatAnyTimes: case Rep_AnyEatMaybe: case Rep_AnyEatAtLeast: case Rep_Odigit: case Rep_OdigitNot: case Rep_Digit: case Rep_DigitNot: case Rep_Xdigit: case Rep_XdigitNot: case Rep_Space: case Rep_SpaceNot: case Rep_Tab: case Rep_Newline: case Rep_Lower: case Rep_Upper: case Rep_Alnum: case Rep_AlnumNot: case Rep_Control: case Rep_ControlNot: case Rep_Bol: case Rep_Eol: case Rep_Bow: case Rep_Eow: rec_code(inf, (ReCode)pat->type); break; case Rep_Backref: rec_code_byte(inf, Re_Backref, pat->data.chr); break; case Rep_Group: if (pat->rep == NULL && !inf->par && rec_code(inf, Re_Open)) break; apat = inf->apat; inf->apat = pat->next; rec_build_grp(inf, pat->data.grp); inf->apat = apat; break; case Rep_StringList: rec_build_stl(inf, pat->data.stl); break; } if (pat->rep) { #if 0 if (rec_dec_spc(inf)) return (inf->ecode); #else if (rec_rep_spc(inf, bas)) return (inf->ecode); #endif distance = inf->len - offset; if (distance > 255) { if (rec_code(inf, Re_RepLongJump) || rec_byte(inf, inf->bas) || rec_byte(inf, distance & 0xff) || rec_byte(inf, (distance & 0xff00) >> 8)) break; } else if (rec_code(inf, Re_RepJump) || rec_byte(inf, inf->bas) || rec_byte(inf, distance)) break; distance = inf->len - offset; inf->cod[jump] = distance & 0xff; inf->cod[jump + 1] = (distance & 0xff00) >> 8; } pat = pat->next; } return (inf->ecode); } static int rec_build_rng(re_inf *inf, rec_rng *rng) { if (rec_check(inf, sizeof(rng->range)) == 0) { memcpy(inf->cod + inf->len, rng->range, sizeof(rng->range)); inf->len += sizeof(rng->range); } return (inf->ecode); } static int rec_build_grp(re_inf *inf, rec_grp *grp) { int par = inf->par; if (!(inf->flags & RE_NOSUB)) { ++inf->par; if (par == 0) ++inf->ref; if (rec_build_alt(inf, grp->alt) == 0) { if (par == 0) { if (grp->comp) rec_code_byte(inf, Re_Update, inf->ref - 1); else rec_code(inf, Re_Close); } } --inf->par; } else rec_build_alt(inf, grp->alt); return (inf->ecode); } static int rec_build_stl(re_inf *inf, rec_stl *stl) { int i, len, rlen; ReCode code; /* Calculate jump distance information */ rlen = stl->tlen + stl->nstrs + 4; /* + code + nstrs + place-offset + data-length */ if (stl->nstrs >= LARGE_STL_COUNT) { rlen += 511; /* Don't write number of strings */ code = stl->type == Rep_StringList ? Re_LargeStringList : Re_LargeCaseStringList; } else code = (ReCode)stl->type; if (rlen >= 16386) return (inf->ecode = RE_ESPACE); if (rec_check(inf, rlen) || rec_code(inf, code)) return (inf->ecode); /* Space is allocated, just write the data */ if (stl->nstrs < LARGE_STL_COUNT) inf->cod[inf->len++] = stl->nstrs; inf->cod[inf->len++] = rlen & 0xff; inf->cod[inf->len++] = (rlen & 0xff00) >> 8; if (stl->nstrs < LARGE_STL_COUNT) { for (i = 0; i < stl->nstrs; i++) inf->cod[inf->len++] = stl->lens[i]; for (i = 0; i < stl->nstrs; i++) { len = stl->lens[i]; if (len > 2) { memcpy(inf->cod + inf->len, stl->strs[i], len); inf->len += len; } else { if (len == 1) inf->cod[inf->len++] = (long)stl->strs[i]; else { inf->cod[inf->len++] = (long)stl->strs[i] & 0xff; inf->cod[inf->len++] = ((long)stl->strs[i] & 0xff00) >> 8; } } } } else { /* The string length goes before the string itself */ int j, chl, chu; /* Fill everything with an invalid jump address */ memset(inf->cod + inf->len, 0xff, 512); for (i = len = 0, j = -1; i < stl->nstrs; i++) { chl = stl->lens[i] > 2 ? stl->strs[i][0] : (long)stl->strs[i] & 0xff; if (chl != j) { inf->cod[inf->len + (chl << 1)] = len & 0xff; inf->cod[inf->len + (chl << 1) + 1] = (len & 0xff00) >> 8; if (code == Re_LargeCaseStringList) { chu = stl->lens[i] > 2 ? stl->strs[i][1] : ((long)(stl->strs[i]) & 0xff00) >> 8; inf->cod[inf->len + (chu << 1)] = len & 0xff; inf->cod[inf->len + (chu << 1) + 1] = (len & 0xff00) >> 8; } j = chl; } len += stl->lens[i] + 1; } inf->len += 512; for (i = 0; i < stl->nstrs; i++) { len = stl->lens[i]; inf->cod[inf->len++] = len; if (len > 2) { memcpy(inf->cod + inf->len, stl->strs[i], len); inf->len += len; } else { if (len == 1) inf->cod[inf->len++] = (long)stl->strs[i]; else { inf->cod[inf->len++] = (long)stl->strs[i] & 0xff; inf->cod[inf->len++] = ((long)stl->strs[i] & 0xff00) >> 8; } } } } return (inf->ecode); } static int rec_build_rep(re_inf *inf, rec_rep *rep) { if (rep) { switch (rep->type) { case Rer_AnyTimes: case Rer_AtLeast: case Rer_Maybe: rec_code(inf, (ReCode)rep->type); break; case Rer_Exact: if (rec_code(inf, Re_Exact) == 0) rec_byte(inf, rep->mine); break; case Rer_Min: if (rec_code(inf, Re_Min) == 0) rec_byte(inf, rep->mine); break; case Rer_Max: if (rec_code(inf, Re_Max) == 0) rec_byte(inf, rep->maxc); break; case Rer_MinMax: if (rec_code(inf, Re_MinMax) == 0 && rec_byte(inf, rep->mine) == 0) rec_byte(inf, rep->maxc); break; } /* It is incremented in rec_build_pat */ rec_byte(inf, inf->bas - 1); } return (inf->ecode); } static int rec_inc_spc(re_inf *inf) { if (++inf->bas >= MAX_DEPTH) return (inf->ecode = RE_ESPACE); return (inf->ecode); } static int rec_dec_spc(re_inf *inf) { if (--inf->bas < 0) return (inf->ecode = RE_ASSERT); return (inf->ecode); } static int rec_add_spc(re_inf *inf, int maybe) { if (++inf->bas >= MAX_DEPTH) return (inf->ecode = RE_ESPACE); inf->sp[inf->bas] = maybe + 1; return (inf->ecode); } /* Could be joined with rec_rep_spc, code almost identical */ static int rec_alt_spc(re_inf *inf, int top) { int distance, i, bas = inf->bas; while ((inf->bas > top) && inf->sp[inf->bas]) { /* Jump to this repetition for cleanup */ distance = inf->len - inf->sr[inf->bas]; /* This will generate a jump to a jump decision opcode */ inf->sj[inf->bas] = inf->len; if (distance > 255) { if (rec_code(inf, Re_RepLongJump) || rec_byte(inf, inf->bas - 1) || rec_byte(inf, distance & 0xff) || rec_byte(inf, (distance & 0xff00) >> 8)) break; } else if (rec_code(inf, Re_RepJump) || rec_byte(inf, inf->bas - 1) || rec_byte(inf, distance)) break; /* Top of stack value before repetition, or end condition value */ --inf->bas; } i = inf->bas + 1; if (inf->ecode == 0 && i <= bas && inf->sp[i]) { /* Only the repetition at the bottom jump to code after testing * all possibilities */ distance = inf->len - inf->sr[i]; inf->cod[inf->sr[i] + 3] = distance & 0xff; inf->cod[inf->sr[i] + 4] = (distance & 0xff00) >> 8; /* The bottom jump is here */ if (rec_code(inf, inf->sp[i] == 1 ? Re_DoneIf : Re_MaybeDone)) return (inf->ecode); /* Generate jumps to the previous special repetition */ for (++i; i <= bas; i++) { if (inf->sp[i]) { distance = inf->sj[i] - inf->sr[i]; inf->cod[inf->sr[i] + 3] = distance & 0xff; inf->cod[inf->sr[i] + 4] = (distance & 0xff00) >> 8; } } } return (inf->ecode); } static int rec_rep_spc(re_inf *inf, int top) { int distance, i, bas = inf->bas; while (inf->bas > top) { if (inf->sp[inf->bas]) { /* Jump to this repetition for cleanup */ distance = inf->len - inf->sr[inf->bas]; /* This will generate a jump to a jump decision opcode */ inf->sj[inf->bas] = inf->len; if (distance > 255) { if (rec_code(inf, Re_RepLongJump) || rec_byte(inf, inf->bas - 1) || rec_byte(inf, distance & 0xff) || rec_byte(inf, (distance & 0xff00) >> 8)) break; } else if (rec_code(inf, Re_RepJump) || rec_byte(inf, inf->bas - 1) || rec_byte(inf, distance)) break; } /* Top of stack value before repetition, or end condition value */ --inf->bas; } /* Find first special repetition offset. XXX This should be a noop */ for (i = 0; i < bas; i++) if (inf->sp[i]) break; if (inf->ecode == 0 && i <= bas && inf->sp[i]) { /* Only the repetition at the bottom jump to code after testing * all possibilities */ distance = inf->len - inf->sr[i]; inf->cod[inf->sr[i] + 3] = distance & 0xff; inf->cod[inf->sr[i] + 4] = (distance & 0xff00) >> 8; /* Generate jumps to the previous special repetition */ for (++i; i <= bas; i++) { if (inf->sp[i]) { distance = inf->sj[i] - inf->sr[i]; inf->cod[inf->sr[i] + 3] = distance & 0xff; inf->cod[inf->sr[i] + 4] = (distance & 0xff00) >> 8; } } } return (inf->ecode); } static int rec_off_spc(re_inf *inf) { /* The jump address before the three bytes instruction */ inf->sr[inf->bas] = inf->len - 3; /* Don't know yet where to go after done with the special * repetition, just reserve two bytes for the jump address. */ return (rec_byte_byte(inf, 0, 0)); } #ifdef DEBUG static void redump(re_cod *code) { int i, j, k; unsigned char *cod = code->cod, *stl; if (cod[0] & RE_NOSUB) printf("Nosub\n"); if (cod[0] & RE_NEWLINE) printf("Newline\n"); ++cod; if (cod[0] != 0xff) printf("%d backrefs\n", cod[0] + 1); ++cod; for (;;) { switch (*cod++) { case Re_Open: printf("Open"); break; case Re_Close: printf("Close"); break; case Re_Update: printf("Update (%d)", (int)*cod++); break; case Re_Alt: printf("Alt"); i = cod[0] | cod[1]; cod += 2; printf(" %d", i); break; case Re_AltNext: printf("Alt-next"); i = cod[0] | cod[1]; cod += 2; printf(" %d", i); break; case Re_AltDone: printf("Alt-done"); break; case Re_AnyTimes: printf("-> Anytimes %d", (int)*cod++); i = cod[0] | (cod[1] << 8); cod += 2; printf(" /%d", i); break; case Re_AnyEatAnyTimes: printf("Any-eat-anytimes"); break; case Re_AnyAnyTimes: printf("-> Any-anytimes %d", (int)*cod++); printf(" (%d)", (int)*cod++); i = cod[0] | (cod[1] << 8); cod += 2; printf(" /%d", i); break; case Re_AnyEatMaybe: printf("Any-eat-maybe"); break; case Re_AnyMaybe: printf("-> Any-maybe %d", (int)*cod++); printf(" (%d)", (int)*cod++); i = cod[0] | (cod[1] << 8); cod += 2; printf(" /%d", i); break; case Re_AnyAtLeast: printf("-> Any-atleast %d", (int)*cod++); printf(" (%d)", (int)*cod++); i = cod[0] | (cod[1] << 8); cod += 2; printf(" /%d", i); break; case Re_AnyEatAtLeast: printf("Any-eat-atleast"); break; case Re_Maybe: printf("-> Maybe %d", (int)*cod++); i = cod[0] | (cod[1] << 8); cod += 2; printf(" /%d", i); break; case Re_AtLeast: printf("-> Atleast %d", (int)*cod++); i = cod[0] | (cod[1] << 8); cod += 2; printf(" /%d", i); break; case Re_Exact: printf("-> Exact "); i = *cod++; printf("%d", i); printf(" %d", (int)*cod++); i = cod[0] | (cod[1] << 8); cod += 2; printf(" /%d", i); break; case Re_Min: printf("-> Min "); i = *cod++; printf("%d", i); printf(" %d", (int)*cod++); i = cod[0] | (cod[1] << 8); cod += 2; printf(" /%d", i); break; case Re_Max: printf("-> Max "); i = *cod++; printf("%d", i); printf(" %d", (int)*cod++); i = cod[0] | (cod[1] << 8); cod += 2; printf(" /%d", i); break; case Re_MinMax: printf("-> Min-max "); i = *cod++; printf("%d ", i); i = *cod++; printf("%d", i); printf(" %d", (int)*cod++); i = cod[0] | (cod[1] << 8); cod += 2; printf(" /%d", i); break; case Re_RepJump: printf("<- Rep-jump %d ", (int)*cod++); i = *cod++; printf("%d", i); break; case Re_RepLongJump: printf("<- Rep-long-jump %d ", (int)*cod++); i = cod[0] | (cod[1] << 8); printf("%d", i); break; case Re_Any: printf("Any"); break; case Re_Odigit: printf("Odigit"); break; case Re_OdigitNot: printf("Odigit-not"); break; case Re_Digit: printf("Digit"); break; case Re_DigitNot: printf("Digit-not"); break; case Re_Xdigit: printf("Xdigit"); break; case Re_XdigitNot: printf("Xdigit-not"); break; case Re_Space: printf("Space"); break; case Re_SpaceNot: printf("Space-not"); break; case Re_Tab: printf("Tab"); break; case Re_Newline: printf("Newline"); break; case Re_Lower: printf("Lower"); break; case Re_Upper: printf("Upper"); break; case Re_Alnum: printf("Alnum"); break; case Re_AlnumNot: printf("Alnum-not"); break; case Re_Control: printf("Control"); break; case Re_ControlNot: printf("Control-not"); break; case Re_Bol: printf("Bol"); break; case Re_Eol: printf("Eol"); break; case Re_Bow: printf("Bow"); break; case Re_Eow: printf("Eow"); break; case Re_Range: printf("Range "); goto range; case Re_RangeNot: printf("Range-not "); range: for (i = 0; i < 256; i += 32) { for (j = k = 0; j < 32; j++) k |= (*cod++ & 1) << (31 - j); printf("%x ", k); } break; case Re_Literal: printf("Literal %c", *cod++); break; case Re_LiteralNot: printf("Literal-not %c", *cod++); break; case Re_SearchLiteral: printf("Search-literal %c", *cod++); break; case Re_CaseLiteral: printf("Case-literal %c", *cod++); putchar(*cod++); break; case Re_CaseLiteralNot: printf("Case-literal-not %c", *cod++); putchar(*cod++); break; case Re_SearchCaseLiteral: printf("Search-case-literal %c", *cod++); putchar(*cod++); break; case Re_String: printf("String "); goto string; case Re_SearchString: printf("Search-string "); goto string; case Re_CaseString: printf("Case-string "); goto string; case Re_SearchCaseString: printf("Search-case-string "); string: i = *cod++; if (i & 0x80) i = (i & 0x7f) | (*cod++ << 7); for (j = 0; j < i; j++) putchar(*cod++); break; case Re_StringList: printf("String-list"); goto string_list; case Re_CaseStringList: printf("Case-string-list"); string_list: j = *cod++; cod += 2; stl = cod + j; for (i = 0; i < j; i++) { k = *cod++; putchar(i ? ',' : ' '); fwrite(stl, k, 1, stdout); stl += k; } cod = stl; break; case Re_LargeStringList: printf("Large-string-list"); large_string_list: i = cod[0] | (cod[1] << 8); stl = cod + i - 1; for (i = 0, cod += 514; cod < stl; i++) { k = *cod++; putchar(i ? ',' : ' '); fwrite(cod, k, 1, stdout); cod += k; } cod = stl; break; case Re_LargeCaseStringList: printf("Large-case-string-list"); goto large_string_list; case Re_Backref: printf("Backref %d", (int)*cod++); break; case Re_DoneIf: printf("Done-if"); break; case Re_MaybeDone: printf("Maybe-done"); break; case Re_Done: printf("Done\n"); return; } putchar('\n'); } } #endif x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/re/rec.c0000664000000000000000000005533312472175711015620 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/re/rec.c,v 1.3 2002/11/15 07:01:33 paulo Exp $ */ #include "rep.h" /* * Types */ /* Information used while compiling the intermediate format of the re. */ typedef struct _irec_info { unsigned char *ptr; /* Pointer in the given regex pattern */ unsigned char *end; /* End of regex pattern */ int flags; /* Compile flags */ rec_alt *alt; /* Toplevel first/single alternative */ rec_alt *palt; /* Current alternative being compiled */ rec_grp *pgrp; /* Current group, if any */ rec_pat *ppat; /* Current pattern, if any */ /* Number of open parenthesis, for error checking */ int nparens; int ngrps; /* Number of groups, for backreference */ int ecode; } irec_info; /* * Prototypes */ /* (i)ntermediate (r)egular (e)xpression (c)ompile * Generates an intermediate stage compiled regex from * the specified pattern argument. Basically builds an * intermediate data structure to analyse and do syntax * error checking. */ static void irec_simple_pattern(irec_info*, rec_pat_t); static void irec_literal_pattern(irec_info*, int); static void irec_case_literal_pattern(irec_info*, int); static void irec_open_group(irec_info*); static void irec_close_group(irec_info*); static void irec_range(irec_info*); static void irec_range_single(irec_info*, int); static void irec_range_complex(irec_info*, int, int); static void irec_escape(irec_info*); static void irec_simple_repetition(irec_info*, rec_rep_t); static void irec_complex_repetition(irec_info*); static void irec_add_repetition(irec_info*, rec_rep*); static void irec_free(irec_info*); static void irec_free_grp(rec_grp*); static void irec_free_pats(rec_pat*); /* * Implementation */ rec_alt * irec_comp(const char *pattern, const char *endp, int flags, int *ecode) { unsigned char *ptr; rec_alt *alt; irec_info inf; if (pattern == NULL || endp < pattern) { *ecode = RE_INVARG; return (NULL); } if (endp == pattern) { *ecode = RE_EMPTY; return (NULL); } alt = calloc(1, sizeof(rec_alt)); if (alt == NULL) { *ecode = RE_ESPACE; return (NULL); } inf.ptr = (unsigned char*)pattern; inf.end = (unsigned char*)endp; inf.flags = flags; inf.alt = inf.palt = alt; inf.pgrp = NULL; inf.ppat = NULL; inf.nparens = inf.ngrps = 0; inf.ecode = 0; if (flags & RE_NOSPEC) { /* Just searching for a character or substring */ for (; inf.ecode == 0 && inf.ptr < inf.end; inf.ptr++) { if (!(flags & RE_ICASE) || (!isupper(*inf.ptr) && !islower(*inf.ptr))) irec_literal_pattern(&inf, *inf.ptr); else irec_case_literal_pattern(&inf, *inf.ptr); } } /* inf.ptr = inf.end is nul if flags & RE_NOSPEC */ for (; inf.ecode == 0 && inf.ptr < inf.end;) { switch (*inf.ptr++) { case '*': irec_simple_repetition(&inf, Rer_AnyTimes); break; case '+': irec_simple_repetition(&inf, Rer_AtLeast); break; case '?': irec_simple_repetition(&inf, Rer_Maybe); break; case '.': irec_simple_pattern(&inf, Rep_Any); break; case '^': if (flags & RE_NEWLINE) /* It is up to the user decide if this can match */ irec_simple_pattern(&inf, Rep_Bol); else { for (ptr = inf.ptr - 1; ptr > (unsigned char*)pattern && *ptr == '('; ptr--) ; /* If at the start of a pattern */ if (ptr == (unsigned char*)pattern || *ptr == '|') irec_simple_pattern(&inf, Rep_Bol); else /* In the middle of a pattern, treat as literal */ irec_literal_pattern(&inf, '^'); } break; case '$': if (flags & RE_NEWLINE) irec_simple_pattern(&inf, Rep_Eol); else { /* Look ahead to check if is the last char of a group */ for (ptr = inf.ptr; ptr < inf.end && *ptr == ')'; ptr++) ; if (*ptr == '\0' || *ptr == '|') /* Last character of pattern, an EOL match */ irec_simple_pattern(&inf, Rep_Eol); else /* Normal character */ irec_literal_pattern(&inf, '$'); } break; case '(': irec_open_group(&inf); break; case ')': /* Look ahead to check if need to close the group now */ ptr = inf.ptr; if (*ptr != '*' && *ptr != '+' && *ptr != '?' && *ptr != '{') /* If a repetition does not follow */ irec_close_group(&inf); else if (inf.pgrp == NULL) /* A repetition follows, but current group is implicit */ inf.ecode = RE_EPAREN; else /* Can do this as next character is known */ inf.ppat = NULL; break; case '[': irec_range(&inf); break; case ']': irec_literal_pattern(&inf, ']'); break; case '{': irec_complex_repetition(&inf); break; case '}': irec_literal_pattern(&inf, '}'); break; case '|': /* If first character in the pattern */ if (inf.ptr - 1 == (unsigned char*)pattern || /* If last character in the pattern */ inf.ptr >= inf.end || /* If empty pattern */ inf.ptr[0] == '|' || inf.ptr[0] == ')') inf.ecode = RE_EMPTY; else { rec_alt *alt = calloc(1, sizeof(rec_alt)); if (alt) { alt->prev = inf.palt; inf.palt->next = alt; inf.palt = alt; inf.ppat = NULL; } else inf.ecode = RE_ESPACE; } break; case '\\': irec_escape(&inf); break; default: if (!(flags & RE_ICASE) || (!isupper(inf.ptr[-1]) && !islower(inf.ptr[-1]))) irec_literal_pattern(&inf, inf.ptr[-1]); else irec_case_literal_pattern(&inf, inf.ptr[-1]); break; } } /* Check if not all groups closed */ if (inf.ecode == 0 && inf.nparens) inf.ecode = RE_EPAREN; if (inf.ecode == 0) inf.ecode = orec_comp(inf.alt, flags); /* If an error generated */ if (inf.ecode) { irec_free(&inf); alt = NULL; } *ecode = inf.ecode; return (alt); } void irec_free_alt(rec_alt *alt) { rec_alt *next; while (alt) { next = alt->next; irec_free_pats(alt->pat); free(alt); alt = next; } } static void irec_simple_pattern(irec_info *inf, rec_pat_t type) { rec_pat *pat; /* Always add a new pattern to list */ if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { inf->ecode = RE_ESPACE; return; } pat->type = type; if ((pat->prev = inf->ppat) != NULL) inf->ppat->next = pat; else inf->palt->pat = pat; inf->ppat = pat; } static void irec_literal_pattern(irec_info *inf, int value) { int length; rec_pat *pat; unsigned char chr, *str; /* If there is a current pattern */ if (inf->ppat && inf->ppat->rep == NULL) { switch (inf->ppat->type) { case Rep_Literal: /* Start literal string */ chr = inf->ppat->data.chr; if ((str = malloc(16)) == NULL) { inf->ecode = RE_ESPACE; return; } inf->ppat->type = Rep_String; inf->ppat->data.str = str; str[0] = chr; str[1] = value; str[2] = '\0'; return; case Rep_String: /* Augments literal string */ length = strlen((char*)inf->ppat->data.str); if ((length % 16) >= 14) { if ((str = realloc(inf->ppat->data.str, length + 18)) == NULL) { inf->ecode = RE_ESPACE; return; } inf->ppat->data.str = str; } inf->ppat->data.str[length] = value; inf->ppat->data.str[length + 1] = '\0'; return; default: /* Anything else is added as a new pattern list element */ break; } } if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { inf->ecode = RE_ESPACE; return; } pat->type = Rep_Literal; pat->data.chr = value; if ((pat->prev = inf->ppat) != NULL) inf->ppat->next = pat; else inf->palt->pat = pat; inf->ppat = pat; } static void irec_case_literal_pattern(irec_info *inf, int value) { int length; rec_pat *pat; unsigned char plower, pupper, lower, upper, *str; lower = tolower(value); upper = toupper(value); /* If there is a current pattern */ if (inf->ppat && inf->ppat->rep == NULL) { switch (inf->ppat->type) { case Rep_CaseLiteral: /* Start case literal string */ plower = inf->ppat->data.cse.lower; pupper = inf->ppat->data.cse.upper; if ((str = malloc(32)) == NULL) { inf->ecode = RE_ESPACE; return; } inf->ppat->type = Rep_CaseString; inf->ppat->data.str = str; str[0] = plower; str[1] = pupper; str[2] = lower; str[3] = upper; str[4] = '\0'; return; case Rep_CaseString: /* Augments case literal string */ length = strlen((char*)inf->ppat->data.str); if (((length) % 32) >= 28) { if ((str = realloc(inf->ppat->data.str, length + 36)) == NULL) { inf->ecode = RE_ESPACE; return; } inf->ppat->data.str = str; } inf->ppat->data.str[length] = lower; inf->ppat->data.str[length + 1] = upper; inf->ppat->data.str[length + 2] = '\0'; return; default: /* Anything else is added as a new pattern list element */ break; } } if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { inf->ecode = RE_ESPACE; return; } pat->type = Rep_CaseLiteral; pat->data.cse.lower = lower; pat->data.cse.upper = upper; pat->prev = inf->ppat; if ((pat->prev = inf->ppat) != NULL) inf->ppat->next = pat; else inf->palt->pat = pat; inf->ppat = pat; } static void irec_open_group(irec_info *inf) { rec_pat *pat; rec_alt *alt; rec_grp *grp; if ((grp = calloc(1, sizeof(rec_grp))) == NULL) { inf->ecode = RE_ESPACE; return; } if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { free(grp); inf->ecode = RE_ESPACE; return; } if ((alt = calloc(1, sizeof(rec_alt))) == NULL) { free(grp); free(pat); inf->ecode = RE_ESPACE; return; } pat->type = Rep_Group; pat->data.grp = grp; grp->parent = pat; grp->palt = inf->palt; grp->pgrp = inf->pgrp; grp->alt = alt; grp->comp = 0; if ((pat->prev = inf->ppat) != NULL) inf->ppat->next = pat; else inf->palt->pat = pat; inf->palt = alt; inf->ppat = NULL; /* Only toplevel parenthesis supported */ if (++inf->nparens == 1) ++inf->ngrps; inf->pgrp = grp; } static void irec_close_group(irec_info *inf) { if (inf->pgrp == NULL) { inf->ecode = RE_EPAREN; return; } inf->palt = inf->pgrp->palt; inf->ppat = inf->pgrp->parent; inf->pgrp = inf->pgrp->pgrp; --inf->nparens; } static void irec_range(irec_info *inf) { int count; rec_pat *pat; rec_rng *rng; int not = inf->ptr[0] == '^'; if (not) ++inf->ptr; pat = calloc(1, sizeof(rec_pat)); if (pat == NULL) { inf->ecode = RE_ESPACE; return; } rng = calloc(1, sizeof(rec_rng)); if (pat == NULL) { free(pat); inf->ecode = RE_ESPACE; return; } pat->data.rng = rng; pat->type = not ? Rep_RangeNot : Rep_Range; if ((pat->prev = inf->ppat) != NULL) inf->ppat->next = pat; else inf->palt->pat = pat; inf->ppat = pat; /* First pass, add everything seen */ for (count = 0; inf->ecode == 0; count++) { /* If bracket not closed */ if (inf->ptr == inf->end) { inf->ecode = RE_EBRACK; return; } /* If not the first character */ else if (inf->ptr[0] == ']' && count) break; else { /* If not a range of characters */ if (inf->ptr[1] != '-' || inf->ptr[2] == ']') { irec_range_single(inf, inf->ptr[0]); ++inf->ptr; } else { if ((inf->flags & RE_NEWLINE) && inf->ptr[0] < '\n' && inf->ptr[2] > '\n') { /* Unless it is forced to be a delimiter, don't allow * a newline in a character range */ if (inf->ptr[0] == '\n' - 1) irec_range_single(inf, inf->ptr[0]); else irec_range_complex(inf, inf->ptr[0], '\n' - 1); if (inf->ptr[2] == '\n' + 1) irec_range_single(inf, inf->ptr[2]); else irec_range_complex(inf, '\n' + 1, inf->ptr[2]); } else irec_range_complex(inf, inf->ptr[0], inf->ptr[2]); inf->ptr += 3; } } } /* Skip ] */ ++inf->ptr; } static void irec_range_single(irec_info *inf, int value) { if (value >= 0 && value <= 255) inf->ppat->data.rng->range[value] = 1; if (inf->flags & RE_ICASE) { if (islower(value)) { value = toupper(value); if (value >= 0 && value <= 255) inf->ppat->data.rng->range[value] = 1; } else if (isupper(value)) { value = tolower(value); if (value >= 0 && value <= 255) inf->ppat->data.rng->range[value] = 1; } } } static void irec_range_complex(irec_info *inf, int chrf, int chrt) { if (chrf > chrt) { inf->ecode = RE_ERANGE; return; } for (; chrf <= chrt; chrf++) irec_range_single(inf, chrf); } static void irec_escape(irec_info *inf) { rec_pat *pat; unsigned char chr = inf->ptr[0]; if (chr == 0) { inf->ecode = RE_EESCAPE; return; } ++inf->ptr; switch (chr) { case 'o': irec_simple_pattern(inf, Rep_Odigit); break; case 'O': irec_simple_pattern(inf, Rep_OdigitNot); break; case 'd': irec_simple_pattern(inf, Rep_Digit); break; case 'D': irec_simple_pattern(inf, Rep_DigitNot); break; case 'x': irec_simple_pattern(inf, Rep_Xdigit); break; case 'X': irec_simple_pattern(inf, Rep_XdigitNot); break; case 's': irec_simple_pattern(inf, Rep_Space); break; case 'S': irec_simple_pattern(inf, Rep_SpaceNot); break; case 't': irec_simple_pattern(inf, Rep_Tab); break; case 'n': irec_simple_pattern(inf, Rep_Newline); break; case 'l': irec_simple_pattern(inf, Rep_Lower); break; case 'u': irec_simple_pattern(inf, Rep_Upper); break; case 'w': irec_simple_pattern(inf, Rep_Alnum); break; case 'W': irec_simple_pattern(inf, Rep_AlnumNot); break; case 'c': irec_simple_pattern(inf, Rep_Control); break; case 'C': irec_simple_pattern(inf, Rep_ControlNot); break; case '<': irec_simple_pattern(inf, Rep_Bow); break; case '>': irec_simple_pattern(inf, Rep_Eow); break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if ((inf->flags & RE_NOSUB) || (chr -= '1') >= inf->ngrps) { inf->ecode = RE_ESUBREG; return; } if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { inf->ecode = RE_ESPACE; return; } pat->type = Rep_Backref; pat->data.chr = chr; pat->prev = inf->ppat; if (inf->ppat) inf->ppat->next = pat; else inf->palt->pat = pat; inf->ppat = pat; break; /* True literals */ case '0': irec_literal_pattern(inf, '\0'); break; case 'a': irec_literal_pattern(inf, '\a'); break; case 'b': irec_literal_pattern(inf, '\b'); break; case 'f': irec_literal_pattern(inf, '\f'); break; case 'r': irec_literal_pattern(inf, '\r'); break; case 'v': irec_literal_pattern(inf, '\v'); break; default: /* Don't check if case insensitive regular expression */ irec_literal_pattern(inf, chr); break; } } static void irec_simple_repetition(irec_info *inf, rec_rep_t type) { rec_rep *rep; /* If nowhere to add repetition */ if ((inf->pgrp == NULL && inf->ppat == NULL) || /* If repetition already added to last/current pattern */ (inf->pgrp == NULL && inf->ppat->rep != NULL) || /* If repetition already added to last/current group */ (inf->ppat == NULL && inf->pgrp->parent->rep != NULL)) { inf->ecode = RE_BADRPT; return; } if ((rep = calloc(1, sizeof(rec_rep))) == NULL) { inf->ecode = RE_ESPACE; return; } rep->type = type; irec_add_repetition(inf, rep); } static void irec_complex_repetition(irec_info *inf) { int exact; rec_rep *rep; long mine, maxc; unsigned char *end; /* If nowhere to add repetition */ if ((inf->pgrp == NULL && inf->ppat == NULL) || /* If repetition already added to last/current pattern */ (inf->pgrp == NULL && inf->ppat->rep != NULL) || /* If repetition already added to last/current group */ (inf->ppat == NULL && inf->pgrp->parent->rep != NULL)) { inf->ecode = RE_EBADBR; return; } exact = 0; mine = maxc = -1; if (inf->ptr[0] == ',') /* Specify max number of ocurrences only */ goto domax; else if (!isdigit(inf->ptr[0])) goto badbr; mine = strtol((char*)inf->ptr, (char**)&end, 10); inf->ptr = end; if (inf->ptr[0] == '}') { exact = 1; ++inf->ptr; goto redone; } else if (inf->ptr[0] != ',') goto badbr; domax: /* Add one to skip comma */ ++inf->ptr; if (inf->ptr[0] == '}') { ++inf->ptr; goto redone; } else if (!isdigit(inf->ptr[0])) goto badbr; maxc = strtol((char*)inf->ptr, (char**)&end, 10); inf->ptr = end; if (inf->ptr[0] != '}') goto badbr; ++inf->ptr; redone: if (mine == maxc) { maxc = -1; exact = 1; } /* Check range and if min-max parameters are valid */ if (mine >= 255 || maxc >= 255 || (mine >= 0 && maxc >= 0 && mine > maxc)) goto badbr; /* Check for noop */ if (exact && mine == 1) return; if ((rep = calloc(1, sizeof(rec_rep))) == NULL) { inf->ecode = RE_ESPACE; return; } /* Convert {0,1} to ? */ if (mine == 0 && maxc == 1) rep->type = Rer_Maybe; else if (exact) { rep->type = Rer_Exact; rep->mine = mine; } /* Convert {0,} to * */ else if (mine == 0 && maxc == -1) rep->type = Rer_AnyTimes; /* Convert {1,} to + */ else if (mine == 1 && maxc == -1) rep->type = Rer_AtLeast; else if (maxc == -1) { rep->type = Rer_Min; rep->mine = mine; } else if (mine < 1) { rep->type = Rer_Max; rep->maxc = maxc; } else { rep->type = Rer_MinMax; rep->mine = mine; rep->maxc = maxc; } irec_add_repetition(inf, rep); return; badbr: inf->ecode = RE_EBADBR; } /* The rep argument is allocated and has no reference yet, * if something fails it must be freed before returning. */ static void irec_add_repetition(irec_info *inf, rec_rep *rep) { int length; rec_pat *pat; rec_grp *grp; rec_rep_t rept; unsigned char value, upper; rept = rep->type; if (inf->ppat == NULL) { rec_pat *any; rec_grp *grp = inf->pgrp; if (rept == Rer_AnyTimes || rept == Rer_Maybe || rept == Re_AtLeast) { /* Convert (.)* to (.*), ((.))* not handled and may not match */ any = NULL; if (grp->alt && grp->alt->pat) { for (any = grp->alt->pat; any->next; any = any->next) ; switch (any->type) { case Rep_Any: break; case Rep_AnyAnyTimes: case Rep_AnyMaybe: case Rep_AnyAtLeast: free(rep); inf->ecode = RE_BADRPT; return; default: any = NULL; break; } } if (any) { free(rep); rep = NULL; any->type = (rept == Rer_AnyTimes) ? Rep_AnyAnyTimes : (rept == Rer_AtLeast) ? Rep_AnyAtLeast : Rep_AnyMaybe; while (grp) { ++grp->comp; grp = grp->pgrp; } } } inf->pgrp->parent->rep = rep; irec_close_group(inf); return; } switch (inf->ppat->type) { case Rep_Bol: case Rep_Eol: case Rep_Bow: case Rep_Eow: case Rep_AnyAnyTimes: case Rep_AnyMaybe: case Rep_AnyAtLeast: /* Markers that cannot repeat */ free(rep); inf->ecode = RE_BADRPT; return; case Rep_Any: grp = inf->pgrp; free(rep); if (rept == Rer_AnyTimes || rept == Rer_Maybe || rept == Rer_AtLeast) { inf->ppat->type = (rept == Rer_AnyTimes) ? Rep_AnyAnyTimes : (rept == Rer_Maybe) ? Rep_AnyMaybe : Rep_AnyAtLeast; while (grp) { ++grp->comp; grp = grp->pgrp; } } else /* XXX Not (yet) implemented */ inf->ecode = RE_BADRPT; rep = NULL; break; case Rep_String: if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { free(rep); inf->ecode = RE_ESPACE; return; } length = strlen((char*)inf->ppat->data.str); pat->type = Rep_Literal; pat->prev = inf->ppat; pat->data.chr = inf->ppat->data.str[length - 1]; if (length == 2) { /* Must convert to two Rep_Literals */ value = inf->ppat->data.str[0]; free(inf->ppat->data.str); inf->ppat->data.chr = value; inf->ppat->type = Rep_Literal; } else /* Must remove last character from string */ inf->ppat->data.str[length - 1] = '\0'; inf->ppat->next = pat; inf->ppat = pat; break; case Rep_CaseString: if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { free(rep); inf->ecode = RE_ESPACE; return; } length = strlen((char*)inf->ppat->data.str); pat->type = Rep_CaseLiteral; pat->prev = inf->ppat; pat->data.cse.lower = inf->ppat->data.str[length - 2]; pat->data.cse.upper = inf->ppat->data.str[length - 1]; if (length == 4) { /* Must convert to two Rep_CaseLiterals */ value = inf->ppat->data.str[0]; upper = inf->ppat->data.str[1]; free(inf->ppat->data.str); inf->ppat->data.cse.lower = value; inf->ppat->data.cse.upper = upper; inf->ppat->next = pat; inf->ppat->type = Rep_CaseLiteral; } else /* Must remove last character pair from string */ inf->ppat->data.str[length - 2] = '\0'; inf->ppat->next = pat; inf->ppat = pat; break; default: /* Anything else does not need special handling */ break; } inf->ppat->rep = rep; } static void irec_free(irec_info *inf) { irec_free_alt(inf->alt); } static void irec_free_grp(rec_grp *grp) { if (grp->alt) irec_free_alt(grp->alt); free(grp); } static void irec_free_pats(rec_pat *pat) { rec_pat *next; rec_pat_t rect; while (pat) { next = pat->next; if (pat->rep) free(pat->rep); rect = pat->type; if (rect == Rep_Range || rect == Rep_RangeNot) free(pat->data.rng); else if (rect == Rep_Group) irec_free_grp(pat->data.grp); else if (rect == Rep_StringList) orec_free_stl(pat->data.stl); free(pat); pat = next; } } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/re/tests.c0000664000000000000000000001236412472175711016206 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86$ */ /* * Compile with: cc -o tests tests.c -L. -lre */ #include #include #include "re.h" int main(int argc, char *argv[]) { re_cod cod; re_mat mat[10]; int line, ecode, i, len, group, failed; long eo, so; char buf[8192]; char str[8192]; FILE *fp = fopen("tests.txt", "r"); if (fp == NULL) { fprintf(stderr, "failed to open tests.txt\n"); exit(1); } ecode = line = group = failed = 0; cod.cod = NULL; while (fgets(buf, sizeof(buf), fp)) { ++line; if (buf[0] == '#' || buf[0] == '\n') continue; else if (buf[0] == '/') { char *ptr = strrchr(buf, '/'); if (ptr == buf) { fprintf(stderr, "syntax error at line %d\n", line); break; } else { int flags = 0; refree(&cod); for (*ptr++ = '\0'; *ptr; ptr++) { if (*ptr == 'i') flags |= RE_ICASE; else if (*ptr == 'n') flags |= RE_NEWLINE; } ecode = recomp(&cod, buf + 1, flags); failed = ecode; } } else if (buf[0] == '>') { if (cod.cod == NULL) { fprintf(stderr, "no previous pattern at line %d\n", line); break; } len = strlen(buf) - 1; buf[len] = '\0'; strcpy(str, buf + 1); for (i = 0, --len; i < len - 1; i++) { if (str[i] == '\\') { memmove(str + i, str + i + 1, len); --len; switch (str[i]) { case 'a': str[i] = '\a'; break; case 'b': str[i] = '\b'; break; case 'f': str[i] = '\f'; break; case 'n': str[i] = '\n'; break; case 'r': str[i] = '\r'; break; case 't': str[i] = '\t'; break; case 'v': str[i] = '\v'; break; default: break; } } } group = 0; ecode = reexec(&cod, str, 10, &mat[0], 0); if (ecode && ecode != RE_NOMATCH) { reerror(failed, &cod, buf, sizeof(buf)); fprintf(stderr, "%s, at line %d\n", buf, line); break; } } else if (buf[0] == ':') { if (failed) { len = strlen(buf) - 1; buf[len] = '\0'; if (failed == RE_EESCAPE && strcmp(buf, ":EESCAPE") == 0) continue; if (failed == RE_ESUBREG && strcmp(buf, ":ESUBREG") == 0) continue; if (failed == RE_EBRACK && strcmp(buf, ":EBRACK") == 0) continue; if (failed == RE_EPAREN && strcmp(buf, ":EPAREN") == 0) continue; if (failed == RE_EBRACE && strcmp(buf, ":EBRACE") == 0) continue; if (failed == RE_EBADBR && strcmp(buf, ":EBADBR") == 0) continue; if (failed == RE_ERANGE && strcmp(buf, ":ERANGE") == 0) continue; if (failed == RE_ESPACE && strcmp(buf, ":ESPACE") == 0) continue; if (failed == RE_BADRPT && strcmp(buf, ":BADRPT") == 0) continue; if (failed == RE_EMPTY && strcmp(buf, ":EMPTY") == 0) continue; reerror(failed, &cod, buf, sizeof(buf)); fprintf(stderr, "Error value %d doesn't match: %s, at line %d\n", failed, buf, line); break; } else if (!ecode) { fprintf(stderr, "found match when shoudn't, at line %d\n", line); break; } } else { if (failed) { reerror(failed, &cod, buf, sizeof(buf)); fprintf(stderr, "%s, at line %d\n", buf, line); break; } if (sscanf(buf, "%ld,%ld:", &so, &eo) != 2) { fprintf(stderr, "expecting match offsets at line %d\n", line); break; } else if (ecode) { fprintf(stderr, "didn't match, at line %d\n", line); break; } else if (group >= 10) { fprintf(stderr, "syntax error at line %d (too many groups)\n", line); break; } else if (so != mat[group].rm_so || eo != mat[group].rm_eo) { fprintf(stderr, "match failed at line %d, got %ld,%ld: ", line, mat[group].rm_so, mat[group].rm_eo); if (mat[group].rm_so < mat[group].rm_eo) fwrite(str + mat[group].rm_so, mat[group].rm_eo - mat[group].rm_so, 1, stderr); fputc('\n', stderr); break; } ++group; } } fclose(fp); return (ecode); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/re/re.h0000664000000000000000000000675712472175711015470 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/re/re.h,v 1.1 2002/09/08 02:29:50 paulo Exp $ */ #include #include #include #ifndef _re_h #define _re_h /* * Defines */ /* Compile flags options */ #define REG_BASIC 0000 /* Not used */ #define REG_EXTENDED 0001 /* Not used, only extended supported */ #define RE_ICASE 0002 #define RE_NOSUB 0004 #define RE_NEWLINE 0010 #define RE_NOSPEC 0020 #define RE_PEND 0040 #define RE_DUMP 0200 /* Execute flag options */ #define RE_NOTBOL 1 #define RE_NOTEOL 2 #define RE_STARTEND 4 #define RE_TRACE 00400 /* Not used/supported */ #define RE_LARGE 01000 /* Not used/supported */ #define RE_BACKR 02000 /* Not used/supported */ /* Value returned by reexec when match fails */ #define RE_NOMATCH 1 /* Compile error values */ #define RE_BADPAT 2 #define RE_ECOLLATE 3 #define RE_ECTYPE 4 #define RE_EESCAPE 5 #define RE_ESUBREG 6 #define RE_EBRACK 7 #define RE_EPAREN 8 #define RE_EBRACE 9 #define RE_EBADBR 10 #define RE_ERANGE 11 #define RE_ESPACE 12 #define RE_BADRPT 13 #define RE_EMPTY 14 #define RE_ASSERT 15 #define RE_INVARG 16 #define RE_ATOI 255 /* Not used/supported */ #define RE_ITOA 0400 /* Not used/supported */ /* * Types */ /* (re)gular expression (mat)ch result */ typedef struct _re_mat { long rm_so; long rm_eo; } re_mat; /* (re)gular expression (cod)e */ typedef struct _re_cod { unsigned char *cod; int re_nsub; /* Public member */ const char *re_endp; /* Support for RE_PEND */ } re_cod; /* * Prototypes */ /* compile the given pattern string * returns 0 on success, error code otherwise */ int recomp(re_cod *preg, const char *pattern, int flags); /* execute the compiled pattern on the string. * returns 0 if matched, RE_NOMATCH if failed, error code otherwise */ int reexec(const re_cod *preg, const char *string, int nmat, re_mat pmat[], int flags); /* formats an error message for the given code in ebuffer */ int reerror(int ecode, const re_cod *preg, char *ebuffer, int ebuffer_size); /* frees the given parameter */ void refree(re_cod *preg); #endif /* _re_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/re/reo.c0000664000000000000000000003707712472175711015641 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/re/reo.c,v 1.8 2002/09/29 02:55:01 paulo Exp $ */ #include "rep.h" /* * This file is a placeholder to add code to analyse and optimize the * intermediate data structure generated in rep.c. * Character ranges are optimized while being generated. */ /* * Types */ typedef struct _orec_inf { rec_alt *alt; /* Main alternatives list */ rec_grp *grp; /* Current group pointer */ int flags; int ecode; } orec_inf; /* * Prototypes */ static int orec_alt(orec_inf*, rec_alt*); static int orec_pat(orec_inf*, rec_pat*); static int orec_grp(orec_inf*, rec_grp*); static int orec_pat_bad_rpt(orec_inf*, rec_pat*); static int orec_pat_bad_forward_rpt(orec_inf*, rec_pat*); static int orec_pat_rng(orec_inf*, rec_pat*); static int orec_pat_cse(orec_inf*, rec_pat*); static int orec_pat_cse_can(orec_inf*, rec_pat*); static int orec_str_list(orec_inf*, rec_alt*, int, int); /* * Initialization */ extern unsigned char re__alnum[256]; extern unsigned char re__odigit[256]; extern unsigned char re__ddigit[256]; extern unsigned char re__xdigit[256]; extern unsigned char re__control[256]; /* * Implementation */ int orec_comp(rec_alt *alt, int flags) { orec_inf inf; inf.alt = alt; inf.grp = NULL; inf.flags = flags; inf.ecode = 0; orec_alt(&inf, alt); return (inf.ecode); } void orec_free_stl(rec_stl *stl) { int i; for (i = 0; i < stl->nstrs; i++) { if (stl->lens[i] > 2) free(stl->strs[i]); } free(stl->lens); free(stl->strs); free(stl); } static int orec_alt(orec_inf *inf, rec_alt *alt) { if (alt) { rec_alt *ptr = alt; int ret, count = 0, str = 1, cstr = 1, lits = 0, clits = 0; /* Check if can build a string list */ if (ptr->next) { /* If more than one alternative */ while (ptr && (str || cstr)) { if (ptr->pat == NULL || ptr->pat->rep != NULL) { cstr = str = 0; break; } if ((inf->flags & RE_ICASE)) { if (!(ret = orec_pat_cse_can(inf, ptr->pat))) { cstr = str = 0; break; } if (ret == 1) ++lits; else if (ret == 2) ++clits; } else if (ptr->pat->next == NULL) { if (ptr->pat->type != Rep_String) { if (ptr->pat->type != Rep_Literal) { str = 0; if (ptr->pat->type != Rep_CaseString) { if (ptr->pat->type != Rep_CaseLiteral) cstr = 0; else ++clits; } else if (strlen((char*)ptr->pat->data.str) >= 255) str = cstr = 0; } else ++lits; } else if (strlen((char*)ptr->pat->data.str) >= 255) str = cstr = 0; } else { str = cstr = 0; break; } if (++count >= 255) str = cstr = 0; ptr = ptr->next; } if (str || cstr) { if (inf->flags & RE_ICASE) { for (ptr = alt; ptr; ptr = ptr->next) { if (orec_pat_cse(inf, ptr->pat)) return (inf->ecode); } str = 0; } return (orec_str_list(inf, alt, str, count)); } } else if (alt == inf->alt && alt->pat && alt->pat->rep == NULL) { /* If the toplevel single alternative */ switch (alt->pat->type) { /* One of these will always be true for RE_NOSPEC, * but can also be optimized for simple patterns */ case Rep_Literal: alt->pat->type = Rep_SearchLiteral; break; case Rep_CaseLiteral: alt->pat->type = Rep_SearchCaseLiteral; break; case Rep_String: alt->pat->type = Rep_SearchString; break; case Rep_CaseString: alt->pat->type = Rep_SearchCaseString; break; default: break; } } while (alt) { orec_pat(inf, alt->pat); alt = alt->next; } } return (inf->ecode); } static int orec_pat(orec_inf *inf, rec_pat *pat) { rec_pat *next; while (pat) { switch (pat->type) { case Rep_AnyAnyTimes: if (pat->next == NULL) { rec_grp *grp = inf->grp; next = NULL; while (grp) { next = grp->parent->next; /* Cannot check if is .*$ as the input * may be a substring */ if (next) break; grp = grp->pgrp; } if (next == NULL) { /* .* */ pat->type = Rep_AnyEatAnyTimes; grp = inf->grp; while (grp) { --grp->comp; next = grp->parent->next; if (next) break; grp = grp->pgrp; } } else if (orec_pat_bad_rpt(inf, next)) return (inf->ecode); } else if (orec_pat_bad_rpt(inf, pat->next)) return (inf->ecode); break; case Rep_AnyMaybe: if (pat->next == NULL) { rec_grp *grp = inf->grp; next = NULL; while (grp) { next = grp->parent->next; if (next) break; grp = grp->pgrp; } if (next == NULL) { /* .? */ pat->type = Rep_AnyEatMaybe; grp = inf->grp; while (grp) { --grp->comp; next = grp->parent->next; if (next) break; grp = grp->pgrp; } } else if (orec_pat_bad_rpt(inf, next)) return (inf->ecode); } else if (orec_pat_bad_rpt(inf, pat->next)) return (inf->ecode); break; case Rep_AnyAtLeast: if (pat->next == NULL) { rec_grp *grp = inf->grp; next = NULL; while (grp) { next = grp->parent->next; if (next) break; grp = grp->pgrp; } if (next == NULL) { /* .+ */ pat->type = Rep_AnyEatAtLeast; grp = inf->grp; while (grp) { --grp->comp; next = grp->parent->next; if (next) break; grp = grp->pgrp; } } else if (orec_pat_bad_rpt(inf, next)) return (inf->ecode); } else if (orec_pat_bad_rpt(inf, pat->next)) return (inf->ecode); break; case Rep_Range: case Rep_RangeNot: orec_pat_rng(inf, pat); break; case Rep_Group: orec_grp(inf, pat->data.grp); break; default: break; } pat = pat->next; } return (inf->ecode); } static int orec_pat_bad_rpt(orec_inf *inf, rec_pat *pat) { switch (pat->type) { /* Not really an error, but aren't supported by the library. * Includes: .*.*, .+? .**, (.*)(*), etc. */ /* Not a repetition, but mathes anything... */ case Rep_Any: /* Zero length matches */ case Rep_Eol: if (!(inf->flags & RE_NEWLINE)) break; case Rep_Bol: case Rep_Bow: case Rep_Eow: /* Repetitions */ case Rep_AnyAnyTimes: case Rep_AnyMaybe: case Rep_AnyAtLeast: inf->ecode = RE_BADRPT; break; /* Check if the first group element is a complex pattern */ case Rep_Group: if (pat->rep == NULL) { if (pat->data.grp->alt) { for (pat = pat->data.grp->alt->pat; pat; pat = pat->next) { if (orec_pat_bad_rpt(inf, pat)) break; } } break; } /*FALLTHROUGH*/ default: if (pat->rep) inf->ecode = RE_BADRPT; break; } if (!inf->ecode && pat && pat->next) orec_pat_bad_forward_rpt(inf, pat->next); return (inf->ecode); } static int orec_pat_bad_forward_rpt(orec_inf *inf, rec_pat *pat) { if (pat->rep) { switch (pat->rep->type) { case Rer_MinMax: if (pat->rep->mine > 0) break; case Rer_AnyTimes: case Rer_Maybe: case Rer_Max: inf->ecode = RE_BADRPT; default: break; } } else if (pat->type == Rep_Group && pat->data.grp->alt && pat->data.grp->alt->pat) orec_pat_bad_forward_rpt(inf, pat->data.grp->alt->pat); return (inf->ecode); } static int orec_grp(orec_inf *inf, rec_grp *grp) { rec_grp *prev = inf->grp; inf->grp = grp; orec_alt(inf, grp->alt); /* Could also just say: inf->grp = grp->gparent */ inf->grp = prev; return (inf->ecode); } static int orec_pat_rng(orec_inf *inf, rec_pat *pat) { int i, j[2], count; rec_pat_t type = pat->type; unsigned char *range = pat->data.rng->range; for (i = count = j[0] = j[1] = 0; i < 256; i++) { if (range[i]) { if (count == 2) { ++count; break; } j[count++] = i; } } if (count == 1 || (count == 2 && ((islower(j[0]) && toupper(j[0]) == j[1]) || (isupper(j[0]) && tolower(j[0]) == j[1])))) { free(pat->data.rng); if (count == 1) { pat->data.chr = j[0]; pat->type = type == Rep_Range ? Rep_Literal : Rep_LiteralNot; } else { pat->data.cse.upper = j[0]; pat->data.cse.lower = j[1]; pat->type = type == Rep_Range ? Rep_CaseLiteral : Rep_CaseLiteralNot; } } else { if (memcmp(re__alnum, range, 256) == 0) type = type == Rep_Range ? Rep_Alnum : Rep_AlnumNot; else if (memcmp(re__odigit, range, 256) == 0) type = type == Rep_Range ? Rep_Odigit : Rep_OdigitNot; else if (memcmp(re__ddigit, range, 256) == 0) type = type == Rep_Range ? Rep_Digit : Rep_DigitNot; else if (memcmp(re__xdigit, range, 256) == 0) type = type == Rep_Range ? Rep_Xdigit : Rep_XdigitNot; else if (memcmp(re__control, range, 256) == 0) type = type == Rep_Range ? Rep_Control : Rep_ControlNot; if (type != pat->type) { free(pat->data.rng); pat->type = type; } } return (inf->ecode); } /* Join patterns if required, will only fail on memory allocation failure: */ static int orec_pat_cse(orec_inf *inf, rec_pat *pat) { rec_pat_t type; int i, len, length; rec_pat *ptr, *next; unsigned char *str, *tofree; if (pat->next == NULL && pat->type == Rep_CaseString) return (inf->ecode); type = Rep_CaseString; /* First calculate how many bytes will be required */ for (ptr = pat, length = 1; ptr; ptr = ptr->next) { switch (ptr->type) { case Rep_Literal: length += 2; break; case Rep_String: length += strlen((char*)ptr->data.str) << 1; break; case Rep_CaseLiteral: length += 2; break; case Rep_CaseString: length += strlen((char*)ptr->data.str); break; default: break; } } if ((str = malloc(length)) == NULL) return (inf->ecode = RE_ESPACE); for (ptr = pat, length = 0; ptr; ptr = next) { tofree = NULL; next = ptr->next; switch (ptr->type) { case Rep_Literal: str[length++] = ptr->data.chr; str[length++] = ptr->data.chr; break; case Rep_String: tofree = ptr->data.str; len = strlen((char*)tofree); for (i = 0; i < len; i++) { str[length++] = tofree[i]; str[length++] = tofree[i]; } break; case Rep_CaseLiteral: str[length++] = ptr->data.cse.lower; str[length++] = ptr->data.cse.upper; break; case Rep_CaseString: tofree = ptr->data.str; len = strlen((char*)tofree); memcpy(str + length, tofree, len); length += len; break; default: break; } if (tofree) free(tofree); if (ptr != pat) free(ptr); } str[length] = '\0'; pat->type = type; pat->data.str = str; pat->next = NULL; return (inf->ecode); } /* Return 0 if the patterns in the list cannot be merged, 1 if will * be a simple string, 2 if a case string. * This is useful when building an alternative list that is composed * only of strings, but the regex is case insensitive, in wich case * the first pass may have splited some patterns, but if it is a member * of an alternatives list, the cost of using a string list is smaller */ static int orec_pat_cse_can(orec_inf *inf, rec_pat *pat) { int ret; if (pat == NULL) return (0); for (ret = 1; pat; pat = pat->next) { if (pat->rep) return (0); switch (pat->type) { case Rep_Literal: case Rep_String: break; case Rep_CaseLiteral: case Rep_CaseString: ret = 2; break; default: return (0); } } return (ret); } /* XXX If everything is a (case) byte, the pattern should be * [abcde] instead of a|b|c|d|e (or [aAbBcCdDeE] instead of aA|bB|cC|dD|eE) * as a string list works fine, but as a character range * should be faster, and maybe could be converted here. But not * very important, if performance is required, it should have already * been done in the pattern. */ static int orec_str_list(orec_inf *inf, rec_alt *alt, int str, int count) { rec_stl *stl; rec_pat *pat; rec_alt *ptr, *next; int i, j, tlen, len, is; if ((stl = calloc(1, sizeof(rec_stl))) == NULL) return (inf->ecode = RE_ESPACE); if ((stl->lens = malloc(sizeof(unsigned char) * count)) == NULL) { free(stl); return (inf->ecode = RE_ESPACE); } if ((stl->strs = malloc(sizeof(char*) * count)) == NULL) { free(stl->lens); free(stl); return (inf->ecode = RE_ESPACE); } if ((pat = calloc(1, sizeof(rec_pat))) == NULL) { free(stl->strs); free(stl->lens); free(stl); return (inf->ecode = RE_ESPACE); } pat->data.stl = stl; pat->type = Rep_StringList; stl->type = str ? Resl_StringList : Resl_CaseStringList; for (i = tlen = 0, ptr = alt; i < count; i++) { next = ptr->next; switch (ptr->pat->type) { case Rep_Literal: is = len = 1; break; case Rep_CaseLiteral: is = len = 2; break; default: is = 0; len = strlen((char*)ptr->pat->data.str); break; } tlen += len; stl->lens[i] = len; if (!is) { if (len > 2) stl->strs[i] = ptr->pat->data.str; else { if (len == 1) stl->strs[i] = (void*)(long)(ptr->pat->data.str[0]); else stl->strs[i] = (void*)(long) (ptr->pat->data.str[0] | ((int)ptr->pat->data.str[1] << 8)); free(ptr->pat->data.str); } } else { if (is == 1) stl->strs[i] = (void*)(long)ptr->pat->data.chr; else stl->strs[i] = (void*)(long) (ptr->pat->data.cse.lower | (ptr->pat->data.cse.upper << 8)); } free(ptr->pat); if (i) free(ptr); ptr = next; } stl->tlen = tlen; stl->nstrs = count; alt->pat = pat; alt->next = NULL; { int li, lj; unsigned char ci, cj, *str; /* Don't need a stable sort, there shouldn't be duplicated strings, * but don't check for it either. Only need to make sure that all * strings that start with the same byte are together */ for (i = 0; i < count; i++) { li = stl->lens[i]; ci = li > 2 ? stl->strs[i][0] : (long)stl->strs[i] & 0xff; for (j = i + 1; j < count; j++) { lj = stl->lens[j]; cj = lj > 2 ? stl->strs[j][0] : (long)stl->strs[j] & 0xff; if ((count >= LARGE_STL_COUNT && cj < ci) || (cj == ci && lj > li)) { /* If both strings start with the same byte, * put the longer first */ str = stl->strs[j]; stl->strs[j] = stl->strs[i]; stl->strs[i] = str; stl->lens[j] = li; stl->lens[i] = lj; li ^= lj; lj ^= li; li ^= lj; ci ^= cj; cj ^= ci; ci ^= cj; } } } } return (inf->ecode); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/re/README0000664000000000000000000001111112472175711015545 0ustar $XFree86: xc/programs/xedit/lisp/re/README,v 1.3 2002/09/23 01:25:41 paulo Exp $ LAST UPDATED: $Date$ This is a small regex library for fast matching tokens in text. It was built to be used by xedit and it's syntax highlight code. It is not compliant with IEEE Std 1003.2, but is expected to be used where very fast matching is required, and exotic patterns will not be used. To understand what kind of patterns this library is expected to be used with, see the file xc/programs/xedit/lisp/modules/progmodes/c.lsp and some samples in the file tests.txt, with comments for patterns that will not work, or may give incorrect results. The library is not built upon the standard regex library by Henry Spencer, but is completely written from scratch, but it's syntax is heavily based on that library, and the only reason for it to exist is that unfortunately the standard version does not fit the requirements needed by xedit. Anyways, I would like to thanks Henry for his regex library, it is a really very useful tool. Small description of understood tokens: M A T C H I N G ------------------------------------------------------------------------ . Any character (won't match newline if compiled with RE_NEWLINE) \w Any word letter (shortcut to [a-zA-Z0-9_] \W Not a word letter (shortcut to [^a-zA-Z0-9_] \d Decimal number \D Not a decimal number \s A space \S Not a space \l A lower case letter \u An upper case letter \c A control character, currently the range 1-32 (minus tab) \C Not a control character \o Octal number \O Not an octal number \x Hexadecimal number \X Not an hexadecimal number \< Beginning of a word (matches an empty string) \> End of a word (matches an empty string) ^ Beginning of a line (matches an empty string) $ End of a line (matches an empty string) [...] Matches one of the characters inside the brackets ranges are specified separating two characters with "-". If the first character is "^", matches only if the character is not in this range. To add a "]" make it the first character, and to add a "-" make it the last. \1 to \9 Backreference, matches the text that was matched by a group, that is, text that was matched by the pattern inside "(" and ")". O P E R A T O R S ------------------------------------------------------------------------ () Any pattern inside works as a backreference, and is also used to group patterns. | Alternation, allows choosing different possibilities, like character ranges, but allows patterns of different lengths. R E P E T I T I O N ------------------------------------------------------------------------ * may occur any number of times, including zero + must occur at least once ? is optional {} must occur exactly times {,} must occur at least times {,} must not occur more than times {,} must occur at least times, but no more than Note that "." is a special character, and when used with a repetition operator it changes completely its meaning. For example, ".*" matches anything up to the end of the input string (unless the pattern was compiled with RE_NEWLINE, in that case it will match anything, but a newline). Limitations: o Only minimal matches supported. The engine has only one level "backtracking", so, it also only does minimal matches to allow backreferences working properly, and to avoid failing to match depending on the input. o Only one level "grouping", for example, with the pattern: (a(b)c) If "abc" is anywhere in the input, it will be in "\1", but there will not exist a "\2" for "b". o Some "special repetitions" were not implemented, these are: .{} .{,} .{,} .{,} o Some patterns will never match, for example: \w*\d Since "\w*" already includes all possible matches of "\d", "\d" will only be tested when "\w*" failed. There are no plans to make such patterns work. Some of these limitations may be worked on future versions of the library, but this is not what the library is expected to do, and, adding support for correct handling of these would probably make the library slower, what is not the reason of it to exist in the first time. If you need "true" regex than this library is not for you, but if all you need is support for very quickly finding simple patterns, than this library can be a very powerful tool, on some patterns it can run more than 200 times faster than "true" regex implementations! And this is the reason it was written. Send comments and code to me (paulo@XFree86.Org) or to the XFree86 mailing/patch lists. -- Paulo x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/core.c0000664000000000000000000044041012472175711015363 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/core.c,v 1.71tsi Exp $ */ #include "lisp/io.h" #include "lisp/core.h" #include "lisp/format.h" #include "lisp/helper.h" #include "lisp/package.h" #include "lisp/private.h" #include "lisp/write.h" /* * Types */ typedef struct _SeqInfo { LispType type; union { LispObj *list; LispObj **vector; unsigned char *string; } data; } SeqInfo; #define SETSEQ(seq, object) \ switch (seq.type = XOBJECT_TYPE(object)) { \ case LispString_t: \ seq.data.string = (unsigned char*)THESTR(object); \ break; \ case LispCons_t: \ seq.data.list = object; \ break; \ default: \ seq.data.list = object->data.array.list; \ break; \ } #ifdef __UNIXOS2__ # define finite(x) isfinite(x) #endif #ifdef NEED_SETENV extern int setenv(const char *name, const char *value, int overwrite); extern void unsetenv(const char *name); #endif /* * Prototypes */ #define NONE 0 #define REMOVE 1 #define SUBSTITUTE 2 #define DELETE 3 #define NSUBSTITUTE 4 #define ASSOC 1 #define MEMBER 2 #define FIND 1 #define POSITION 2 #define IF 1 #define IFNOT 2 #define UNION 1 #define INTERSECTION 2 #define SETDIFFERENCE 3 #define SETEXCLUSIVEOR 4 #define SUBSETP 5 #define NSETDIFFERENCE 6 #define NINTERSECTION 7 #define NUNION 8 #define NSETEXCLUSIVEOR 9 #define COPY_LIST 1 #define COPY_ALIST 2 #define COPY_TREE 3 #define EVERY 1 #define SOME 2 #define NOTEVERY 3 #define NOTANY 4 /* Call directly LispObjectCompare() if possible */ #define FCODE(predicate) \ predicate == Oeql ? FEQL : \ predicate == Oequal ? FEQUAL : \ predicate == Oeq ? FEQ : \ predicate == Oequalp ? FEQUALP : 0 #define FCOMPARE(predicate, left, right, code) \ code == FEQ ? left == right : \ code ? LispObjectCompare(left, right, code) != NIL : \ APPLY2(predicate, left, right) != NIL #define FUNCTION_CHECK(predicate) \ if (FUNCTIONP(predicate)) \ predicate = (predicate)->data.atom->object #define CHECK_TEST_0() \ if (test != UNSPEC && test_not != UNSPEC) \ LispDestroy("%s: specify either :TEST or :TEST-NOT", \ STRFUN(builtin)) #define CHECK_TEST() \ CHECK_TEST_0(); \ if (test_not == UNSPEC) { \ if (test == UNSPEC) \ lambda = Oeql; \ else \ lambda = test; \ expect = 1; \ } \ else { \ lambda = test_not; \ expect = 0; \ } \ FUNCTION_CHECK(lambda); \ code = FCODE(lambda) static LispObj *LispAdjoin(LispBuiltin*, LispObj*, LispObj*, LispObj*, LispObj*, LispObj*); static LispObj *LispAssocOrMember(LispBuiltin*, int, int); static LispObj *LispEverySomeAnyNot(LispBuiltin*, int); static LispObj *LispFindOrPosition(LispBuiltin*, int, int); static LispObj *LispDeleteOrRemoveDuplicates(LispBuiltin*, int); static LispObj *LispDeleteRemoveXSubstitute(LispBuiltin*, int, int); static LispObj *LispListSet(LispBuiltin*, int); static LispObj *LispMapc(LispBuiltin*, int); static LispObj *LispMapl(LispBuiltin*, int); static LispObj *LispMapnconc(LispObj*); extern LispObj *LispRunSetf(LispArgList*, LispObj*, LispObj*, LispObj*); extern LispObj *LispRunSetfMacro(LispAtom*, LispObj*, LispObj*); static LispObj *LispMergeSort(LispObj*, LispObj*, LispObj*, int); static LispObj *LispXReverse(LispBuiltin*, int); static LispObj *LispCopyList(LispBuiltin*, LispObj*, int); static LispObj *LispValuesList(LispBuiltin*, int); static LispObj *LispTreeEqual(LispObj*, LispObj*, LispObj*, int); static LispDocType_t LispDocumentationType(LispBuiltin*, LispObj*); extern void LispSetAtomObjectProperty(LispAtom*, LispObj*); /* * Initialization */ LispObj *Oeq, *Oeql, *Oequal, *Oequalp, *Omake_array, *Kinitial_contents, *Osetf, *Ootherwise, *Oquote; LispObj *Ogensym_counter; Atom_id Svariable, Sstructure, Stype, Ssetf; /* * Implementation */ void LispCoreInit(void) { Oeq = STATIC_ATOM("EQ"); Oeql = STATIC_ATOM("EQL"); Oequal = STATIC_ATOM("EQUAL"); Oequalp = STATIC_ATOM("EQUALP"); Omake_array = STATIC_ATOM("MAKE-ARRAY"); Kinitial_contents = KEYWORD("INITIAL-CONTENTS"); Osetf = STATIC_ATOM("SETF"); Ootherwise = STATIC_ATOM("OTHERWISE"); LispExportSymbol(Ootherwise); Oquote = STATIC_ATOM("QUOTE"); LispExportSymbol(Oquote); Svariable = GETATOMID("VARIABLE"); Sstructure = GETATOMID("STRUCTURE"); Stype = GETATOMID("TYPE"); /* Create as a constant so that only the C code should change the value */ Ogensym_counter = STATIC_ATOM("*GENSYM-COUNTER*"); LispDefconstant(Ogensym_counter, FIXNUM(0), NIL); LispExportSymbol(Ogensym_counter); Ssetf = ATOMID(Osetf); } LispObj * Lisp_Acons(LispBuiltin *builtin) /* acons key datum alist */ { LispObj *key, *datum, *alist; alist = ARGUMENT(2); datum = ARGUMENT(1); key = ARGUMENT(0); return (CONS(CONS(key, datum), alist)); } static LispObj * LispAdjoin(LispBuiltin*builtin, LispObj *item, LispObj *list, LispObj *key, LispObj *test, LispObj *test_not) { GC_ENTER(); int code, expect, value; LispObj *lambda, *compare, *object; CHECK_LIST(list); CHECK_TEST(); if (key != UNSPEC) { item = APPLY1(key, item); /* Result is not guaranteed to be gc protected */ GC_PROTECT(item); } /* Check if item is not already in place */ for (object = list; CONSP(object); object = CDR(object)) { compare = CAR(object); if (key != UNSPEC) { compare = APPLY1(key, compare); GC_PROTECT(compare); value = FCOMPARE(lambda, item, compare, code); /* Unprotect compare... */ --lisp__data.protect.length; } else value = FCOMPARE(lambda, item, compare, code); if (value == expect) { /* Item is already in list */ GC_LEAVE(); return (list); } } GC_LEAVE(); return (CONS(item, list)); } LispObj * Lisp_Adjoin(LispBuiltin *builtin) /* adjoin item list &key key test test-not */ { LispObj *item, *list, *key, *test, *test_not; test_not = ARGUMENT(4); test = ARGUMENT(3); key = ARGUMENT(2); list = ARGUMENT(1); item = ARGUMENT(0); return (LispAdjoin(builtin, item, list, key, test, test_not)); } LispObj * Lisp_Append(LispBuiltin *builtin) /* append &rest lists */ { GC_ENTER(); LispObj *result, *cons, *list; LispObj *lists; lists = ARGUMENT(0); /* no arguments */ if (!CONSP(lists)) return (NIL); /* skip initial nil lists */ for (; CONSP(CDR(lists)) && CAR(lists) == NIL; lists = CDR(lists)) ; /* last argument is not copied (even if it is the single argument) */ if (!CONSP(CDR(lists))) return (CAR(lists)); /* make sure result is a list */ list = CAR(lists); CHECK_CONS(list); result = cons = CONS(CAR(list), NIL); GC_PROTECT(result); for (list = CDR(list); CONSP(list); list = CDR(list)) { RPLACD(cons, CONS(CAR(list), NIL)); cons = CDR(cons); } lists = CDR(lists); /* copy intermediate lists */ for (; CONSP(CDR(lists)); lists = CDR(lists)) { list = CAR(lists); if (list == NIL) continue; /* intermediate elements must be lists */ CHECK_CONS(list); for (; CONSP(list); list = CDR(list)) { RPLACD(cons, CONS(CAR(list), NIL)); cons = CDR(cons); } } /* add last element */ RPLACD(cons, CAR(lists)); GC_LEAVE(); return (result); } LispObj * Lisp_Aref(LispBuiltin *builtin) /* aref array &rest subscripts */ { long c, count, idx, seq; LispObj *obj, *dim; LispObj *array, *subscripts; subscripts = ARGUMENT(1); array = ARGUMENT(0); /* accept strings also */ if (STRINGP(array) && CONSP(subscripts) && CDR(subscripts) == NIL) { long offset, length = STRLEN(array); CHECK_INDEX(CAR(subscripts)); offset = FIXNUM_VALUE(CAR(subscripts)); if (offset >= length) LispDestroy("%s: index %ld too large for sequence length %ld", STRFUN(builtin), offset, length); return (SCHAR(THESTR(array)[offset])); } CHECK_ARRAY(array); for (count = 0, dim = subscripts, obj = array->data.array.dim; CONSP(dim); count++, dim = CDR(dim), obj = CDR(obj)) { if (count >= array->data.array.rank) LispDestroy("%s: too many subscripts %s", STRFUN(builtin), STROBJ(subscripts)); if (!INDEXP(CAR(dim)) || FIXNUM_VALUE(CAR(dim)) >= FIXNUM_VALUE(CAR(obj))) LispDestroy("%s: %s is out of range or a bad index", STRFUN(builtin), STROBJ(CAR(dim))); } if (count < array->data.array.rank) LispDestroy("%s: too few subscripts %s", STRFUN(builtin), STROBJ(subscripts)); for (count = seq = 0, dim = subscripts; CONSP(dim); dim = CDR(dim), seq++) { for (idx = 0, obj = array->data.array.dim; idx < seq; obj = CDR(obj), ++idx) ; for (c = 1, obj = CDR(obj); obj != NIL; obj = CDR(obj)) c *= FIXNUM_VALUE(CAR(obj)); count += c * FIXNUM_VALUE(CAR(dim)); } for (array = array->data.array.list; count > 0; array = CDR(array), count--) ; return (CAR(array)); } static LispObj * LispAssocOrMember(LispBuiltin *builtin, int function, int comparison) /* assoc item list &key test test-not key assoc-if predicate list &key key assoc-if-not predicate list &key key member item list &key test test-not key member-if predicate list &key key member-if-not predicate list &key key */ { int code = 0, expect, value; LispObj *lambda, *result, *compare; LispObj *item, *list, *test, *test_not, *key; if (comparison == NONE) { key = ARGUMENT(4); test_not = ARGUMENT(3); test = ARGUMENT(2); list = ARGUMENT(1); item = ARGUMENT(0); lambda = NIL; } else { key = ARGUMENT(2); list = ARGUMENT(1); lambda = ARGUMENT(0); test = test_not = UNSPEC; item = NIL; } if (list == NIL) return (NIL); CHECK_CONS(list); /* Resolve compare function, and expected result of comparison */ if (comparison == NONE) { CHECK_TEST(); } else expect = comparison == IFNOT ? 0 : 1; result = NIL; for (; CONSP(list); list = CDR(list)) { compare = CAR(list); if (function == ASSOC) { if (!CONSP(compare)) continue; compare = CAR(compare); } if (key != UNSPEC) compare = APPLY1(key, compare); if (comparison == NONE) value = FCOMPARE(lambda, item, compare, code); else value = APPLY1(lambda, compare) != NIL; if (value == expect) { result = list; if (function == ASSOC) result = CAR(result); break; } } if (function == MEMBER) { CHECK_LIST(list); } return (result); } LispObj * Lisp_Assoc(LispBuiltin *builtin) /* assoc item list &key test test-not key */ { return (LispAssocOrMember(builtin, ASSOC, NONE)); } LispObj * Lisp_AssocIf(LispBuiltin *builtin) /* assoc-if predicate list &key key */ { return (LispAssocOrMember(builtin, ASSOC, IF)); } LispObj * Lisp_AssocIfNot(LispBuiltin *builtin) /* assoc-if-not predicate list &key key */ { return (LispAssocOrMember(builtin, ASSOC, IFNOT)); } LispObj * Lisp_And(LispBuiltin *builtin) /* and &rest args */ { LispObj *result = T, *args; args = ARGUMENT(0); for (; CONSP(args); args = CDR(args)) { result = EVAL(CAR(args)); if (result == NIL) break; } return (result); } LispObj * Lisp_Apply(LispBuiltin *builtin) /* apply function arg &rest more-args */ { GC_ENTER(); LispObj *result, *arguments; LispObj *function, *arg, *more_args; more_args = ARGUMENT(2); arg = ARGUMENT(1); function = ARGUMENT(0); if (more_args == NIL) { CHECK_LIST(arg); arguments = arg; for (; CONSP(arg); arg = CDR(arg)) ; CHECK_LIST(arg); } else { LispObj *cons; CHECK_CONS(more_args); arguments = cons = CONS(arg, NIL); GC_PROTECT(arguments); for (arg = CDR(more_args); CONSP(arg); more_args = arg, arg = CDR(arg)) { RPLACD(cons, CONS(CAR(more_args), NIL)); cons = CDR(cons); } more_args = CAR(more_args); if (more_args != NIL) { for (arg = more_args; CONSP(arg); arg = CDR(arg)) ; CHECK_LIST(arg); RPLACD(cons, more_args); } } result = APPLY(function, arguments); GC_LEAVE(); return (result); } LispObj * Lisp_Atom(LispBuiltin *builtin) /* atom object */ { LispObj *object; object = ARGUMENT(0); return (CONSP(object) ? NIL : T); } LispObj * Lisp_Block(LispBuiltin *builtin) /* block name &rest body */ { int did_jump, *pdid_jump = &did_jump; LispObj *res, **pres = &res; LispBlock *block; LispObj *name, *body; body = ARGUMENT(1); name = ARGUMENT(0); if (!SYMBOLP(name) && name != NIL && name != T) LispDestroy("%s: %s cannot name a block", STRFUN(builtin), STROBJ(name)); *pres = NIL; *pdid_jump = 1; block = LispBeginBlock(name, LispBlockTag); if (setjmp(block->jmp) == 0) { for (; CONSP(body); body = CDR(body)) res = EVAL(CAR(body)); *pdid_jump = 0; } LispEndBlock(block); if (*pdid_jump) *pres = lisp__data.block.block_ret; return (res); } LispObj * Lisp_Boundp(LispBuiltin *builtin) /* boundp symbol */ { LispAtom *atom; LispObj *symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); atom = symbol->data.atom; if (atom->package == lisp__data.keyword || (atom->a_object && atom->property->value != UNBOUND)) return (T); return (NIL); } LispObj * Lisp_Butlast(LispBuiltin *builtin) /* butlast list &optional count */ { GC_ENTER(); long length, count; LispObj *result, *cons, *list, *ocount; ocount = ARGUMENT(1); list = ARGUMENT(0); CHECK_LIST(list); if (ocount == UNSPEC) count = 1; else { CHECK_INDEX(ocount); count = FIXNUM_VALUE(ocount); } length = LispLength(list); if (count == 0) return (list); else if (count >= length) return (NIL); length -= count + 1; result = cons = CONS(CAR(list), NIL); GC_PROTECT(result); for (list = CDR(list); length > 0; list = CDR(list), length--) { RPLACD(cons, CONS(CAR(list), NIL)); cons = CDR(cons); } GC_LEAVE(); return (result); } LispObj * Lisp_Nbutlast(LispBuiltin *builtin) /* nbutlast list &optional count */ { long length, count; LispObj *result, *list, *ocount; ocount = ARGUMENT(1); list = ARGUMENT(0); CHECK_LIST(list); if (ocount == UNSPEC) count = 1; else { CHECK_INDEX(ocount); count = FIXNUM_VALUE(ocount); } length = LispLength(list); if (count == 0) return (list); else if (count >= length) return (NIL); length -= count + 1; result = list; for (; length > 0; list = CDR(list), length--) ; RPLACD(list, NIL); return (result); } LispObj * Lisp_Car(LispBuiltin *builtin) /* car list */ { LispObj *list, *result = NULL; list = ARGUMENT(0); if (list == NIL) result = NIL; else { CHECK_CONS(list); result = CAR(list); } return (result); } LispObj * Lisp_Case(LispBuiltin *builtin) /* case keyform &rest body */ { LispObj *result, *code, *keyform, *body, *form; body = ARGUMENT(1); keyform = ARGUMENT(0); result = NIL; keyform = EVAL(keyform); for (; CONSP(body); body = CDR(body)) { code = CAR(body); CHECK_CONS(code); form = CAR(code); if (form == T || form == Ootherwise) { if (CONSP(CDR(body))) LispDestroy("%s: %s must be the last clause", STRFUN(builtin), STROBJ(CAR(code))); result = CDR(code); break; } else if (CONSP(form)) { for (; CONSP(form); form = CDR(form)) if (XEQL(keyform, CAR(form)) == T) { result = CDR(code); break; } if (CONSP(form)) /* if found match */ break; } else if (XEQL(keyform, form) == T) { result = CDR(code); break; } } for (body = result; CONSP(body); body = CDR(body)) result = EVAL(CAR(body)); return (result); } LispObj * Lisp_Catch(LispBuiltin *builtin) /* catch tag &rest body */ { int did_jump, *pdid_jump = &did_jump; LispObj *res, **pres = &res; LispBlock *block; LispObj *tag, *body; body = ARGUMENT(1); tag = ARGUMENT(0); *pres = NIL; *pdid_jump = 1; block = LispBeginBlock(tag, LispBlockCatch); if (setjmp(block->jmp) == 0) { for (; CONSP(body); body = CDR(body)) res = EVAL(CAR(body)); *pdid_jump = 0; } LispEndBlock(block); if (*pdid_jump) *pres = lisp__data.block.block_ret; return (res); } LispObj * Lisp_Coerce(LispBuiltin *builtin) /* coerce object result-type */ { LispObj *object, *result_type; result_type = ARGUMENT(1); object = ARGUMENT(0); return (LispCoerce(builtin, object, result_type)); } LispObj * Lisp_Cdr(LispBuiltin *builtin) /* cdr list */ { LispObj *list, *result = NULL; list = ARGUMENT(0); if (list == NIL) result = NIL; else { CHECK_CONS(list); result = CDR(list); } return (result); } LispObj * Lisp_C_r(LispBuiltin *builtin) /* c[ad]{2,4}r list */ { char *desc; LispObj *list, *result = NULL; list = ARGUMENT(0); result = list; desc = STRFUN(builtin); while (desc[1] != 'R') ++desc; while (*desc != 'C') { if (result == NIL) break; CHECK_CONS(result); result = *desc == 'A' ? CAR(result) : CDR(result); --desc; } return (result); } LispObj * Lisp_Cond(LispBuiltin *builtin) /* cond &rest body */ { LispObj *result, *code, *body; body = ARGUMENT(0); result = NIL; for (; CONSP(body); body = CDR(body)) { code = CAR(body); CHECK_CONS(code); result = EVAL(CAR(code)); if (result == NIL) continue; for (code = CDR(code); CONSP(code); code = CDR(code)) result = EVAL(CAR(code)); break; } return (result); } static LispObj * LispCopyList(LispBuiltin *builtin, LispObj *list, int function) { GC_ENTER(); LispObj *result, *cons; if (list == NIL) return (list); CHECK_CONS(list); result = cons = CONS(NIL, NIL); GC_PROTECT(result); if (CONSP(CAR(list))) { switch (function) { case COPY_LIST: RPLACA(result, CAR(list)); break; case COPY_ALIST: RPLACA(result, CONS(CAR(CAR(list)), CDR(CAR(list)))); break; case COPY_TREE: RPLACA(result, LispCopyList(builtin, CAR(list), COPY_TREE)); break; } } else RPLACA(result, CAR(list)); for (list = CDR(list); CONSP(list); list = CDR(list)) { CDR(cons) = CONS(NIL, NIL); cons = CDR(cons); if (CONSP(CAR(list))) { switch (function) { case COPY_LIST: RPLACA(cons, CAR(list)); break; case COPY_ALIST: RPLACA(cons, CONS(CAR(CAR(list)), CDR(CAR(list)))); break; case COPY_TREE: RPLACA(cons, LispCopyList(builtin, CAR(list), COPY_TREE)); break; } } else RPLACA(cons, CAR(list)); } /* in case list is dotted */ RPLACD(cons, list); GC_LEAVE(); return (result); } LispObj * Lisp_CopyAlist(LispBuiltin *builtin) /* copy-alist list */ { LispObj *list; list = ARGUMENT(0); return (LispCopyList(builtin, list, COPY_ALIST)); } LispObj * Lisp_CopyList(LispBuiltin *builtin) /* copy-list list */ { LispObj *list; list = ARGUMENT(0); return (LispCopyList(builtin, list, COPY_LIST)); } LispObj * Lisp_CopyTree(LispBuiltin *builtin) /* copy-tree list */ { LispObj *list; list = ARGUMENT(0); return (LispCopyList(builtin, list, COPY_TREE)); } LispObj * Lisp_Cons(LispBuiltin *builtin) /* cons car cdr */ { LispObj *car, *cdr; cdr = ARGUMENT(1); car = ARGUMENT(0); return (CONS(car, cdr)); } LispObj * Lisp_Consp(LispBuiltin *builtin) /* consp object */ { LispObj *object; object = ARGUMENT(0); return (CONSP(object) ? T : NIL); } LispObj * Lisp_Constantp(LispBuiltin *builtin) /* constantp form &optional environment */ { LispObj *form; form = ARGUMENT(0); /* not all self-evaluating objects are considered constants */ if (!POINTERP(form) || NUMBERP(form) || XQUOTEP(form) || (XCONSP(form) && CAR(form) == Oquote) || (XSYMBOLP(form) && form->data.atom->constant) || XSTRINGP(form) || XARRAYP(form)) return (T); return (NIL); } LispObj * Lisp_Defconstant(LispBuiltin *builtin) /* defconstant name initial-value &optional documentation */ { LispObj *name, *initial_value, *documentation; documentation = ARGUMENT(2); initial_value = ARGUMENT(1); name = ARGUMENT(0); CHECK_SYMBOL(name); if (documentation != UNSPEC) { CHECK_STRING(documentation); } else documentation = NIL; LispDefconstant(name, EVAL(initial_value), documentation); return (name); } LispObj * Lisp_Defmacro(LispBuiltin *builtin) /* defmacro name lambda-list &rest body */ { LispArgList *alist; LispObj *lambda, *name, *lambda_list, *body; body = ARGUMENT(2); lambda_list = ARGUMENT(1); name = ARGUMENT(0); CHECK_SYMBOL(name); alist = LispCheckArguments(LispMacro, lambda_list, ATOMID(name)->value, 0); if (CONSP(body) && STRINGP(CAR(body))) { LispAddDocumentation(name, CAR(body), LispDocFunction); body = CDR(body); } lambda_list = LispListProtectedArguments(alist); lambda = LispNewLambda(name, body, lambda_list, LispMacro); if (name->data.atom->a_builtin || name->data.atom->a_compiled) { if (name->data.atom->a_builtin) { ERROR_CHECK_SPECIAL_FORM(name->data.atom); } /* redefining these may cause surprises if bytecode * compiled functions references them */ LispWarning("%s: %s is being redefined", STRFUN(builtin), ATOMID(name)->value); LispRemAtomBuiltinProperty(name->data.atom); } LispSetAtomFunctionProperty(name->data.atom, lambda, alist); LispUseArgList(alist); return (name); } LispObj * Lisp_Defun(LispBuiltin *builtin) /* defun name lambda-list &rest body */ { LispArgList *alist; LispObj *lambda, *name, *lambda_list, *body; body = ARGUMENT(2); lambda_list = ARGUMENT(1); name = ARGUMENT(0); CHECK_SYMBOL(name); alist = LispCheckArguments(LispFunction, lambda_list, ATOMID(name)->value, 0); if (CONSP(body) && STRINGP(CAR(body))) { LispAddDocumentation(name, CAR(body), LispDocFunction); body = CDR(body); } lambda_list = LispListProtectedArguments(alist); lambda = LispNewLambda(name, body, lambda_list, LispFunction); if (name->data.atom->a_builtin || name->data.atom->a_compiled) { if (name->data.atom->a_builtin) { ERROR_CHECK_SPECIAL_FORM(name->data.atom); } /* redefining these may cause surprises if bytecode * compiled functions references them */ LispWarning("%s: %s is being redefined", STRFUN(builtin), ATOMID(name)->value); LispRemAtomBuiltinProperty(name->data.atom); } LispSetAtomFunctionProperty(name->data.atom, lambda, alist); LispUseArgList(alist); return (name); } LispObj * Lisp_Defsetf(LispBuiltin *builtin) /* defsetf function lambda-list &rest body */ { LispArgList *alist; LispObj *obj; LispObj *lambda, *function, *lambda_list, *store, *body; body = ARGUMENT(2); lambda_list = ARGUMENT(1); function = ARGUMENT(0); CHECK_SYMBOL(function); if (body == NIL || (CONSP(body) && STRINGP(CAR(body)))) { if (!SYMBOLP(lambda_list)) LispDestroy("%s: syntax error %s %s", STRFUN(builtin), STROBJ(function), STROBJ(lambda_list)); if (body != NIL) LispAddDocumentation(function, CAR(body), LispDocSetf); LispSetAtomSetfProperty(function->data.atom, lambda_list, NULL); return (function); } alist = LispCheckArguments(LispSetf, lambda_list, ATOMID(function)->value, 0); store = CAR(body); if (!CONSP(store)) LispDestroy("%s: %s is a bad store value", STRFUN(builtin), STROBJ(store)); for (obj = store; CONSP(obj); obj = CDR(obj)) { CHECK_SYMBOL(CAR(obj)); } body = CDR(body); if (CONSP(body) && STRINGP(CAR(body))) { LispAddDocumentation(function, CAR(body), LispDocSetf); body = CDR(body); } lambda = LispNewLambda(function, body, store, LispSetf); LispSetAtomSetfProperty(function->data.atom, lambda, alist); LispUseArgList(alist); return (function); } LispObj * Lisp_Defparameter(LispBuiltin *builtin) /* defparameter name initial-value &optional documentation */ { LispObj *name, *initial_value, *documentation; documentation = ARGUMENT(2); initial_value = ARGUMENT(1); name = ARGUMENT(0); CHECK_SYMBOL(name); if (documentation != UNSPEC) { CHECK_STRING(documentation); } else documentation = NIL; LispProclaimSpecial(name, EVAL(initial_value), documentation); return (name); } LispObj * Lisp_Defvar(LispBuiltin *builtin) /* defvar name &optional initial-value documentation */ { LispObj *name, *initial_value, *documentation; documentation = ARGUMENT(2); initial_value = ARGUMENT(1); name = ARGUMENT(0); CHECK_SYMBOL(name); if (documentation != UNSPEC) { CHECK_STRING(documentation); } else documentation = NIL; LispProclaimSpecial(name, initial_value != UNSPEC ? EVAL(initial_value) : NULL, documentation); return (name); } LispObj * Lisp_Delete(LispBuiltin *builtin) /* delete item sequence &key from-end test test-not start end count key */ { return (LispDeleteRemoveXSubstitute(builtin, DELETE, NONE)); } LispObj * Lisp_DeleteIf(LispBuiltin *builtin) /* delete-if predicate sequence &key from-end start end count key */ { return (LispDeleteRemoveXSubstitute(builtin, DELETE, IF)); } LispObj * Lisp_DeleteIfNot(LispBuiltin *builtin) /* delete-if-not predicate sequence &key from-end start end count key */ { return (LispDeleteRemoveXSubstitute(builtin, DELETE, IFNOT)); } LispObj * Lisp_DeleteDuplicates(LispBuiltin *builtin) /* delete-duplicates sequence &key from-end test test-not start end key */ { return (LispDeleteOrRemoveDuplicates(builtin, DELETE)); } LispObj * Lisp_Do(LispBuiltin *builtin) /* do init test &rest body */ { return (LispDo(builtin, 0)); } LispObj * Lisp_DoP(LispBuiltin *builtin) /* do* init test &rest body */ { return (LispDo(builtin, 1)); } static LispDocType_t LispDocumentationType(LispBuiltin *builtin, LispObj *type) { Atom_id atom; LispDocType_t doc_type = LispDocVariable; CHECK_SYMBOL(type); atom = ATOMID(type); if (atom == Svariable) doc_type = LispDocVariable; else if (atom == Sfunction) doc_type = LispDocFunction; else if (atom == Sstructure) doc_type = LispDocStructure; else if (atom == Stype) doc_type = LispDocType; else if (atom == Ssetf) doc_type = LispDocSetf; else { LispDestroy("%s: unknown documentation type %s", STRFUN(builtin), STROBJ(type)); /*NOTREACHED*/ } return (doc_type); } LispObj * Lisp_Documentation(LispBuiltin *builtin) /* documentation symbol type */ { LispObj *symbol, *type; type = ARGUMENT(1); symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); /* type is checked in LispDocumentationType() */ return (LispGetDocumentation(symbol, LispDocumentationType(builtin, type))); } LispObj * Lisp_DoList(LispBuiltin *builtin) { return (LispDoListTimes(builtin, 0)); } LispObj * Lisp_DoTimes(LispBuiltin *builtin) { return (LispDoListTimes(builtin, 1)); } LispObj * Lisp_Elt(LispBuiltin *builtin) /* elt sequence index svref sequence index */ { long offset, length; LispObj *result, *sequence, *oindex; oindex = ARGUMENT(1); sequence = ARGUMENT(0); length = LispLength(sequence); CHECK_INDEX(oindex); offset = FIXNUM_VALUE(oindex); if (offset >= length) LispDestroy("%s: index %ld too large for sequence length %ld", STRFUN(builtin), offset, length); if (STRINGP(sequence)) result = SCHAR(THESTR(sequence)[offset]); else { if (ARRAYP(sequence)) sequence = sequence->data.array.list; for (; offset > 0; offset--, sequence = CDR(sequence)) ; result = CAR(sequence); } return (result); } LispObj * Lisp_Endp(LispBuiltin *builtin) /* endp object */ { LispObj *object; object = ARGUMENT(0); if (object == NIL) return (T); CHECK_CONS(object); return (NIL); } LispObj * Lisp_Eq(LispBuiltin *builtin) /* eq left right */ { LispObj *left, *right; right = ARGUMENT(1); left = ARGUMENT(0); return (XEQ(left, right)); } LispObj * Lisp_Eql(LispBuiltin *builtin) /* eql left right */ { LispObj *left, *right; right = ARGUMENT(1); left = ARGUMENT(0); return (XEQL(left, right)); } LispObj * Lisp_Equal(LispBuiltin *builtin) /* equal left right */ { LispObj *left, *right; right = ARGUMENT(1); left = ARGUMENT(0); return (XEQUAL(left, right)); } LispObj * Lisp_Equalp(LispBuiltin *builtin) /* equalp left right */ { LispObj *left, *right; right = ARGUMENT(1); left = ARGUMENT(0); return (XEQUALP(left, right)); } LispObj * Lisp_Error(LispBuiltin *builtin) /* error control-string &rest arguments */ { LispObj *string, *arglist; LispObj *control_string, *arguments; arguments = ARGUMENT(1); control_string = ARGUMENT(0); arglist = CONS(NIL, CONS(control_string, arguments)); GC_PROTECT(arglist); string = APPLY(Oformat, arglist); LispDestroy("%s", THESTR(string)); /*NOTREACHED*/ /* No need to call GC_ENTER() and GC_LEAVE() macros */ return (NIL); } LispObj * Lisp_Eval(LispBuiltin *builtin) /* eval form */ { int lex; LispObj *form, *result; form = ARGUMENT(0); /* make sure eval form will not access local variables */ lex = lisp__data.env.lex; lisp__data.env.lex = lisp__data.env.length; result = EVAL(form); lisp__data.env.lex = lex; return (result); } static LispObj * LispEverySomeAnyNot(LispBuiltin *builtin, int function) /* every predicate sequence &rest more-sequences some predicate sequence &rest more-sequences notevery predicate sequence &rest more-sequences notany predicate sequence &rest more-sequences */ { GC_ENTER(); long i, j, length, count; LispObj *result, *list, *item, *arguments, *acons, *value; SeqInfo stk[8], *seqs; LispObj *predicate, *sequence, *more_sequences; more_sequences = ARGUMENT(2); sequence = ARGUMENT(1); predicate = ARGUMENT(0); count = 1; length = LispLength(sequence); for (list = more_sequences; CONSP(list); list = CDR(list), count++) { i = LispLength(CAR(list)); if (i < length) length = i; } result = function == EVERY || function == NOTANY ? T : NIL; /* if at least one sequence has length zero */ if (length == 0) return (result); if (count > sizeof(stk) / sizeof(stk[0])) seqs = LispMalloc(count * sizeof(SeqInfo)); else seqs = &stk[0]; /* build information about sequences */ SETSEQ(seqs[0], sequence); for (i = 1, list = more_sequences; CONSP(list); list = CDR(list), i++) { item = CAR(list); SETSEQ(seqs[i], item); } /* prepare argument list */ arguments = acons = CONS(NIL, NIL); GC_PROTECT(arguments); for (i = 1; i < count; i++) { RPLACD(acons, CONS(NIL, NIL)); acons = CDR(acons); } /* loop applying predicate in sequence elements */ for (i = 0; i < length; i++) { /* build argument list */ for (acons = arguments, j = 0; j < count; acons = CDR(acons), j++) { if (seqs[j].type == LispString_t) item = SCHAR(*seqs[j].data.string++); else { item = CAR(seqs[j].data.list); seqs[j].data.list = CDR(seqs[j].data.list); } RPLACA(acons, item); } /* apply predicate */ value = APPLY(predicate, arguments); /* check if needs to terminate loop */ if (value == NIL) { if (function == EVERY) { result = NIL; break; } if (function == NOTEVERY) { result = T; break; } } else { if (function == SOME) { result = value; break; } if (function == NOTANY) { result = NIL; break; } } } GC_LEAVE(); if (seqs != &stk[0]) LispFree(seqs); return (result); } LispObj * Lisp_Every(LispBuiltin *builtin) /* every predicate sequence &rest more-sequences */ { return (LispEverySomeAnyNot(builtin, EVERY)); } LispObj * Lisp_Some(LispBuiltin *builtin) /* some predicate sequence &rest more-sequences */ { return (LispEverySomeAnyNot(builtin, SOME)); } LispObj * Lisp_Notevery(LispBuiltin *builtin) /* notevery predicate sequence &rest more-sequences */ { return (LispEverySomeAnyNot(builtin, NOTEVERY)); } LispObj * Lisp_Notany(LispBuiltin *builtin) /* notany predicate sequence &rest more-sequences */ { return (LispEverySomeAnyNot(builtin, NOTANY)); } LispObj * Lisp_Fboundp(LispBuiltin *builtin) /* fboundp symbol */ { LispAtom *atom; LispObj *symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); atom = symbol->data.atom; if (atom->a_function || atom->a_builtin || atom->a_compiled) return (T); return (NIL); } LispObj * Lisp_Find(LispBuiltin *builtin) /* find item sequence &key from-end test test-not start end key */ { return (LispFindOrPosition(builtin, FIND, NONE)); } LispObj * Lisp_FindIf(LispBuiltin *builtin) /* find-if predicate sequence &key from-end start end key */ { return (LispFindOrPosition(builtin, FIND, IF)); } LispObj * Lisp_FindIfNot(LispBuiltin *builtin) /* find-if-not predicate sequence &key from-end start end key */ { return (LispFindOrPosition(builtin, FIND, IFNOT)); } LispObj * Lisp_Fill(LispBuiltin *builtin) /* fill sequence item &key start end */ { long i, start, end, length; LispObj *sequence, *item, *ostart, *oend; oend = ARGUMENT(3); ostart = ARGUMENT(2); item = ARGUMENT(1); sequence = ARGUMENT(0); LispCheckSequenceStartEnd(builtin, sequence, ostart, oend, &start, &end, &length); if (STRINGP(sequence)) { int ch; char *string = THESTR(sequence); CHECK_STRING_WRITABLE(sequence); CHECK_SCHAR(item); ch = SCHAR_VALUE(item); for (i = start; i < end; i++) string[i] = ch; } else { LispObj *list; if (CONSP(sequence)) list = sequence; else list = sequence->data.array.list; for (i = 0; i < start; i++, list = CDR(list)) ; for (; i < end; i++, list = CDR(list)) RPLACA(list, item); } return (sequence); } LispObj * Lisp_Fmakunbound(LispBuiltin *builtin) /* fmkaunbound symbol */ { LispObj *symbol; symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); if (symbol->data.atom->a_function) LispRemAtomFunctionProperty(symbol->data.atom); else if (symbol->data.atom->a_builtin) LispRemAtomBuiltinProperty(symbol->data.atom); else if (symbol->data.atom->a_compiled) LispRemAtomCompiledProperty(symbol->data.atom); return (symbol); } LispObj * Lisp_Funcall(LispBuiltin *builtin) /* funcall function &rest arguments */ { LispObj *result; LispObj *function, *arguments; arguments = ARGUMENT(1); function = ARGUMENT(0); result = APPLY(function, arguments); return (result); } LispObj * Lisp_Functionp(LispBuiltin *builtin) /* functionp object */ { LispObj *object; object = ARGUMENT(0); return (FUNCTIONP(object) || LAMBDAP(object) ? T : NIL); } LispObj * Lisp_Get(LispBuiltin *builtin) /* get symbol indicator &optional default */ { LispObj *result; LispObj *symbol, *indicator, *defalt; defalt = ARGUMENT(2); indicator = ARGUMENT(1); symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); result = LispGetAtomProperty(symbol->data.atom, indicator); if (result != NIL) result = CAR(result); else result = defalt == UNSPEC ? NIL : defalt; return (result); } /* * ext::getenv */ LispObj * Lisp_Getenv(LispBuiltin *builtin) /* getenv name */ { char *value; LispObj *name; name = ARGUMENT(0); CHECK_STRING(name); value = getenv(THESTR(name)); return (value ? STRING(value) : NIL); } LispObj * Lisp_Gc(LispBuiltin *builtin) /* gc &optional car cdr */ { LispObj *car, *cdr; cdr = ARGUMENT(1); car = ARGUMENT(0); LispGC(car, cdr); return (NIL); } LispObj * Lisp_Gensym(LispBuiltin *builtin) /* gensym &optional arg */ { const char *preffix = "G"; char name[132]; long counter = LONGINT_VALUE(Ogensym_counter->data.atom->property->value); LispObj *symbol; LispObj *arg; arg = ARGUMENT(0); if (arg != UNSPEC) { if (STRINGP(arg)) preffix = THESTR(arg); else { CHECK_INDEX(arg); counter = FIXNUM_VALUE(arg); } } snprintf(name, sizeof(name), "%s%ld", preffix, counter); if (strlen(name) >= 128) LispDestroy("%s: name %s too long", STRFUN(builtin), name); Ogensym_counter->data.atom->property->value = INTEGER(counter + 1); symbol = UNINTERNED_ATOM(name); symbol->data.atom->unreadable = !LispCheckAtomString(name); return (symbol); } LispObj * Lisp_Go(LispBuiltin *builtin) /* go tag */ { unsigned blevel = lisp__data.block.block_level; LispObj *tag; tag = ARGUMENT(0); while (blevel) { LispBlock *block = lisp__data.block.block[--blevel]; if (block->type == LispBlockClosure) /* if reached a function call */ break; if (block->type == LispBlockBody) { lisp__data.block.block_ret = tag; LispBlockUnwind(block); BLOCKJUMP(block); } } LispDestroy("%s: no visible tagbody for %s", STRFUN(builtin), STROBJ(tag)); /*NOTREACHED*/ return (NIL); } LispObj * Lisp_If(LispBuiltin *builtin) /* if test then &optional else */ { LispObj *result, *test, *then, *oelse; oelse = ARGUMENT(2); then = ARGUMENT(1); test = ARGUMENT(0); test = EVAL(test); if (test != NIL) result = EVAL(then); else if (oelse != UNSPEC) result = EVAL(oelse); else result = NIL; return (result); } LispObj * Lisp_IgnoreErrors(LispBuiltin *builtin) /* ignore-erros &rest body */ { LispObj *result; int i, jumped; LispBlock *block; /* interpreter state */ GC_ENTER(); int stack, lex, length; /* memory allocation */ int mem_level; void **mem; LispObj *body; body = ARGUMENT(0); /* Save environment information */ stack = lisp__data.stack.length; lex = lisp__data.env.lex; length = lisp__data.env.length; /* Save memory allocation information */ mem_level = lisp__data.mem.level; mem = LispMalloc(mem_level * sizeof(void*)); memcpy(mem, lisp__data.mem.mem, mem_level * sizeof(void*)); ++lisp__data.ignore_errors; result = NIL; jumped = 1; block = LispBeginBlock(NIL, LispBlockProtect); if (setjmp(block->jmp) == 0) { for (; CONSP(body); body = CDR(body)) result = EVAL(CAR(body)); jumped = 0; } LispEndBlock(block); if (!lisp__data.destroyed && jumped) result = lisp__data.block.block_ret; if (lisp__data.destroyed) { /* Restore environment */ lisp__data.stack.length = stack; lisp__data.env.lex = lex; lisp__data.env.head = lisp__data.env.length = length; GC_LEAVE(); /* Check for possible leaks due to ignoring errors */ for (i = 0; i < mem_level; i++) { if (lisp__data.mem.mem[i] && mem[i] != lisp__data.mem.mem[i]) LispFree(lisp__data.mem.mem[i]); } for (; i < lisp__data.mem.level; i++) { if (lisp__data.mem.mem[i]) LispFree(lisp__data.mem.mem[i]); } lisp__data.destroyed = 0; result = NIL; RETURN_COUNT = 1; RETURN(0) = lisp__data.error_condition; } LispFree(mem); --lisp__data.ignore_errors; return (result); } LispObj * Lisp_Intersection(LispBuiltin *builtin) /* intersection list1 list2 &key test test-not key */ { return (LispListSet(builtin, INTERSECTION)); } LispObj * Lisp_Nintersection(LispBuiltin *builtin) /* nintersection list1 list2 &key test test-not key */ { return (LispListSet(builtin, NINTERSECTION)); } LispObj * Lisp_Keywordp(LispBuiltin *builtin) /* keywordp object */ { LispObj *object; object = ARGUMENT(0); return (KEYWORDP(object) ? T : NIL); } LispObj * Lisp_Lambda(LispBuiltin *builtin) /* lambda lambda-list &rest body */ { GC_ENTER(); LispObj *name; LispArgList *alist; LispObj *lambda, *lambda_list, *body; body = ARGUMENT(1); lambda_list = ARGUMENT(0); alist = LispCheckArguments(LispLambda, lambda_list, Snil->value, 0); name = OPAQUE(alist, LispArgList_t); lambda_list = LispListProtectedArguments(alist); GC_PROTECT(name); GC_PROTECT(lambda_list); lambda = LispNewLambda(name, body, lambda_list, LispLambda); LispUseArgList(alist); GC_LEAVE(); return (lambda); } LispObj * Lisp_Last(LispBuiltin *builtin) /* last list &optional count */ { long count, length; LispObj *list, *ocount; ocount = ARGUMENT(1); list = ARGUMENT(0); if (!CONSP(list)) return (list); length = LispLength(list); if (ocount == UNSPEC) count = 1; else { CHECK_INDEX(ocount); count = FIXNUM_VALUE(ocount); } if (count >= length) return (list); length -= count; for (; length > 0; length--) list = CDR(list); return (list); } LispObj * Lisp_Length(LispBuiltin *builtin) /* length sequence */ { LispObj *sequence; sequence = ARGUMENT(0); return (FIXNUM(LispLength(sequence))); } LispObj * Lisp_Let(LispBuiltin *builtin) /* let init &rest body */ { GC_ENTER(); int head = lisp__data.env.length; LispObj *init, *body, *pair, *result, *list, *cons = NIL; body = ARGUMENT(1); init = ARGUMENT(0); CHECK_LIST(init); for (list = NIL; CONSP(init); init = CDR(init)) { LispObj *symbol, *value; pair = CAR(init); if (SYMBOLP(pair)) { symbol = pair; value = NIL; } else { CHECK_CONS(pair); symbol = CAR(pair); CHECK_SYMBOL(symbol); pair = CDR(pair); if (CONSP(pair)) { value = CAR(pair); if (CDR(pair) != NIL) LispDestroy("%s: too much arguments to initialize %s", STRFUN(builtin), STROBJ(symbol)); value = EVAL(value); } else value = NIL; } pair = CONS(symbol, value); if (list == NIL) { list = cons = CONS(pair, NIL); GC_PROTECT(list); } else { RPLACD(cons, CONS(pair, NIL)); cons = CDR(cons); } } /* Add variables */ for (; CONSP(list); list = CDR(list)) { pair = CAR(list); CHECK_CONSTANT(CAR(pair)); LispAddVar(CAR(pair), CDR(pair)); ++lisp__data.env.head; } /* Values of symbols are now protected */ GC_LEAVE(); /* execute body */ for (result = NIL; CONSP(body); body = CDR(body)) result = EVAL(CAR(body)); lisp__data.env.head = lisp__data.env.length = head; return (result); } LispObj * Lisp_LetP(LispBuiltin *builtin) /* let* init &rest body */ { int head = lisp__data.env.length; LispObj *init, *body, *pair, *result; body = ARGUMENT(1); init = ARGUMENT(0); CHECK_LIST(init); for (; CONSP(init); init = CDR(init)) { LispObj *symbol, *value; pair = CAR(init); if (SYMBOLP(pair)) { symbol = pair; value = NIL; } else { CHECK_CONS(pair); symbol = CAR(pair); CHECK_SYMBOL(symbol); pair = CDR(pair); if (CONSP(pair)) { value = CAR(pair); if (CDR(pair) != NIL) LispDestroy("%s: too much arguments to initialize %s", STRFUN(builtin), STROBJ(symbol)); value = EVAL(value); } else value = NIL; } CHECK_CONSTANT(symbol); LispAddVar(symbol, value); ++lisp__data.env.head; } /* execute body */ for (result = NIL; CONSP(body); body = CDR(body)) result = EVAL(CAR(body)); lisp__data.env.head = lisp__data.env.length = head; return (result); } LispObj * Lisp_List(LispBuiltin *builtin) /* list &rest args */ { LispObj *args; args = ARGUMENT(0); return (args); } LispObj * Lisp_ListP(LispBuiltin *builtin) /* list* object &rest more-objects */ { GC_ENTER(); LispObj *result, *cons; LispObj *object, *more_objects; more_objects = ARGUMENT(1); object = ARGUMENT(0); if (!CONSP(more_objects)) return (object); result = cons = CONS(object, CAR(more_objects)); GC_PROTECT(result); for (more_objects = CDR(more_objects); CONSP(more_objects); more_objects = CDR(more_objects)) { object = CAR(more_objects); RPLACD(cons, CONS(CDR(cons), object)); cons = CDR(cons); } GC_LEAVE(); return (result); } /* "classic" list-length */ LispObj * Lisp_ListLength(LispBuiltin *builtin) /* list-length list */ { long length; LispObj *fast, *slow; LispObj *list; list = ARGUMENT(0); CHECK_LIST(list); for (fast = slow = list, length = 0; CONSP(slow); slow = CDR(slow), length += 2) { if (fast == NIL) break; CHECK_CONS(fast); fast = CDR(fast); if (fast == NIL) { ++length; break; } CHECK_CONS(fast); fast = CDR(fast); if (slow == fast) /* circular list */ return (NIL); } return (FIXNUM(length)); } LispObj * Lisp_Listp(LispBuiltin *builtin) /* listp object */ { LispObj *object; object = ARGUMENT(0); return (object == NIL || CONSP(object) ? T : NIL); } static LispObj * LispListSet(LispBuiltin *builtin, int function) /* intersection list1 list2 &key test test-not key nintersection list1 list2 &key test test-not key set-difference list1 list2 &key test test-not key nset-difference list1 list2 &key test test-not key set-exclusive-or list1 list2 &key test test-not key nset-exclusive-or list1 list2 &key test test-not key subsetp list1 list2 &key test test-not key union list1 list2 &key test test-not key nunion list1 list2 &key test test-not key */ { GC_ENTER(); int code, expect, value, inplace, check_list2, intersection, setdifference, xunion, setexclusiveor; LispObj *lambda, *result, *cmp, *cmp1, *cmp2, *item, *clist1, *clist2, *cons, *cdr; LispObj *list1, *list2, *test, *test_not, *key; key = ARGUMENT(4); test_not = ARGUMENT(3); test = ARGUMENT(2); list2 = ARGUMENT(1); list1 = ARGUMENT(0); /* Check if arguments are valid lists */ CHECK_LIST(list1); CHECK_LIST(list2); setdifference = intersection = xunion = setexclusiveor = inplace = 0; switch (function) { case NSETDIFFERENCE: inplace = 1; case SETDIFFERENCE: setdifference = 1; break; case NINTERSECTION: inplace = 1; case INTERSECTION: intersection = 1; break; case NUNION: inplace = 1; case UNION: xunion = 1; break; case NSETEXCLUSIVEOR: inplace = 1; case SETEXCLUSIVEOR: setexclusiveor = 1; break; } /* Check for fast return */ if (list1 == NIL) return (setdifference || intersection ? NIL : function == SUBSETP ? T : list2); if (list2 == NIL) return (intersection || xunion || function == SUBSETP ? NIL : list1); CHECK_TEST(); clist1 = cdr = NIL; /* Make a copy of list2 with the key predicate applied */ if (key != UNSPEC) { result = cons = CONS(APPLY1(key, CAR(list2)), NIL); GC_PROTECT(result); for (cmp2 = CDR(list2); CONSP(cmp2); cmp2 = CDR(cmp2)) { item = APPLY1(key, CAR(cmp2)); RPLACD(cons, CONS(APPLY1(key, CAR(cmp2)), NIL)); cons = CDR(cons); } /* check if list2 is a proper list */ CHECK_LIST(cmp2); clist2 = result; check_list2 = 0; } else { clist2 = list2; check_list2 = 1; } result = cons = NIL; /* Compare elements of lists * Logic: * UNION * 1) Walk list1 and if CAR(list1) not in list2, add it to result * 2) Add list2 to result * INTERSECTION * 1) Walk list1 and if CAR(list1) in list2, add it to result * SET-DIFFERENCE * 1) Walk list1 and if CAR(list1) not in list2, add it to result * SET-EXCLUSIVE-OR * 1) Walk list1 and if CAR(list1) not in list2, add it to result * 2) Walk list2 and if CAR(list2) not in list1, add it to result * SUBSETP * 1) Walk list1 and if CAR(list1) not in list2, return NIL * 2) Return T */ value = 0; for (cmp1 = list1; CONSP(cmp1); cmp1 = CDR(cmp1)) { item = CAR(cmp1); /* Apply key predicate if required */ if (key != UNSPEC) { cmp = APPLY1(key, item); if (setexclusiveor) { if (clist1 == NIL) { clist1 = cdr = CONS(cmp, NIL); GC_PROTECT(clist1); } else { RPLACD(cdr, CONS(cmp, NIL)); cdr = CDR(cdr); } } } else cmp = item; /* Compare against list2 */ for (cmp2 = clist2; CONSP(cmp2); cmp2 = CDR(cmp2)) { value = FCOMPARE(lambda, cmp, CAR(cmp2), code); if (value == expect) break; } if (check_list2 && value != expect) { /* check if list2 is a proper list */ CHECK_LIST(cmp2); check_list2 = 0; } if (function == SUBSETP) { /* Element of list1 not in list2? */ if (value != expect) { GC_LEAVE(); return (NIL); } } /* If need to add item to result */ else if (((setdifference || xunion || setexclusiveor) && value != expect) || (intersection && value == expect)) { if (inplace) { if (result == NIL) result = cons = cmp1; else { if (setexclusiveor) { /* don't remove elements yet, will need * to check agains't list2 later */ for (cmp2 = cons; CDR(cmp2) != cmp1; cmp2 = CDR(cmp2)) ; if (cmp2 != cons) { RPLACD(cmp2, list1); list1 = cmp2; } } RPLACD(cons, cmp1); cons = cmp1; } } else { if (result == NIL) { result = cons = CONS(item, NIL); GC_PROTECT(result); } else { RPLACD(cons, CONS(item, NIL)); cons = CDR(cons); } } } } /* check if list1 is a proper list */ CHECK_LIST(cmp1); if (function == SUBSETP) { GC_LEAVE(); return (T); } else if (xunion) { /* Add list2 to tail of result */ if (result == NIL) result = list2; else RPLACD(cons, list2); } else if (setexclusiveor) { LispObj *result2, *cons2; result2 = cons2 = NIL; for (cmp2 = list2; CONSP(cmp2); cmp2 = CDR(cmp2)) { item = CAR(cmp2); if (key != UNSPEC) { cmp = CAR(clist2); /* XXX changing clist2 */ clist2 = CDR(clist2); cmp1 = clist1; } else { cmp = item; cmp1 = list1; } /* Compare against list1 */ for (; CONSP(cmp1); cmp1 = CDR(cmp1)) { value = FCOMPARE(lambda, cmp, CAR(cmp1), code); if (value == expect) break; } if (value != expect) { if (inplace) { if (result2 == NIL) result2 = cons2 = cmp2; else { RPLACD(cons2, cmp2); cons2 = cmp2; } } else { if (result == NIL) { result = cons = CONS(item, NIL); GC_PROTECT(result); } else { RPLACD(cons, CONS(item, NIL)); cons = CDR(cons); } } } } if (inplace) { if (CONSP(cons2)) RPLACD(cons2, NIL); if (result == NIL) result = result2; else RPLACD(cons, result2); } } else if ((function == NSETDIFFERENCE || function == NINTERSECTION) && CONSP(cons)) RPLACD(cons, NIL); GC_LEAVE(); return (result); } LispObj * Lisp_Loop(LispBuiltin *builtin) /* loop &rest body */ { LispObj *code, *result; LispBlock *block; LispObj *body; body = ARGUMENT(0); result = NIL; block = LispBeginBlock(NIL, LispBlockTag); if (setjmp(block->jmp) == 0) { for (;;) for (code = body; CONSP(code); code = CDR(code)) (void)EVAL(CAR(code)); } LispEndBlock(block); result = lisp__data.block.block_ret; return (result); } /* XXX This function is broken, needs a review (being delayed until true array/vectors be implemented) */ LispObj * Lisp_MakeArray(LispBuiltin *builtin) /* make-array dimensions &key element-type initial-element initial-contents adjustable fill-pointer displaced-to displaced-index-offset */ { long rank = 0, count = 1, offset, zero, c; LispObj *obj, *dim, *array; LispType type; LispObj *dimensions, *element_type, *initial_element, *initial_contents, *displaced_to, *displaced_index_offset; dim = array = NIL; type = LispNil_t; displaced_index_offset = ARGUMENT(7); displaced_to = ARGUMENT(6); initial_contents = ARGUMENT(3); initial_element = ARGUMENT(2); element_type = ARGUMENT(1); dimensions = ARGUMENT(0); if (INDEXP(dimensions)) { dim = CONS(dimensions, NIL); rank = 1; count = FIXNUM_VALUE(dimensions); } else if (CONSP(dimensions)) { dim = dimensions; for (rank = 0; CONSP(dim); rank++, dim = CDR(dim)) { obj = CAR(dim); CHECK_INDEX(obj); count *= FIXNUM_VALUE(obj); } dim = dimensions; } else if (dimensions == NIL) { dim = NIL; rank = count = 0; } else LispDestroy("%s: %s is a bad array dimension", STRFUN(builtin), STROBJ(dimensions)); /* check element-type */ if (element_type != UNSPEC) { if (element_type == T) type = LispNil_t; else if (!SYMBOLP(element_type)) LispDestroy("%s: unsupported element type %s", STRFUN(builtin), STROBJ(element_type)); else { Atom_id atom = ATOMID(element_type); if (atom == Satom) type = LispAtom_t; else if (atom == Sinteger) type = LispInteger_t; else if (atom == Scharacter) type = LispSChar_t; else if (atom == Sstring) type = LispString_t; else if (atom == Slist) type = LispCons_t; else if (atom == Sopaque) type = LispOpaque_t; else LispDestroy("%s: unsupported element type %s", STRFUN(builtin), ATOMID(element_type)->value); } } /* check initial-contents */ if (rank) { CHECK_LIST(initial_contents); } /* check displaced-to */ if (displaced_to != UNSPEC) { CHECK_ARRAY(displaced_to); } /* check displaced-index-offset */ offset = -1; if (displaced_index_offset != UNSPEC) { CHECK_INDEX(displaced_index_offset); offset = FIXNUM_VALUE(displaced_index_offset); } c = 0; if (initial_element != UNSPEC) ++c; if (initial_contents != UNSPEC) ++c; if (displaced_to != UNSPEC || offset >= 0) ++c; if (c > 1) LispDestroy("%s: more than one initialization specified", STRFUN(builtin)); if (initial_element == UNSPEC) initial_element = NIL; zero = count == 0; if (displaced_to != UNSPEC) { CHECK_ARRAY(displaced_to); if (offset < 0) offset = 0; for (c = 1, obj = displaced_to->data.array.dim; obj != NIL; obj = CDR(obj)) c *= FIXNUM_VALUE(CAR(obj)); if (c < count + offset) LispDestroy("%s: array-total-size + displaced-index-offset " "exceeds total size", STRFUN(builtin)); for (c = 0, array = displaced_to->data.array.list; c < offset; c++) array = CDR(array); } else if (initial_contents != UNSPEC) { CHECK_CONS(initial_contents); if (rank == 0) array = initial_contents; else if (rank == 1) { for (array = initial_contents, c = 0; c < count; array = CDR(array), c++) if (!CONSP(array)) LispDestroy("%s: bad argument or size %s", STRFUN(builtin), STROBJ(array)); if (array != NIL) LispDestroy("%s: bad argument or size %s", STRFUN(builtin), STROBJ(array)); array = initial_contents; } else { LispObj *err = NIL; /* check if list matches */ int i, j, k, *dims, *loop; /* create iteration variables */ dims = LispMalloc(sizeof(int) * rank); loop = LispCalloc(1, sizeof(int) * (rank - 1)); for (i = 0, obj = dim; CONSP(obj); i++, obj = CDR(obj)) dims[i] = FIXNUM_VALUE(CAR(obj)); /* check if list matches specified dimensions */ while (loop[0] < dims[0]) { for (obj = initial_contents, i = 0; i < rank - 1; i++) { for (j = 0; j < loop[i]; j++) obj = CDR(obj); err = obj; if (!CONSP(obj = CAR(obj))) goto make_array_error; err = obj; } --i; for (;;) { ++loop[i]; if (i && loop[i] >= dims[i]) loop[i] = 0; else break; --i; } for (k = 0; k < dims[rank - 1]; obj = CDR(obj), k++) { if (!CONSP(obj)) goto make_array_error; } if (obj == NIL) continue; make_array_error: LispFree(dims); LispFree(loop); LispDestroy("%s: bad argument or size %s", STRFUN(builtin), STROBJ(err)); } /* list is correct, use it to fill initial values */ /* reset loop */ memset(loop, 0, sizeof(int) * (rank - 1)); GCDisable(); /* fill array with supplied values */ array = NIL; while (loop[0] < dims[0]) { for (obj = initial_contents, i = 0; i < rank - 1; i++) { for (j = 0; j < loop[i]; j++) obj = CDR(obj); obj = CAR(obj); } --i; for (;;) { ++loop[i]; if (i && loop[i] >= dims[i]) loop[i] = 0; else break; --i; } for (k = 0; k < dims[rank - 1]; obj = CDR(obj), k++) { if (array == NIL) array = CONS(CAR(obj), NIL); else { RPLACD(array, CONS(CAR(array), CDR(array))); RPLACA(array, CAR(obj)); } } } LispFree(dims); LispFree(loop); array = LispReverse(array); GCEnable(); } } else { GCDisable(); /* allocate array */ if (count) { --count; array = CONS(initial_element, NIL); while (count) { RPLACD(array, CONS(CAR(array), CDR(array))); RPLACA(array, initial_element); count--; } } GCEnable(); } obj = LispNew(array, dim); obj->type = LispArray_t; obj->data.array.list = array; obj->data.array.dim = dim; obj->data.array.rank = rank; obj->data.array.type = type; obj->data.array.zero = zero; return (obj); } LispObj * Lisp_MakeList(LispBuiltin *builtin) /* make-list size &key initial-element */ { GC_ENTER(); long count; LispObj *result, *cons; LispObj *size, *initial_element; initial_element = ARGUMENT(1); size = ARGUMENT(0); CHECK_INDEX(size); count = FIXNUM_VALUE(size); if (count == 0) return (NIL); if (initial_element == UNSPEC) initial_element = NIL; result = cons = CONS(initial_element, NIL); GC_PROTECT(result); for (; count > 1; count--) { RPLACD(cons, CONS(initial_element, NIL)); cons = CDR(cons); } GC_LEAVE(); return (result); } LispObj * Lisp_MakeSymbol(LispBuiltin *builtin) /* make-symbol name */ { LispObj *name, *symbol; name = ARGUMENT(0); CHECK_STRING(name); symbol = UNINTERNED_ATOM(THESTR(name)); symbol->data.atom->unreadable = !LispCheckAtomString(THESTR(name)); return (symbol); } LispObj * Lisp_Makunbound(LispBuiltin *builtin) /* makunbound symbol */ { LispObj *symbol; symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); LispUnsetVar(symbol); return (symbol); } LispObj * Lisp_Mapc(LispBuiltin *builtin) /* mapc function list &rest more-lists */ { return (LispMapc(builtin, 0)); } LispObj * Lisp_Mapcar(LispBuiltin *builtin) /* mapcar function list &rest more-lists */ { return (LispMapc(builtin, 1)); } /* Like nconc but ignore non list arguments */ LispObj * LispMapnconc(LispObj *list) { LispObj *result = NIL; if (CONSP(list)) { LispObj *cons, *head, *tail; cons = NIL; for (; CONSP(CDR(list)); list = CDR(list)) { head = CAR(list); if (CONSP(head)) { for (tail = head; CONSP(CDR(tail)); tail = CDR(tail)) ; if (cons != NIL) RPLACD(cons, head); else result = head; cons = tail; } } head = CAR(list); if (CONSP(head)) { if (cons != NIL) RPLACD(cons, head); else result = head; } } return (result); } LispObj * Lisp_Mapcan(LispBuiltin *builtin) /* mapcan function list &rest more-lists */ { return (LispMapnconc(LispMapc(builtin, 1))); } static LispObj * LispMapc(LispBuiltin *builtin, int mapcar) { GC_ENTER(); long i, offset, count, length; LispObj *result = NIL, *cons, *arguments, *acons, *rest, *alist, *value; LispObj *stk[8], **cdrs; LispObj *function, *list, *more_lists; more_lists = ARGUMENT(2); list = ARGUMENT(1); function = ARGUMENT(0); /* Result will be no longer than this */ for (length = 0, alist = list; CONSP(alist); length++, alist = CDR(alist)) ; /* If first argument is not a list... */ if (length == 0) return (NIL); /* At least one argument will be passed to function, count how many * extra arguments will be used, and calculate result length. */ count = 0; for (rest = more_lists; CONSP(rest); rest = CDR(rest), count++) { /* Check if extra list is really a list, and if it is smaller * than the first list */ for (i = 0, alist = CAR(rest); i < length && CONSP(alist); i++, alist = CDR(alist)) ; /* If it is not a true list */ if (i == 0) return (NIL); /* If it is smaller than the currently calculated result length */ if (i < length) length = i; } if (mapcar) { /* Initialize gc protected object cells for resulting list */ result = cons = CONS(NIL, NIL); GC_PROTECT(result); } else result = cons = list; if (count >= sizeof(stk) / sizeof(stk[0])) cdrs = LispMalloc(count * sizeof(LispObj*)); else cdrs = &stk[0]; for (i = 0, rest = more_lists; i < count; i++, rest = CDR(rest)) cdrs[i] = CAR(rest); /* Initialize gc protected object cells for argument list */ arguments = acons = CONS(NIL, NIL); GC_PROTECT(arguments); /* Allocate space for extra arguments */ for (i = 0; i < count; i++) { RPLACD(acons, CONS(NIL, NIL)); acons = CDR(acons); } /* For every element of the list that will be used */ for (offset = 0;; list = CDR(list)) { acons = arguments; /* Add first argument */ RPLACA(acons, CAR(list)); acons = CDR(acons); /* For every extra list argument */ for (i = 0; i < count; i++) { alist = cdrs[i]; cdrs[i] = CDR(cdrs[i]); /* Add element to argument list */ RPLACA(acons, CAR(alist)); acons = CDR(acons); } value = APPLY(function, arguments); if (mapcar) { /* Store result */ RPLACA(cons, value); /* Allocate new result cell */ if (++offset < length) { RPLACD(cons, CONS(NIL, NIL)); cons = CDR(cons); } else break; } else if (++offset >= length) break; } /* Unprotect argument and result list */ GC_LEAVE(); if (cdrs != &stk[0]) LispFree(cdrs); return (result); } static LispObj * LispMapl(LispBuiltin *builtin, int maplist) { GC_ENTER(); long i, offset, count, length; LispObj *result = NIL, *cons, *arguments, *acons, *rest, *alist, *value; LispObj *stk[8], **cdrs; LispObj *function, *list, *more_lists; more_lists = ARGUMENT(2); list = ARGUMENT(1); function = ARGUMENT(0); /* count is the number of lists, length is the length of the result */ for (length = 0, alist = list; CONSP(alist); length++, alist = CDR(alist)) ; /* first argument is not a list */ if (length == 0) return (NIL); /* check remaining arguments */ for (count = 0, rest = more_lists; CONSP(rest); rest = CDR(rest), count++) { for (i = 0, alist = CAR(rest); i < length && CONSP(alist); i++, alist = CDR(alist)) ; /* argument is not a list */ if (i == 0) return (NIL); /* result will have the length of the smallest list */ if (i < length) length = i; } /* result will be a list */ if (maplist) { result = cons = CONS(NIL, NIL); GC_PROTECT(result); } else result = cons = list; if (count >= sizeof(stk) / sizeof(stk[0])) cdrs = LispMalloc(count * sizeof(LispObj*)); else cdrs = &stk[0]; for (i = 0, rest = more_lists; i < count; i++, rest = CDR(rest)) cdrs[i] = CAR(rest); /* initialize argument list */ arguments = acons = CONS(NIL, NIL); GC_PROTECT(arguments); for (i = 0; i < count; i++) { RPLACD(acons, CONS(NIL, NIL)); acons = CDR(acons); } /* for every used list element */ for (offset = 0;; list = CDR(list)) { acons = arguments; /* first argument */ RPLACA(acons, list); acons = CDR(acons); /* for every extra list */ for (i = 0; i < count; i++) { RPLACA(acons, cdrs[i]); cdrs[i] = CDR(cdrs[i]); acons = CDR(acons); } value = APPLY(function, arguments); if (maplist) { /* store result */ RPLACA(cons, value); /* allocate new cell */ if (++offset < length) { RPLACD(cons, CONS(NIL, NIL)); cons = CDR(cons); } else break; } else if (++offset >= length) break; } GC_LEAVE(); if (cdrs != &stk[0]) LispFree(cdrs); return (result); } LispObj * Lisp_Mapl(LispBuiltin *builtin) /* mapl function list &rest more-lists */ { return (LispMapl(builtin, 0)); } LispObj * Lisp_Maplist(LispBuiltin *builtin) /* maplist function list &rest more-lists */ { return (LispMapl(builtin, 1)); } LispObj * Lisp_Mapcon(LispBuiltin *builtin) /* mapcon function list &rest more-lists */ { return (LispMapnconc(LispMapl(builtin, 1))); } LispObj * Lisp_Member(LispBuiltin *builtin) /* member item list &key test test-not key */ { int code, expect; LispObj *compare, *lambda; LispObj *item, *list, *test, *test_not, *key; key = ARGUMENT(4); test_not = ARGUMENT(3); test = ARGUMENT(2); list = ARGUMENT(1); item = ARGUMENT(0); if (list == NIL) return (NIL); CHECK_CONS(list); CHECK_TEST(); if (key == UNSPEC) { if (code == FEQ) { for (; CONSP(list); list = CDR(list)) if (item == CAR(list)) return (list); } else { for (; CONSP(list); list = CDR(list)) if ((FCOMPARE(lambda, item, CAR(list), code)) == expect) return (list); } } else { if (code == FEQ) { for (; CONSP(list); list = CDR(list)) if (item == APPLY1(key, CAR(list))) return (list); } else { for (; CONSP(list); list = CDR(list)) { compare = APPLY1(key, CAR(list)); if ((FCOMPARE(lambda, item, compare, code)) == expect) return (list); } } } /* check if is a proper list */ CHECK_LIST(list); return (NIL); } LispObj * Lisp_MemberIf(LispBuiltin *builtin) /* member-if predicate list &key key */ { return (LispAssocOrMember(builtin, MEMBER, IF)); } LispObj * Lisp_MemberIfNot(LispBuiltin *builtin) /* member-if-not predicate list &key key */ { return (LispAssocOrMember(builtin, MEMBER, IFNOT)); } LispObj * Lisp_MultipleValueBind(LispBuiltin *builtin) /* multiple-value-bind symbols values &rest body */ { int i, head = lisp__data.env.length; LispObj *result, *symbol, *value; LispObj *symbols, *values, *body; body = ARGUMENT(2); values = ARGUMENT(1); symbols = ARGUMENT(0); result = EVAL(values); for (i = -1; CONSP(symbols); symbols = CDR(symbols), i++) { symbol = CAR(symbols); CHECK_SYMBOL(symbol); CHECK_CONSTANT(symbol); if (i >= 0 && i < RETURN_COUNT) value = RETURN(i); else if (i < 0) value = result; else value = NIL; LispAddVar(symbol, value); ++lisp__data.env.head; } /* Execute code with binded variables (if any) */ for (result = NIL; CONSP(body); body = CDR(body)) result = EVAL(CAR(body)); lisp__data.env.head = lisp__data.env.length = head; return (result); } LispObj * Lisp_MultipleValueCall(LispBuiltin *builtin) /* multiple-value-call function &rest form */ { GC_ENTER(); int i; LispObj *arguments, *cons, *result; LispObj *function, *form; form = ARGUMENT(1); function = ARGUMENT(0); /* build argument list */ arguments = cons = NIL; for (; CONSP(form); form = CDR(form)) { RETURN_COUNT = 0; result = EVAL(CAR(form)); if (RETURN_COUNT >= 0) { if (arguments == NIL) { arguments = cons = CONS(result, NIL); GC_PROTECT(arguments); } else { RPLACD(cons, CONS(result, NIL)); cons = CDR(cons); } for (i = 0; i < RETURN_COUNT; i++) { RPLACD(cons, CONS(RETURN(i), NIL)); cons = CDR(cons); } } } /* apply function */ if (POINTERP(function) && !XSYMBOLP(function) && !XFUNCTIONP(function)) { function = EVAL(function); GC_PROTECT(function); } result = APPLY(function, arguments); GC_LEAVE(); return (result); } LispObj * Lisp_MultipleValueProg1(LispBuiltin *builtin) /* multiple-value-prog1 first-form &rest form */ { GC_ENTER(); int i, count; LispObj *values, *cons; LispObj *first_form, *form; form = ARGUMENT(1); first_form = ARGUMENT(0); values = EVAL(first_form); if (!CONSP(form)) return (values); cons = NIL; count = RETURN_COUNT; if (count < 0) values = NIL; else if (count == 0) { GC_PROTECT(values); } else { values = cons = CONS(values, NIL); GC_PROTECT(values); for (i = 0; i < count; i++) { RPLACD(cons, CONS(RETURN(i), NIL)); cons = CDR(cons); } } for (; CONSP(form); form = CDR(form)) EVAL(CAR(form)); RETURN_COUNT = count; if (count > 0) { for (i = 0, cons = CDR(values); CONSP(cons); cons = CDR(cons), i++) RETURN(i) = CAR(cons); values = CAR(values); } GC_LEAVE(); return (values); } LispObj * Lisp_MultipleValueList(LispBuiltin *builtin) /* multiple-value-list form */ { int i; GC_ENTER(); LispObj *form, *result, *cons; form = ARGUMENT(0); result = EVAL(form); if (RETURN_COUNT < 0) return (NIL); result = cons = CONS(result, NIL); GC_PROTECT(result); for (i = 0; i < RETURN_COUNT; i++) { RPLACD(cons, CONS(RETURN(i), NIL)); cons = CDR(cons); } GC_LEAVE(); return (result); } LispObj * Lisp_MultipleValueSetq(LispBuiltin *builtin) /* multiple-value-setq symbols form */ { int i; LispObj *result, *symbol, *value; LispObj *symbols, *form; form = ARGUMENT(1); symbols = ARGUMENT(0); CHECK_LIST(symbols); result = EVAL(form); if (CONSP(symbols)) { symbol = CAR(symbols); CHECK_SYMBOL(symbol); CHECK_CONSTANT(symbol); LispSetVar(symbol, result); symbols = CDR(symbols); } for (i = 0; CONSP(symbols); symbols = CDR(symbols), i++) { symbol = CAR(symbols); CHECK_SYMBOL(symbol); CHECK_CONSTANT(symbol); if (i < RETURN_COUNT && RETURN_COUNT > 0) value = RETURN(i); else value = NIL; LispSetVar(symbol, value); } return (result); } LispObj * Lisp_Nconc(LispBuiltin *builtin) /* nconc &rest lists */ { LispObj *list, *lists, *cons, *head, *tail; lists = ARGUMENT(0); /* skip any initial empty lists */ for (; CONSP(lists); lists = CDR(lists)) if (CAR(lists) != NIL) break; /* don't check if a proper list */ if (!CONSP(lists)) return (lists); /* setup to concatenate lists */ list = CAR(lists); CHECK_CONS(list); for (cons = list; CONSP(CDR(cons)); cons = CDR(cons)) ; /* if only two lists */ lists = CDR(lists); if (!CONSP(lists)) { RPLACD(cons, lists); return (list); } /* concatenate */ for (; CONSP(CDR(lists)); lists = CDR(lists)) { head = CAR(lists); if (head == NIL) continue; CHECK_CONS(head); for (tail = head; CONSP(CDR(tail)); tail = CDR(tail)) ; RPLACD(cons, head); cons = tail; } /* add last list */ RPLACD(cons, CAR(lists)); return (list); } LispObj * Lisp_Nreverse(LispBuiltin *builtin) /* nreverse sequence */ { return (LispXReverse(builtin, 1)); } LispObj * Lisp_NsetDifference(LispBuiltin *builtin) /* nset-difference list1 list2 &key test test-not key */ { return (LispListSet(builtin, NSETDIFFERENCE)); } LispObj * Lisp_Nsubstitute(LispBuiltin *builtin) /* nsubstitute newitem olditem sequence &key from-end test test-not start end count key */ { return (LispDeleteRemoveXSubstitute(builtin, NSUBSTITUTE, NONE)); } LispObj * Lisp_NsubstituteIf(LispBuiltin *builtin) /* nsubstitute-if newitem test sequence &key from-end start end count key */ { return (LispDeleteRemoveXSubstitute(builtin, NSUBSTITUTE, IF)); } LispObj * Lisp_NsubstituteIfNot(LispBuiltin *builtin) /* nsubstitute-if-not newitem test sequence &key from-end start end count key */ { return (LispDeleteRemoveXSubstitute(builtin, NSUBSTITUTE, IFNOT)); } LispObj * Lisp_Nth(LispBuiltin *builtin) /* nth index list */ { long position; LispObj *oindex, *list; list = ARGUMENT(1); oindex = ARGUMENT(0); CHECK_INDEX(oindex); position = FIXNUM_VALUE(oindex); if (list == NIL) return (NIL); CHECK_CONS(list); for (; position > 0; position--) { if (!CONSP(list)) return (NIL); list = CDR(list); } return (CONSP(list) ? CAR(list) : NIL); } LispObj * Lisp_Nthcdr(LispBuiltin *builtin) /* nthcdr index list */ { long position; LispObj *oindex, *list; list = ARGUMENT(1); oindex = ARGUMENT(0); CHECK_INDEX(oindex); position = FIXNUM_VALUE(oindex); if (list == NIL) return (NIL); CHECK_CONS(list); for (; position > 0; position--) { if (!CONSP(list)) return (NIL); list = CDR(list); } return (list); } LispObj * Lisp_NthValue(LispBuiltin *builtin) /* nth-value index form */ { long i; LispObj *oindex, *form, *result; form = ARGUMENT(1); oindex = ARGUMENT(0); oindex = EVAL(oindex); CHECK_INDEX(oindex); i = FIXNUM_VALUE(oindex) - 1; result = EVAL(form); if (RETURN_COUNT < 0 || i >= RETURN_COUNT) result = NIL; else if (i >= 0) result = RETURN(i); return (result); } LispObj * Lisp_Null(LispBuiltin *builtin) /* null list */ { LispObj *list; list = ARGUMENT(0); return (list == NIL ? T : NIL); } LispObj * Lisp_Or(LispBuiltin *builtin) /* or &rest args */ { LispObj *result = NIL, *args; args = ARGUMENT(0); for (; CONSP(args); args = CDR(args)) { result = EVAL(CAR(args)); if (result != NIL) break; } return (result); } LispObj * Lisp_Pairlis(LispBuiltin *builtin) /* pairlis key data &optional alist */ { LispObj *result, *cons; LispObj *key, *data, *alist; alist = ARGUMENT(2); data = ARGUMENT(1); key = ARGUMENT(0); if (CONSP(key) && CONSP(data)) { GC_ENTER(); result = cons = CONS(CONS(CAR(key), CAR(data)), NIL); GC_PROTECT(result); key = CDR(key); data = CDR(data); for (; CONSP(key) && CONSP(data); key = CDR(key), data = CDR(data)) { RPLACD(cons, CONS(CONS(CAR(key), CAR(data)), NIL)); cons = CDR(cons); } if (CONSP(key) || CONSP(data)) LispDestroy("%s: different length lists", STRFUN(builtin)); GC_LEAVE(); if (alist != UNSPEC) RPLACD(cons, alist); } else result = alist == UNSPEC ? NIL : alist; return (result); } static LispObj * LispFindOrPosition(LispBuiltin *builtin, int function, int comparison) /* find item sequence &key from-end test test-not start end key find-if predicate sequence &key from-end start end key find-if-not predicate sequence &key from-end start end key position item sequence &key from-end test test-not start end key position-if predicate sequence &key from-end start end key position-if-not predicate sequence &key from-end start end key */ { int code = 0, istring, expect, value; char *string = NULL; long offset = -1, start, end, length, i = comparison == NONE ? 7 : 5; LispObj *cmp, *element, **objects = NULL; LispObj *item, *predicate, *sequence, *from_end, *test, *test_not, *ostart, *oend, *key; key = ARGUMENT(i); --i; oend = ARGUMENT(i); --i; ostart = ARGUMENT(i); --i; if (comparison == NONE) { test_not = ARGUMENT(i); --i; test = ARGUMENT(i); --i; } else test_not = test = UNSPEC; from_end = ARGUMENT(i); --i; if (from_end == UNSPEC) from_end = NIL; sequence = ARGUMENT(i); --i; if (comparison == NONE) { item = ARGUMENT(i); predicate = Oeql; } else { predicate = ARGUMENT(i); item = NIL; } LispCheckSequenceStartEnd(builtin, sequence, ostart, oend, &start, &end, &length); if (sequence == NIL) return (NIL); /* Cannot specify both :test and :test-not */ if (test != UNSPEC && test_not != UNSPEC) LispDestroy("%s: specify either :TEST or :TEST-NOT", STRFUN(builtin)); expect = 1; if (comparison == NONE) { if (test != UNSPEC) predicate = test; else if (test_not != UNSPEC) { predicate = test_not; expect = 0; } FUNCTION_CHECK(predicate); code = FCODE(predicate); } cmp = element = NIL; istring = STRINGP(sequence); if (istring) string = THESTR(sequence); else { if (!CONSP(sequence)) sequence = sequence->data.array.list; for (i = 0; i < start; i++) sequence = CDR(sequence); } if ((length = end - start) == 0) return (NIL); if (from_end != NIL && !istring) { objects = LispMalloc(sizeof(LispObj*) * length); for (i = length - 1; i >= 0; i--, sequence = CDR(sequence)) objects[i] = CAR(sequence); } for (i = 0; i < length; i++) { if (istring) element = SCHAR(string[from_end == NIL ? i + start : end - i - 1]); else element = from_end == NIL ? CAR(sequence) : objects[i]; if (key != UNSPEC) cmp = APPLY1(key, element); else cmp = element; /* Update list */ if (!istring && from_end == NIL) sequence = CDR(sequence); if (comparison == NONE) value = FCOMPARE(predicate, item, cmp, code); else value = APPLY1(predicate, cmp) != NIL; if ((!value && (comparison == IFNOT || (comparison == NONE && !expect))) || (value && (comparison == IF || (comparison == NONE && expect)))) { offset = from_end == NIL ? i + start : end - i - 1; break; } } if (from_end != NIL && !istring) LispFree(objects); return (offset == -1 ? NIL : function == FIND ? element : FIXNUM(offset)); } LispObj * Lisp_Pop(LispBuiltin *builtin) /* pop place */ { LispObj *result, *value; LispObj *place; place = ARGUMENT(0); if (SYMBOLP(place)) { result = LispGetVar(place); if (result == NULL) LispDestroy("EVAL: the variable %s is unbound", STROBJ(place)); CHECK_CONSTANT(place); if (result != NIL) { CHECK_CONS(result); value = CDR(result); result = CAR(result); } else value = NIL; LispSetVar(place, value); } else { GC_ENTER(); LispObj quote; result = EVAL(place); if (result != NIL) { CHECK_CONS(result); value = CDR(result); GC_PROTECT(value); result = CAR(result); } else value = NIL; quote.type = LispQuote_t; quote.data.quote = value; APPLY2(Osetf, place, "e); GC_LEAVE(); } return (result); } LispObj * Lisp_Position(LispBuiltin *builtin) /* position item sequence &key from-end test test-not start end key */ { return (LispFindOrPosition(builtin, POSITION, NONE)); } LispObj * Lisp_PositionIf(LispBuiltin *builtin) /* position-if predicate sequence &key from-end start end key */ { return (LispFindOrPosition(builtin, POSITION, IF)); } LispObj * Lisp_PositionIfNot(LispBuiltin *builtin) /* position-if-not predicate sequence &key from-end start end key */ { return (LispFindOrPosition(builtin, POSITION, IFNOT)); } LispObj * Lisp_Proclaim(LispBuiltin *builtin) /* proclaim declaration */ { LispObj *arguments, *object; char *operation; LispObj *declaration; declaration = ARGUMENT(0); CHECK_CONS(declaration); arguments = declaration; object = CAR(arguments); CHECK_SYMBOL(object); operation = ATOMID(object)->value; if (strcmp(operation, "SPECIAL") == 0) { for (arguments = CDR(arguments); CONSP(arguments); arguments = CDR(arguments)) { object = CAR(arguments); CHECK_SYMBOL(object); LispProclaimSpecial(object, NULL, NIL); } } else if (strcmp(operation, "TYPE") == 0) { /* XXX no type checking yet, but should be added */ } /* else do nothing */ return (NIL); } LispObj * Lisp_Prog1(LispBuiltin *builtin) /* prog1 first &rest body */ { GC_ENTER(); LispObj *result; LispObj *first, *body; body = ARGUMENT(1); first = ARGUMENT(0); result = EVAL(first); GC_PROTECT(result); for (; CONSP(body); body = CDR(body)) (void)EVAL(CAR(body)); GC_LEAVE(); return (result); } LispObj * Lisp_Prog2(LispBuiltin *builtin) /* prog2 first second &rest body */ { GC_ENTER(); LispObj *result; LispObj *first, *second, *body; body = ARGUMENT(2); second = ARGUMENT(1); first = ARGUMENT(0); (void)EVAL(first); result = EVAL(second); GC_PROTECT(result); for (; CONSP(body); body = CDR(body)) (void)EVAL(CAR(body)); GC_LEAVE(); return (result); } LispObj * Lisp_Progn(LispBuiltin *builtin) /* progn &rest body */ { LispObj *result = NIL; LispObj *body; body = ARGUMENT(0); for (; CONSP(body); body = CDR(body)) result = EVAL(CAR(body)); return (result); } /* * This does what I believe is the expected behaviour (or at least * acceptable for the the interpreter), if the code being executed * ever tries to change/bind a progv symbol, the symbol state will * be restored when exiting the progv block, so, code like: * (progv '(*x*) '(1) (defvar *x* 10)) * when exiting the block, will have *x* unbound, and not a dynamic * symbol; if it was already bound, will have the old value. * Symbols already dynamic can be freely changed, even unbounded in * the progv block. */ LispObj * Lisp_Progv(LispBuiltin *builtin) /* progv symbols values &rest body */ { GC_ENTER(); int head = lisp__data.env.length, i, count, ostk[32], *offsets; LispObj *result, *list, *symbol, *value; int jumped; char fstk[32], *flags; LispBlock *block; LispAtom *atom; LispObj *symbols, *values, *body; /* Possible states */ #define DYNAMIC_SYMBOL 1 #define GLOBAL_SYMBOL 2 #define UNBOUND_SYMBOL 3 body = ARGUMENT(2); values = ARGUMENT(1); symbols = ARGUMENT(0); /* get symbol names */ symbols = EVAL(symbols); GC_PROTECT(symbols); /* get symbol values */ values = EVAL(values); GC_PROTECT(values); /* count/check symbols and allocate space to remember symbol state */ for (count = 0, list = symbols; CONSP(list); count++, list = CDR(list)) { symbol = CAR(list); CHECK_SYMBOL(symbol); CHECK_CONSTANT(symbol); } if (count > sizeof(fstk)) { flags = LispMalloc(count); offsets = LispMalloc(count * sizeof(int)); } else { flags = &fstk[0]; offsets = &ostk[0]; } /* store flags and save old value if required */ for (i = 0, list = symbols; i < count; i++, list = CDR(list)) { atom = CAR(list)->data.atom; if (atom->dyn) flags[i] = DYNAMIC_SYMBOL; else if (atom->a_object) { flags[i] = GLOBAL_SYMBOL; offsets[i] = lisp__data.protect.length; GC_PROTECT(atom->property->value); } else flags[i] = UNBOUND_SYMBOL; } /* bind the symbols */ for (i = 0, list = symbols; i < count; i++, list = CDR(list)) { symbol = CAR(list); atom = symbol->data.atom; if (CONSP(values)) { value = CAR(values); values = CDR(values); } else value = NIL; if (flags[i] != DYNAMIC_SYMBOL) { if (!atom->a_object) LispSetAtomObjectProperty(atom, value); else SETVALUE(atom, value); } else LispAddVar(symbol, value); } /* bind dynamic symbols */ lisp__data.env.head = lisp__data.env.length; jumped = 0; result = NIL; block = LispBeginBlock(NIL, LispBlockProtect); if (setjmp(block->jmp) == 0) { for (; CONSP(body); body = CDR(body)) result = EVAL(CAR(body)); } /* restore symbols */ for (i = 0, list = symbols; i < count; i++, list = CDR(list)) { symbol = CAR(list); atom = symbol->data.atom; if (flags[i] != DYNAMIC_SYMBOL) { if (flags[i] == UNBOUND_SYMBOL) LispUnsetVar(symbol); else { /* restore global symbol value */ LispSetAtomObjectProperty(atom, lisp__data.protect.objects [offsets[i]]); atom->dyn = 0; } } } /* unbind dynamic symbols */ lisp__data.env.head = lisp__data.env.length = head; GC_LEAVE(); if (count > sizeof(fstk)) { LispFree(flags); LispFree(offsets); } LispEndBlock(block); if (!lisp__data.destroyed) { if (jumped) result = lisp__data.block.block_ret; } else { /* check if there is an unwind-protect block */ LispBlockUnwind(NULL); /* no unwind-protect block, return to the toplevel */ LispDestroy("."); } return (result); } LispObj * Lisp_Provide(LispBuiltin *builtin) /* provide module */ { LispObj *module, *obj; module = ARGUMENT(0); CHECK_STRING(module); for (obj = MOD; obj != NIL; obj = CDR(obj)) { if (STRLEN(CAR(obj)) == STRLEN(module) && memcmp(THESTR(CAR(obj)), THESTR(module), STRLEN(module)) == 0) return (module); } if (MOD == NIL) MOD = CONS(module, NIL); else { RPLACD(MOD, CONS(CAR(MOD), CDR(MOD))); RPLACA(MOD, module); } LispSetVar(lisp__data.modules, MOD); return (MOD); } LispObj * Lisp_Push(LispBuiltin *builtin) /* push item place */ { LispObj *result, *list; LispObj *item, *place; place = ARGUMENT(1); item = ARGUMENT(0); item = EVAL(item); if (SYMBOLP(place)) { list = LispGetVar(place); if (list == NULL) LispDestroy("EVAL: the variable %s is unbound", STROBJ(place)); CHECK_CONSTANT(place); LispSetVar(place, result = CONS(item, list)); } else { GC_ENTER(); LispObj quote; list = EVAL(place); result = CONS(item, list); GC_PROTECT(result); quote.type = LispQuote_t; quote.data.quote = result; APPLY2(Osetf, place, "e); GC_LEAVE(); } return (result); } LispObj * Lisp_Pushnew(LispBuiltin *builtin) /* pushnew item place &key key test test-not */ { GC_ENTER(); LispObj *result, *list; LispObj *item, *place, *key, *test, *test_not; test_not = ARGUMENT(4); test = ARGUMENT(3); key = ARGUMENT(2); place = ARGUMENT(1); item = ARGUMENT(0); /* Evaluate place */ if (SYMBOLP(place)) { list = LispGetVar(place); if (list == NULL) LispDestroy("EVAL: the variable %s is unbound", STROBJ(place)); /* Do error checking now. */ CHECK_CONSTANT(place); } else /* It is possible that list is not gc protected? */ list = EVAL(place); item = EVAL(item); GC_PROTECT(item); if (key != UNSPEC) { key = EVAL(key); GC_PROTECT(key); } if (test != UNSPEC) { test = EVAL(test); GC_PROTECT(test); } else if (test_not != UNSPEC) { test_not = EVAL(test_not); GC_PROTECT(test_not); } result = LispAdjoin(builtin, item, list, key, test, test_not); /* Item already in list */ if (result == list) { GC_LEAVE(); return (result); } if (SYMBOLP(place)) { CHECK_CONSTANT(place); LispSetVar(place, result); } else { LispObj quote; GC_PROTECT(result); quote.type = LispQuote_t; quote.data.quote = result; APPLY2(Osetf, place, "e); } GC_LEAVE(); return (result); } #ifdef __SUNPRO_C /* prevent "Function has no return statement" error for Lisp_Quit */ #pragma does_not_return(exit) #endif LispObj * Lisp_Quit(LispBuiltin *builtin) /* quit &optional status */ { int status = 0; LispObj *ostatus; ostatus = ARGUMENT(0); if (FIXNUMP(ostatus)) status = (int)FIXNUM_VALUE(ostatus); else if (ostatus != UNSPEC) LispDestroy("%s: bad exit status argument %s", STRFUN(builtin), STROBJ(ostatus)); exit(status); } LispObj * Lisp_Quote(LispBuiltin *builtin) /* quote object */ { LispObj *object; object = ARGUMENT(0); return (object); } LispObj * Lisp_Replace(LispBuiltin *builtin) /* replace sequence1 sequence2 &key start1 end1 start2 end2 */ { long length, length1, length2, start1, end1, start2, end2; LispObj *sequence1, *sequence2, *ostart1, *oend1, *ostart2, *oend2; oend2 = ARGUMENT(5); ostart2 = ARGUMENT(4); oend1 = ARGUMENT(3); ostart1 = ARGUMENT(2); sequence2 = ARGUMENT(1); sequence1 = ARGUMENT(0); LispCheckSequenceStartEnd(builtin, sequence1, ostart1, oend1, &start1, &end1, &length1); LispCheckSequenceStartEnd(builtin, sequence2, ostart2, oend2, &start2, &end2, &length2); if (start1 == end1 || start2 == end2) return (sequence1); length = end1 - start1; if (length > end2 - start2) length = end2 - start2; if (STRINGP(sequence1)) { CHECK_STRING_WRITABLE(sequence1); if (!STRINGP(sequence2)) LispDestroy("%s: cannot store %s in %s", STRFUN(builtin), STROBJ(sequence2), THESTR(sequence1)); memmove(THESTR(sequence1) + start1, THESTR(sequence2) + start2, length); } else { int i; LispObj *from, *to; if (ARRAYP(sequence1)) sequence1 = sequence1->data.array.list; if (ARRAYP(sequence2)) sequence2 = sequence2->data.array.list; /* adjust pointers */ for (i = 0, from = sequence2; i < start2; i++, from = CDR(from)) ; for (i = 0, to = sequence1; i < start1; i++, to = CDR(to)) ; /* copy data */ for (i = 0; i < length; i++, from = CDR(from), to = CDR(to)) RPLACA(to, CAR(from)); } return (sequence1); } static LispObj * LispDeleteOrRemoveDuplicates(LispBuiltin *builtin, int function) /* delete-duplicates sequence &key from-end test test-not start end key remove-duplicates sequence &key from-end test test-not start end key */ { GC_ENTER(); int code, expect, value = 0; long i, j, start, end, length, count; LispObj *lambda, *result, *cons, *compare; LispObj *sequence, *from_end, *test, *test_not, *ostart, *oend, *key; key = ARGUMENT(6); oend = ARGUMENT(5); ostart = ARGUMENT(4); test_not = ARGUMENT(3); test = ARGUMENT(2); from_end = ARGUMENT(1); if (from_end == UNSPEC) from_end = NIL; sequence = ARGUMENT(0); LispCheckSequenceStartEnd(builtin, sequence, ostart, oend, &start, &end, &length); /* Check if need to do something */ if (start == end) return (sequence); CHECK_TEST(); /* Initialize */ count = 0; result = cons = NIL; if (STRINGP(sequence)) { char *ptr, *string, *buffer = LispMalloc(length + 1); /* Use same code, update start/end offsets */ if (from_end != NIL) { i = length - start; start = length - end; end = i; } if (from_end == NIL) string = THESTR(sequence); else { /* Make a reversed copy of the sequence */ string = LispMalloc(length + 1); for (ptr = THESTR(sequence) + length - 1, i = 0; i < length; i++) string[i] = *ptr--; string[i] = '\0'; } ptr = buffer; /* Copy leading bytes */ for (i = 0; i < start; i++) *ptr++ = string[i]; compare = SCHAR(string[i]); if (key != UNSPEC) compare = APPLY1(key, compare); result = cons = CONS(compare, NIL); GC_PROTECT(result); for (++i; i < end; i++) { compare = SCHAR(string[i]); if (key != UNSPEC) compare = APPLY1(key, compare); RPLACD(cons, CONS(compare, NIL)); cons = CDR(cons); } for (i = start; i < end; i++, result = CDR(result)) { compare = CAR(result); for (j = i + 1, cons = CDR(result); j < end; j++, cons = CDR(cons)) { value = FCOMPARE(lambda, compare, CAR(cons), code); if (value == expect) break; } if (value != expect) *ptr++ = string[i]; else ++count; } if (count) { /* Copy ending bytes */ for (; i <= length; i++) /* Also copy the ending nul */ *ptr++ = string[i]; if (from_end == NIL) ptr = buffer; else { for (i = 0, ptr = buffer + strlen(buffer); ptr > buffer; i++) string[i] = *--ptr; string[i] = '\0'; ptr = string; LispFree(buffer); } if (function == REMOVE) result = STRING2(ptr); else { CHECK_STRING_WRITABLE(sequence); result = sequence; free(THESTR(result)); THESTR(result) = ptr; LispMused(ptr); } } else { result = sequence; if (from_end != NIL) LispFree(string); } } else { long xlength = end - start; LispObj *list, *object, **kobjects = NULL, **xobjects; LispObj **objects = LispMalloc(sizeof(LispObj*) * xlength); if (!CONSP(sequence)) object = sequence->data.array.list; else object = sequence; list = object; for (i = 0; i < start; i++) object = CDR(object); /* Put data in a vector */ if (from_end == NIL) { for (i = 0; i < xlength; i++, object = CDR(object)) objects[i] = CAR(object); } else { for (i = xlength - 1; i >= 0; i--, object = CDR(object)) objects[i] = CAR(object); } /* Apply key predicate if required */ if (key != UNSPEC) { kobjects = LispMalloc(sizeof(LispObj*) * xlength); for (i = 0; i < xlength; i++) { kobjects[i] = APPLY1(key, objects[i]); GC_PROTECT(kobjects[i]); } xobjects = kobjects; } else xobjects = objects; /* Check if needs to remove something */ for (i = 0; i < xlength; i++) { compare = xobjects[i]; for (j = i + 1; j < xlength; j++) { value = FCOMPARE(lambda, compare, xobjects[j], code); if (value == expect) { objects[i] = NULL; ++count; break; } } } if (count) { /* Create/set result list */ object = list; if (start) { /* Skip first elements of resulting list */ if (function == REMOVE) { result = cons = CONS(CAR(object), NIL); GC_PROTECT(result); for (i = 1, object = CDR(object); i < start; i++, object = CDR(object)) { RPLACD(cons, CONS(CAR(object), NIL)); cons = CDR(cons); } } else { result = cons = object; for (i = 1; i < start; i++, cons = CDR(cons)) ; } } else if (function == DELETE) result = list; /* Skip initial removed elements */ if (function == REMOVE) { for (i = 0; objects[i] == NULL && i < xlength; i++) ; } else i = 0; if (i < xlength) { int xstart, xlimit, xinc; if (from_end == NIL) { xstart = i; xlimit = xlength; xinc = 1; } else { xstart = xlength - 1; xlimit = i - 1; xinc = -1; } if (function == REMOVE) { for (i = xstart; i != xlimit; i += xinc) { if (objects[i] != NULL) { if (result == NIL) { result = cons = CONS(objects[i], NIL); GC_PROTECT(result); } else { RPLACD(cons, CONS(objects[i], NIL)); cons = CDR(cons); } } } } else { /* Delete duplicates */ for (i = xstart; i != xlimit; i += xinc) { if (objects[i] == NULL) { if (cons == NIL) { if (CONSP(CDR(result))) { RPLACA(result, CADR(result)); RPLACD(result, CDDR(result)); } else { RPLACA(result, CDR(result)); RPLACD(result, NIL); } } else { if (CONSP(CDR(cons))) RPLACD(cons, CDDR(cons)); else RPLACD(cons, NIL); } } else { if (cons == NIL) cons = result; else cons = CDR(cons); } } } } if (end < length && function == REMOVE) { for (i = start; i < end; i++, object = CDR(object)) ; if (result == NIL) { result = cons = CONS(CAR(object), NIL); GC_PROTECT(result); ++i; object = CDR(object); } for (; i < length; i++, object = CDR(object)) { RPLACD(cons, CONS(CAR(object), NIL)); cons = CDR(cons); } } } else result = sequence; LispFree(objects); if (key != UNSPEC) LispFree(kobjects); if (count && !CONSP(sequence)) { if (function == REMOVE) result = VECTOR(result); else { length = FIXNUM_VALUE(CAR(sequence->data.array.dim)) - count; CAR(sequence->data.array.dim) = FIXNUM(length); result = sequence; } } } GC_LEAVE(); return (result); } LispObj * Lisp_RemoveDuplicates(LispBuiltin *builtin) /* remove-duplicates sequence &key from-end test test-not start end key */ { return (LispDeleteOrRemoveDuplicates(builtin, REMOVE)); } static LispObj * LispDeleteRemoveXSubstitute(LispBuiltin *builtin, int function, int comparison) /* delete item sequence &key from-end test test-not start end count key delete-if predicate sequence &key from-end start end count key delete-if-not predicate sequence &key from-end start end count key remove item sequence &key from-end test test-not start end count key remove-if predicate sequence &key from-end start end count key remove-if-not predicate sequence &key from-end start end count key substitute newitem olditem sequence &key from-end test test-not start end count key substitute-if newitem test sequence &key from-end start end count key substitute-if-not newitem test sequence &key from-end start end count key nsubstitute newitem olditem sequence &key from-end test test-not start end count key nsubstitute-if newitem test sequence &key from-end start end count key nsubstitute-if-not newitem test sequence &key from-end start end count key */ { GC_ENTER(); int code, expect, value, inplace, substitute; long i, j, start, end, length, copy, count, xstart, xend, xinc, xlength; LispObj *result, *compare; LispObj *item, *newitem, *lambda, *sequence, *from_end, *test, *test_not, *ostart, *oend, *ocount, *key; substitute = function == SUBSTITUTE || function == NSUBSTITUTE; if (!substitute) i = comparison == NONE ? 8 : 6; else /* substitute */ i = comparison == NONE ? 9 : 7; /* Get function arguments */ key = ARGUMENT(i); --i; ocount = ARGUMENT(i); --i; oend = ARGUMENT(i); --i; ostart = ARGUMENT(i); --i; if (comparison == NONE) { test_not = ARGUMENT(i); --i; test = ARGUMENT(i); --i; } else test_not = test = UNSPEC; from_end = ARGUMENT(i); --i; if (from_end == UNSPEC) from_end = NIL; sequence = ARGUMENT(i); --i; if (comparison != NONE) { lambda = ARGUMENT(i); --i; if (substitute) newitem = ARGUMENT(0); else newitem = NIL; item = NIL; } else { lambda = NIL; if (substitute) { item = ARGUMENT(1); newitem = ARGUMENT(0); } else { item = ARGUMENT(0); newitem = NIL; } } /* Check if argument is a valid sequence, and if start/end * are correctly specified. */ LispCheckSequenceStartEnd(builtin, sequence, ostart, oend, &start, &end, &length); /* Check count argument */ if (ocount == UNSPEC) { count = length; /* Doesn't matter, but left to right should be slightly faster */ from_end = NIL; } else { CHECK_INDEX(ocount); count = FIXNUM_VALUE(ocount); } /* Check if need to do something */ if (start == end || count == 0) return (sequence); CHECK_TEST_0(); /* Resolve comparison function, and expected result of comparison */ if (comparison == NONE) { if (test_not == UNSPEC) { if (test == UNSPEC) lambda = Oeql; else lambda = test; expect = 1; } else { lambda = test_not; expect = 0; } FUNCTION_CHECK(lambda); } else expect = comparison == IFNOT ? 0 : 1; /* Check for fast path to comparison function */ code = FCODE(lambda); /* Initialize for loop */ copy = count; result = sequence; inplace = function == DELETE || function == NSUBSTITUTE; xlength = end - start; /* String is easier */ if (STRINGP(sequence)) { char *buffer, *string; if (comparison == NONE) { CHECK_SCHAR(item); } if (substitute) { CHECK_SCHAR(newitem); } if (from_end == NIL) { xstart = start; xend = end; xinc = 1; } else { xstart = end - 1; xend = start - 1; xinc = -1; } string = THESTR(sequence); buffer = LispMalloc(length + 1); /* Copy leading bytes, if any */ for (i = 0; i < start; i++) buffer[i] = string[i]; for (j = xstart; i != xend && count > 0; i += xinc) { compare = SCHAR(string[i]); if (key != UNSPEC) { compare = APPLY1(key, compare); /* Value returned by the key predicate may not be protected */ GC_PROTECT(compare); if (comparison == NONE) value = FCOMPARE(lambda, item, compare, code); else value = APPLY1(lambda, compare) != NIL; /* Unprotect value returned by the key predicate */ GC_LEAVE(); } else { if (comparison == NONE) value = FCOMPARE(lambda, item, compare, code); else value = APPLY1(lambda, compare) != NIL; } if (value != expect) { buffer[j] = string[i]; j += xinc; } else { if (substitute) { buffer[j] = SCHAR_VALUE(newitem); j += xinc; } else --count; } } if (count != copy && from_end != NIL) memmove(buffer + start, buffer + copy - count, count); /* Copy remaining bytes, if any */ for (; i < length; i++, j++) buffer[j] = string[i]; buffer[j] = '\0'; xlength = length - (copy - count); if (inplace) { CHECK_STRING_WRITABLE(sequence); /* result is a pointer to sequence */ LispFree(THESTR(sequence)); LispMused(buffer); THESTR(sequence) = buffer; STRLEN(sequence) = xlength; } else result = LSTRING2(buffer, xlength); } /* If inplace, need to update CAR and CDR of sequence */ else { LispObj *list, *object; LispObj **objects = LispMalloc(sizeof(LispObj*) * xlength); if (!CONSP(sequence)) list = sequence->data.array.list; else list = sequence; /* Put data in a vector */ for (i = 0, object = list; i < start; i++) object = CDR(object); for (i = 0; i < xlength; i++, object = CDR(object)) objects[i] = CAR(object); if (from_end == NIL) { xstart = 0; xend = xlength; xinc = 1; } else { xstart = xlength - 1; xend = -1; xinc = -1; } /* Check if needs to remove something */ for (i = xstart; i != xend && count > 0; i += xinc) { compare = objects[i]; if (key != UNSPEC) { compare = APPLY1(key, compare); GC_PROTECT(compare); if (comparison == NONE) value = FCOMPARE(lambda, item, compare, code); else value = APPLY1(lambda, compare) != NIL; GC_LEAVE(); } else { if (comparison == NONE) value = FCOMPARE(lambda, item, compare, code); else value = APPLY1(lambda, compare) != NIL; } if (value == expect) { if (substitute) objects[i] = newitem; else objects[i] = NULL; --count; } } if (copy != count) { LispObj *cons = NIL; i = 0; object = list; if (inplace) { /* While result is NIL, skip initial elements of sequence */ result = start ? list : NIL; /* Skip initial elements, if any */ for (; i < start; i++, cons = object, object = CDR(object)) ; } /* Copy initial elements, if any */ else { result = NIL; if (start) { result = cons = CONS(CAR(list), NIL); GC_PROTECT(result); for (++i, object = CDR(list); i < start; i++, object = CDR(object)) { RPLACD(cons, CONS(CAR(object), NIL)); cons = CDR(cons); } } } /* Skip initial removed elements, if any */ for (i = 0; i < xlength && objects[i] == NULL; i++) ; for (i = 0; i < xlength; i++, object = CDR(object)) { if (objects[i]) { if (inplace) { if (result == NIL) result = cons = object; else { RPLACD(cons, object); cons = CDR(cons); } if (function == NSUBSTITUTE) RPLACA(cons, objects[i]); } else { if (result == NIL) { result = cons = CONS(objects[i], NIL); GC_PROTECT(result); } else { RPLACD(cons, CONS(objects[i], NIL)); cons = CDR(cons); } } } } if (inplace) { if (result == NIL) result = object; else RPLACD(cons, object); if (!CONSP(sequence)) { result = sequence; CAR(result)->data.array.dim = FIXNUM(length - (copy - count)); } } else if (end < length) { i = end; /* Copy ending elements, if any */ if (result == NIL) { result = cons = CONS(CAR(object), NIL); GC_PROTECT(result); object = CDR(object); i++; } for (; i < length; i++, object = CDR(object)) { RPLACD(cons, CONS(CAR(object), NIL)); cons = CDR(cons); } } } /* Release comparison vector */ LispFree(objects); } GC_LEAVE(); return (result); } LispObj * Lisp_Remove(LispBuiltin *builtin) /* remove item sequence &key from-end test test-not start end count key */ { return (LispDeleteRemoveXSubstitute(builtin, REMOVE, NONE)); } LispObj * Lisp_RemoveIf(LispBuiltin *builtin) /* remove-if predicate sequence &key from-end start end count key */ { return (LispDeleteRemoveXSubstitute(builtin, REMOVE, IF)); } LispObj * Lisp_RemoveIfNot(LispBuiltin *builtin) /* remove-if-not predicate sequence &key from-end start end count key */ { return (LispDeleteRemoveXSubstitute(builtin, REMOVE, IFNOT)); } LispObj * Lisp_Remprop(LispBuiltin *builtin) /* remprop symbol indicator */ { LispObj *symbol, *indicator; indicator = ARGUMENT(1); symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); return (LispRemAtomProperty(symbol->data.atom, indicator)); } LispObj * Lisp_Return(LispBuiltin *builtin) /* return &optional result */ { unsigned blevel = lisp__data.block.block_level; LispObj *result; result = ARGUMENT(0); while (blevel) { LispBlock *block = lisp__data.block.block[--blevel]; if (block->type == LispBlockClosure) /* if reached a function call */ break; if (block->type == LispBlockTag && block->tag == NIL) { lisp__data.block.block_ret = result == UNSPEC ? NIL : EVAL(result); LispBlockUnwind(block); BLOCKJUMP(block); } } LispDestroy("%s: no visible NIL block", STRFUN(builtin)); /*NOTREACHED*/ return (NIL); } LispObj * Lisp_ReturnFrom(LispBuiltin *builtin) /* return-from name &optional result */ { unsigned blevel = lisp__data.block.block_level; LispObj *name, *result; result = ARGUMENT(1); name = ARGUMENT(0); if (name != NIL && name != T && !SYMBOLP(name)) LispDestroy("%s: %s is not a valid block name", STRFUN(builtin), STROBJ(name)); while (blevel) { LispBlock *block = lisp__data.block.block[--blevel]; if (name == block->tag && (block->type == LispBlockTag || block->type == LispBlockClosure)) { lisp__data.block.block_ret = result == UNSPEC ? NIL : EVAL(result); LispBlockUnwind(block); BLOCKJUMP(block); } if (block->type == LispBlockClosure) /* can use return-from only in the current function */ break; } LispDestroy("%s: no visible block named %s", STRFUN(builtin), STROBJ(name)); /*NOTREACHED*/ return (NIL); } static LispObj * LispXReverse(LispBuiltin *builtin, int inplace) /* nreverse sequence reverse sequence */ { long length; LispObj *list, *result = NIL; LispObj *sequence; sequence = ARGUMENT(0); /* Do error checking for arrays and object type. */ length = LispLength(sequence); if (length <= 1) return (sequence); switch (XOBJECT_TYPE(sequence)) { case LispString_t: { long i; char *from, *to; from = THESTR(sequence) + length - 1; if (inplace) { char temp; CHECK_STRING_WRITABLE(sequence); to = THESTR(sequence); for (i = 0; i < length / 2; i++) { temp = to[i]; to[i] = from[-i]; from[-i] = temp; } result = sequence; } else { to = LispMalloc(length + 1); to[length] = '\0'; for (i = 0; i < length; i++) to[i] = from[-i]; result = STRING2(to); } } return (result); case LispCons_t: if (inplace) { long i, j; LispObj *temp; /* For large lists this can be very slow, but for small * amounts of data, this avoid allocating a buffer to * to store the CAR of the sequence. This is only done * to not destroy the contents of a variable. */ for (i = 0, list = sequence; i < (length + 1) / 2; i++, list = CDR(list)) ; length /= 2; for (i = 0; i < length; i++, list = CDR(list)) { for (j = length - i - 1, result = sequence; j > 0; j--, result = CDR(result)) ; temp = CAR(list); RPLACA(list, CAR(result)); RPLACA(result, temp); } return (sequence); } list = sequence; break; case LispArray_t: if (inplace) { sequence->data.array.list = LispReverse(sequence->data.array.list); return (sequence); } list = sequence->data.array.list; break; default: /* LispNil_t */ return (result); } { GC_ENTER(); LispObj *cons; result = cons = CONS(CAR(list), NIL); GC_PROTECT(result); for (list = CDR(list); CONSP(list); list = CDR(list)) { RPLACD(cons, CONS(CAR(list), NIL)); cons = CDR(cons); } result = LispReverse(result); GC_LEAVE(); } if (ARRAYP(sequence)) { list = result; result = LispNew(list, NIL); result->type = LispArray_t; result->data.array.list = list; result->data.array.dim = sequence->data.array.dim; result->data.array.rank = sequence->data.array.rank; result->data.array.type = sequence->data.array.type; result->data.array.zero = sequence->data.array.zero; } return (result); } LispObj * Lisp_Reverse(LispBuiltin *builtin) /* reverse sequence */ { return (LispXReverse(builtin, 0)); } LispObj * Lisp_Rplaca(LispBuiltin *builtin) /* rplaca place value */ { LispObj *place, *value; value = ARGUMENT(1); place = ARGUMENT(0); CHECK_CONS(place); RPLACA(place, value); return (place); } LispObj * Lisp_Rplacd(LispBuiltin *builtin) /* rplacd place value */ { LispObj *place, *value; value = ARGUMENT(1); place = ARGUMENT(0); CHECK_CONS(place); RPLACD(place, value); return (place); } LispObj * Lisp_Search(LispBuiltin *builtin) /* search sequence1 sequence2 &key from-end test test-not key start1 start2 end1 end2 */ { int code = 0, expect, value; long start1, start2, end1, end2, length1, length2, off1, off2, offset = -1; LispObj *cmp1, *cmp2, *list1 = NIL, *lambda; SeqInfo seq1, seq2; LispObj *sequence1, *sequence2, *from_end, *test, *test_not, *key, *ostart1, *ostart2, *oend1, *oend2; oend2 = ARGUMENT(9); oend1 = ARGUMENT(8); ostart2 = ARGUMENT(7); ostart1 = ARGUMENT(6); key = ARGUMENT(5); test_not = ARGUMENT(4); test = ARGUMENT(3); from_end = ARGUMENT(2); sequence2 = ARGUMENT(1); sequence1 = ARGUMENT(0); LispCheckSequenceStartEnd(builtin, sequence1, ostart1, oend1, &start1, &end1, &length1); LispCheckSequenceStartEnd(builtin, sequence2, ostart2, oend2, &start2, &end2, &length2); /* Check for special conditions */ if (start1 == end1) return (FIXNUM(end2)); else if (start2 == end2) return (start1 == end1 ? FIXNUM(start2) : NIL); CHECK_TEST(); if (from_end == UNSPEC) from_end = NIL; SETSEQ(seq1, sequence1); SETSEQ(seq2, sequence2); length1 = end1 - start1; length2 = end2 - start2; /* update start of sequences */ if (start1) { if (seq1.type == LispString_t) seq1.data.string += start1; else { for (cmp1 = seq1.data.list; start1; cmp1 = CDR(cmp1), --start1) ; seq1.data.list = cmp1; } end1 = length1; } if (start2) { if (seq2.type == LispString_t) seq2.data.string += start2; else { for (cmp2 = seq2.data.list; start2; cmp2 = CDR(cmp2), --start2) ; seq2.data.list = cmp2; } end2 = length2; } /* easier case */ if (from_end == NIL) { LispObj *list2 = NIL; /* while a match is possible */ while (end2 - start2 >= length1) { /* prepare to search */ off1 = 0; off2 = start2; if (seq1.type != LispString_t) list1 = seq1.data.list; if (seq2.type != LispString_t) list2 = seq2.data.list; /* for every element that must match in sequence1 */ while (off1 < length1) { if (seq1.type == LispString_t) cmp1 = SCHAR(seq1.data.string[off1]); else cmp1 = CAR(list1); if (seq2.type == LispString_t) cmp2 = SCHAR(seq2.data.string[off2]); else cmp2 = CAR(list2); if (key != UNSPEC) { cmp1 = APPLY1(key, cmp1); cmp2 = APPLY1(key, cmp2); } /* compare elements */ value = FCOMPARE(lambda, cmp1, cmp2, code); if (value != expect) break; /* update offsets/sequence pointers */ ++off1; ++off2; if (seq1.type != LispString_t) list1 = CDR(list1); if (seq2.type != LispString_t) list2 = CDR(list2); } /* if everything matched */ if (off1 == end1) { offset = off2 - length1; break; } /* update offset/sequence2 pointer */ ++start2; if (seq2.type != LispString_t) seq2.data.list = CDR(seq2.data.list); } } else { /* allocate vector if required, only list2 requires it. * list1 can be traversed forward */ if (seq2.type != LispString_t) { cmp2 = seq2.data.list; seq2.data.vector = LispMalloc(sizeof(LispObj*) * length2); for (off2 = 0; off2 < end2; off2++, cmp2 = CDR(cmp2)) seq2.data.vector[off2] = CAR(cmp2); } /* while a match is possible */ while (end2 >= length1) { /* prepare to search */ off1 = 0; off2 = end2 - length1; if (seq1.type != LispString_t) list1 = seq1.data.list; /* for every element that must match in sequence1 */ while (off1 < end1) { if (seq1.type == LispString_t) cmp1 = SCHAR(seq1.data.string[off1]); else cmp1 = CAR(list1); if (seq2.type == LispString_t) cmp2 = SCHAR(seq2.data.string[off2]); else cmp2 = seq2.data.vector[off2]; if (key != UNSPEC) { cmp1 = APPLY1(key, cmp1); cmp2 = APPLY1(key, cmp2); } /* Compare elements */ value = FCOMPARE(lambda, cmp1, cmp2, code); if (value != expect) break; /* Update offsets */ ++off1; ++off2; if (seq1.type != LispString_t) list1 = CDR(list1); } /* If all elements matched */ if (off1 == end1) { offset = off2 - length1; break; } /* Update offset */ --end2; } if (seq2.type != LispString_t) LispFree(seq2.data.vector); } return (offset == -1 ? NIL : FIXNUM(offset)); } /* * ext::getenv */ LispObj * Lisp_Setenv(LispBuiltin *builtin) /* setenv name value &optional overwrite */ { char *name, *value; LispObj *oname, *ovalue, *overwrite; overwrite = ARGUMENT(2); ovalue = ARGUMENT(1); oname = ARGUMENT(0); CHECK_STRING(oname); name = THESTR(oname); CHECK_STRING(ovalue); value = THESTR(ovalue); setenv(name, value, overwrite != UNSPEC && overwrite != NIL); value = getenv(name); return (value ? STRING(value) : NIL); } LispObj * Lisp_Set(LispBuiltin *builtin) /* set symbol value */ { LispAtom *atom; LispObj *symbol, *value; value = ARGUMENT(1); symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); atom = symbol->data.atom; if (atom->dyn) LispSetVar(symbol, value); else if (atom->watch || !atom->a_object) LispSetAtomObjectProperty(atom, value); else { CHECK_CONSTANT(symbol); SETVALUE(atom, value); } return (value); } LispObj * Lisp_SetDifference(LispBuiltin *builtin) /* set-difference list1 list2 &key test test-not key */ { return (LispListSet(builtin, SETDIFFERENCE)); } LispObj * Lisp_SetExclusiveOr(LispBuiltin *builtin) /* set-exclusive-or list1 list2 &key test test-not key */ { return (LispListSet(builtin, SETEXCLUSIVEOR)); } LispObj * Lisp_NsetExclusiveOr(LispBuiltin *builtin) /* nset-exclusive-or list1 list2 &key test test-not key */ { return (LispListSet(builtin, NSETEXCLUSIVEOR)); } LispObj * Lisp_SetQ(LispBuiltin *builtin) /* setq &rest form */ { LispObj *result, *variable, *form; form = ARGUMENT(0); result = NIL; for (; CONSP(form); form = CDR(form)) { variable = CAR(form); CHECK_SYMBOL(variable); CHECK_CONSTANT(variable); form = CDR(form); if (!CONSP(form)) LispDestroy("%s: odd number of arguments", STRFUN(builtin)); result = EVAL(CAR(form)); LispSetVar(variable, result); } return (result); } LispObj * Lisp_Psetq(LispBuiltin *builtin) /* psetq &rest form */ { GC_ENTER(); int base = gc__protect; LispObj *value, *symbol, *list, *form; form = ARGUMENT(0); /* parallel setq, first pass evaluate values and basic error checking */ for (list = form; CONSP(list); list = CDR(list)) { symbol = CAR(list); CHECK_SYMBOL(symbol); list = CDR(list); if (!CONSP(list)) LispDestroy("%s: odd number of arguments", STRFUN(builtin)); value = EVAL(CAR(list)); GC_PROTECT(value); } /* second pass, assign values */ for (; CONSP(form); form = CDDR(form)) { symbol = CAR(form); CHECK_CONSTANT(symbol); LispSetVar(symbol, lisp__data.protect.objects[base++]); } GC_LEAVE(); return (NIL); } LispObj * Lisp_Setf(LispBuiltin *builtin) /* setf &rest form */ { LispAtom *atom; LispObj *setf, *place, *value, *result = NIL, *data; LispObj *form; form = ARGUMENT(0); for (; CONSP(form); form = CDR(form)) { place = CAR(form); form = CDR(form); if (!CONSP(form)) LispDestroy("%s: odd number of arguments", STRFUN(builtin)); value = CAR(form); if (!POINTERP(place)) goto invalid_place; if (XSYMBOLP(place)) { CHECK_CONSTANT(place); result = EVAL(value); (void)LispSetVar(place, result); } else if (XCONSP(place)) { /* it really should not be required to protect any object * evaluated here, but is done for safety in case one of * the evaluated forms returns data not gc protected, what * could cause surprises if the object is garbage collected * before finishing setf. */ GC_ENTER(); setf = CAR(place); if (!SYMBOLP(setf)) goto invalid_place; if (!CONSP(CDR(place))) goto invalid_place; value = EVAL(value); GC_PROTECT(value); atom = setf->data.atom; if (atom->a_defsetf == 0) { if (atom->a_defstruct && atom->property->structure.function >= 0) { /* Use a default setf method for the structure field, as * if this definition have been done * (defsetf THE-STRUCT-FIELD (struct) (value) * `(lisp::struct-store 'THE-STRUCT-FIELD ,struct ,value)) */ place = CDR(place); data = CAR(place); if (CONSP(CDR(place))) goto invalid_place; data = EVAL(data); GC_PROTECT(data); result = APPLY3(Ostruct_store, setf, data, value); GC_LEAVE(); continue; } /* Must also expand macros */ else if (atom->a_function && atom->property->fun.function->funtype == LispMacro) { result = LispRunSetfMacro(atom, CDR(place), value); continue; } goto invalid_place; } place = CDR(place); setf = setf->data.atom->property->setf; if (SYMBOLP(setf)) { LispObj *arguments, *cons; if (!CONSP(CDR(place))) { arguments = EVAL(CAR(place)); GC_PROTECT(arguments); result = APPLY2(setf, arguments, value); } else if (!CONSP(CDDR(place))) { arguments = EVAL(CAR(place)); GC_PROTECT(arguments); cons = EVAL(CADR(place)); GC_PROTECT(cons); result = APPLY3(setf, arguments, cons, value); } else { arguments = cons = CONS(EVAL(CAR(place)), NIL); GC_PROTECT(arguments); for (place = CDR(place); CONSP(place); place = CDR(place)) { RPLACD(cons, CONS(EVAL(CAR(place)), NIL)); cons = CDR(cons); } RPLACD(cons, CONS(value, NIL)); result = APPLY(setf, arguments); } } else result = LispRunSetf(atom->property->salist, setf, place, value); GC_LEAVE(); } else goto invalid_place; } return (result); invalid_place: LispDestroy("%s: %s is an invalid place", STRFUN(builtin), STROBJ(place)); /*NOTREACHED*/ return (NIL); } LispObj * Lisp_Psetf(LispBuiltin *builtin) /* psetf &rest form */ { int base; GC_ENTER(); LispAtom *atom; LispObj *setf, *place = NIL, *value, *data; LispObj *form; form = ARGUMENT(0); /* parallel setf, first pass evaluate values and basic error checking */ base = gc__protect; for (setf = form; CONSP(setf); setf = CDR(setf)) { if (!POINTERP(CAR(setf))) goto invalid_place; setf = CDR(setf); if (!CONSP(setf)) LispDestroy("%s: odd number of arguments", STRFUN(builtin)); value = EVAL(CAR(setf)); GC_PROTECT(value); } /* second pass, assign values */ for (; CONSP(form); form = CDDR(form)) { place = CAR(form); value = lisp__data.protect.objects[base++]; if (XSYMBOLP(place)) { CHECK_CONSTANT(place); (void)LispSetVar(place, value); } else if (XCONSP(place)) { LispObj *arguments, *cons; int xbase = lisp__data.protect.length; setf = CAR(place); if (!SYMBOLP(setf)) goto invalid_place; if (!CONSP(CDR(place))) goto invalid_place; atom = setf->data.atom; if (atom->a_defsetf == 0) { if (atom->a_defstruct && atom->property->structure.function >= 0) { place = CDR(place); data = CAR(place); if (CONSP(CDR(place))) goto invalid_place; data = EVAL(data); GC_PROTECT(data); (void)APPLY3(Ostruct_store, setf, data, value); lisp__data.protect.length = xbase; continue; } else if (atom->a_function && atom->property->fun.function->funtype == LispMacro) { (void)LispRunSetfMacro(atom, CDR(place), value); lisp__data.protect.length = xbase; continue; } goto invalid_place; } place = CDR(place); setf = setf->data.atom->property->setf; if (SYMBOLP(setf)) { if (!CONSP(CDR(place))) { arguments = EVAL(CAR(place)); GC_PROTECT(arguments); (void)APPLY2(setf, arguments, value); } else if (!CONSP(CDDR(place))) { arguments = EVAL(CAR(place)); GC_PROTECT(arguments); cons = EVAL(CADR(place)); GC_PROTECT(cons); (void)APPLY3(setf, arguments, cons, value); } else { arguments = cons = CONS(EVAL(CAR(place)), NIL); GC_PROTECT(arguments); for (place = CDR(place); CONSP(place); place = CDR(place)) { RPLACD(cons, CONS(EVAL(CAR(place)), NIL)); cons = CDR(cons); } RPLACD(cons, CONS(value, NIL)); (void)APPLY(setf, arguments); } lisp__data.protect.length = xbase; } else (void)LispRunSetf(atom->property->salist, setf, place, value); } else goto invalid_place; } GC_LEAVE(); return (NIL); invalid_place: LispDestroy("%s: %s is an invalid place", STRFUN(builtin), STROBJ(place)); /*NOTREACHED*/ return (NIL); } LispObj * Lisp_Sleep(LispBuiltin *builtin) /* sleep seconds */ { long sec, msec; double value, dsec; LispObj *seconds; seconds = ARGUMENT(0); value = -1.0; switch (OBJECT_TYPE(seconds)) { case LispFixnum_t: value = FIXNUM_VALUE(seconds); break; case LispDFloat_t: value = DFLOAT_VALUE(seconds); break; default: break; } if (value < 0.0 || value > MOST_POSITIVE_FIXNUM) LispDestroy("%s: %s is not a positive fixnum", STRFUN(builtin), STROBJ(seconds)); msec = modf(value, &dsec) * 1e6; sec = dsec; if (sec) sleep(sec); if (msec) usleep(msec); return (NIL); } /* * This function is called recursively, but the contents of "list2" are * kept gc protected until it returns to LispSort. This is required partly * because the "gc protection logic" protects an object, not the contents * of the c pointer. */ static LispObj * LispMergeSort(LispObj *list, LispObj *predicate, LispObj *key, int code) { int protect; LispObj *list1, *list2, *left, *right, *result, *cons; /* Check if list length is larger than 1 */ if (!CONSP(list) || !CONSP(CDR(list))) return (list); list1 = list2 = list; for (;;) { list = CDR(list); if (!CONSP(list)) break; list = CDR(list); if (!CONSP(list)) break; list2 = CDR(list2); } cons = list2; list2 = CDR(list2); RPLACD(cons, NIL); protect = 0; if (lisp__data.protect.length + 2 >= lisp__data.protect.space) LispMoreProtects(); lisp__data.protect.objects[lisp__data.protect.length++] = list2; list1 = LispMergeSort(list1, predicate, key, code); list2 = LispMergeSort(list2, predicate, key, code); left = CAR(list1); right = CAR(list2); if (key != UNSPEC) { protect = lisp__data.protect.length; left = APPLY1(key, left); lisp__data.protect.objects[protect] = left; right = APPLY1(key, right); lisp__data.protect.objects[protect + 1] = right; } result = NIL; for (;;) { if ((FCOMPARE(predicate, left, right, code)) == 0 && (FCOMPARE(predicate, right, left, code)) == 1) { /* right is "smaller" */ if (result == NIL) result = list2; else RPLACD(cons, list2); cons = list2; list2 = CDR(list2); if (!CONSP(list2)) { RPLACD(cons, list1); break; } right = CAR(list2); if (key != UNSPEC) { right = APPLY1(key, right); lisp__data.protect.objects[protect + 1] = right; } } else { /* left is "smaller" */ if (result == NIL) result = list1; else RPLACD(cons, list1); cons = list1; list1 = CDR(list1); if (!CONSP(list1)) { RPLACD(cons, list2); break; } left = CAR(list1); if (key != UNSPEC) { left = APPLY1(key, left); lisp__data.protect.objects[protect] = left; } } } if (key != UNSPEC) lisp__data.protect.length = protect; return (result); } /* XXX The first version made a copy of the list and then adjusted * the CARs of the list. To minimize GC time now it is now doing * the sort inplace. So, instead of writing just (sort variable) * now it is required to write (setq variable (sort variable)) * if the variable should always keep all elements. */ LispObj * Lisp_Sort(LispBuiltin *builtin) /* sort sequence predicate &key key */ { GC_ENTER(); int istring, code; long length; char *string; LispObj *list, *work, *cons = NULL; LispObj *sequence, *predicate, *key; key = ARGUMENT(2); predicate = ARGUMENT(1); sequence = ARGUMENT(0); length = LispLength(sequence); if (length < 2) return (sequence); list = sequence; istring = XSTRINGP(sequence); if (istring) { CHECK_STRING_WRITABLE(sequence); /* Convert string to list */ string = THESTR(sequence); work = cons = CONS(SCHAR(string[0]), NIL); GC_PROTECT(work); for (++string; *string; ++string) { RPLACD(cons, CONS(SCHAR(*string), NIL)); cons = CDR(cons); } } else if (ARRAYP(list)) work = list->data.array.list; else work = list; FUNCTION_CHECK(predicate); code = FCODE(predicate); work = LispMergeSort(work, predicate, key, code); if (istring) { /* Convert list to string */ string = THESTR(sequence); for (; CONSP(work); ++string, work = CDR(work)) *string = SCHAR_VALUE(CAR(work)); } else if (ARRAYP(list)) list->data.array.list = work; else sequence = work; GC_LEAVE(); return (sequence); } LispObj * Lisp_Subseq(LispBuiltin *builtin) /* subseq sequence start &optional end */ { long start, end, length, seqlength; LispObj *sequence, *ostart, *oend, *result; oend = ARGUMENT(2); ostart = ARGUMENT(1); sequence = ARGUMENT(0); LispCheckSequenceStartEnd(builtin, sequence, ostart, oend, &start, &end, &length); seqlength = end - start; if (sequence == NIL) result = NIL; else if (XSTRINGP(sequence)) { char *string = LispMalloc(seqlength + 1); memcpy(string, THESTR(sequence) + start, seqlength); string[seqlength] = '\0'; result = STRING2(string); } else { GC_ENTER(); LispObj *object; if (end > start) { /* list or array */ int count; LispObj *cons; if (ARRAYP(sequence)) object = sequence->data.array.list; else object = sequence; /* goto first element to copy */ for (count = 0; count < start; count++, object = CDR(object)) ; result = cons = CONS(CAR(object), NIL); GC_PROTECT(result); for (++count, object = CDR(object); count < end; count++, object = CDR(object)) { RPLACD(cons, CONS(CAR(object), NIL)); cons = CDR(cons); } } else result = NIL; if (ARRAYP(sequence)) { object = LispNew(NIL, NIL); GC_PROTECT(object); object->type = LispArray_t; object->data.array.list = result; object->data.array.dim = CONS(FIXNUM(seqlength), NIL); object->data.array.rank = 1; object->data.array.type = sequence->data.array.type; object->data.array.zero = length == 0; result = object; } GC_LEAVE(); } return (result); } LispObj * Lisp_Subsetp(LispBuiltin *builtin) /* subsetp list1 list2 &key test test-not key */ { return (LispListSet(builtin, SUBSETP)); } LispObj * Lisp_Substitute(LispBuiltin *builtin) /* substitute newitem olditem sequence &key from-end test test-not start end count key */ { return (LispDeleteRemoveXSubstitute(builtin, SUBSTITUTE, NONE)); } LispObj * Lisp_SubstituteIf(LispBuiltin *builtin) /* substitute-if newitem test sequence &key from-end start end count key */ { return (LispDeleteRemoveXSubstitute(builtin, SUBSTITUTE, IF)); } LispObj * Lisp_SubstituteIfNot(LispBuiltin *builtin) /* substitute-if-not newitem test sequence &key from-end start end count key */ { return (LispDeleteRemoveXSubstitute(builtin, SUBSTITUTE, IFNOT)); } LispObj * Lisp_Symbolp(LispBuiltin *builtin) /* symbolp object */ { LispObj *object; object = ARGUMENT(0); return (SYMBOLP(object) ? T : NIL); } LispObj * Lisp_SymbolFunction(LispBuiltin *builtin) /* symbol-function symbol */ { LispObj *symbol; symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); return (LispSymbolFunction(symbol)); } LispObj * Lisp_SymbolName(LispBuiltin *builtin) /* symbol-name symbol */ { LispObj *symbol; symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); return (LispSymbolName(symbol)); } LispObj * Lisp_SymbolPackage(LispBuiltin *builtin) /* symbol-package symbol */ { LispObj *symbol; symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); symbol = symbol->data.atom->package; return (symbol ? symbol : NIL); } LispObj * Lisp_SymbolPlist(LispBuiltin *builtin) /* symbol-plist symbol */ { LispObj *symbol; symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); return (symbol->data.atom->a_property ? symbol->data.atom->property->properties : NIL); } LispObj * Lisp_SymbolValue(LispBuiltin *builtin) /* symbol-value symbol */ { LispAtom *atom; LispObj *symbol; symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); atom = symbol->data.atom; if (!atom->a_object || atom->property->value == UNBOUND) { if (atom->package == lisp__data.keyword) return (symbol); LispDestroy("%s: the symbol %s has no value", STRFUN(builtin), STROBJ(symbol)); } return (atom->dyn ? LispGetVar(symbol) : atom->property->value); } LispObj * Lisp_Tagbody(LispBuiltin *builtin) /* tagbody &rest body */ { GC_ENTER(); int stack, lex, length; LispObj *list, *body, *ptr, *tag, *labels, *map, **p_body; LispBlock *block; body = ARGUMENT(0); /* Save environment information */ stack = lisp__data.stack.length; lex = lisp__data.env.lex; length = lisp__data.env.length; /* Since the body may be large, and the code may iterate several * thousand times, it is not a bad idea to avoid checking all * elements of the body to verify if it is a tag. */ for (labels = map = NIL, ptr = body; CONSP(ptr); ptr = CDR(ptr)) { tag = CAR(ptr); switch (OBJECT_TYPE(tag)) { case LispNil_t: case LispAtom_t: case LispFixnum_t: /* Don't allow duplicated labels */ for (list = labels; CONSP(list); list = CDDR(list)) { if (CAR(list) == tag) LispDestroy("%s: tag %s specified more than once", STRFUN(builtin), STROBJ(tag)); } if (labels == NIL) { labels = CONS(tag, CONS(NIL, NIL)); map = CDR(labels); GC_PROTECT(labels); } else { RPLACD(map, CONS(tag, CONS(NIL, NIL))); map = CDDR(map); } break; case LispCons_t: /* Restart point for tag */ if (map != NIL && CAR(map) == NIL) RPLACA(map, ptr); break; default: break; } } /* Check for consecutive labels without code between them */ for (ptr = labels; CONSP(ptr); ptr = CDDR(ptr)) { if (CADR(ptr) == NIL) { for (map = CDDR(ptr); CONSP(map); map = CDDR(map)) { if (CADR(map) != NIL) { RPLACA(CDR(ptr), CADR(map)); break; } } } } /* Initialize */ list = body; p_body = &body; block = LispBeginBlock(NIL, LispBlockBody); /* Loop */ if (setjmp(block->jmp) != 0) { /* Restore environment */ lisp__data.stack.length = stack; lisp__data.env.lex = lex; lisp__data.env.head = lisp__data.env.length = length; tag = lisp__data.block.block_ret; for (ptr = labels; CONSP(ptr); ptr = CDDR(ptr)) { map = CAR(ptr); if (map == tag) break; } if (!CONSP(ptr)) LispDestroy("%s: no such tag %s", STRFUN(builtin), STROBJ(tag)); *p_body = CADR(ptr); } /* Execute code */ for (; CONSP(body); body = CDR(body)) { LispObj *form = CAR(body); if (CONSP(form)) EVAL(form); } /* If got here, (go) not called, else, labels will be candidate to gc * when GC_LEAVE() be called by the code in the bottom of the stack. */ GC_LEAVE(); /* Finished */ LispEndBlock(block); /* Always return NIL */ return (NIL); } LispObj * Lisp_The(LispBuiltin *builtin) /* the value-type form */ { LispObj *value_type, *form; form = ARGUMENT(1); value_type = ARGUMENT(0); form = EVAL(form); return (LispCoerce(builtin, form, value_type)); } LispObj * Lisp_Throw(LispBuiltin *builtin) /* throw tag result */ { unsigned blevel = lisp__data.block.block_level; LispObj *tag, *result; result = ARGUMENT(1); tag = ARGUMENT(0); tag = EVAL(tag); if (blevel == 0) LispDestroy("%s: not within a block", STRFUN(builtin)); while (blevel) { LispBlock *block = lisp__data.block.block[--blevel]; if (block->type == LispBlockCatch && tag == block->tag) { lisp__data.block.block_ret = EVAL(result); LispBlockUnwind(block); BLOCKJUMP(block); } } LispDestroy("%s: %s is not a valid tag", STRFUN(builtin), STROBJ(tag)); /*NOTREACHED*/ return (NIL); } static LispObj * LispTreeEqual(LispObj *left, LispObj *right, LispObj *test, int expect) { LispObj *cmp_left, *cmp_right; if ((OBJECT_TYPE(left)) ^ (OBJECT_TYPE(right))) return (NIL); if (CONSP(left)) { for (; CONSP(left) && CONSP(right); left = CDR(left), right = CDR(right)) { cmp_left = CAR(left); cmp_right = CAR(right); if ((OBJECT_TYPE(cmp_left)) ^ (OBJECT_TYPE(cmp_right))) return (NIL); if (CONSP(cmp_left)) { if (LispTreeEqual(cmp_left, cmp_right, test, expect) == NIL) return (NIL); } else { if (POINTERP(cmp_left) && (XQUOTEP(cmp_left) || XBACKQUOTEP(cmp_left))) { cmp_left = cmp_left->data.quote; cmp_right = cmp_right->data.quote; } else if (COMMAP(cmp_left)) { cmp_left = cmp_left->data.comma.eval; cmp_right = cmp_right->data.comma.eval; } if ((APPLY2(test, cmp_left, cmp_right) != NIL) != expect) return (NIL); } } if ((OBJECT_TYPE(left)) ^ (OBJECT_TYPE(right))) return (NIL); } if (POINTERP(left) && (XQUOTEP(left) || XBACKQUOTEP(left))) { left = left->data.quote; right = right->data.quote; } else if (COMMAP(left)) { left = left->data.comma.eval; right = right->data.comma.eval; } return ((APPLY2(test, left, right) != NIL) == expect ? T : NIL); } LispObj * Lisp_TreeEqual(LispBuiltin *builtin) /* tree-equal tree-1 tree-2 &key test test-not */ { int expect; LispObj *compare; LispObj *tree_1, *tree_2, *test, *test_not; test_not = ARGUMENT(3); test = ARGUMENT(2); tree_2 = ARGUMENT(1); tree_1 = ARGUMENT(0); CHECK_TEST_0(); if (test_not != UNSPEC) { expect = 0; compare = test_not; } else { if (test == UNSPEC) test = Oeql; expect = 1; compare = test; } return (LispTreeEqual(tree_1, tree_2, compare, expect)); } LispObj * Lisp_Typep(LispBuiltin *builtin) /* typep object type */ { LispObj *result = NULL; LispObj *object, *type; type = ARGUMENT(1); object = ARGUMENT(0); if (SYMBOLP(type)) { Atom_id atom = ATOMID(type); if (OBJECT_TYPE(object) == LispStruct_t) result = ATOMID(CAR(object->data.struc.def)) == atom ? T : NIL; else if (type->data.atom->a_defstruct && type->data.atom->property->structure.function == STRUCT_NAME) result = NIL; else if (atom == Snil) result = object == NIL ? T : NIL; else if (atom == St) result = object == T ? T : NIL; else if (atom == Satom) result = !CONSP(object) ? T : NIL; else if (atom == Ssymbol) result = SYMBOLP(object) || object == NIL || object == T ? T : NIL; else if (atom == Sinteger) result = INTEGERP(object) ? T : NIL; else if (atom == Srational) result = RATIONALP(object) ? T : NIL; else if (atom == Scons || atom == Slist) result = CONSP(object) ? T : NIL; else if (atom == Sstring) result = STRINGP(object) ? T : NIL; else if (atom == Scharacter) result = SCHARP(object) ? T : NIL; else if (atom == Scomplex) result = COMPLEXP(object) ? T : NIL; else if (atom == Svector || atom == Sarray) result = ARRAYP(object) ? T : NIL; else if (atom == Skeyword) result = KEYWORDP(object) ? T : NIL; else if (atom == Sfunction) result = LAMBDAP(object) ? T : NIL; else if (atom == Spathname) result = PATHNAMEP(object) ? T : NIL; else if (atom == Sopaque) result = OPAQUEP(object) ? T : NIL; } else if (CONSP(type)) { if (OBJECT_TYPE(object) == LispStruct_t && SYMBOLP(CAR(type)) && ATOMID(CAR(type)) == Sstruct && SYMBOLP(CAR(CDR(type))) && CDR(CDR(type)) == NIL) { result = ATOMID(CAR(object->data.struc.def)) == ATOMID(CAR(CDR(type))) ? T : NIL; } } else if (type == NIL) result = object == NIL ? T : NIL; else if (type == T) result = object == T ? T : NIL; if (result == NULL) LispDestroy("%s: bad type specification %s", STRFUN(builtin), STROBJ(type)); return (result); } LispObj * Lisp_Union(LispBuiltin *builtin) /* union list1 list2 &key test test-not key */ { return (LispListSet(builtin, UNION)); } LispObj * Lisp_Nunion(LispBuiltin *builtin) /* nunion list1 list2 &key test test-not key */ { return (LispListSet(builtin, NUNION)); } LispObj * Lisp_Unless(LispBuiltin *builtin) /* unless test &rest body */ { LispObj *result, *test, *body; body = ARGUMENT(1); test = ARGUMENT(0); result = NIL; test = EVAL(test); RETURN_COUNT = 0; if (test == NIL) { for (; CONSP(body); body = CDR(body)) result = EVAL(CAR(body)); } return (result); } /* * ext::until */ LispObj * Lisp_Until(LispBuiltin *builtin) /* until test &rest body */ { LispObj *result, *test, *body, *prog; body = ARGUMENT(1); test = ARGUMENT(0); result = NIL; for (;;) { if ((result = EVAL(test)) == NIL) { for (prog = body; CONSP(prog); prog = CDR(prog)) (void)EVAL(CAR(prog)); } else break; } return (result); } LispObj * Lisp_UnwindProtect(LispBuiltin *builtin) /* unwind-protect protect &rest cleanup */ { LispObj *result, **presult = &result; int did_jump, *pdid_jump = &did_jump, destroyed; LispBlock *block; LispObj *protect, *cleanup, **pcleanup = &cleanup; cleanup = ARGUMENT(1); protect = ARGUMENT(0); /* run protected code */ *presult = NIL; *pdid_jump = 1; block = LispBeginBlock(NIL, LispBlockProtect); if (setjmp(block->jmp) == 0) { *presult = EVAL(protect); *pdid_jump = 0; } LispEndBlock(block); if (!lisp__data.destroyed && *pdid_jump) *presult = lisp__data.block.block_ret; destroyed = lisp__data.destroyed; lisp__data.destroyed = 0; /* run cleanup, unprotected code */ if (CONSP(*pcleanup)) for (; CONSP(cleanup); cleanup = CDR(cleanup)) (void)EVAL(CAR(cleanup)); if (destroyed) { /* in case there is another unwind-protect */ LispBlockUnwind(NULL); /* if not, just return to the toplevel */ lisp__data.destroyed = 1; LispDestroy("."); } return (result); } static LispObj * LispValuesList(LispBuiltin *builtin, int check_list) { long i, count; LispObj *result; LispObj *list; list = ARGUMENT(0); count = LispLength(list) - 1; if (count >= 0) { result = CAR(list); if ((RETURN_CHECK(count)) != count) LispDestroy("%s: too many values", STRFUN(builtin)); RETURN_COUNT = count; for (i = 0, list = CDR(list); count && CONSP(list); count--, i++, list = CDR(list)) RETURN(i) = CAR(list); if (check_list) { CHECK_LIST(list); } } else { RETURN_COUNT = -1; result = NIL; } return (result); } LispObj * Lisp_Values(LispBuiltin *builtin) /* values &rest objects */ { return (LispValuesList(builtin, 0)); } LispObj * Lisp_ValuesList(LispBuiltin *builtin) /* values-list list */ { return (LispValuesList(builtin, 1)); } LispObj * Lisp_Vector(LispBuiltin *builtin) /* vector &rest objects */ { LispObj *objects; objects = ARGUMENT(0); return (VECTOR(objects)); } LispObj * Lisp_When(LispBuiltin *builtin) /* when test &rest body */ { LispObj *result, *test, *body; body = ARGUMENT(1); test = ARGUMENT(0); result = NIL; test = EVAL(test); RETURN_COUNT = 0; if (test != NIL) { for (; CONSP(body); body = CDR(body)) result = EVAL(CAR(body)); } return (result); } /* * ext::while */ LispObj * Lisp_While(LispBuiltin *builtin) /* while test &rest body */ { LispObj *test, *body, *prog; body = ARGUMENT(1); test = ARGUMENT(0); for (;;) { if (EVAL(test) != NIL) { for (prog = body; CONSP(prog); prog = CDR(prog)) (void)EVAL(CAR(prog)); } else break; } return (NIL); } /* * ext::unsetenv */ LispObj * Lisp_Unsetenv(LispBuiltin *builtin) /* unsetenv name */ { char *name; LispObj *oname; oname = ARGUMENT(0); CHECK_STRING(oname); name = THESTR(oname); unsetenv(name); return (NIL); } LispObj * Lisp_XeditEltStore(LispBuiltin *builtin) /* lisp::elt-store sequence index value */ { int length, offset; LispObj *sequence, *oindex, *value; value = ARGUMENT(2); oindex = ARGUMENT(1); sequence = ARGUMENT(0); CHECK_INDEX(oindex); offset = FIXNUM_VALUE(oindex); length = LispLength(sequence); if (offset >= length) LispDestroy("%s: index %d too large for sequence length %d", STRFUN(builtin), offset, length); if (STRINGP(sequence)) { int ch; CHECK_STRING_WRITABLE(sequence); CHECK_SCHAR(value); ch = SCHAR_VALUE(value); if (ch < 0 || ch > 255) LispDestroy("%s: cannot represent character %d", STRFUN(builtin), ch); THESTR(sequence)[offset] = ch; } else { if (ARRAYP(sequence)) sequence = sequence->data.array.list; for (; offset > 0; offset--, sequence = CDR(sequence)) ; RPLACA(sequence, value); } return (value); } LispObj * Lisp_XeditPut(LispBuiltin *builtin) /* lisp::put symbol indicator value */ { LispObj *symbol, *indicator, *value; value = ARGUMENT(2); indicator = ARGUMENT(1); symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); return (CAR(LispPutAtomProperty(symbol->data.atom, indicator, value))); } LispObj * Lisp_XeditSetSymbolPlist(LispBuiltin *builtin) /* lisp::set-symbol-plist symbol list */ { LispObj *symbol, *list; list = ARGUMENT(1); symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); return (LispReplaceAtomPropertyList(symbol->data.atom, list)); } LispObj * Lisp_XeditVectorStore(LispBuiltin *builtin) /* lisp::vector-store array &rest values */ { LispObj *value, *list, *object; long rank, count, sequence, offset, accum; LispObj *array, *values; values = ARGUMENT(1); array = ARGUMENT(0); /* check for errors */ for (rank = 0, list = values; CONSP(list) && CONSP(CDR(list)); list = CDR(list), rank++) { CHECK_INDEX(CAR(values)); } if (rank == 0) LispDestroy("%s: too few subscripts", STRFUN(builtin)); value = CAR(list); if (STRINGP(array) && rank == 1) { long ch; long length = STRLEN(array); long offset = FIXNUM_VALUE(CAR(values)); CHECK_SCHAR(value); CHECK_STRING_WRITABLE(array); ch = SCHAR_VALUE(value); if (offset >= length) LispDestroy("%s: index %ld too large for sequence length %ld", STRFUN(builtin), offset, length); if (ch < 0 || ch > 255) LispDestroy("%s: cannot represent character %ld", STRFUN(builtin), ch); THESTR(array)[offset] = ch; return (value); } CHECK_ARRAY(array); if (rank != array->data.array.rank) LispDestroy("%s: too %s subscripts", STRFUN(builtin), rank < array->data.array.rank ? "few" : "many"); for (list = values, object = array->data.array.dim; CONSP(CDR(list)); list = CDR(list), object = CDR(object)) { if (FIXNUM_VALUE(CAR(list)) >= FIXNUM_VALUE(CAR(object))) LispDestroy("%s: %ld is out of range, index %ld", STRFUN(builtin), FIXNUM_VALUE(CAR(list)), FIXNUM_VALUE(CAR(object))); } for (count = sequence = 0, list = values; CONSP(CDR(list)); list = CDR(list), sequence++) { for (offset = 0, object = array->data.array.dim; offset < sequence; object = CDR(object), offset++) ; for (accum = 1, object = CDR(object); CONSP(object); object = CDR(object)) accum *= FIXNUM_VALUE(CAR(object)); count += accum * FIXNUM_VALUE(CAR(list)); } for (array = array->data.array.list; count > 0; array = CDR(array), count--) ; RPLACA(array, value); return (value); } LispObj * Lisp_XeditDocumentationStore(LispBuiltin *builtin) /* lisp::documentation-store symbol type string */ { LispDocType_t doc_type; LispObj *symbol, *type, *string; string = ARGUMENT(2); type = ARGUMENT(1); symbol = ARGUMENT(0); CHECK_SYMBOL(symbol); /* type is checked in LispDocumentationType() */ doc_type = LispDocumentationType(builtin, type); if (string == NIL) /* allow explicitly releasing memory used for documentation */ LispRemDocumentation(symbol, doc_type); else { CHECK_STRING(string); LispAddDocumentation(symbol, string, doc_type); } return (string); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/math.h0000664000000000000000000000712712472175711015375 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/math.h,v 1.6tsi Exp $ */ #ifndef Lisp_math_h #define Lisp_math_h #include "lisp/internal.h" #include "mp.h" void LispMathInit(void); LispObj *LispFloatCoerce(LispBuiltin*, LispObj*); LispObj *Lisp_Mul(LispBuiltin*); LispObj *Lisp_Plus(LispBuiltin*); LispObj *Lisp_Minus(LispBuiltin*); LispObj *Lisp_Div(LispBuiltin*); LispObj *Lisp_OnePlus(LispBuiltin*); LispObj *Lisp_OneMinus(LispBuiltin*); LispObj *Lisp_Less(LispBuiltin*); LispObj *Lisp_LessEqual(LispBuiltin*); LispObj *Lisp_Equal_(LispBuiltin*); LispObj *Lisp_Greater(LispBuiltin*); LispObj *Lisp_GreaterEqual(LispBuiltin*); LispObj *Lisp_NotEqual(LispBuiltin*); LispObj *Lisp_Max(LispBuiltin*); LispObj *Lisp_Min(LispBuiltin*); LispObj *Lisp_Mod(LispBuiltin*); LispObj *Lisp_Abs(LispBuiltin*); LispObj *Lisp_Complex(LispBuiltin*); LispObj *Lisp_Complexp(LispBuiltin*); LispObj *Lisp_Conjugate(LispBuiltin*); LispObj *Lisp_Decf(LispBuiltin*); LispObj *Lisp_Denominator(LispBuiltin*); LispObj *Lisp_Evenp(LispBuiltin*); LispObj *Lisp_Float(LispBuiltin*); LispObj *Lisp_Floatp(LispBuiltin*); LispObj *Lisp_Gcd(LispBuiltin*); LispObj *Lisp_Imagpart(LispBuiltin*); LispObj *Lisp_Incf(LispBuiltin*); LispObj *Lisp_Integerp(LispBuiltin*); LispObj *Lisp_Isqrt(LispBuiltin*); LispObj *Lisp_Lcm(LispBuiltin*); LispObj *Lisp_Logand(LispBuiltin*); LispObj *Lisp_Logeqv(LispBuiltin*); LispObj *Lisp_Logior(LispBuiltin*); LispObj *Lisp_Lognot(LispBuiltin*); LispObj *Lisp_Logxor(LispBuiltin*); LispObj *Lisp_Minusp(LispBuiltin*); LispObj *Lisp_Numberp(LispBuiltin*); LispObj *Lisp_Numerator(LispBuiltin*); LispObj *Lisp_Oddp(LispBuiltin*); LispObj *Lisp_Plusp(LispBuiltin*); LispObj *Lisp_Rational(LispBuiltin*); #if 0 LispObj *Lisp_Rationalize(LispBuiltin*); #endif LispObj *Lisp_Rationalp(LispBuiltin*); LispObj *Lisp_Realpart(LispBuiltin*); LispObj *Lisp_Rem(LispBuiltin*); LispObj *Lisp_Sqrt(LispBuiltin*); LispObj *Lisp_Zerop(LispBuiltin*); LispObj *Lisp_Ceiling(LispBuiltin*); LispObj *Lisp_Fceiling(LispBuiltin*); LispObj *Lisp_Floor(LispBuiltin*); LispObj *Lisp_Ffloor(LispBuiltin*); LispObj *Lisp_Round(LispBuiltin*); LispObj *Lisp_Fround(LispBuiltin*); LispObj *Lisp_Truncate(LispBuiltin*); LispObj *Lisp_Ftruncate(LispBuiltin*); #endif /* Lisp_math_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/setenv.c0000664000000000000000000001121312472175711015732 0ustar /* $OpenBSD: setenv.c,v 1.13 2010/08/23 22:31:50 millert Exp $ */ /* * Copyright (c) 1987 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include #include #include char *__findenv(const char *name, int len, int *offset); extern char **environ; static char **lastenv; /* last value of environ */ /* * putenv -- * Add a name=value string directly to the environmental, replacing * any current value. */ int putenv(char *str) { char **P, *cp; size_t cnt; int offset = 0; for (cp = str; *cp && *cp != '='; ++cp) ; if (*cp != '=') { errno = EINVAL; return (-1); /* missing `=' in string */ } if (__findenv(str, (int)(cp - str), &offset) != NULL) { environ[offset++] = str; /* could be set multiple times */ while (__findenv(str, (int)(cp - str), &offset)) { for (P = &environ[offset];; ++P) if (!(*P = *(P + 1))) break; } return (0); } /* create new slot for string */ for (P = environ; *P != NULL; P++) ; cnt = P - environ; P = (char **)realloc(lastenv, sizeof(char *) * (cnt + 2)); if (!P) return (-1); if (lastenv != environ) memcpy(P, environ, cnt * sizeof(char *)); lastenv = environ = P; environ[cnt] = str; environ[cnt + 1] = NULL; return (0); } /* * setenv -- * Set the value of the environmental variable "name" to be * "value". If rewrite is set, replace any current value. */ int setenv(const char *name, const char *value, int rewrite) { char *C, **P; const char *np; int l_value, offset = 0; for (np = name; *np && *np != '='; ++np) ; #ifdef notyet if (*np) { errno = EINVAL; return (-1); /* has `=' in name */ } #endif l_value = strlen(value); if ((C = __findenv(name, (int)(np - name), &offset)) != NULL) { int tmpoff = offset + 1; if (!rewrite) return (0); #if 0 /* XXX - existing entry may not be writable */ if (strlen(C) >= l_value) { /* old larger; copy over */ while ((*C++ = *value++)) ; return (0); } #endif /* could be set multiple times */ while (__findenv(name, (int)(np - name), &tmpoff)) { for (P = &environ[tmpoff];; ++P) if (!(*P = *(P + 1))) break; } } else { /* create new slot */ size_t cnt; for (P = environ; *P != NULL; P++) ; cnt = P - environ; P = (char **)realloc(lastenv, sizeof(char *) * (cnt + 2)); if (!P) return (-1); if (lastenv != environ) memcpy(P, environ, cnt * sizeof(char *)); lastenv = environ = P; offset = cnt; environ[cnt + 1] = NULL; } if (!(environ[offset] = /* name + `=' + value */ malloc((size_t)((int)(np - name) + l_value + 2)))) return (-1); for (C = environ[offset]; (*C = *name++) && *C != '='; ++C) ; for (*C++ = '='; (*C++ = *value++); ) ; return (0); } /* * unsetenv(name) -- * Delete environmental variable "name". */ int unsetenv(const char *name) { char **P; const char *np; int offset = 0; if (!name || !*name) { errno = EINVAL; return (-1); } for (np = name; *np && *np != '='; ++np) ; if (*np) { errno = EINVAL; return (-1); /* has `=' in name */ } /* could be set multiple times */ while (__findenv(name, (int)(np - name), &offset)) { for (P = &environ[offset];; ++P) if (!(*P = *(P + 1))) break; } return (0); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/write.c0000664000000000000000000017005612472175711015573 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/write.c,v 1.31tsi Exp $ */ #include "lisp/write.h" #include "lisp/hash.h" #include #include #define FLOAT_PREC 17 #define UPCASE 0 #define DOWNCASE 1 #define CAPITALIZE 2 #define INCDEPTH() \ if (++info->depth > MAX_STACK_DEPTH / 2) \ LispDestroy("stack overflow") #define DECDEPTH() --info->depth /* * Types */ typedef struct _circle_info { long circle_nth; /* nth circular list */ LispObj *object; /* the circular object */ } circle_info; typedef struct _write_info { long depth; long level; /* current level */ long length; /* current length */ long print_level; /* *print-level* when started printing */ long print_length; /* *print-length* when started printing */ int print_escape; int print_case; long circle_count; /* used while building circle info */ LispObj **objects; long num_objects; /* the circular lists */ circle_info *circles; long num_circles; } write_info; /* * Prototypes */ static void check_stream(LispObj*, LispFile**, LispString**, int); static void parse_double(char*, int*, double, int); static int float_string_inc(char*, int); static void format_integer(char*, long, int); static int LispWriteCPointer(LispObj*, void*); static int LispWriteCString(LispObj*, char*, long, write_info*); static int LispDoFormatExponentialFloat(LispObj*, LispObj*, int, int, int*, int, int, int, int, int, int); static int LispWriteInteger(LispObj*, LispObj*); static int LispWriteCharacter(LispObj*, LispObj*, write_info*); static int LispWriteString(LispObj*, LispObj*, write_info*); static int LispWriteFloat(LispObj*, LispObj*); static int LispWriteAtom(LispObj*, LispObj*, write_info*); static int LispDoWriteAtom(LispObj*, const char*, int, int); static int LispWriteList(LispObj*, LispObj*, write_info*, int); static int LispWriteArray(LispObj*, LispObj*, write_info*); static int LispWriteStruct(LispObj*, LispObj*, write_info*); static int LispDoWriteObject(LispObj*, LispObj*, write_info*, int); static void LispBuildCircle(LispObj*, write_info*); static void LispDoBuildCircle(LispObj*, write_info*); static long LispCheckCircle(LispObj*, write_info*); static int LispPrintCircle(LispObj*, LispObj*, long, int*, write_info*); static int LispWriteAlist(LispObj*, LispArgList*, write_info*); /* * Initialization */ LispObj *Oprint_level, *Oprint_length, *Oprint_circle, *Oprint_escape, *Oprint_case; LispObj *Kupcase, *Kdowncase, *Kcapitalize; /* * Implementation */ void LispWriteInit(void) { Oprint_level = STATIC_ATOM("*PRINT-LEVEL*"); LispProclaimSpecial(Oprint_level, NIL, NIL); LispExportSymbol(Oprint_level); Oprint_length = STATIC_ATOM("*PRINT-LENGTH*"); LispProclaimSpecial(Oprint_length, NIL, NIL); LispExportSymbol(Oprint_length); Oprint_circle = STATIC_ATOM("*PRINT-CIRCLE*"); LispProclaimSpecial(Oprint_circle, T, NIL); LispExportSymbol(Oprint_circle); Oprint_escape = STATIC_ATOM("*PRINT-ESCAPE*"); LispProclaimSpecial(Oprint_escape, T, NIL); LispExportSymbol(Oprint_escape); Kupcase = KEYWORD("UPCASE"); Kdowncase = KEYWORD("DOWNCASE"); Kcapitalize = KEYWORD("CAPITALIZE"); Oprint_case = STATIC_ATOM("*PRINT-CASE*"); LispProclaimSpecial(Oprint_case, Kupcase, NIL); LispExportSymbol(Oprint_case); } LispObj * Lisp_FreshLine(LispBuiltin *builtin) /* fresh-line &optional output-stream */ { LispObj *output_stream; output_stream = ARGUMENT(0); if (output_stream == UNSPEC) output_stream = NIL; else if (output_stream != NIL) { CHECK_STREAM(output_stream); } if (LispGetColumn(output_stream)) { LispWriteChar(output_stream, '\n'); if (output_stream == NIL || (output_stream->data.stream.type == LispStreamStandard && output_stream->data.stream.source.file == Stdout)) LispFflush(Stdout); return (T); } return (NIL); } LispObj * Lisp_Prin1(LispBuiltin *builtin) /* prin1 object &optional output-stream */ { LispObj *object, *output_stream; output_stream = ARGUMENT(1); object = ARGUMENT(0); if (output_stream == UNSPEC) output_stream = NIL; LispPrint(object, output_stream, 0); return (object); } LispObj * Lisp_Princ(LispBuiltin *builtin) /* princ object &optional output-stream */ { int head; LispObj *object, *output_stream; output_stream = ARGUMENT(1); object = ARGUMENT(0); if (output_stream == UNSPEC) output_stream = NIL; head = lisp__data.env.length; LispAddVar(Oprint_escape, NIL); ++lisp__data.env.head; LispPrint(object, output_stream, 0); lisp__data.env.head = lisp__data.env.length = head; return (object); } LispObj * Lisp_Print(LispBuiltin *builtin) /* print object &optional output-stream */ { LispObj *object, *output_stream; output_stream = ARGUMENT(1); object = ARGUMENT(0); if (output_stream == UNSPEC) output_stream = NIL; LispWriteChar(output_stream, '\n'); LispPrint(object, output_stream, 0); LispWriteChar(output_stream, ' '); return (object); } LispObj * Lisp_Terpri(LispBuiltin *builtin) /* terpri &optional output-stream */ { LispObj *output_stream; output_stream = ARGUMENT(0); if (output_stream == UNSPEC) output_stream = NIL; else if (output_stream != NIL) { CHECK_STREAM(output_stream); } LispWriteChar(output_stream, '\n'); if (output_stream == NIL || (output_stream->data.stream.type == LispStreamStandard && output_stream->data.stream.source.file == Stdout)) LispFflush(Stdout); return (NIL); } LispObj * Lisp_Write(LispBuiltin *builtin) /* write object &key case circle escape length level lines pretty readably right-margin stream */ { int head = lisp__data.env.length; LispObj *object, *ocase, *circle, *escape, *length, *level, *stream; stream = ARGUMENT(10); level = ARGUMENT(5); length = ARGUMENT(4); escape = ARGUMENT(3); circle = ARGUMENT(2); ocase = ARGUMENT(1); object = ARGUMENT(0); if (stream == UNSPEC) stream = NIL; else if (stream != NIL) { CHECK_STREAM(stream); } /* prepare the printer environment */ if (circle != UNSPEC) LispAddVar(Oprint_circle, circle); if (length != UNSPEC) LispAddVar(Oprint_length, length); if (level != UNSPEC) LispAddVar(Oprint_level, level); if (ocase != UNSPEC) LispAddVar(Oprint_case, ocase); if (escape != UNSPEC) LispAddVar(Oprint_escape, escape); lisp__data.env.head = lisp__data.env.length; (void)LispWriteObject(stream, object); lisp__data.env.head = lisp__data.env.length = head; return (object); } LispObj * Lisp_WriteChar(LispBuiltin *builtin) /* write-char character &optional output-stream */ { int ch; LispObj *character, *output_stream; output_stream = ARGUMENT(1); character = ARGUMENT(0); if (output_stream == UNSPEC) output_stream = NIL; CHECK_SCHAR(character); ch = SCHAR_VALUE(character); LispWriteChar(output_stream, ch); return (character); } LispObj * Lisp_WriteLine(LispBuiltin *builtin) /* write-line string &optional output-stream &key start end */ { return (LispWriteString_(builtin, 1)); } LispObj * Lisp_WriteString(LispBuiltin *builtin) /* write-string string &optional output-stream &key start end */ { return (LispWriteString_(builtin, 0)); } int LispWriteObject(LispObj *stream, LispObj *object) { write_info info; int bytes; LispObj *level, *length, *circle, *oescape, *ocase; /* current state */ info.depth = info.level = info.length = 0; /* maximum level to descend */ level = LispGetVar(Oprint_level); if (level && INDEXP(level)) info.print_level = FIXNUM_VALUE(level); else info.print_level = -1; /* maximum list length */ length = LispGetVar(Oprint_length); if (length && INDEXP(length)) info.print_length = FIXNUM_VALUE(length); else info.print_length = -1; /* detect circular/shared objects? */ circle = LispGetVar(Oprint_circle); info.circle_count = 0; info.objects = NULL; info.num_objects = 0; info.circles = NULL; info.num_circles = 0; if (circle && circle != NIL) { LispBuildCircle(object, &info); /* free this data now */ if (info.num_objects) { LispFree(info.objects); info.num_objects = 0; } } /* escape characters and strings? */ oescape = LispGetVar(Oprint_escape); if (oescape != NULL) info.print_escape = oescape == NIL; else info.print_escape = -1; /* don't use the default case printing? */ ocase = LispGetVar(Oprint_case); if (ocase == Kdowncase) info.print_case = DOWNCASE; else if (ocase == Kcapitalize) info.print_case = CAPITALIZE; else info.print_case = UPCASE; bytes = LispDoWriteObject(stream, object, &info, 1); if (circle && circle != NIL && info.num_circles) LispFree(info.circles); return (bytes); } static void LispBuildCircle(LispObj *object, write_info *info) { LispObj *list; switch (OBJECT_TYPE(object)) { case LispCons_t: LispDoBuildCircle(object, info); break; case LispArray_t: /* Currently arrays are implemented as lists, but only * the elements could/should be circular */ if (LispCheckCircle(object, info) >= 0) return; LispDoBuildCircle(object, info); for (list = object->data.array.list; CONSP(list); list = CDR(list)) LispBuildCircle(CAR(list), info); break; case LispStruct_t: /* Like arrays, structs are currently implemented as lists, * but only the elements could/should be circular */ if (LispCheckCircle(object, info) >= 0) return; LispDoBuildCircle(object, info); for (list = object->data.struc.fields; CONSP(list); list = CDR(list)) LispBuildCircle(CAR(list), info); break; case LispQuote_t: case LispBackquote_t: case LispFunctionQuote_t: LispDoBuildCircle(object, info); LispBuildCircle(object->data.quote, info); break; case LispComma_t: LispDoBuildCircle(object, info); LispBuildCircle(object->data.comma.eval, info); break; case LispLambda_t: /* Circularity in a function body should fail elsewhere... */ if (LispCheckCircle(object, info) >= 0) return; LispDoBuildCircle(object, info); LispBuildCircle(object->data.lambda.code, info); break; default: break; } } static void LispDoBuildCircle(LispObj *object, write_info *info) { long i; if (LispCheckCircle(object, info) >= 0) return; for (i = 0; i < info->num_objects; i++) if (info->objects[i] == object) { /* circularity found */ info->circles = LispRealloc(info->circles, sizeof(circle_info) * (info->num_circles + 1)); info->circles[info->num_circles].circle_nth = 0; info->circles[info->num_circles].object = object; ++info->num_circles; return; } /* object pointer not yet recorded */ if ((i % 16) == 0) info->objects = LispRealloc(info->objects, sizeof(LispObj*) * (info->num_objects + 16)); info->objects[info->num_objects++] = object; if (CONSP(object)) { if (CONSP(CAR(object))) LispDoBuildCircle(CAR(object), info); else LispBuildCircle(CAR(object), info); if (CONSP(CDR(object))) LispDoBuildCircle(CDR(object), info); else LispBuildCircle(CDR(object), info); } } static long LispCheckCircle(LispObj *object, write_info *info) { long i; for (i = 0; i < info->num_circles; i++) if (info->circles[i].object == object) return (i); return (-1); } static int LispPrintCircle(LispObj *stream, LispObj *object, long circle, int *length, write_info *info) { char stk[32]; if (!info->circles[circle].circle_nth) { sprintf(stk, "#%ld=", ++info->circle_count); *length += LispWriteStr(stream, stk, strlen(stk)); info->circles[circle].circle_nth = info->circle_count; return (1); } sprintf(stk, "#%ld#", info->circles[circle].circle_nth); *length += LispWriteStr(stream, stk, strlen(stk)); return (0); } static int LispWriteAlist(LispObj *stream, LispArgList *alist, write_info *info) { Atom_id name; int i, length = 0, need_space = 0; #define WRITE_ATOM(object) \ name = ATOMID(object); \ length += LispDoWriteAtom(stream, name->value, name->length, \ info->print_case) #define WRITE_ATOMID(atomid) \ length += LispDoWriteAtom(stream, atomid->value, atomid->length, \ info->print_case) #define WRITE_OBJECT(object) \ length += LispDoWriteObject(stream, object, info, 1) #define WRITE_OPAREN() \ length += LispWriteChar(stream, '(') #define WRITE_SPACE() \ length += LispWriteChar(stream, ' ') #define WRITE_CPAREN() \ length += LispWriteChar(stream, ')') WRITE_OPAREN(); for (i = 0; i < alist->normals.num_symbols; i++) { WRITE_ATOM(alist->normals.symbols[i]); if (i + 1 < alist->normals.num_symbols) WRITE_SPACE(); else need_space = 1; } if (alist->optionals.num_symbols) { if (need_space) WRITE_SPACE(); WRITE_ATOMID(Soptional); WRITE_SPACE(); for (i = 0; i < alist->optionals.num_symbols; i++) { WRITE_OPAREN(); WRITE_ATOM(alist->optionals.symbols[i]); WRITE_SPACE(); WRITE_OBJECT(alist->optionals.defaults[i]); if (alist->optionals.sforms[i]) { WRITE_SPACE(); WRITE_ATOM(alist->optionals.sforms[i]); } WRITE_CPAREN(); if (i + 1 < alist->optionals.num_symbols) WRITE_SPACE(); } need_space = 1; } if (alist->keys.num_symbols) { if (need_space) WRITE_SPACE(); length += LispDoWriteAtom(stream, Skey->value, 4, info->print_case); WRITE_SPACE(); for (i = 0; i < alist->keys.num_symbols; i++) { WRITE_OPAREN(); if (alist->keys.keys[i]) { WRITE_OPAREN(); WRITE_ATOM(alist->keys.keys[i]); WRITE_SPACE(); } WRITE_ATOM(alist->keys.symbols[i]); if (alist->keys.keys[i]) WRITE_CPAREN(); WRITE_SPACE(); WRITE_OBJECT(alist->keys.defaults[i]); if (alist->keys.sforms[i]) { WRITE_SPACE(); WRITE_ATOM(alist->keys.sforms[i]); } WRITE_CPAREN(); if (i + 1 < alist->keys.num_symbols) WRITE_SPACE(); } need_space = 1; } if (alist->rest) { if (need_space) WRITE_SPACE(); WRITE_ATOMID(Srest); WRITE_SPACE(); WRITE_ATOM(alist->rest); need_space = 1; } if (alist->auxs.num_symbols) { if (need_space) WRITE_SPACE(); WRITE_ATOMID(Saux); WRITE_SPACE(); for (i = 0; i < alist->auxs.num_symbols; i++) { WRITE_OPAREN(); WRITE_ATOM(alist->auxs.symbols[i]); WRITE_SPACE(); WRITE_OBJECT(alist->auxs.initials[i]); WRITE_CPAREN(); if (i + 1 < alist->auxs.num_symbols) WRITE_SPACE(); } } WRITE_CPAREN(); #undef WRITE_ATOM #undef WRITE_ATOMID #undef WRITE_OBJECT #undef WRITE_OPAREN #undef WRITE_SPACE #undef WRITE_CPAREN return (length); } static void check_stream(LispObj *stream, LispFile **file, LispString **string, int check_writable) { /* NIL is UNIX stdout, *STANDARD-OUTPUT* may not be UNIX stdout */ if (stream == NIL) { *file = Stdout; *string = NULL; } else { if (!STREAMP(stream)) LispDestroy("%s is not a stream", STROBJ(stream)); if (check_writable && !stream->data.stream.writable) LispDestroy("%s is not writable", STROBJ(stream)); else if (stream->data.stream.type == LispStreamString) { *string = SSTREAMP(stream); *file = NULL; } else { if (stream->data.stream.type == LispStreamPipe) *file = OPSTREAMP(stream); else *file = stream->data.stream.source.file; *string = NULL; } } } /* Assumes buffer has enough storage, 64 bytes should be more than enough */ static void parse_double(char *buffer, int *exponent, double value, int d) { char stk[64], fmt[32], *ptr, *fract = NULL; int positive = value >= 0.0; parse_double_again: if (d >= 8) { double dcheck; int icheck, count; /* this should to do the correct rounding */ for (count = 2; count >= 0; count--) { icheck = d <= 0 ? 0 : d > FLOAT_PREC ? FLOAT_PREC - count : d - count; sprintf(fmt, "%%.%de", icheck); sprintf(stk, fmt, value); if (count) { /* if the value read back is the same formatted */ sscanf(stk, "%lf", &dcheck); if (dcheck == value) break; } } } else { sprintf(fmt, "%%.%de", d <= 0 ? 0 : d > FLOAT_PREC ? FLOAT_PREC : d); sprintf(stk, fmt, value); } /* this "should" never fail */ ptr = strchr(stk, 'e'); if (ptr) { *ptr++ = '\0'; *exponent = atoi(ptr); } else *exponent = 0; /* find start of number representation */ for (ptr = stk; *ptr && !isdigit(*ptr); ptr++) ; /* check if did not trim any significant digit, * this may happen because '%.e' puts only one digit before the '.' */ if (d > 0 && d < FLOAT_PREC && fabs(value) >= 10.0 && strlen(ptr) - 1 - !positive <= *exponent) { d += *exponent - (strlen(ptr) - 1 - !positive) + 1; goto parse_double_again; } /* this "should" never fail */ fract = strchr(ptr, '.'); if (fract) *fract++ = '\0'; /* store number representation in buffer */ *buffer = positive ? '+' : '-'; strcpy(buffer + 1, ptr); if (fract) strcpy(buffer + strlen(buffer), fract); } static void format_integer(char *buffer, long value, int radix) { if (radix == 10) sprintf(buffer, "%ld", value); else if (radix == 16) sprintf(buffer, "%lx", value); else if (radix == 8) sprintf(buffer, "%lo", value); else { /* use bignum routine to convert number to string */ mpi integer; mpi_init(&integer); mpi_seti(&integer, value); mpi_getstr(buffer, &integer, radix); mpi_clear(&integer); } } static int LispWriteCPointer(LispObj *stream, void *data) { char stk[32]; #ifdef LONG64 sprintf(stk, "0x%016lx", (long)data); #else sprintf(stk, "0x%08lx", (long)data); #endif return (LispWriteStr(stream, stk, strlen(stk))); } static int LispWriteCString(LispObj *stream, char *string, long length, write_info *info) { int result; if (!info->print_escape) { char *base, *ptr, *end; result = LispWriteChar(stream, '"'); for (base = ptr = string, end = string + length; ptr < end; ptr++) { if (*ptr == '\\' || *ptr == '"') { result += LispWriteStr(stream, base, ptr - base); result += LispWriteChar(stream, '\\'); result += LispWriteChar(stream, *ptr); base = ptr + 1; } } result += LispWriteStr(stream, base, end - base); result += LispWriteChar(stream, '"'); } else result = LispWriteStr(stream, string, length); return (result); } static int LispWriteList(LispObj *stream, LispObj *object, write_info *info, int paren) { int length = 0; long circle = 0; INCDEPTH(); if (info->print_level < 0 || info->level <= info->print_level) { LispObj *car, *cdr; long print_length = info->length; if (info->circles && (circle = LispCheckCircle(object, info)) >= 0) { if (!paren) { length += LispWriteStr(stream, ". ", 2); paren = 1; } if (LispPrintCircle(stream, object, circle, &length, info) == 0) { DECDEPTH(); return (length); } } car = CAR(object); cdr = CDR(object); if (cdr == NIL) { if (paren) length += LispWriteChar(stream, '('); if (info->print_length < 0 || info->length < info->print_length) { info->length = 0; length += LispDoWriteObject(stream, car, info, 1); info->length = print_length + 1; } else length += LispWriteStr(stream, "...", 3); if (paren) length += LispWriteChar(stream, ')'); } else { if (paren) length += LispWriteChar(stream, '('); if (info->print_length < 0 || info->length < info->print_length) { info->length = 0; length += LispDoWriteObject(stream, car, info, 1); info->length = print_length + 1; if (!CONSP(cdr)) { length += LispWriteStr(stream, " . ", 3); info->length = 0; length += LispDoWriteObject(stream, cdr, info, 0); } else { length += LispWriteChar(stream, ' '); if (info->print_length < 0 || info->length < info->print_length) length += LispWriteList(stream, cdr, info, 0); else length += LispWriteStr(stream, "...", 3); } } else length += LispWriteStr(stream, "...", 3); if (paren) length += LispWriteChar(stream, ')'); } info->length = print_length; } else length += LispWriteChar(stream, '#'); DECDEPTH(); return (length); } static int LispDoWriteObject(LispObj *stream, LispObj *object, write_info *info, int paren) { long print_level; int length = 0; char stk[64]; const char *string = NULL; write_again: switch (OBJECT_TYPE(object)) { case LispNil_t: if (object == NIL) string = Snil->value; else if (object == T) string = St->value; else if (object == DOT) string = "#"; else if (object == UNSPEC) string = "#"; else if (object == UNBOUND) string = "#"; else string = "#"; length += LispDoWriteAtom(stream, string, strlen(string), info->print_case); break; case LispOpaque_t: { char *desc = LispIntToOpaqueType(object->data.opaque.type); length += LispWriteChar(stream, '#'); length += LispWriteCPointer(stream, object->data.opaque.data); length += LispWriteStr(stream, desc, strlen(desc)); } break; case LispAtom_t: length += LispWriteAtom(stream, object, info); break; case LispFunction_t: if (object->data.atom->a_function) { object = object->data.atom->property->fun.function; goto write_lambda; } length += LispWriteStr(stream, "#<", 2); if (object->data.atom->a_compiled) LispDoWriteAtom(stream, "COMPILED", 8, info->print_case); else if (object->data.atom->a_builtin) LispDoWriteAtom(stream, "BUILTIN", 7, info->print_case); /* XXX the function does not exist anymore */ /* FIXME not sure if I want this fixed... */ else LispDoWriteAtom(stream, "UNBOUND", 7, info->print_case); LispDoWriteAtom(stream, "-FUNCTION", 9, info->print_case); length += LispWriteChar(stream, ' '); length += LispWriteAtom(stream, object->data.atom->object, info); length += LispWriteChar(stream, '>'); break; case LispString_t: length += LispWriteString(stream, object, info); break; case LispSChar_t: length += LispWriteCharacter(stream, object, info); break; case LispDFloat_t: length += LispWriteFloat(stream, object); break; case LispFixnum_t: case LispInteger_t: case LispBignum_t: length += LispWriteInteger(stream, object); break; case LispRatio_t: format_integer(stk, object->data.ratio.numerator, 10); length += LispWriteStr(stream, stk, strlen(stk)); length += LispWriteChar(stream, '/'); format_integer(stk, object->data.ratio.denominator, 10); length += LispWriteStr(stream, stk, strlen(stk)); break; case LispBigratio_t: { int sz; char *ptr; sz = mpi_getsize(mpr_num(object->data.mp.ratio), 10) + 1 + mpi_getsize(mpr_den(object->data.mp.ratio), 10) + 1 + (mpi_sgn(mpr_num(object->data.mp.ratio)) < 0); if (sz > sizeof(stk)) ptr = LispMalloc(sz); else ptr = stk; mpr_getstr(ptr, object->data.mp.ratio, 10); length += LispWriteStr(stream, ptr, sz - 1); if (ptr != stk) LispFree(ptr); } break; case LispComplex_t: length += LispWriteStr(stream, "#C(", 3); length += LispDoWriteObject(stream, object->data.complex.real, info, 0); length += LispWriteChar(stream, ' '); length += LispDoWriteObject(stream, object->data.complex.imag, info, 0); length += LispWriteChar(stream, ')'); break; case LispCons_t: print_level = info->level; ++info->level; length += LispWriteList(stream, object, info, paren); info->level = print_level; break; case LispQuote_t: length += LispWriteChar(stream, '\''); paren = 1; object = object->data.quote; goto write_again; case LispBackquote_t: length += LispWriteChar(stream, '`'); paren = 1; object = object->data.quote; goto write_again; case LispComma_t: if (object->data.comma.atlist) length += LispWriteStr(stream, ",@", 2); else length += LispWriteChar(stream, ','); paren = 1; object = object->data.comma.eval; goto write_again; break; case LispFunctionQuote_t: length += LispWriteStr(stream, "#'", 2); paren = 1; object = object->data.quote; goto write_again; case LispArray_t: length += LispWriteArray(stream, object, info); break; case LispStruct_t: length += LispWriteStruct(stream, object, info); break; case LispLambda_t: write_lambda: switch (object->funtype) { case LispLambda: string = "#print_case); if (object->funtype != LispLambda) { length += LispWriteAtom(stream, object->data.lambda.name, info); length += LispWriteChar(stream, ' '); length += LispWriteAlist(stream, object->data.lambda.name ->data.atom->property->alist, info); } else { length += LispDoWriteAtom(stream, "NIL", 3, info->print_case); length += LispWriteChar(stream, ' '); length += LispWriteAlist(stream, (LispArgList*)object-> data.lambda.name->data.opaque.data, info); } length += LispWriteChar(stream, ' '); length += LispDoWriteObject(stream, object->data.lambda.code, info, 0); length += LispWriteChar(stream, '>'); break; case LispStream_t: length += LispWriteStr(stream, "#<", 2); if (object->data.stream.type == LispStreamFile) string = "FILE-STREAM "; else if (object->data.stream.type == LispStreamString) string = "STRING-STREAM "; else if (object->data.stream.type == LispStreamStandard) string = "STANDARD-STREAM "; else if (object->data.stream.type == LispStreamPipe) string = "PIPE-STREAM "; length += LispDoWriteAtom(stream, string, strlen(string), info->print_case); if (!object->data.stream.readable && !object->data.stream.writable) length += LispDoWriteAtom(stream, "CLOSED", 6, info->print_case); else { if (object->data.stream.readable) length += LispDoWriteAtom(stream, "READ", 4, info->print_case); if (object->data.stream.writable) { if (object->data.stream.readable) length += LispWriteChar(stream, '-'); length += LispDoWriteAtom(stream, "WRITE", 5, info->print_case); } } if (object->data.stream.type != LispStreamString) { length += LispWriteChar(stream, ' '); length += LispDoWriteObject(stream, object->data.stream.pathname, info, 1); /* same address/size for pipes */ length += LispWriteChar(stream, ' '); length += LispWriteCPointer(stream, object->data.stream.source.file); if (object->data.stream.readable && object->data.stream.type == LispStreamFile && !object->data.stream.source.file->binary) { length += LispWriteStr(stream, " @", 2); format_integer(stk, object->data.stream.source.file->line, 10); length += LispWriteStr(stream, stk, strlen(stk)); } } length += LispWriteChar(stream, '>'); break; case LispPathname_t: length += LispWriteStr(stream, "#P", 2); paren = 1; object = CAR(object->data.quote); goto write_again; case LispPackage_t: length += LispDoWriteAtom(stream, "#print_case); length += LispWriteStr(stream, THESTR(object->data.package.name), STRLEN(object->data.package.name)); length += LispWriteChar(stream, '>'); break; case LispRegex_t: length += LispDoWriteAtom(stream, "#print_case); length += LispDoWriteObject(stream, object->data.regex.pattern, info, 1); if (object->data.regex.options & RE_NOSPEC) length += LispDoWriteAtom(stream, " :NOSPEC", 8, info->print_case); if (object->data.regex.options & RE_ICASE) length += LispDoWriteAtom(stream, " :ICASE", 7, info->print_case); if (object->data.regex.options & RE_NOSUB) length += LispDoWriteAtom(stream, " :NOSUB", 7, info->print_case); if (object->data.regex.options & RE_NEWLINE) length += LispDoWriteAtom(stream, " :NEWLINE", 9, info->print_case); length += LispWriteChar(stream, '>'); break; case LispBytecode_t: length += LispDoWriteAtom(stream, "#print_case); length += LispWriteCPointer(stream, object->data.bytecode.bytecode); length += LispWriteChar(stream, '>'); break; case LispHashTable_t: length += LispDoWriteAtom(stream, "#print_case); length += LispWriteAtom(stream, object->data.hash.test, info); snprintf(stk, sizeof(stk), " %g %g", object->data.hash.table->rehash_size, object->data.hash.table->rehash_threshold); length += LispWriteStr(stream, stk, strlen(stk)); snprintf(stk, sizeof(stk), " %ld/%ld>", object->data.hash.table->count, object->data.hash.table->num_entries); length += LispWriteStr(stream, stk, strlen(stk)); break; } return (length); } /* return current column number in stream */ int LispGetColumn(LispObj *stream) { LispFile *file; LispString *string; check_stream(stream, &file, &string, 0); if (file != NULL) return (file->column); return (string->column); } /* write a character to stream */ int LispWriteChar(LispObj *stream, int character) { LispFile *file; LispString *string; check_stream(stream, &file, &string, 1); if (file != NULL) return (LispFputc(file, character)); return (LispSputc(string, character)); } /* write a character count times to stream */ int LispWriteChars(LispObj *stream, int character, int count) { int length = 0; if (count > 0) { char stk[64]; LispFile *file; LispString *string; check_stream(stream, &file, &string, 1); if (count >= sizeof(stk)) { memset(stk, character, sizeof(stk)); for (; count >= sizeof(stk); count -= sizeof(stk)) { if (file != NULL) length += LispFwrite(file, stk, sizeof(stk)); else length += LispSwrite(string, stk, sizeof(stk)); } } else memset(stk, character, count); if (count) { if (file != NULL) length += LispFwrite(file, stk, count); else length += LispSwrite(string, stk, count); } } return (length); } /* write a string to stream */ int LispWriteStr(LispObj *stream, const char *buffer, long length) { LispFile *file; LispString *string; check_stream(stream, &file, &string, 1); if (file != NULL) return (LispFwrite(file, buffer, length)); return (LispSwrite(string, buffer, length)); } static int LispDoWriteAtom(LispObj *stream, const char *string, int length, int print_case) { int bytes = 0, cap = 0; char buffer[128], *ptr; switch (print_case) { case DOWNCASE: for (ptr = buffer; length > 0; length--, string++) { if (isupper(*string)) *ptr = tolower(*string); else *ptr = *string; ++ptr; if (ptr - buffer >= sizeof(buffer)) { bytes += LispWriteStr(stream, buffer, ptr - buffer); ptr = buffer; } } if (ptr > buffer) bytes += LispWriteStr(stream, buffer, ptr - buffer); break; case CAPITALIZE: for (ptr = buffer; length > 0; length--, string++) { if (isalnum(*string)) { if (cap && isupper(*string)) *ptr = tolower(*string); else *ptr = *string; cap = 1; } else { *ptr = *string; cap = 0; } ++ptr; if (ptr - buffer >= sizeof(buffer)) { bytes += LispWriteStr(stream, buffer, ptr - buffer); ptr = buffer; } } if (ptr > buffer) bytes += LispWriteStr(stream, buffer, ptr - buffer); break; default: /* Strings are already stored upcase/quoted */ bytes += LispWriteStr(stream, string, length); break; } return (bytes); } static int LispWriteAtom(LispObj *stream, LispObj *object, write_info *info) { int length = 0; LispAtom *atom = object->data.atom; Atom_id id = atom->key; if (atom->package != PACKAGE) { if (atom->package == lisp__data.keyword) length += LispWriteChar(stream, ':'); else if (atom->package == NULL) length += LispWriteStr(stream, "#:", 2); else { /* Check if the symbol is visible */ int i, visible = 0; if (atom->ext) { for (i = lisp__data.pack->use.length - 1; i >= 0; i--) { if (lisp__data.pack->use.pairs[i] == atom->package) { visible = 1; break; } } } if (!visible) { /* XXX this assumes that package names are always "readable" */ length += LispDoWriteAtom(stream, THESTR(atom->package->data.package.name), STRLEN(atom->package->data.package.name), info->print_case); length += LispWriteChar(stream, ':'); if (!atom->ext) length += LispWriteChar(stream, ':'); } } } if (atom->unreadable) length += LispWriteChar(stream, '|'); length += LispDoWriteAtom(stream, id->value, id->length, atom->unreadable ? UPCASE : info->print_case); if (atom->unreadable) length += LispWriteChar(stream, '|'); return (length); } static int LispWriteInteger(LispObj *stream, LispObj *object) { return (LispFormatInteger(stream, object, 10, 0, 0, 0, 0, 0, 0)); } static int LispWriteCharacter(LispObj *stream, LispObj *object, write_info *info) { return (LispFormatCharacter(stream, object, !info->print_escape, 0)); } static int LispWriteString(LispObj *stream, LispObj *object, write_info *info) { return (LispWriteCString(stream, THESTR(object), STRLEN(object), info)); } static int LispWriteFloat(LispObj *stream, LispObj *object) { double value = DFLOAT_VALUE(object); if (value == 0.0 || (fabs(value) < 1.0E7 && fabs(value) > 1.0E-4)) return (LispFormatFixedFloat(stream, object, 0, 0, NULL, 0, 0, 0)); return (LispDoFormatExponentialFloat(stream, object, 0, 0, NULL, 0, 1, 0, ' ', 'E', 0)); } static int LispWriteArray(LispObj *stream, LispObj *object, write_info *info) { int length = 0; long print_level = info->level, circle; if (info->circles && (circle = LispCheckCircle(object, info)) >= 0 && LispPrintCircle(stream, object, circle, &length, info) == 0) return (length); if (object->data.array.rank == 0) { length += LispWriteStr(stream, "#0A", 3); length += LispDoWriteObject(stream, object->data.array.list, info, 1); return (length); } INCDEPTH(); ++info->level; if (info->print_level < 0 || info->level <= info->print_level) { if (object->data.array.rank == 1) length += LispWriteStr(stream, "#(", 2); else { char stk[32]; format_integer(stk, object->data.array.rank, 10); length += LispWriteChar(stream, '#'); length += LispWriteStr(stream, stk, strlen(stk)); length += LispWriteStr(stream, "A(", 2); } if (!object->data.array.zero) { long print_length = info->length, local_length = 0; if (object->data.array.rank == 1) { LispObj *ary; long count; for (ary = object->data.array.dim, count = 1; ary != NIL; ary = CDR(ary)) count *= FIXNUM_VALUE(CAR(ary)); for (ary = object->data.array.list; count > 0; ary = CDR(ary), count--) { if (info->print_length < 0 || ++local_length <= info->print_length) { info->length = 0; length += LispDoWriteObject(stream, CAR(ary), info, 1); } else { length += LispWriteStr(stream, "...", 3); break; } if (count - 1 > 0) length += LispWriteChar(stream, ' '); } } else { LispObj *ary; int i, k, rank, *dims, *loop; rank = object->data.array.rank; dims = LispMalloc(sizeof(int) * rank); loop = LispCalloc(1, sizeof(int) * (rank - 1)); /* fill dim */ for (i = 0, ary = object->data.array.dim; ary != NIL; i++, ary = CDR(ary)) dims[i] = FIXNUM_VALUE(CAR(ary)); i = 0; ary = object->data.array.list; while (loop[0] < dims[0]) { if (info->print_length < 0 || local_length < info->print_length) { for (; i < rank - 1; i++) length += LispWriteChar(stream, '('); --i; for (;;) { ++loop[i]; if (i && loop[i] >= dims[i]) loop[i] = 0; else break; --i; } for (k = 0; k < dims[rank - 1] - 1; k++, ary = CDR(ary)) { if (info->print_length < 0 || k < info->print_length) { ++local_length; info->length = 0; length += LispDoWriteObject(stream, CAR(ary), info, 1); length += LispWriteChar(stream, ' '); } } if (info->print_length < 0 || k < info->print_length) { ++local_length; info->length = 0; length += LispDoWriteObject(stream, CAR(ary), info, 0); } else length += LispWriteStr(stream, "...", 3); for (k = rank - 1; k > i; k--) length += LispWriteChar(stream, ')'); if (loop[0] < dims[0]) length += LispWriteChar(stream, ' '); ary = CDR(ary); } else { ++local_length; length += LispWriteStr(stream, "...)", 4); for (; local_length < dims[0] - 1; local_length++) length += LispWriteStr(stream, " ...)", 5); if (local_length <= dims[0]) length += LispWriteStr(stream, " ...", 4); break; } } LispFree(dims); LispFree(loop); } info->length = print_length; } length += LispWriteChar(stream, ')'); } else length += LispWriteChar(stream, '#'); info->level = print_level; DECDEPTH(); return (length); } static int LispWriteStruct(LispObj *stream, LispObj *object, write_info *info) { int length; long circle; LispObj *symbol; LispObj *def = object->data.struc.def; LispObj *field = object->data.struc.fields; if (info->circles && (circle = LispCheckCircle(object, info)) >= 0 && LispPrintCircle(stream, object, circle, &length, info) == 0) return (length); INCDEPTH(); length = LispWriteStr(stream, "#S(", 3); symbol = SYMBOLP(CAR(def)) ? CAR(def) : CAAR(def); length += LispWriteAtom(stream, symbol, info); def = CDR(def); for (; def != NIL; def = CDR(def), field = CDR(field)) { length += LispWriteChar(stream, ' '); symbol = SYMBOLP(CAR(def)) ? CAR(def) : CAAR(def); length += LispWriteAtom(stream, symbol, info); length += LispWriteChar(stream, ' '); length += LispDoWriteObject(stream, CAR(field), info, 1); } length += LispWriteChar(stream, ')'); DECDEPTH(); return (length); } int LispFormatInteger(LispObj *stream, LispObj *object, int radix, int atsign, int collon, int mincol, int padchar, int commachar, int commainterval) { char stk[128], *str = stk; int i, length, sign, intervals; if (LONGINTP(object)) format_integer(stk, LONGINT_VALUE(object), radix); else { if (mpi_getsize(object->data.mp.integer, radix) >= sizeof(stk)) str = mpi_getstr(NULL, object->data.mp.integer, radix); else mpi_getstr(str, object->data.mp.integer, radix); } sign = *str == '-'; length = strlen(str); /* if collon, update length for the number of commachars to be printed */ if (collon && commainterval > 0 && commachar) { intervals = length / commainterval; length += intervals; } else intervals = 0; /* if sign must be printed, and number is positive */ if (atsign && !sign) ++length; /* if need padding */ if (padchar && mincol > length) LispWriteChars(stream, padchar, mincol - length); /* if need to print number sign */ if (sign || atsign) LispWriteChar(stream, sign ? '-' : '+'); /* if need to print commas to separate groups of numbers */ if (intervals) { int j; char *ptr; i = (length - atsign) - intervals; j = i % commainterval; /* make the loop below easier */ if (j == 0) j = commainterval; i -= j; ptr = str + sign; for (; j > 0; j--, ptr++) LispWriteChar(stream, *ptr); for (; i > 0; i -= commainterval) { LispWriteChar(stream, commachar); for (j = 0; j < commainterval; j++, ptr++) LispWriteChar(stream, *ptr); } } /* else, just print the string */ else LispWriteStr(stream, str + sign, length - sign); /* if number required more than sizeof(stk) bytes */ if (str != stk) LispFree(str); return (length); } int LispFormatRomanInteger(LispObj *stream, long value, int new_roman) { char stk[32]; int length; length = 0; while (value > 1000) { stk[length++] = 'M'; value -= 1000; } if (new_roman) { if (value >= 900) { strcpy(stk + length, "CM"); length += 2, value -= 900; } else if (value < 500 && value >= 400) { strcpy(stk + length, "CD"); length += 2; value -= 400; } } if (value >= 500) { stk[length++] = 'D'; value -= 500; } while (value >= 100) { stk[length++] = 'C'; value -= 100; } if (new_roman) { if (value >= 90) { strcpy(stk + length, "XC"); length += 2, value -= 90; } else if (value < 50 && value >= 40) { strcpy(stk + length, "XL"); length += 2; value -= 40; } } if (value >= 50) { stk[length++] = 'L'; value -= 50; } while (value >= 10) { stk[length++] = 'X'; value -= 10; } if (new_roman) { if (value == 9) { strcpy(stk + length, "IX"); length += 2, value -= 9; } else if (value == 4) { strcpy(stk + length, "IV"); length += 2; value -= 4; } } if (value >= 5) { stk[length++] = 'V'; value -= 5; } while (value) { stk[length++] = 'I'; --value; } stk[length] = '\0'; return (LispWriteStr(stream, stk, length)); } int LispFormatEnglishInteger(LispObj *stream, long number, int ordinal) { static const char *ds[] = { "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" }; static const char *dsth[] = { "", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth" }; static const char *hs[] = { "", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" }; static const char *hsth[] = { "", "", "twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", "seventieth", "eightieth", "ninetieth" }; static const char *ts[] = { "", "thousand", "million" }; static const char *tsth[] = { "", "thousandth", "millionth" }; char stk[256]; int length, sign; sign = number < 0; if (sign) number = -number; length = 0; #define SIGNLEN 6 /* strlen("minus ") */ if (sign) { strcpy(stk, "minus "); length += SIGNLEN; } else if (number == 0) { if (ordinal) { strcpy(stk, "zeroth"); length += 6; /* strlen("zeroth") */ } else { strcpy(stk, "zero"); length += 4; /* strlen("zero") */ } } for (;;) { int count, temp; const char *t, *h, *d; long value = number; for (count = 0; value >= 1000; value /= 1000, count++) ; t = ds[value / 100]; if (ordinal && !count && (value % 10) == 0) h = hsth[(value % 100) / 10]; else h = hs[(value % 100) / 10]; if (ordinal && !count) d = *h ? dsth[value % 10] : dsth[value % 20]; else d = *h ? ds[value % 10] : ds[value % 20]; if (((!sign && length) || length > SIGNLEN) && (*t || *h || *d)) { if (!ordinal || count || *h || *t) { strcpy(stk + length, ", "); length += 2; } else { strcpy(stk + length, " "); ++length; } } if (*t) { if (ordinal && !count && (value % 100) == 0) temp = sprintf(stk + length, "%s hundredth", t); else temp = sprintf(stk + length, "%s hundred", t); length += temp; } if (*h) { if (*t) { if (ordinal && !count) { strcpy(stk + length, " "); ++length; } else { strcpy(stk + length, " and "); length += 5; /* strlen(" and ") */ } } strcpy(stk + length, h); length += strlen(h); } if (*d) { if (*h) { strcpy(stk + length, "-"); ++length; } else if (*t) { if (ordinal && !count) { strcpy(stk + length, " "); ++length; } else { strcpy(stk + length, " and "); length += 5; /* strlen(" and ") */ } } strcpy(stk + length, d); length += strlen(d); } if (!count) break; else temp = count; if (count > 1) { value *= 1000; while (--count) value *= 1000; number -= value; } else number %= 1000; if (ordinal && number == 0 && !*t && !*h) temp = sprintf(stk + length, " %s", tsth[temp]); else temp = sprintf(stk + length, " %s", ts[temp]); length += temp; if (!number) break; } return (LispWriteStr(stream, stk, length)); } int LispFormatCharacter(LispObj *stream, LispObj *object, int atsign, int collon) { int length = 0; int ch = SCHAR_VALUE(object); if (atsign && !collon) length += LispWriteStr(stream, "#\\", 2); if ((atsign || collon) && (ch <= ' ' || ch == 0177)) { const char *name = LispChars[ch].names[0]; length += LispWriteStr(stream, name, strlen(name)); } else length += LispWriteChar(stream, ch); return (length); } /* returns 1 if string size must grow, done inplace */ static int float_string_inc(char *buffer, int offset) { int i; for (i = offset; i >= 0; i--) { if (buffer[i] == '9') buffer[i] = '0'; else if (buffer[i] != '.') { ++buffer[i]; break; } } if (i < 0) { int length = strlen(buffer); /* string size must change */ memmove(buffer + 1, buffer, length + 1); buffer[0] = '1'; return (1); } return (0); } int LispFormatFixedFloat(LispObj *stream, LispObj *object, int atsign, int w, int *pd, int k, int overflowchar, int padchar) { char buffer[512], stk[64]; int sign, exponent, length, offset, d = pd ? *pd : FLOAT_PREC, again; double value = DFLOAT_VALUE(object); if (value == 0.0) { exponent = k = 0; strcpy(stk, "+0"); } else /* calculate format parameters, adjusting scale factor */ parse_double(stk, &exponent, value, d + 1 + k); /* make sure k won't cause overflow */ if (k > 128) k = 128; else if (k < -128) k = -128; /* make sure d won't cause overflow */ if (d > 128) d = 128; else if (d < -128) d = -128; /* adjust scale factor, exponent is used as an index in stk */ exponent += k + 1; /* how many bytes in float representation */ length = strlen(stk) - 1; /* need to print a sign? */ sign = atsign || (stk[0] == '-'); /* format number, cannot overflow, as control variables were checked */ offset = 0; if (sign) buffer[offset++] = stk[0]; if (exponent > 0) { if (exponent > length) { memcpy(buffer + offset, stk + 1, length); memset(buffer + offset + length, '0', exponent - length); } else memcpy(buffer + offset, stk + 1, exponent); offset += exponent; buffer[offset++] = '.'; if (length > exponent) { memcpy(buffer + offset, stk + 1 + exponent, length - exponent); offset += length - exponent; } else buffer[offset++] = '0'; } else { buffer[offset++] = '0'; buffer[offset++] = '.'; while (exponent < 0) { buffer[offset++] = '0'; exponent++; } memcpy(buffer + offset, stk + 1, length); offset += length; } buffer[offset] = '\0'; again = 0; fixed_float_check_again: /* make sure only d digits are printed after decimal point */ if (d > 0) { char *dptr = strchr(buffer, '.'); length = strlen(dptr) - 1; /* check if need to remove excess digits */ if (length > d) { int digit; offset = (dptr - buffer) + 1 + d; digit = buffer[offset]; /* remove extra digits */ buffer[offset] = '\0'; /* check if need to round */ if (!again && offset > 1 && isdigit(digit) && digit >= '5' && isdigit(buffer[offset - 1]) && float_string_inc(buffer, offset - 1)) ++offset; } /* check if need to add extra zero digits to fill space */ else if (length < d) { offset += d - length; for (++length; length <= d; length++) dptr[length] = '0'; dptr[length] = '\0'; } } else { /* no digits after decimal point */ int digit, inc = 0; char *dptr = strchr(buffer, '.') + 1; digit = *dptr; if (!again && digit >= '5' && dptr >= buffer + 2 && isdigit(dptr[-2])) inc = float_string_inc(buffer, dptr - buffer - 2); offset = (dptr - buffer) + inc; buffer[offset] = '\0'; } /* if d was not specified, remove any extra zeros */ if (pd == NULL) { while (offset > 2 && buffer[offset - 2] != '.' && buffer[offset - 1] == '0') --offset; buffer[offset] = '\0'; } if (w > 0 && offset > w) { /* first check if can remove extra fractional digits */ if (pd == NULL) { char *ptr = strchr(buffer, '.') + 1; if (ptr - buffer < w) { d = w - (ptr - buffer); goto fixed_float_check_again; } } /* remove leading "zero" to save space */ if ((!sign && buffer[0] == '0') || (sign && buffer[1] == '0')) { /* ending nul also copied */ memmove(buffer + sign, buffer + sign + 1, offset); --offset; } /* remove leading '+' to "save" space */ if (offset > w && buffer[0] == '+') { /* ending nul also copied */ memmove(buffer, buffer + 1, offset); --offset; } } /* if cannot represent number in given width */ if (overflowchar && offset > w) { again = 1; goto fixed_float_overflow; } length = 0; /* print padding if required */ if (w > offset) length += LispWriteChars(stream, padchar, w - offset); /* print float number representation */ return (LispWriteStr(stream, buffer, offset) + length); fixed_float_overflow: return (LispWriteChars(stream, overflowchar, w)); } int LispFormatExponentialFloat(LispObj *stream, LispObj *object, int atsign, int w, int *pd, int e, int k, int overflowchar, int padchar, int exponentchar) { return (LispDoFormatExponentialFloat(stream, object, atsign, w, pd, e, k, overflowchar, padchar, exponentchar, 1)); } int LispDoFormatExponentialFloat(LispObj *stream, LispObj *object, int atsign, int w, int *pd, int e, int k, int overflowchar, int padchar, int exponentchar, int format) { char buffer[512], stk[64]; int sign, exponent, length, offset, d = pd ? *pd : FLOAT_PREC; double value = DFLOAT_VALUE(object); if (value == 0.0) { exponent = 0; k = 1; strcpy(stk, "+0"); } else /* calculate format parameters, adjusting scale factor */ parse_double(stk, &exponent, value, d + k - 1); /* set e to a value that won't overflow */ if (e > 16) e = 16; /* set k to a value that won't overflow */ if (k > 128) k = 128; else if (k < -128) k = -128; /* set d to a value that won't overflow */ if (d > 128) d = 128; else if (d < -128) d = -128; /* how many bytes in float representation */ length = strlen(stk) - 1; /* need to print a sign? */ sign = atsign || (stk[0] == '-'); /* adjust number of digits after decimal point */ if (k > 0) d -= k - 1; /* adjust exponent, based on scale factor */ exponent -= k - 1; /* format number, cannot overflow, as control variables were checked */ offset = 0; if (sign) buffer[offset++] = stk[0]; if (k > 0) { if (k > length) { memcpy(buffer + offset, stk + 1, length); offset += length; } else { memcpy(buffer + offset, stk + 1, k); offset += k; } buffer[offset++] = '.'; if (length > k) { memcpy(buffer + offset, stk + 1 + k, length - k); offset += length - k; } else buffer[offset++] = '0'; } else { int tmp = k; buffer[offset++] = '0'; buffer[offset++] = '.'; while (tmp < 0) { buffer[offset++] = '0'; tmp++; } memcpy(buffer + offset, stk + 1, length); offset += length; } /* if format, then always add a sign to exponent */ buffer[offset++] = exponentchar; if (format || exponent < 0) buffer[offset++] = exponent < 0 ? '-' : '+'; /* XXX destroy stk contents */ sprintf(stk, "%%0%dd", e); /* format scale factor*/ length = sprintf(buffer + offset, stk, exponent < 0 ? -exponent : exponent); /* check for overflow in exponent */ if (length > e && overflowchar) goto exponential_float_overflow; offset += length; /* make sure only d digits are printed after decimal point */ if (d > 0) { int currd; char *dptr = strchr(buffer, '.'), *eptr = strchr(dptr, exponentchar); currd = eptr - dptr - 1; length = strlen(eptr); /* check if need to remove excess digits */ if (currd > d) { int digit, dpos; dpos = offset = (dptr - buffer) + 1 + d; digit = buffer[offset]; memmove(buffer + offset, eptr, length + 1); /* also copy ending nul character */ /* adjust offset to length of total string */ offset += length; /* check if need to round */ if (dpos > 1 && isdigit(digit) && digit >= '5' && isdigit(buffer[dpos - 1]) && float_string_inc(buffer, dpos - 1)) ++offset; } /* check if need to add extra zero digits to fill space */ else if (pd && currd < d) { memmove(eptr + d - currd, eptr, length + 1); /* also copy ending nul character */ offset += d - currd; for (++currd; currd <= d; currd++) dptr[currd] = '0'; } /* check if need to remove zeros */ else if (pd == NULL) { int zeros = 1; while (eptr[-zeros] == '0') ++zeros; if (eptr[-zeros] == '.') --zeros; if (zeros > 1) { memmove(eptr - zeros + 1, eptr, length + 1); offset -= zeros - 1; } } } else { /* no digits after decimal point */ int digit, inc = 0; char *dptr = strchr(buffer, '.'), *eptr = strchr(dptr, exponentchar); digit = dptr[1]; offset = (dptr - buffer) + 1; length = strlen(eptr); memmove(buffer + offset, eptr, length + 1); /* also copy ending nul character */ if (digit >= '5' && dptr >= buffer + 2 && isdigit(dptr[-2])) inc = float_string_inc(buffer, dptr - buffer - 2); /* adjust offset to length of total string */ offset += length + inc; } if (w > 0 && offset > w) { /* remove leading "zero" to save space */ if ((!sign && buffer[0] == '0') || (sign && buffer[1] == '0')) { /* ending nul also copied */ memmove(buffer + sign, buffer + sign + 1, offset); --offset; } /* remove leading '+' to "save" space */ if (offset > w && buffer[0] == '+') { /* ending nul also copied */ memmove(buffer, buffer + 1, offset); --offset; } } /* if cannot represent number in given width */ if (overflowchar && offset > w) goto exponential_float_overflow; length = 0; /* print padding if required */ if (w > offset) length += LispWriteChars(stream, padchar, w - offset); /* print float number representation */ return (LispWriteStr(stream, buffer, offset) + length); exponential_float_overflow: return (LispWriteChars(stream, overflowchar, w)); } int LispFormatGeneralFloat(LispObj *stream, LispObj *object, int atsign, int w, int *pd, int e, int k, int overflowchar, int padchar, int exponentchar) { char stk[64]; int length, exponent, n, dd, ee, ww, d = pd ? *pd : FLOAT_PREC; double value = DFLOAT_VALUE(object); if (value == 0.0) { exponent = 0; n = 0; d = 1; strcpy(stk, "+0"); } else { /* calculate format parameters, adjusting scale factor */ parse_double(stk, &exponent, value, d + k - 1); n = exponent + 1; } /* Let ee equal e+2, or 4 if e is omitted. */ if (e) ee = e + 2; else ee = 4; /* Let ww equal w-ee, or nil if w is omitted. */ if (w) ww = w - ee; else ww = 0; dd = d - n; if (d >= dd && dd >= 0) { length = LispFormatFixedFloat(stream, object, atsign, ww, &dd, 0, overflowchar, padchar); /* ~ee@T */ length += LispWriteChars(stream, padchar, ee); } else length = LispFormatExponentialFloat(stream, object, atsign, w, pd, e, k, overflowchar, padchar, exponentchar); return (length); } int LispFormatDollarFloat(LispObj *stream, LispObj *object, int atsign, int collon, int d, int n, int w, int padchar) { char buffer[512], stk[64]; int sign, exponent, length, offset; double value = DFLOAT_VALUE(object); if (value == 0.0) { exponent = 0; strcpy(stk, "+0"); } else /* calculate format parameters, adjusting scale factor */ parse_double(stk, &exponent, value, d == 0 ? FLOAT_PREC : d + 1); /* set d to a "sane" value */ if (d > 128) d = 128; /* set n to a "sane" value */ if (n > 128) n = 128; /* use exponent as index in stk */ ++exponent; /* don't put sign in buffer, * if collon specified, must go before padding */ sign = atsign || (stk[0] == '-'); offset = 0; /* pad with zeros if required */ if (exponent > 0) n -= exponent; while (n > 0) { buffer[offset++] = '0'; n--; } /* how many bytes in float representation */ length = strlen(stk) - 1; if (exponent > 0) { if (exponent > length) { memcpy(buffer + offset, stk + 1, length); memset(buffer + offset + length, '0', exponent - length); } else memcpy(buffer + offset, stk + 1, exponent); offset += exponent; buffer[offset++] = '.'; if (length > exponent) { memcpy(buffer + offset, stk + 1 + exponent, length - exponent); offset += length - exponent; } else buffer[offset++] = '0'; } else { if (n > 0) buffer[offset++] = '0'; buffer[offset++] = '.'; while (exponent < 0) { buffer[offset++] = '0'; exponent++; } memcpy(buffer + offset, stk + 1, length); offset += length; } buffer[offset] = '\0'; /* make sure only d digits are printed after decimal point */ if (d > 0) { char *dptr = strchr(buffer, '.'); length = strlen(dptr) - 1; /* check if need to remove excess digits */ if (length > d) { int digit; offset = (dptr - buffer) + 1 + d; digit = buffer[offset]; /* remove extra digits */ buffer[offset] = '\0'; /* check if need to round */ if (offset > 1 && isdigit(digit) && digit >= '5' && isdigit(buffer[offset - 1]) && float_string_inc(buffer, offset - 1)) ++offset; } /* check if need to add extra zero digits to fill space */ else if (length < d) { offset += d - length; for (++length; length <= d; length++) dptr[length] = '0'; dptr[length] = '\0'; } } else { /* no digits after decimal point */ int digit, inc = 0; char *dptr = strchr(buffer, '.') + 1; digit = *dptr; if (digit >= '5' && dptr >= buffer + 2 && isdigit(dptr[-2])) inc = float_string_inc(buffer, dptr - buffer - 2); offset = (dptr - buffer) + inc; buffer[offset] = '\0'; } length = 0; if (sign) { ++offset; if (atsign && collon) length += LispWriteChar(stream, value >= 0.0 ? '+' : '-'); } /* print padding if required */ if (w > offset) length += LispWriteChars(stream, padchar, w - offset); if (atsign && !collon) length += LispWriteChar(stream, value >= 0.0 ? '+' : '-'); /* print float number representation */ return (LispWriteStr(stream, buffer, offset) + length); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/README0000664000000000000000000001715212472175711015152 0ustar $XFree86: xc/programs/xedit/lisp/README,v 1.12 2002/11/23 08:26:47 paulo Exp $ LAST UPDATED: $Date$ SUMMARY This is a small lisp interpreter for xedit. It implements a subset of Common Lisp and the xedit package implements several of the basic Emacs lisp functions. (shared modules not broken, but needs a redesign for better performance, but won't be made available in the default build probably for a long time, it would be really better to generate the interface dinamically, and/or just link agains't the required libraries and use a ffi interface) +------------------------------------------------------------------------ | It has a very simple method for loading shared modules, slightly based on | the XFree86 loader code, that is currently disabled by default. To enable it, | edit lisp.cf and change BuildSharedLispModules to YES. | | Assuming you have built it with BuildSharedLispModules enabled, you can build | a small test application can be built in this directory running "make lsp". | Two lisp programs are available in the test directory. To test the programs | run "./lsp test/hello.lsp" or "./lsp test/widgets.lsp". +------------------------------------------------------------------------ Currently, it should be used as an helper and/or a small calculator embedded in xedit. For the future it should be possible to write entire interfaces in the xedit text buffers. USAGE SUMMARY To evaluate lisp expressions, put the text cursor just after the lisp expression and press: C-x,C-e - will evaluate it, and print the result to the message window C-j - will evaluate it, and print the result to the edit window, any errors are printed to the message window. C-g - will send an SIGINT to the lisp process, and that process will stop whatever it was processing and jump to the toplevel, to wait for more input. Note that C-j will only work in the *scratch* buffer. NOTES The improvements to xedit including the several possibilites to extend the editor using Lisp are expected to allow making of xedit a versatile text editor for programming, but there is code being (slowly) developed that should also make it useable as a small word processor, for things like WYSIWYG html, etc. The xedit development is being done very slowly, maybe it will get somewhere someday, but it is a pet/hobby project, there is no intention of making of it an end user editor (the idea is to make it an useful development tool). In some aspects the development is trying to mimic several Emacs features, but there is no intention of competition (if xedit ever get something better than Emacs, I hope that it serves as a motivation to make of Emacs an even better editor), actually it is expected to explore different areas and use alternate solutions for the implementation. Most work in a computer is done in a text editor and the more the editor can help the user the better. (debugger is broken and very slow, no prevision for fixing it, but is expected to work correctly for interpreted only code) +------------------------------------------------------------------------ | DEBUGGER | | There is a, currently, very simple debugger implement in the interpreter. | The debugger is now optional, and off by default. To make it available, | you need to recompile with -DDEBUGGER. | To use the debugger, run the lsp sample program as "./lsp -d", and optionally | pass a second parameter, for the file to be interpreted. Once the debugger | prompt is visible, type "help" for a summary of options. To leave the debugger | type "continue". | Note that the debugger is still very simple, it won't work from xedit, and | won't drop to the debugger on "fatal errors". It allows adding breakpoints to | functions and watchpoints to variables. Support for changing data and going to | the debugger on fatal errors should be added at some time. +------------------------------------------------------------------------ COMPILER Now there is a very simple bytecode compiler. It is far from finished, but for simple code can show significant better performance. There is not yet an interface to compile entire files and no interface to store the generated bytecode in disk. There is an interface to bytecode compile toplevel forms as a LAMBDA NIL, but it is not yet exported. If your code needs to call GO/RETURN/RETURN-FROM as the result of an EVAL, it must jump to code in the interpreter, after compiling all calls to GO/RETURN/RETURN-FROM are just stack adjusting and jumps in the bytecode. CATCH/THROW and UNWIND-PROTECT are running as interpreted code for now, so it is safe to use these, but code in such blocks is not compiled/optimized (not even macro expansion is done, as it understands that while not compiled, everything is candidate to redefinition at any time). To compile the code, just write a function, and compile it, example: (defun fact (n) (if (< n 2) 1 (* n (fact (1- n))) ) ) FACT (compile 'fact) FACT NIL NIL (disassemble 'fact) Function FACT: 1 required argument: N 0 optional arguments 0 keyword parameters No rest argument Bytecode header: 1 element used in the stack 2 elements used in the builtin stack 0 elements used in the protected stack Constant 0 = 1 Constant 1 = (2) Symbol 0 = N Builtin 0 = * Builtin 1 = 1- Builtin 2 = < Initial stack: 0 = N Bytecode stream: 0 LOAD&PUSH (0) 2 LOADCON&PUSH [1] ; (2) 4 CALL 2 [2] ; < 7 JUMPNIL 8 10 LOADCON [0] ; 1 12 NOOP 13 JUMP 19 16 LOAD&PUSH (0) 18 LOAD&PUSH (0) 20 CALL 1 [1] ; 1- 23 LET* [0] ; N 25 LETREC 1 27 UNLET 1 29 BCONS1 30 CALL 1 [0] ; * 33 RETURN FACT There are several optimizations that should be done at some time, I don't think adding NOOP opcodes will help everywhere to make aligned memory reads of shorts and ints. It should have explicitly visible registers, not the abstraction of "the current value", so the code generator can choose register allocation for loop control variables, commonly used variables, etc, for example. Jumps should have 3 types: byte relative, 2 bytes relative and 4 bytes relative. For now there is only 2 byte relative jumps, byte relative jumps can show a significant performance increase, but they are disable until it is decided how inlined functions will work, if it just updates the bytecode header and cut&past the bytecode, jumps must be updated, and some jumps may not fit anymore in a byte. OPTIMIZATION There are plenty of possibilities to make the interpreter run faster. Some optimizations that can make it run quite faster in certain cases are: o Better object memory layout and gc. The current memory allocation code is very bad, it try to keep 3 times more free objects than the currently used number, this can consume a lot of memory. The reason is to reduce the gc time cost so that it will in average miss only one in every 4 collect tries. o Implement real vectors, currently they are just a list, so it cannot just deference a given index, and gc time is very long also. o Most lists are never changed once created, it could somehow add an index field in the cons cell, so that NTH/NTHCDR/LENGTH like code could just deference the correct object, instead of traversing the CDR of every cons. This would probably require implementing lists as vectors, while making it easy to deference would make life harder when deleting/inserting sublists in a list. It should also better be done in a way that does not require a lot of objects allocated linearly. HELPING Send comments and code to me (paulo@XFree86.Org) or to the XFree86 mailing/patch lists. -- Paulo x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/internal.h0000664000000000000000000006033512472175711016260 0ustar /* $XdotOrg: xc/programs/xedit/lisp/internal.h,v 1.2 2004/04/23 19:54:44 eich Exp $ */ /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/internal.h,v 1.50tsi Exp $ */ #ifndef Lisp_internal_h #define Lisp_internal_h #include #include "lisp/lisp.h" #include "mp.h" #include "re.h" #include "util.h" /* * Defines */ typedef struct _LispMac LispMac; #define STREAM_READ 0x01 #define STREAM_WRITE 0x02 #define STREAM_BINARY 0x20 #define RPLACA(cons, object) (CAR(cons) = object) #define RPLACD(cons, object) (CDR(cons) = object) #define CAR(list) ((list)->data.cons.car) #define CAAR(list) ((list)->data.cons.car->data.cons.car) #define CADR(list) ((list)->data.cons.cdr->data.cons.car) #define CDR(list) ((list)->data.cons.cdr) #define CDAR(list) ((list)->data.cons.car->data.cons.cdr) #define CDDR(list) ((list)->data.cons.cdr->data.cons.cdr) #define CONS(car, cdr) LispNewCons(car, cdr) #define EVAL(list) LispEval(list) #define APPLY(fun, args) LispFuncall(fun, args, 0) #define APPLY1(fun, arg) LispApply1(fun, arg) #define APPLY2(fun, arg1, arg2) LispApply2(fun, arg1, arg2) #define APPLY3(f, a1, a2, a3) LispApply3(f, a1, a2, a3) #define EXECUTE(string) LispExecute(string) #define SYMBOL(atom) LispNewSymbol(atom) #define ATOM(string) LispNewAtom(string, 1) #define UNINTERNED_ATOM(string) LispNewAtom(string, 0) #define FUNCTION(symbol) LispNewFunction(symbol) #define FUNCTION_QUOTE(symbol) LispNewFunctionQuote(symbol) /* atom string is a static variable */ #define ATOM2(string) LispNewSymbol(LispGetPermAtom(string)) /* make a gc never released variable with a static string argument */ #define STATIC_ATOM(string) LispNewStaticAtom(string) #define STRING(str) LispNewString(str, strlen(str)) #define LSTRING(str, size) LispNewString(str, size) /* string must be from the LispXXX allocation functions, * and LispMused not yet called on it */ #define STRING2(str) LispNewStringAlloced(str, strlen(str)) #define LSTRING2(str, size) LispNewStringAlloced(str, size) #define VECTOR(objects) LispNewVector(objects) /* STRINGSTREAM2 and LSTRINGSTREAM2 require that the * string be allocated from the LispXXX allocation functions, * and LispMused not yet called on it */ #define STRINGSTREAM(str, flag) \ LispNewStringStream(str, flag, strlen(str)) #define STRINGSTREAM2(str, flag) \ LispNewStringStreamAlloced(str, flag, strlen(str)) #define LSTRINGSTREAM(str, flag, length) \ LispNewStringStream(str, flag, length) #define LSTRINGSTREAM2(str, flag, length) \ LispNewStringStreamAlloced(str, flag, length) #define FILESTREAM(file, path, flag) \ LispNewFileStream(file, path, flag) #define PIPESTREAM(file, path, flag) \ LispNewPipeStream(file, path, flag) #define CHECKO(obj, typ) \ ((obj)->type == LispOpaque_t && \ ((obj)->data.opaque.type == typ || (obj)->data.opaque.type == 0)) #define PROTECT(key, list) LispProtect(key, list) #define UPROTECT(key, list) LispUProtect(key, list) /* create a new unique static atom string */ #define GETATOMID(string) LispGetAtomKey(string, 1) #define GCDisable() ++gcpro #define GCEnable() --gcpro /* pointer to something unique to all atoms with the same print representation */ #define ATOMID(object) (object)->data.atom->key #define NIL_BIT 0x01 #define FIXNUM_BIT 0x02 #define FIXNUM_MASK 0x03 #define SCHAR_BIT 0x04 #define SCHAR_MASK 0x05 #define BIT_COUNT 4 #define BIT_MASK 0x0f #define POINTERP(object) \ (((unsigned long)(object) & NIL_BIT) == 0) #define MOST_POSITIVE_FIXNUM ((1L << (sizeof(long) * 8 - 5)) - 1) #define MOST_NEGATIVE_FIXNUM (-1L << (sizeof(long) * 8 - 5)) #define SCHAR(value) \ ((LispObj*)(((long)(value) << BIT_COUNT) | SCHAR_MASK)) #define SCHAR_VALUE(object) FIXNUM_VALUE(object) #define SCHARP(object) \ (((unsigned long)(object) & BIT_MASK) == SCHAR_MASK) #define CHECK_SCHAR(object) \ if (!SCHARP(object)) \ LispDestroy("%s: %s is not a character", \ STRFUN(builtin), STROBJ(object)) #define XOBJECT_TYPE(object) ((object)->type) #define OBJECT_TYPE(object) (POINTERP(object) ? \ XOBJECT_TYPE(object) : \ (LispType)((long)(object) & BIT_MASK)) #define NIL (LispObj*)0x00000001 #define T (LispObj*)0x00000011 #define DOT (LispObj*)0x00000021 /* unmatched ')' */ #define EOLIST (LispObj*)0x00000031 #define READLABEL_MASK 0x00000041 /* unspecified argument */ #define UNSPEC (LispObj*)0x00000051 #define INVALIDP(object) \ ((object) == NULL || (object) == EOLIST || (object) == DOT) /* cons */ #define XCONSP(object) ((object)->type == LispCons_t) #define CONSP(object) (POINTERP(object) && XCONSP(object)) #define CHECK_CONS(object) \ if (!CONSP(object)) \ LispDestroy("%s: %s is not of type cons", \ STRFUN(builtin), STROBJ(object)) #define LISTP(object) (object == NIL || CONSP(object)) #define CHECK_LIST(object) \ if (!LISTP(object)) \ LispDestroy("%s: %s is not a list", \ STRFUN(builtin), STROBJ(object)) /* fixnum */ #define FIXNUM(value) \ ((LispObj*)(((long)(value) << BIT_COUNT) | FIXNUM_MASK)) #define FIXNUM_VALUE(object) ((long)(object) >> BIT_COUNT) #define FIXNUMP(object) \ (((unsigned long)(object) & BIT_MASK) == FIXNUM_MASK) #define CHECK_FIXNUM(object) \ if (!FIXNUMP(object)) \ LispDestroy("%s: %s is not a fixnum", \ STRFUN(builtin), STROBJ(object)) #define INDEXP(object) \ (FIXNUMP(object) && FIXNUM_VALUE(object) >= 0) #define CHECK_INDEX(object) \ if (!INDEXP(object)) \ LispDestroy("%s: %s is not a positive fixnum", \ STRFUN(builtin), STROBJ(object)) /* long int integer */ #define XINTP(object) ((object)->type == LispInteger_t) #define INTP(objet) (POINTERP(object) && XINTP(object)) #define INT_VALUE(object) (object)->data.integer /* values that fit in a machine long int but not in a fixnum */ #define LONGINTP(object) \ (POINTERP(object) ? XINTP(object) : FIXNUMP(object)) #define LONGINT_VALUE(object) \ (POINTERP(object) ? INT_VALUE(object) : FIXNUM_VALUE(object)) #define CHECK_LONGINT(object) \ if (!LONGINTP(object)) \ LispDestroy("%s: %s is not an integer", \ STRFUN(builtin), STROBJ(object)) /* bignum */ #define XBIGNUMP(object) ((object)->type == LispBignum_t) #define BIGNUMP(object) (POINTERP(object) && XBIGNUMP(object)) #define BIGNUM(object) LispNewBignum(object) /* generic integer */ #define INTEGER(integer) LispNewInteger(integer) #define INTEGERP(object) \ (POINTERP(object) ? XINTP(object) || XBIGNUMP(object) : FIXNUMP(object)) #define CHECK_INTEGER(object) \ if (!INTEGERP(object)) \ LispDestroy("%s: %s is not an integer", \ STRFUN(builtin), STROBJ(object)) /* ratio */ #define XRATIOP(object) ((object)->type == LispRatio_t) #define RATIOP(object) (POINTERP(object) && XRATIOP(object)) #define RATIO(num, den) LispNewRatio(num, den) /* bigratio */ #define XBIGRATIOP(object) ((object)->type == LispBigratio_t) #define BIGRATIOP(object) (POINTERP(object) && XBIGRATIOP(object)) #define BIGRATIO(ratio) LispNewBigratio(ratio) /* generic rational */ #define RATIONALP(object) \ (POINTERP(object) ? XINTP(object) || XRATIOP(object) || \ XBIGNUMP(object) || XBIGRATIOP(object) : \ FIXNUMP(object)) /* double float */ #define XDFLOATP(object) ((object)->type == LispDFloat_t) #define DFLOATP(object) (POINTERP(object) && XDFLOATP(object)) #define DFLOAT_VALUE(object) (object)->data.dfloat #define CHECK_DFLOAT(object) \ if (!DFLOATP(object)) \ LispDestroy("%s: %s is not a float number", \ STRFUN(builtin), STROBJ(object)) #define DFLOAT(value) LispNewDFloat(value) /* generic float - currently only double float supported */ #define FLOATP(object) DFLOATP(object) /* real number */ #define REALP(object) \ (POINTERP(object) ? XINTP(object) || XDFLOATP(object) || \ XRATIOP(object) || XBIGNUMP(object) || \ XBIGRATIOP(object) : \ FIXNUMP(object)) #define CHECK_REAL(object) \ if (!REALP(object)) \ LispDestroy("%s: %s is not a real number", \ STRFUN(builtin), STROBJ(object)) /* complex */ #define XCOMPLEXP(object) ((object)->type == LispComplex_t) #define COMPLEXP(object) (POINTERP(object) && XCOMPLEXP(object)) #define COMPLEX(real, imag) LispNewComplex(real, imag) /* generic number */ #define NUMBERP(object) \ (POINTERP(object) ? XINTP(object) || XDFLOATP(object) || \ XRATIOP(object) || XBIGNUMP(object) || \ XBIGRATIOP(object) || XCOMPLEXP(object) : \ FIXNUMP(object)) #define CHECK_NUMBER(object) \ if (!NUMBERP(object)) \ LispDestroy("%s: %s is not a number", \ STRFUN(builtin), STROBJ(object)) /* symbol */ #define XSYMBOLP(object) ((object)->type == LispAtom_t) #define SYMBOLP(object) (POINTERP(object) && XSYMBOLP(object)) #define CHECK_SYMBOL(object) \ if (!SYMBOLP(object)) \ LispDestroy("%s: %s is not a symbol", \ STRFUN(builtin), STROBJ(object)) /* keyword */ #define XKEYWORDP(object) \ ((object)->data.atom->package == lisp__data.keyword) #define KEYWORDP(object) \ (POINTERP(object) && XSYMBOLP(object) && XKEYWORDP(object)) #define KEYWORD(string) LispNewKeyword(string) #define CHECK_KEYWORD(object) \ if (!KEYWORDP(object)) \ LispDestroy("%s: %s is not a keyword", \ STRFUN(builtin), STROBJ(object)) #define CHECK_CONSTANT(object) \ if ((object)->data.atom->constant) \ LispDestroy("%s: %s is a constant", \ STRFUN(builtin), STROBJ(object)) #define SETVALUE(atom, object) ((atom)->property->value = object) /* function */ #define XFUNCTIONP(object) ((object)->type == LispFunction_t) #define FUNCTIONP(object) (POINTERP(object) && XFUNCTIONP(object)) /* lambda */ #define XLAMBDAP(object) ((object)->type == LispLambda_t) #define LAMBDAP(object) (POINTERP(object) && XLAMBDAP(object)) /* string - currently only simple 8 bit characters */ #define XSTRINGP(object) ((object)->type == LispString_t) #define STRINGP(object) (POINTERP(object) && XSTRINGP(object)) #define THESTR(object) (object)->data.string.string #define STRLEN(object) (object)->data.string.length #define CHECK_STRING(object) \ if (!STRINGP(object)) \ LispDestroy("%s: %s is not a string", \ STRFUN(builtin), STROBJ(object)) #define CHECK_STRING_WRITABLE(object) \ if (!object->data.string.writable) \ LispDestroy("%s: %s is readonly", \ STRFUN(builtin), STROBJ(object)) /* array/vector */ #define XARRAYP(object) ((object)->type == LispArray_t) #define ARRAYP(object) (POINTERP(object) && XARRAYP(object)) #define CHECK_ARRAY(object) \ if (!ARRAYP(object)) \ LispDestroy("%s: %s is not an array", \ STRFUN(builtin), STROBJ(object)) /* quote */ #define XQUOTEP(object) ((object)->type == LispQuote_t) #define QUOTEP(object) (POINTERP(object) && XQUOTEP(object)) #define QUOTE(object) LispNewQuote(object) #define XBACKQUOTEP(object) ((object)->type == LispBackquote_t) #define BACKQUOTEP(object) (POINTERP(object) && XBACKQUOTEP(object)) #define BACKQUOTE(object) LispNewBackquote(object) #define XCOMMAP(object) ((object)->type == LispComma_t) #define COMMAP(object) (POINTERP(object) && XCOMMAP(object)) #define COMMA(object, at) LispNewComma(object, at) /* package */ #define XPACKAGEP(object) ((object)->type == LispPackage_t) #define PACKAGEP(object) (POINTERP(object) && XPACKAGEP(object)) /* pathname */ #define XPATHNAMEP(object) ((object)->type == LispPathname_t) #define PATHNAMEP(object) (POINTERP(object) && XPATHNAMEP(object)) #define PATHNAME(object) LispNewPathname(object) #define CHECK_PATHNAME(object) \ if (!PATHNAMEP(object)) \ LispDestroy("%s: %s is not a pathname", \ STRFUN(builtin), STROBJ(object)) /* stream */ #define XSTREAMP(object) ((object)->type == LispStream_t) #define STREAMP(object) (POINTERP(object) && XSTREAMP(object)) #define CHECK_STREAM(object) \ if (!STREAMP(object)) \ LispDestroy("%s: %s is not a stream", \ STRFUN(builtin), STROBJ(object)) /* hastable */ #define XHASHTABLEP(object) ((object)->type == LispHashTable_t) #define HASHTABLEP(object) (POINTERP(object) && XHASHTABLEP(object)) #define CHECK_HASHTABLE(object) \ if (!HASHTABLEP(object)) \ LispDestroy("%s: %s is not a hash-table", \ STRFUN(builtin), STROBJ(object)) /* regex */ #define XREGEXP(object) ((object)->type == LispRegex_t) #define REGEXP(object) (POINTERP(object) && XREGEXP(object)) #define CHECK_REGEX(object) \ if (!REGEXP(object)) \ LispDestroy("%s: %s is not a regexp", \ STRFUN(builtin), STROBJ(object)) /* bytecode */ #define XBYTECODEP(object) ((object)->type == LispBytecode_t) #define BYTECODEP(object) (POINTERP(object) && XBYTECODEP(object)) /* opaque */ #define XOPAQUEP(object) ((object)->type == LispOpaque_t) #define OPAQUEP(object) (POINTERP(object) && XOPAQUEP(object)) #define OPAQUE(data, type) LispNewOpaque((void*)((long)data), type) #define SSTREAMP(str) ((str)->data.stream.source.string) #define FSTREAMP(str) ((str)->data.stream.source.file) #define PSTREAMP(str) ((str)->data.stream.source.program) #define PIDPSTREAMP(str) ((str)->data.stream.source.program->pid) #define IPSTREAMP(str) ((str)->data.stream.source.program->input) #define OPSTREAMP(str) ((str)->data.stream.source.program->output) #define EPSTREAMP(str) \ FSTREAMP((str)->data.stream.source.program->errorp) #define LispFileno(file) ((file)->descriptor) #define STRFUN(builtin) ATOMID(builtin->symbol)->value #define STROBJ(obj) LispStrObj(obj) /* fetch builtin function/macro argument value */ #define ARGUMENT(index) \ lisp__data.stack.values[lisp__data.stack.base + (index)] #define RETURN(index) lisp__data.returns.values[(index)] #define RETURN_COUNT lisp__data.returns.count #define RETURN_CHECK(value) \ value < MULTIPLE_VALUES_LIMIT ? \ value : MULTIPLE_VALUES_LIMIT #define GC_ENTER() int gc__protect = lisp__data.protect.length #define GC_PROTECT(object) \ if (lisp__data.protect.length >= lisp__data.protect.space) \ LispMoreProtects(); \ lisp__data.protect.objects[lisp__data.protect.length++] = object #define GC_LEAVE() lisp__data.protect.length = gc__protect #define ERROR_CHECK_SPECIAL_FORM(atom) \ if ((atom)->property->fun.builtin->compile) \ LispDestroy("%s: the special form %s cannot be redefined", \ STRFUN(builtin), (atom)->key->value) #define CONSTANTP(object) \ (!POINTERP(object) || \ XOBJECT_TYPE(object) < LispAtom_t || \ (XSYMBOLP(object) && XKEYWORDP(object))) /* slightly faster test, since keywords are very uncommon as eval arguments */ #define NCONSTANTP(object) \ (OBJECT_TYPE(object) >= LispAtom_t) /* * Types */ typedef struct _LispObj LispObj; typedef struct _LispAtom LispAtom; typedef struct _LispBuiltin LispBuiltin; typedef struct _LispModuleData LispModuleData; typedef struct _LispFile LispFile; typedef struct _LispString LispString; typedef struct _LispPackage LispPackage; typedef struct _LispBytecode LispBytecode; typedef struct _LispHashTable LispHashTable; /* Bytecode compiler data */ typedef struct _LispCom LispCom; typedef hash_key *Atom_id; typedef enum _LispType { /* objects encoded in the LispObj pointer */ LispNil_t = 1, LispFixnum_t = 3, LispSChar_t = 5, /* objects that have a structure */ LispInteger_t = 16, LispDFloat_t, LispString_t, LispRatio_t, LispOpaque_t, /* simple access for marking */ LispBignum_t, LispBigratio_t, LispAtom_t, LispFunction_t, LispFunctionQuote_t, LispLambda_t, LispComplex_t, LispCons_t, LispQuote_t, LispArray_t, LispStruct_t, LispStream_t, LispBackquote_t, LispComma_t, LispPathname_t, LispPackage_t, LispRegex_t, LispBytecode_t, LispHashTable_t } LispType; typedef enum _LispFunType { LispLambda, LispFunction, LispMacro, LispSetf } LispFunType; typedef enum _LispStreamType { LispStreamString, LispStreamFile, LispStreamStandard, LispStreamPipe } LispStreamType; typedef struct { int pid; /* process id of program */ LispFile *input; /* if READABLE: stdout of program */ LispFile *output; /* if WRITABLE: stdin of program */ LispObj *errorp; /* ALWAYS (ONLY) READABLE: stderr of program */ } LispPipe; /* silly IBM compiler */ #ifdef AIXV5 /* probably want !gcc too */ #define LispType int #define LispFunType int #define LispStreamType int #endif struct _LispObj { LispType type : 6; unsigned int mark : 1; /* gc protected */ unsigned int prot: 1; /* protection for constant/unamed variables */ LispFunType funtype : 4; /* this is subject to change in the future */ union { LispAtom *atom; struct { char *string; long length; unsigned int writable : 1; } string; long integer; double dfloat; LispObj *quote; LispObj *pathname; /* don't use quote generic name, * to avoid confusing code */ struct { long numerator; long denominator; } ratio; union { mpi *integer; mpr *ratio; } mp; struct { LispObj *real; LispObj *imag; } complex; struct { LispObj *car; LispObj *cdr; } cons; struct { LispObj *name; LispObj *code; LispObj *data; /* extra data to protect */ } lambda; struct { LispObj *list; /* stored as a linear list */ LispObj *dim; /* dimensions of array */ unsigned int rank : 8; /* i.e. array-rank-limit => 256 */ unsigned int type : 7; /* converted to LispType, if not * Lisp_Nil_t only accepts given * type in array fields */ unsigned int zero : 1; /* at least one of the dimensions * is zero */ } array; struct { LispObj *fields; /* structure fields */ LispObj *def; /* structure definition */ } struc; struct { union { LispFile *file; LispPipe *program; LispString *string; } source; LispObj *pathname; LispStreamType type : 6; unsigned int readable : 1; unsigned int writable : 1; } stream; struct { void *data; int type; } opaque; struct { LispObj *eval; int atlist; } comma; struct { LispObj *name; LispObj *nicknames; LispPackage *package; } package; struct { re_cod *regex; LispObj *pattern; /* regex string */ int options; /* regex compile flags */ } regex; struct { LispBytecode *bytecode; LispObj *code; /* object used to generate bytecode */ LispObj *name; /* name of function, or NIL */ } bytecode; struct { LispHashTable *table; LispObj *test; } hash; } data; }; #ifdef AIXV5 #undef LispType #undef LispFunType #undef LispStreamType #endif typedef LispObj *(*LispFunPtr)(LispBuiltin*); typedef void (*LispComPtr)(LispCom*, LispBuiltin*); struct _LispBuiltin { /* these fields must be set */ LispFunType type; LispFunPtr function; const char *declaration; /* this field is optional, set if the function returns multiple values */ int multiple_values; /* this field is also optional, set if the function should not be exported */ int internal; /* this optional field points to a function of the bytecode compiler */ LispComPtr compile; /* this field is set at runtime */ LispObj *symbol; }; typedef int (*LispLoadModule)(void); typedef int (*LispUnloadModule)(void); #define LISP_MODULE_VERSION 1 struct _LispModuleData { int version; LispLoadModule load; LispUnloadModule unload; }; /* * Prototypes */ LispObj *LispEval(LispObj*); LispObj *LispFuncall(LispObj*, LispObj*, int); LispObj *LispApply1(LispObj*, LispObj*); LispObj *LispApply2(LispObj*, LispObj*, LispObj*); LispObj *LispApply3(LispObj*, LispObj*, LispObj*, LispObj*); LispObj *LispNew(LispObj*, LispObj*); LispObj *LispNewSymbol(LispAtom*); LispObj *LispNewAtom(const char*, int); LispObj *LispNewFunction(LispObj*); LispObj *LispNewFunctionQuote(LispObj*); LispObj *LispNewStaticAtom(const char*); LispObj *LispNewDFloat(double); LispObj *LispNewString(const char*, long); LispObj *LispNewStringAlloced(char*, long); LispObj *LispNewInteger(long); LispObj *LispNewRatio(long, long); LispObj *LispNewVector(LispObj*); LispObj *LispNewQuote(LispObj*); LispObj *LispNewBackquote(LispObj*); LispObj *LispNewComma(LispObj*, int); LispObj *LispNewCons(LispObj*, LispObj*); LispObj *LispNewLambda(LispObj*, LispObj*, LispObj*, LispFunType); LispObj *LispNewStruct(LispObj*, LispObj*); LispObj *LispNewComplex(LispObj*, LispObj*); LispObj *LispNewOpaque(void*, int); LispObj *LispNewKeyword(const char*); LispObj *LispNewPathname(LispObj*); LispObj *LispNewStringStream(const char*, int, long); LispObj *LispNewStringStreamAlloced(char*, int, long); LispObj *LispNewFileStream(LispFile*, LispObj*, int); LispObj *LispNewPipeStream(LispPipe*, LispObj*, int); LispObj *LispNewBignum(mpi*); LispObj *LispNewBigratio(mpr*); LispAtom *LispGetAtom(const char*); /* This function does not allocate a copy of it's argument, but the argument * itself. The argument string should never change. */ LispAtom *LispGetPermAtom(const char*); void *LispMalloc(size_t); void *LispCalloc(size_t, size_t); void *LispRealloc(void*, size_t); char *LispStrdup(const char*); void LispFree(void*); /* LispMused means memory is now safe from LispDestroy, and should not be * freed in case of an error */ void LispMused(void*); void LispGC(LispObj*, LispObj*); char *LispStrObj(LispObj*); #ifdef __GNUC__ #define PRINTF_FORMAT __attribute__ ((format (printf, 1, 2))) #else #define PRINTF_FORMAT /**/ #endif void LispDestroy(const char *fmt, ...) PRINTF_FORMAT; /* continuable error */ void LispContinuable(const char *fmt, ...) PRINTF_FORMAT; void LispMessage(const char *fmt, ...) PRINTF_FORMAT; void LispWarning(const char *fmt, ...) PRINTF_FORMAT; #undef PRINTF_FORMAT LispObj *LispSetVariable(LispObj*, LispObj*, const char*, int); int LispRegisterOpaqueType(const char*); void LispProtect(LispObj*, LispObj*); void LispUProtect(LispObj*, LispObj*); /* this function should be called when a module is loaded, and is called * when loading the interpreter */ void LispAddBuiltinFunction(LispBuiltin*); /* * Initialization */ extern LispObj *UNBOUND; extern int gcpro; extern LispObj *Okey, *Orest, *Ooptional, *Oaux, *Olambda; extern Atom_id Snil, St, Skey, Srest, Soptional, Saux; extern Atom_id Sand, Sor, Snot; extern Atom_id Satom, Ssymbol, Sinteger, Scharacter, Sstring, Slist, Scons, Svector, Sarray, Sstruct, Skeyword, Sfunction, Spathname, Srational, Sfloat, Scomplex, Sopaque, Sdefault; extern LispObj *Ocomplex, *Oformat, *Kunspecific; extern LispObj *Omake_array, *Kinitial_contents, *Osetf; extern Atom_id Svariable, Sstructure, Stype, Ssetf; extern Atom_id Smake_struct, Sstruct_access, Sstruct_store, Sstruct_type; extern LispObj *Omake_struct, *Ostruct_access, *Ostruct_store, *Ostruct_type; extern LispObj *Oparse_namestring, *Kerror, *Kabsolute, *Krelative, *Oopen, *Oclose, *Kif_does_not_exist; extern LispObj *Oequal_; extern LispFile *Stdout, *Stdin, *Stderr; #endif /* Lisp_internal_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/read.c0000664000000000000000000013644712472175711015362 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/read.c,v 1.36tsi Exp $ */ #include #include "lisp/read.h" #include "lisp/package.h" #include "lisp/write.h" #include #include /* This should be visible only in read.c, but if an error is generated, * the current code in write.c will print it as # */ #define LABEL_BIT_COUNT 8 #define LABEL_BIT_MASK 0xff #define MAX_LABEL_VALUE ((1L << (sizeof(long) * 8 - 9)) - 1) #define READLABEL(label) \ (LispObj*)(((label) << LABEL_BIT_COUNT) | READLABEL_MASK) #define READLABELP(object) \ (((unsigned long)(object) & LABEL_BIT_MASK) == READLABEL_MASK) #define READLABEL_VALUE(object) \ ((long)(object) >> LABEL_BIT_COUNT) #define READ_ENTER() \ LispObj *read__stream = SINPUT; \ int read__line = LispGetLine(read__stream) #define READ_ERROR0(format) \ LispReadError(read__stream, read__line, format) #define READ_ERROR1(format, arg1) \ LispReadError(read__stream, read__line, format, arg1) #define READ_ERROR2(format, arg1, arg2) \ LispReadError(read__stream, read__line, format, arg1, arg2) #define READ_ERROR_EOF() READ_ERROR0("unexpected end of input") #define READ_ERROR_FIXNUM() READ_ERROR0("number is not a fixnum") #define READ_ERROR_INVARG() READ_ERROR0("invalid argument") #ifdef __UNIXOS2__ # define finite(x) isfinite(x) #endif /* * Types */ typedef struct _object_info { long label; /* the read label of this object */ LispObj *object; /* the resulting object */ long num_circles; /* references to object before it was completely read */ } object_info; typedef struct _read_info { int level; /* level of open parentheses */ int nodot; /* flag set when reading a "special" list */ int discard; /* flag used when reading an unavailable feature */ long circle_count; /* if non zero, must resolve some labels */ /* information for #= and ## */ object_info *objects; long num_objects; /* could use only the objects field as all circular data is known, * but check every object so that circular/shared references generated * by evaluations would not cause an infinite loop at read time */ LispObj **circles; long num_circles; } read_info; /* * Protypes */ static LispObj *LispReadChar(LispBuiltin*, int); static int LispGetLine(LispObj*); #ifdef __GNUC__ #define PRINTF_FORMAT __attribute__ ((format (printf, 3, 4))) #else #define PRINTF_FORMAT /**/ #endif static void LispReadError(LispObj*, int, const char*, ...); #undef PRINTF_FORMAT static void LispReadFixCircle(LispObj*, read_info*); static LispObj *LispReadLabelCircle(LispObj*, read_info*); static int LispReadCheckCircle(LispObj*, read_info*); static LispObj *LispDoRead(read_info*); static int LispSkipWhiteSpace(void); static LispObj *LispReadList(read_info*); static LispObj *LispReadQuote(read_info*); static LispObj *LispReadBackquote(read_info*); static LispObj *LispReadCommaquote(read_info*); static LispObj *LispReadObject(int, read_info*); static LispObj *LispParseAtom(char*, char*, int, int, LispObj*, int); static LispObj *LispParseNumber(char*, int, LispObj*, int); static int StringInRadix(char*, int, int); static int AtomSeparator(int, int, int); static LispObj *LispReadVector(read_info*); static LispObj *LispReadMacro(read_info*); static LispObj *LispReadFunction(read_info*); static LispObj *LispReadRational(int, read_info*); static LispObj *LispReadCharacter(read_info*); static void LispSkipComment(void); static LispObj *LispReadEval(read_info*); static LispObj *LispReadComplex(read_info*); static LispObj *LispReadPathname(read_info*); static LispObj *LispReadStruct(read_info*); static LispObj *LispReadMacroArg(read_info*); static LispObj *LispReadArray(long, read_info*); static LispObj *LispReadFeature(int, read_info*); static LispObj *LispEvalFeature(LispObj*); /* * Initialization */ static const char * const Char_Nul[] = {"Null", "Nul", NULL}; static const char * const Char_Soh[] = {"Soh", NULL}; static const char * const Char_Stx[] = {"Stx", NULL}; static const char * const Char_Etx[] = {"Etx", NULL}; static const char * const Char_Eot[] = {"Eot", NULL}; static const char * const Char_Enq[] = {"Enq", NULL}; static const char * const Char_Ack[] = {"Ack", NULL}; static const char * const Char_Bel[] = {"Bell", "Bel", NULL}; static const char * const Char_Bs[] = {"Backspace", "Bs", NULL}; static const char * const Char_Tab[] = {"Tab", NULL}; static const char * const Char_Nl[] = {"Newline", "Nl", "Lf", "Linefeed", NULL}; static const char * const Char_Vt[] = {"Vt", NULL}; static const char * const Char_Np[] = {"Page", "Np", NULL}; static const char * const Char_Cr[] = {"Return", "Cr", NULL}; static const char * const Char_Ff[] = {"So", "Ff", NULL}; static const char * const Char_Si[] = {"Si", NULL}; static const char * const Char_Dle[] = {"Dle", NULL}; static const char * const Char_Dc1[] = {"Dc1", NULL}; static const char * const Char_Dc2[] = {"Dc2", NULL}; static const char * const Char_Dc3[] = {"Dc3", NULL}; static const char * const Char_Dc4[] = {"Dc4", NULL}; static const char * const Char_Nak[] = {"Nak", NULL}; static const char * const Char_Syn[] = {"Syn", NULL}; static const char * const Char_Etb[] = {"Etb", NULL}; static const char * const Char_Can[] = {"Can", NULL}; static const char * const Char_Em[] = {"Em", NULL}; static const char * const Char_Sub[] = {"Sub", NULL}; static const char * const Char_Esc[] = {"Escape", "Esc", NULL}; static const char * const Char_Fs[] = {"Fs", NULL}; static const char * const Char_Gs[] = {"Gs", NULL}; static const char * const Char_Rs[] = {"Rs", NULL}; static const char * const Char_Us[] = {"Us", NULL}; static const char * const Char_Sp[] = {"Space", "Sp", NULL}; static const char * const Char_Del[] = {"Rubout", "Del", "Delete", NULL}; const LispCharInfo LispChars[256] = { {Char_Nul}, {Char_Soh}, {Char_Stx}, {Char_Etx}, {Char_Eot}, {Char_Enq}, {Char_Ack}, {Char_Bel}, {Char_Bs}, {Char_Tab}, {Char_Nl}, {Char_Vt}, {Char_Np}, {Char_Cr}, {Char_Ff}, {Char_Si}, {Char_Dle}, {Char_Dc1}, {Char_Dc2}, {Char_Dc3}, {Char_Dc4}, {Char_Nak}, {Char_Syn}, {Char_Etb}, {Char_Can}, {Char_Em}, {Char_Sub}, {Char_Esc}, {Char_Fs}, {Char_Gs}, {Char_Rs}, {Char_Us}, {Char_Sp}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {Char_Del}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} }; Atom_id Sand, Sor, Snot; /* * Implementation */ LispObj * Lisp_Read(LispBuiltin *builtin) /* read &optional input-stream eof-error-p eof-value recursive-p */ { LispObj *result; LispObj *input_stream, *eof_error_p, *eof_value; eof_value = ARGUMENT(2); eof_error_p = ARGUMENT(1); input_stream = ARGUMENT(0); if (input_stream == UNSPEC) input_stream = NIL; else if (input_stream != NIL) { CHECK_STREAM(input_stream); else if (!input_stream->data.stream.readable) LispDestroy("%s: stream %s is not readable", STRFUN(builtin), STROBJ(input_stream)); LispPushInput(input_stream); } else if (CONSP(lisp__data.input_list)) { input_stream = STANDARD_INPUT; LispPushInput(input_stream); } if (eof_value == UNSPEC) eof_value = NIL; result = LispRead(); if (input_stream != NIL) LispPopInput(input_stream); if (result == NULL) { if (eof_error_p != NIL) LispDestroy("%s: EOF reading stream %s", STRFUN(builtin), STROBJ(input_stream)); else result = eof_value; } return (result); } static LispObj * LispReadChar(LispBuiltin *builtin, int nohang) { int character; LispObj *input_stream, *eof_error_p, *eof_value; eof_value = ARGUMENT(2); eof_error_p = ARGUMENT(1); input_stream = ARGUMENT(0); if (input_stream == UNSPEC) input_stream = NIL; else if (input_stream != NIL) { CHECK_STREAM(input_stream); } else input_stream = lisp__data.input; if (eof_value == UNSPEC) eof_value = NIL; character = EOF; if (input_stream->data.stream.readable) { LispFile *file = NULL; switch (input_stream->data.stream.type) { case LispStreamStandard: case LispStreamFile: file = FSTREAMP(input_stream); break; case LispStreamPipe: file = IPSTREAMP(input_stream); break; case LispStreamString: character = LispSgetc(SSTREAMP(input_stream)); break; default: break; } if (file != NULL) { if (file->available || file->offset < file->length) character = LispFgetc(file); else { if (nohang && !file->nonblock) { if (fcntl(file->descriptor, F_SETFL, O_NONBLOCK) < 0) LispDestroy("%s: fcntl(%d): %s", STRFUN(builtin), file->descriptor, strerror(errno)); file->nonblock = 1; } else if (!nohang && file->nonblock) { if (fcntl(file->descriptor, F_SETFL, 0) < 0) LispDestroy("%s: fcntl(%d): %s", STRFUN(builtin), file->descriptor, strerror(errno)); file->nonblock = 0; } if (nohang) { unsigned char ch; if (read(file->descriptor, &ch, 1) == 1) character = ch; else if (errno == EAGAIN) return (NIL); /* XXX no character available */ else character = EOF; } else character = LispFgetc(file); } } } else LispDestroy("%s: stream %s is unreadable", STRFUN(builtin), STROBJ(input_stream)); if (character == EOF) { if (eof_error_p != NIL) LispDestroy("%s: EOF reading stream %s", STRFUN(builtin), STROBJ(input_stream)); return (eof_value); } return (SCHAR(character)); } LispObj * Lisp_ReadChar(LispBuiltin *builtin) /* read-char &optional input-stream eof-error-p eof-value recursive-p */ { return (LispReadChar(builtin, 0)); } LispObj * Lisp_ReadCharNoHang(LispBuiltin *builtin) /* read-char-no-hang &optional input-stream eof-error-p eof-value recursive-p */ { return (LispReadChar(builtin, 1)); } LispObj * Lisp_ReadLine(LispBuiltin *builtin) /* read-line &optional input-stream eof-error-p eof-value recursive-p */ { char *string; int ch, length; LispObj *result, *status = NIL; LispObj *input_stream, *eof_error_p, *eof_value; eof_value = ARGUMENT(2); eof_error_p = ARGUMENT(1); input_stream = ARGUMENT(0); if (input_stream == UNSPEC) input_stream = NIL; else if (input_stream == NIL) input_stream = STANDARD_INPUT; else { CHECK_STREAM(input_stream); } if (eof_value == UNSPEC) eof_value = NIL; result = NIL; string = NULL; length = 0; if (!input_stream->data.stream.readable) LispDestroy("%s: stream %s is unreadable", STRFUN(builtin), STROBJ(input_stream)); if (input_stream->data.stream.type == LispStreamString) { char *start, *end, *ptr; if (SSTREAMP(input_stream)->input >= SSTREAMP(input_stream)->length) { if (eof_error_p != NIL) LispDestroy("%s: EOS found reading %s", STRFUN(builtin), STROBJ(input_stream)); status = T; result = eof_value; goto read_line_done; } start = SSTREAMP(input_stream)->string + SSTREAMP(input_stream)->input; end = SSTREAMP(input_stream)->string + SSTREAMP(input_stream)->length; /* Search for a newline */ for (ptr = start; *ptr != '\n' && ptr < end; ptr++) ; if (ptr == end) status = T; else if (!SSTREAMP(input_stream)->binary) ++SSTREAMP(input_stream)->line; length = ptr - start; string = LispMalloc(length + 1); memcpy(string, start, length); string[length] = '\0'; result = LSTRING2(string, length); /* macro LSTRING2 does not make a copy of it's arguments, and * calls LispMused on it. */ SSTREAMP(input_stream)->input += length + (status == NIL); } else /*if (input_stream->data.stream.type == LispStreamFile || input_stream->data.stream.type == LispStreamStandard || input_stream->data.stream.type == LispStreamPipe)*/ { LispFile *file; if (input_stream->data.stream.type == LispStreamPipe) file = IPSTREAMP(input_stream); else file = FSTREAMP(input_stream); if (file->nonblock) { if (fcntl(file->descriptor, F_SETFL, 0) < 0) LispDestroy("%s: fcntl: %s", STRFUN(builtin), strerror(errno)); file->nonblock = 0; } while (1) { ch = LispFgetc(file); if (ch == EOF) { if (length) break; if (eof_error_p != NIL) LispDestroy("%s: EOF found reading %s", STRFUN(builtin), STROBJ(input_stream)); if (string) LispFree(string); status = T; result = eof_value; goto read_line_done; } else if (ch == '\n') break; else if ((length % 64) == 0) string = LispRealloc(string, length + 64); string[length++] = ch; } if (string) { if ((length % 64) == 0) string = LispRealloc(string, length + 1); string[length] = '\0'; result = LSTRING2(string, length); } else result = STRING(""); } read_line_done: RETURN(0) = status; RETURN_COUNT = 1; return (result); } LispObj * LispRead(void) { READ_ENTER(); read_info info; LispObj *result, *code = COD; info.level = info.nodot = info.discard = 0; info.circle_count = 0; info.objects = NULL; info.num_objects = 0; result = LispDoRead(&info); /* fix circular/shared lists, note that this is done when returning to * the toplevel, so, if some circular/shared reference was evaluated, * it should have generated an expected error */ if (info.num_objects) { if (info.circle_count) { info.circles = NULL; info.num_circles = 0; LispReadFixCircle(result, &info); if (info.num_circles) LispFree(info.circles); } LispFree(info.objects); } if (result == EOLIST) READ_ERROR0("object cannot start with #\\)"); else if (result == DOT) READ_ERROR0("dot allowed only on lists"); if (result != NULL && POINTERP(result)) { if (code == NIL) COD = result; else COD = CONS(COD, result); } return (result); } static int LispGetLine(LispObj *stream) { int line = -1; if (STREAMP(stream)) { switch (stream->data.stream.type) { case LispStreamStandard: case LispStreamFile: if (!FSTREAMP(stream)->binary) line = FSTREAMP(stream)->line; break; case LispStreamPipe: if (!IPSTREAMP(stream)->binary) line = IPSTREAMP(stream)->line; break; case LispStreamString: if (!SSTREAMP(stream)->binary) line = SSTREAMP(stream)->line; break; default: break; } } else if (stream == NIL && !Stdin->binary) line = Stdin->line; return (line); } static void LispReadError(LispObj *stream, int line, const char *fmt, ...) { char string[128]; const char *buffer_string; LispObj *buffer = LSTRINGSTREAM("", STREAM_READ | STREAM_WRITE, 0); int length; va_list ap; va_start(ap, fmt); vsnprintf(string, sizeof(string), fmt, ap); va_end(ap); LispFwrite(Stderr, "*** Reading ", 12); LispWriteObject(buffer, stream); buffer_string = LispGetSstring(SSTREAMP(buffer), &length); LispFwrite(Stderr, buffer_string, length); LispFwrite(Stderr, " at line ", 9); if (line < 0) LispFwrite(Stderr, "?\n", 2); else { char str[32]; sprintf(str, "%d\n", line); LispFputs(Stderr, str); } LispDestroy("READ: %s", string); } static void LispReadFixCircle(LispObj *object, read_info *info) { LispObj *cons; fix_again: switch (OBJECT_TYPE(object)) { case LispCons_t: for (cons = object; CONSP(object); cons = object, object = CDR(object)) { if (READLABELP(CAR(object))) CAR(object) = LispReadLabelCircle(CAR(object), info); else if (LispReadCheckCircle(object, info)) return; else LispReadFixCircle(CAR(object), info); } if (READLABELP(object)) CDR(cons) = LispReadLabelCircle(object, info); else goto fix_again; break; case LispArray_t: if (READLABELP(object->data.array.list)) object->data.array.list = LispReadLabelCircle(object->data.array.list, info); else if (!LispReadCheckCircle(object, info)) { object = object->data.array.list; goto fix_again; } break; case LispStruct_t: if (READLABELP(object->data.struc.fields)) object->data.struc.fields = LispReadLabelCircle(object->data.struc.fields, info); else if (!LispReadCheckCircle(object, info)) { object = object->data.struc.fields; goto fix_again; } break; case LispQuote_t: case LispBackquote_t: case LispFunctionQuote_t: if (READLABELP(object->data.quote)) object->data.quote = LispReadLabelCircle(object->data.quote, info); else { object = object->data.quote; goto fix_again; } break; case LispComma_t: if (READLABELP(object->data.comma.eval)) object->data.comma.eval = LispReadLabelCircle(object->data.comma.eval, info); else { object = object->data.comma.eval; goto fix_again; } break; case LispLambda_t: if (READLABELP(object->data.lambda.code)) object->data.lambda.code = LispReadLabelCircle(object->data.lambda.code, info); else if (!LispReadCheckCircle(object, info)) { object = object->data.lambda.code; goto fix_again; } break; default: break; } } static LispObj * LispReadLabelCircle(LispObj *label, read_info *info) { long i, value = READLABEL_VALUE(label); for (i = 0; i < info->num_objects; i++) if (info->objects[i].label == value) return (info->objects[i].object); LispDestroy("READ: internal error"); /*NOTREACHED*/ return (label); } static int LispReadCheckCircle(LispObj *object, read_info *info) { long i; for (i = 0; i < info->num_circles; i++) if (info->circles[i] == object) return (1); if ((info->num_circles % 16) == 0) info->circles = LispRealloc(info->circles, sizeof(LispObj*) * (info->num_circles + 16)); info->circles[info->num_circles++] = object; return (0); } static LispObj * LispDoRead(read_info *info) { LispObj *object; int ch = LispSkipWhiteSpace(); switch (ch) { case '(': object = LispReadList(info); break; case ')': for (ch = LispGet(); ch != EOF && ch != '\n'; ch = LispGet()) { if (!isspace(ch)) { LispUnget(ch); break; } } return (EOLIST); case EOF: return (NULL); case '\'': object = LispReadQuote(info); break; case '`': object = LispReadBackquote(info); break; case ',': object = LispReadCommaquote(info); break; case '#': object = LispReadMacro(info); break; default: LispUnget(ch); object = LispReadObject(0, info); break; } return (object); } static LispObj * LispReadMacro(read_info *info) { READ_ENTER(); LispObj *result = NULL; int ch = LispGet(); switch (ch) { case '(': result = LispReadVector(info); break; case '\'': result = LispReadFunction(info); break; case 'b': case 'B': result = LispReadRational(2, info); break; case 'o': case 'O': result = LispReadRational(8, info); break; case 'x': case 'X': result = LispReadRational(16, info); break; case '\\': result = LispReadCharacter(info); break; case '|': LispSkipComment(); result = LispDoRead(info); break; case '.': /* eval when compiling */ case ',': /* eval when loading */ result = LispReadEval(info); break; case 'c': case 'C': result = LispReadComplex(info); break; case 'p': case 'P': result = LispReadPathname(info); break; case 's': case 'S': result = LispReadStruct(info); break; case '+': result = LispReadFeature(1, info); break; case '-': result = LispReadFeature(0, info); break; case ':': /* Uninterned symbol */ result = LispReadObject(1, info); break; default: if (isdigit(ch)) { LispUnget(ch); result = LispReadMacroArg(info); } else if (!info->discard) READ_ERROR1("undefined dispatch macro character #%c", ch); break; } return (result); } static LispObj * LispReadMacroArg(read_info *info) { READ_ENTER(); LispObj *result = NIL; long i, integer; int ch; /* skip leading zeros */ while (ch = LispGet(), ch != EOF && isdigit(ch) && ch == '0') ; if (ch == EOF) READ_ERROR_EOF(); /* if ch is not a number the argument was zero */ if (isdigit(ch)) { char stk[32], *str; int len = 1; stk[0] = ch; for (;;) { ch = LispGet(); if (!isdigit(ch)) break; if (len + 1 >= sizeof(stk)) READ_ERROR_FIXNUM(); stk[len++] = ch; } stk[len] = '\0'; errno = 0; integer = strtol(stk, &str, 10); /* number is positive because sign is not processed here */ if (*str || errno == ERANGE || integer > MOST_POSITIVE_FIXNUM) READ_ERROR_FIXNUM(); } else integer = 0; switch (ch) { case 'a': case 'A': if (integer == 1) { /* LispReadArray and LispReadList expect * the '(' being already read */ if ((ch = LispSkipWhiteSpace()) != '(') { if (info->discard) return (ch == EOF ? NULL : NIL); READ_ERROR0("bad array specification"); } result = LispReadVector(info); } else result = LispReadArray(integer, info); break; case 'r': case 'R': result = LispReadRational(integer, info); break; case '=': if (integer > MAX_LABEL_VALUE) READ_ERROR_FIXNUM(); if (!info->discard) { long num_objects = info->num_objects; /* check for duplicated label */ for (i = 0; i < info->num_objects; i++) { if (info->objects[i].label == integer) READ_ERROR1("label #%ld# defined more than once", integer); } info->objects = LispRealloc(info->objects, sizeof(object_info) * (num_objects + 1)); /* if this label is referenced it is a shared/circular object */ info->objects[num_objects].label = integer; info->objects[num_objects].object = NULL; info->objects[num_objects].num_circles = 0; ++info->num_objects; result = LispDoRead(info); if (READLABELP(result) && READLABEL_VALUE(result) == integer) READ_ERROR2("incorrect syntax #%ld= #%ld#", integer, integer); /* any reference to it now is not shared/circular */ info->objects[num_objects].object = result; } else result = LispDoRead(info); break; case '#': if (integer > MAX_LABEL_VALUE) READ_ERROR_FIXNUM(); if (!info->discard) { /* search object */ for (i = 0; i < info->num_objects; i++) { if (info->objects[i].label == integer) { result = info->objects[i].object; if (result == NULL) { ++info->objects[i].num_circles; ++info->circle_count; result = READLABEL(integer); } break; } } if (i == info->num_objects) READ_ERROR1("undefined label #%ld#", integer); } break; default: if (!info->discard) READ_ERROR1("undefined dispatch macro character #%c", ch); break; } return (result); } static int LispSkipWhiteSpace(void) { int ch; for (;;) { while (ch = LispGet(), isspace(ch) && ch != EOF) ; if (ch == ';') { while (ch = LispGet(), ch != '\n' && ch != EOF) ; if (ch == EOF) return (EOF); } else break; } return (ch); } /* any data in the format '(' FORM ')' is read here */ static LispObj * LispReadList(read_info *info) { READ_ENTER(); GC_ENTER(); LispObj *result, *cons, *object; int dot = 0; ++info->level; /* check for () */ object = LispDoRead(info); if (object == EOLIST) { --info->level; return (NIL); } if (object == DOT) READ_ERROR0("illegal start of dotted list"); result = cons = CONS(object, NIL); /* make sure GC will not release data being read */ GC_PROTECT(result); while ((object = LispDoRead(info)) != EOLIST) { if (object == NULL) READ_ERROR_EOF(); if (object == DOT) { if (info->nodot == info->level) READ_ERROR0("dotted list not allowed"); /* this is a dotted list */ if (dot) READ_ERROR0("more than one . in list"); dot = 1; } else { if (dot) { /* only one object after a dot */ if (++dot > 2) READ_ERROR0("more than one object after . in list"); RPLACD(cons, object); } else { RPLACD(cons, CONS(object, NIL)); cons = CDR(cons); } } } /* this will happen if last list element was a dot */ if (dot == 1) READ_ERROR0("illegal end of dotted list"); --info->level; GC_LEAVE(); return (result); } static LispObj * LispReadQuote(read_info *info) { READ_ENTER(); LispObj *quote = LispDoRead(info), *result; if (INVALIDP(quote)) READ_ERROR_INVARG(); result = QUOTE(quote); return (result); } static LispObj * LispReadBackquote(read_info *info) { READ_ENTER(); LispObj *backquote = LispDoRead(info), *result; if (INVALIDP(backquote)) READ_ERROR_INVARG(); result = BACKQUOTE(backquote); return (result); } static LispObj * LispReadCommaquote(read_info *info) { READ_ENTER(); LispObj *comma, *result; int atlist = LispGet(); if (atlist == EOF) READ_ERROR_EOF(); else if (atlist != '@' && atlist != '.') LispUnget(atlist); comma = LispDoRead(info); if (comma == DOT) { atlist = '@'; comma = LispDoRead(info); } if (INVALIDP(comma)) READ_ERROR_INVARG(); result = COMMA(comma, atlist == '@' || atlist == '.'); return (result); } /* * Read anything that is not readily identifiable by it's first character * and also put the code for reading atoms, numbers and strings together. */ static LispObj * LispReadObject(int unintern, read_info *info) { READ_ENTER(); LispObj *object; char stk[128], *string, *package, *symbol; int ch, length, backslash, size, quote, unreadable, collon; package = symbol = string = stk; size = sizeof(stk); backslash = quote = unreadable = collon = 0; length = 0; ch = LispGet(); if (unintern && (ch == ':' || ch == '"')) READ_ERROR0("syntax error after #:"); else if (ch == '"' || ch == '|') quote = ch; else if (ch == '\\') { unreadable = backslash = 1; string[length++] = ch; } else if (ch == ':') { collon = 1; string[length++] = ch; symbol = string + 1; ch = LispGet(); if (ch == '|') { quote = ch; unreadable = 1; } else if (ch != EOF) LispUnget(ch); } else if (ch) { if (islower(ch)) ch = toupper(ch); string[length++] = ch; } else unreadable = 1; /* read remaining data */ for (; ch;) { ch = LispGet(); if (ch == EOF) { if (quote) { /* if quote, file ended with an open quoted object */ if (string != stk) LispFree(string); return (NULL); } break; } else if (ch == '\0') break; if (ch == '\\') { backslash = !backslash; if (quote == '"') { /* only remove backslashs from strings */ if (backslash) continue; } else unreadable = 1; } else if (backslash) backslash = 0; else if (ch == quote) break; else if (!quote && !backslash) { if (islower(ch)) ch = toupper(ch); else if (isspace(ch)) break; else if (AtomSeparator(ch, 0, 0)) { LispUnget(ch); break; } else if (ch == ':') { if (collon == 0 || (collon == (1 - unintern) && symbol == string + length)) { ++collon; symbol = string + length + 1; } else READ_ERROR0("too many collons"); } } if (length + 2 >= size) { if (string == stk) { size = 1024; string = LispMalloc(size); strcpy(string, stk); } else { size += 1024; string = LispRealloc(string, size); } symbol = string + (symbol - package); package = string; } string[length++] = ch; } if (info->discard) { if (string != stk) LispFree(string); return (ch == EOF ? NULL : NIL); } string[length] = '\0'; if (unintern) { if (length == 0) READ_ERROR0("syntax error after #:"); object = UNINTERNED_ATOM(string); } else if (quote == '"') object = LSTRING(string, length); else if (collon) { /* Package specified in object name */ symbol[-1] = '\0'; if (collon > 1) symbol[-2] = '\0'; object = LispParseAtom(package, symbol, collon == 2, unreadable, read__stream, read__line); } else if (quote == '|' || (unreadable && !collon)) { /* Set unreadable field, this atom needs quoting to be read back */ object = ATOM(string); object->data.atom->unreadable = 1; } /* Check some common symbols */ else if (length == 1 && string[0] == 'T') /* The T */ object = T; else if (length == 1 && string[0] == '.') /* The dot */ object = DOT; else if (length == 3 && string[0] == 'N' && string[1] == 'I' && string[2] == 'L') /* The NIL */ object = NIL; else if (isdigit(string[0]) || string[0] == '.' || ((string[0] == '-' || string[0] == '+') && string[1])) /* Looks like a number */ object = LispParseNumber(string, 10, read__stream, read__line); else /* A normal atom */ object = ATOM(string); if (string != stk) LispFree(string); return (object); } static LispObj * LispParseAtom(char *package, char *symbol, int intern, int unreadable, LispObj *read__stream, int read__line) { LispObj *object = NULL, *thepackage = NULL; LispPackage *pack = NULL; if (!unreadable) { /* Until NIL and T be treated as normal symbols */ if (symbol[0] == 'N' && symbol[1] == 'I' && symbol[2] == 'L' && symbol[3] == '\0') return (NIL); if (symbol[0] == 'T' && symbol[1] == '\0') return (T); unreadable = !LispCheckAtomString(symbol); } /* If package is empty, it is a keyword */ if (package[0] == '\0') { thepackage = lisp__data.keyword; pack = lisp__data.key; } else { /* Else, search it in the package list */ thepackage = LispFindPackageFromString(package); if (thepackage == NIL) READ_ERROR1("the package %s is not available", package); pack = thepackage->data.package.package; } if (pack == lisp__data.pack && intern) { /* Redundant package specification, since requesting a * intern symbol, create it if does not exist */ object = ATOM(symbol); if (unreadable) object->data.atom->unreadable = 1; } else if (intern || pack == lisp__data.key) { /* Symbol is created, or just fetched from the specified package */ LispPackage *savepack; LispObj *savepackage = PACKAGE; /* Remember curent package */ savepack = lisp__data.pack; /* Temporarily set another package */ lisp__data.pack = pack; PACKAGE = thepackage; /* Get the object pointer */ if (pack == lisp__data.key) object = KEYWORD(LispDoGetAtom(symbol, 0)->key->value); else object = ATOM(symbol); if (unreadable) object->data.atom->unreadable = 1; /* Restore current package */ lisp__data.pack = savepack; PACKAGE = savepackage; } else { /* Symbol must exist (and be extern) in the specified package */ LispAtom *atom; atom = (LispAtom *)hash_check(pack->atoms, symbol, strlen(symbol)); if (atom) object = atom->object; /* No object found */ if (object == NULL || object->data.atom->ext == 0) READ_ERROR2("no extern symbol %s in package %s", symbol, package); } return (object); } static LispObj * LispParseNumber(char *str, int radix, LispObj *read__stream, int read__line) { int len; long integer; double dfloat; char *ratio, *ptr; LispObj *number; mpi *bignum; mpr *bigratio; if (radix < 2 || radix > 36) READ_ERROR1("radix %d is not in the range 2 to 36", radix); if (*str == '\0') return (NULL); ratio = strchr(str, '/'); if (ratio) { /* check if looks like a correctly specified ratio */ if (ratio[1] == '\0' || strchr(ratio + 1, '/') != NULL) return (ATOM(str)); /* ratio must point to an integer in radix base */ *ratio++ = '\0'; } else if (radix == 10) { int dot = 0; int type = 0; /* check if it is a floating point number */ ptr = str; if (*ptr == '-' || *ptr == '+') ++ptr; else if (*ptr == '.') { dot = 1; ++ptr; } while (*ptr) { if (*ptr == '.') { if (dot) return (ATOM(str)); /* ignore it if last char is a dot */ if (ptr[1] == '\0') { *ptr = '\0'; break; } dot = 1; } else if (!isdigit(*ptr)) break; ++ptr; } switch (*ptr) { case '\0': if (dot) /* if dot, it is default float */ type = 'E'; break; case 'E': case 'S': case 'F': case 'D': case 'L': type = *ptr; *ptr = 'E'; break; default: return (ATOM(str)); /* syntax error */ } /* if type set, it is not an integer specification */ if (type) { if (*ptr) { int itype = *ptr; char *ptype = ptr; ++ptr; if (*ptr == '+' || *ptr == '-') ++ptr; while (*ptr && isdigit(*ptr)) ++ptr; if (*ptr) { *ptype = itype; return (ATOM(str)); } } dfloat = strtod(str, NULL); if (!finite(dfloat)) READ_ERROR0("floating point overflow"); return (DFLOAT(dfloat)); } } /* check if correctly specified in the given radix */ len = strlen(str) - 1; if (!ratio && radix != 10 && str[len] == '.') str[len] = '\0'; if (ratio || radix != 10) { if (!StringInRadix(str, radix, 1)) { if (ratio) ratio[-1] = '/'; return (ATOM(str)); } if (ratio && !StringInRadix(ratio, radix, 0)) { ratio[-1] = '/'; return (ATOM(str)); } } bignum = NULL; bigratio = NULL; errno = 0; integer = strtol(str, NULL, radix); /* if does not fit in a long */ if (errno == ERANGE) { bignum = LispMalloc(sizeof(mpi)); mpi_init(bignum); mpi_setstr(bignum, str, radix); } if (ratio && integer != 0) { long denominator; errno = 0; denominator = strtol(ratio, NULL, radix); if (denominator == 0) READ_ERROR0("divide by zero"); if (bignum == NULL) { if (integer == MINSLONG || (denominator == LONG_MAX && errno == ERANGE)) { bigratio = LispMalloc(sizeof(mpr)); mpr_init(bigratio); mpi_seti(mpr_num(bigratio), integer); mpi_setstr(mpr_den(bigratio), ratio, radix); } } else { bigratio = LispMalloc(sizeof(mpr)); mpr_init(bigratio); mpi_set(mpr_num(bigratio), bignum); mpi_clear(bignum); LispFree(bignum); mpi_setstr(mpr_den(bigratio), ratio, radix); } if (bigratio) { mpr_canonicalize(bigratio); if (mpi_fiti(mpr_num(bigratio)) && mpi_fiti(mpr_den(bigratio))) { integer = mpi_geti(mpr_num(bigratio)); denominator = mpi_geti(mpr_den(bigratio)); mpr_clear(bigratio); LispFree(bigratio); if (denominator == 1) number = INTEGER(integer); else number = RATIO(integer, denominator); } else number = BIGRATIO(bigratio); } else { long num = integer, den = denominator, rest; if (num < 0) num = -num; for (;;) { if ((rest = den % num) == 0) break; den = num; num = rest; } if (den != 1) { denominator /= num; integer /= num; } if (denominator < 0) { integer = -integer; denominator = -denominator; } if (denominator == 1) number = INTEGER(integer); else number = RATIO(integer, denominator); } } else if (bignum) number = BIGNUM(bignum); else number = INTEGER(integer); return (number); } static int StringInRadix(char *str, int radix, int skip_sign) { if (skip_sign && (*str == '-' || *str == '+')) ++str; while (*str) { if (*str >= '0' && *str <= '9') { if (*str - '0' >= radix) return (0); } else if (*str >= 'A' && *str <= 'Z') { if (radix <= 10 || *str - 'A' + 10 >= radix) return (0); } else return (0); str++; } return (1); } static int AtomSeparator(int ch, int check_space, int check_backslash) { if (check_space && isspace(ch)) return (1); if (check_backslash && ch == '\\') return (1); return (strchr("(),\";'`#|,", ch) != NULL); } static LispObj * LispReadVector(read_info *info) { LispObj *objects; int nodot = info->nodot; info->nodot = info->level + 1; objects = LispReadList(info); info->nodot = nodot; if (info->discard) return (objects); return (VECTOR(objects)); } static LispObj * LispReadFunction(read_info *info) { READ_ENTER(); int nodot = info->nodot; LispObj *function; info->nodot = info->level + 1; function = LispDoRead(info); info->nodot = nodot; if (info->discard) return (function); if (INVALIDP(function)) READ_ERROR_INVARG(); else if (CONSP(function)) { if (CAR(function) != Olambda) READ_ERROR_INVARG(); return (FUNCTION_QUOTE(function)); } else if (!SYMBOLP(function)) READ_ERROR_INVARG(); return (FUNCTION_QUOTE(function)); } static LispObj * LispReadRational(int radix, read_info *info) { READ_ENTER(); LispObj *number; int ch, len, size; char stk[128], *str; len = 0; str = stk; size = sizeof(stk); for (;;) { ch = LispGet(); if (ch == EOF || isspace(ch)) break; else if (AtomSeparator(ch, 0, 1)) { LispUnget(ch); break; } else if (islower(ch)) ch = toupper(ch); if ((ch < '0' || ch > '9') && (ch < 'A' || ch > 'Z') && ch != '+' && ch != '-' && ch != '/') { if (str != stk) LispFree(str); if (!info->discard) READ_ERROR1("bad character %c for rational number", ch); } if (len + 1 >= size) { if (str == stk) { size = 512; str = LispMalloc(size); strcpy(str + 1, stk + 1); } else { size += 512; str = LispRealloc(str, size); } } str[len++] = ch; } if (info->discard) { if (str != stk) LispFree(str); return (ch == EOF ? NULL : NIL); } str[len] = '\0'; number = LispParseNumber(str, radix, read__stream, read__line); if (str != stk) LispFree(str); if (!RATIONALP(number)) READ_ERROR0("bad rational number specification"); return (number); } static LispObj * LispReadCharacter(read_info *info) { READ_ENTER(); long c; int ch, len; char stk[64]; ch = LispGet(); if (ch == EOF) return (NULL); stk[0] = ch; len = 1; for (;;) { ch = LispGet(); if (ch == EOF) break; else if (ch != '-' && !isalnum(ch)) { LispUnget(ch); break; } if (len + 1 < sizeof(stk)) stk[len++] = ch; } if (len > 1) { const char * const *names; int found = 0; stk[len] = '\0'; for (c = ch = 0; ch <= ' ' && !found; ch++) { for (names = LispChars[ch].names; *names; names++) if (strcasecmp(*names, stk) == 0) { c = ch; found = 1; break; } } if (!found) { for (names = LispChars[0177].names; *names; names++) if (strcasecmp(*names, stk) == 0) { c = 0177; found = 1; break; } } if (!found) { if (info->discard) return (NIL); READ_ERROR1("unkwnown character %s", stk); } } else c = stk[0]; return (SCHAR(c)); } static void LispSkipComment(void) { READ_ENTER(); int ch, comm = 1; for (;;) { ch = LispGet(); if (ch == '#') { ch = LispGet(); if (ch == '|') ++comm; continue; } while (ch == '|') { ch = LispGet(); if (ch == '#' && --comm == 0) return; } if (ch == EOF) READ_ERROR_EOF(); } } static LispObj * LispReadEval(read_info *info) { READ_ENTER(); int nodot = info->nodot; LispObj *code; info->nodot = info->level + 1; code = LispDoRead(info); info->nodot = nodot; if (info->discard) return (code); if (INVALIDP(code)) READ_ERROR_INVARG(); return (EVAL(code)); } static LispObj * LispReadComplex(read_info *info) { READ_ENTER(); GC_ENTER(); int nodot = info->nodot; LispObj *number, *arguments; info->nodot = info->level + 1; arguments = LispDoRead(info); info->nodot = nodot; /* form read */ if (info->discard) return (arguments); if (INVALIDP(arguments) || !CONSP(arguments)) READ_ERROR_INVARG(); GC_PROTECT(arguments); number = APPLY(Ocomplex, arguments); GC_LEAVE(); return (number); } static LispObj * LispReadPathname(read_info *info) { READ_ENTER(); GC_ENTER(); int nodot = info->nodot; LispObj *path, *arguments; info->nodot = info->level + 1; arguments = LispDoRead(info); info->nodot = nodot; /* form read */ if (info->discard) return (arguments); if (INVALIDP(arguments)) READ_ERROR_INVARG(); GC_PROTECT(arguments); path = APPLY1(Oparse_namestring, arguments); GC_LEAVE(); return (path); } static LispObj * LispReadStruct(read_info *info) { READ_ENTER(); GC_ENTER(); int len, nodot = info->nodot; char stk[128], *str; LispObj *struc, *fields; info->nodot = info->level + 1; fields = LispDoRead(info); info->nodot = nodot; /* form read */ if (info->discard) return (fields); if (INVALIDP(fields) || !CONSP(fields) || !SYMBOLP(CAR(fields))) READ_ERROR_INVARG(); GC_PROTECT(fields); len = ATOMID(CAR(fields))->length; /* MAKE- */ if (len + 6 > sizeof(stk)) str = LispMalloc(len + 6); else str = stk; sprintf(str, "MAKE-%s", ATOMID(CAR(fields))->value); RPLACA(fields, ATOM(str)); if (str != stk) LispFree(str); struc = APPLY(Omake_struct, fields); GC_LEAVE(); return (struc); } /* XXX This is broken, needs a rewritten as soon as true vector/arrays be * implemented. */ static LispObj * LispReadArray(long dimensions, read_info *info) { READ_ENTER(); GC_ENTER(); long count; int nodot = info->nodot; LispObj *arguments, *initial, *dim, *cons, *array, *data; info->nodot = info->level + 1; data = LispDoRead(info); info->nodot = nodot; /* form read */ if (info->discard) return (data); if (INVALIDP(data)) READ_ERROR_INVARG(); initial = Kinitial_contents; dim = cons = NIL; if (dimensions) { LispObj *array; for (count = 0, array = data; count < dimensions; count++) { long length; LispObj *item; if (!CONSP(array)) READ_ERROR0("bad array for given dimension"); item = array; array = CAR(array); for (length = 0; CONSP(item); item = CDR(item), length++) ; if (dim == NIL) { dim = cons = CONS(FIXNUM(length), NIL); GC_PROTECT(dim); } else { RPLACD(cons, CONS(FIXNUM(length), NIL)); cons = CDR(cons); } } } arguments = CONS(dim, CONS(initial, CONS(data, NIL))); GC_PROTECT(arguments); array = APPLY(Omake_array, arguments); GC_LEAVE(); return (array); } static LispObj * LispReadFeature(int with, read_info *info) { READ_ENTER(); LispObj *status; LispObj *feature = LispDoRead(info); /* form read */ if (info->discard) return (feature); if (INVALIDP(feature)) READ_ERROR_INVARG(); /* paranoia check, features must be a list, possibly empty */ if (!CONSP(FEATURES) && FEATURES != NIL) READ_ERROR1("%s is not a list", STROBJ(FEATURES)); status = LispEvalFeature(feature); if (with) { if (status == T) return (LispDoRead(info)); /* need to use the field discard because the following expression * may be #.FORM or #,FORM or any other form that may generate * side effects */ info->discard = 1; LispDoRead(info); info->discard = 0; return (LispDoRead(info)); } if (status == NIL) return (LispDoRead(info)); info->discard = 1; LispDoRead(info); info->discard = 0; return (LispDoRead(info)); } /* * A very simple eval loop with AND, NOT, and OR functions for testing * the available features. */ static LispObj * LispEvalFeature(LispObj *feature) { READ_ENTER(); Atom_id test; LispObj *object; if (CONSP(feature)) { LispObj *function = CAR(feature), *arguments = CDR(feature); if (!SYMBOLP(function)) READ_ERROR1("bad feature test function %s", STROBJ(function)); if (!CONSP(arguments)) READ_ERROR1("bad feature test arguments %s", STROBJ(arguments)); test = ATOMID(function); if (test == Sand) { for (; CONSP(arguments); arguments = CDR(arguments)) { if (LispEvalFeature(CAR(arguments)) == NIL) return (NIL); } return (T); } else if (test == Sor) { for (; CONSP(arguments); arguments = CDR(arguments)) { if (LispEvalFeature(CAR(arguments)) == T) return (T); } return (NIL); } else if (test == Snot) { if (CONSP(CDR(arguments))) READ_ERROR0("too many arguments to NOT"); return (LispEvalFeature(CAR(arguments)) == NIL ? T : NIL); } else READ_ERROR1("unimplemented feature test function %s", test); } if (KEYWORDP(feature)) feature = feature->data.quote; else if (!SYMBOLP(feature)) READ_ERROR1("bad feature specification %s", STROBJ(feature)); test = ATOMID(feature); for (object = FEATURES; CONSP(object); object = CDR(object)) { /* paranoia check, elements in the feature list must ge keywords */ if (!KEYWORDP(CAR(object))) READ_ERROR1("%s is not a keyword", STROBJ(CAR(object))); if (ATOMID(CAR(object)) == test) return (T); } /* unknown feature */ return (NIL); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/compile.c0000664000000000000000000015141612472175711016070 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/compile.c,v 1.15tsi Exp $ */ #define VARIABLE_USED 0x0001 #define VARIABLE_ARGUMENT 0x0002 /* * Prototypes */ static void ComPredicate(LispCom*, LispBuiltin*, LispBytePredicate); static void ComReturnFrom(LispCom*, LispBuiltin*, int); static int ComConstantp(LispCom*, LispObj*); static void ComAddVariable(LispCom*, LispObj*, LispObj*); static int ComGetVariable(LispCom*, LispObj*); static void ComVariableSetFlag(LispCom*, LispAtom*, int); #define COM_VARIABLE_USED(atom) \ ComVariableSetFlag(com, atom, VARIABLE_USED) #define COM_VARIABLE_ARGUMENT(atom) \ ComVariableSetFlag(com, atom, VARIABLE_ARGUMENT) static int FindIndex(void*, void**, int); static int compare(const void*, const void*); static int BuildTablePointer(void*, void***, int*); static void ComLabel(LispCom*, LispObj*); static void ComPush(LispCom*, LispObj*, LispObj*, int, int, int); static int ComCall(LispCom*, LispArgList*, LispObj*, LispObj*, int, int, int); static void ComFuncall(LispCom*, LispObj*, LispObj*, int); static void ComProgn(LispCom*, LispObj*); static void ComEval(LispCom*, LispObj*); static void ComRecursiveCall(LispCom*, LispArgList*, LispObj*, LispObj*); static void ComInlineCall(LispCom*, LispArgList*, LispObj*, LispObj*, LispObj*); static void ComMacroBackquote(LispCom*, LispObj*); static void ComMacroCall(LispCom*, LispArgList*, LispObj*, LispObj*, LispObj*); static LispObj *ComMacroExpandBackquote(LispCom*, LispObj*); static LispObj *ComMacroExpand(LispCom*, LispObj*); static LispObj *ComMacroExpandFuncall(LispCom*, LispObj*, LispObj*); static LispObj *ComMacroExpandEval(LispCom*, LispObj*); /* * Implementation */ void Com_And(LispCom *com, LispBuiltin *builtin) /* and &rest args */ { LispObj *args; args = ARGUMENT(0); if (CONSP(args)) { /* Evaluate first argument */ ComEval(com, CAR(args)); args = CDR(args); /* If more than one argument, create jump list */ if (CONSP(args)) { CodeTree *tree = NULL, *group; group = NEW_TREE(CodeTreeJumpIf); group->code = XBC_JUMPNIL; for (; CONSP(args); args = CDR(args)) { ComEval(com, CAR(args)); tree = NEW_TREE(CodeTreeJumpIf); tree->code = XBC_JUMPNIL; group->group = tree; group = tree; } /* Finish form the last CodeTree code is changed to sign the * end of the AND list */ group->code = XBC_NOOP; if (group) group->group = tree; } } else /* Identity of AND is T */ com_Bytecode(com, XBC_T); } void Com_Block(LispCom *com, LispBuiltin *builtin) /* block name &rest body */ { LispObj *name, *body; body = ARGUMENT(1); name = ARGUMENT(0); if (name != NIL && name != T && !SYMBOLP(name)) LispDestroy("%s: %s cannot name a block", STRFUN(builtin), STROBJ(name)); if (CONSP(body)) { CompileIniBlock(com, LispBlockTag, name); ComProgn(com, body); CompileFiniBlock(com); } else /* Just load NIL without starting an empty block */ com_Bytecode(com, XBC_NIL); } void Com_C_r(LispCom *com, LispBuiltin *builtin) /* c[ad]{1,4}r list */ { LispObj *list; const char *desc; list = ARGUMENT(0); desc = STRFUN(builtin); if (*desc == 'F') /* FIRST */ desc = "CAR"; else if (*desc == 'R') /* REST */ desc = "CDR"; /* Check if it is a list of constants */ while (desc[1] != 'R') desc++; ComEval(com, list); while (*desc != 'C') { com_Bytecode(com, *desc == 'A' ? XBC_CAR : XBC_CDR); --desc; } } void Com_Cond(LispCom *com, LispBuiltin *builtin) /* cond &rest body */ { int count; LispObj *code, *body; CodeTree *group, *tree; body = ARGUMENT(0); count = 0; group = NULL; if (CONSP(body)) { for (; CONSP(body); body = CDR(body)) { code = CAR(body); CHECK_CONS(code); ++count; ComEval(com, CAR(code)); tree = NEW_TREE(CodeTreeCond); if (group) group->group = tree; tree->code = XBC_JUMPNIL; group = tree; /* The code to execute if the test is true */ ComProgn(com, CDR(code)); /* Add a node signaling the end of the PROGN code */ tree = NEW_TREE(CodeTreeCond); tree->code = XBC_JUMPT; if (group) group->group = tree; group = tree; } } if (!count) com_Bytecode(com, XBC_NIL); else /* Where to jump after T progn */ group->code = XBC_NOOP; } void Com_Cons(LispCom *com, LispBuiltin *builtin) /* cons car cdr */ { LispObj *car, *cdr; cdr = ARGUMENT(1); car = ARGUMENT(0); if (ComConstantp(com, car) && ComConstantp(com, cdr)) com_BytecodeCons(com, XBC_CCONS, car, cdr); else { ++com->stack.cpstack; if (com->stack.pstack < com->stack.cpstack) com->stack.pstack = com->stack.cpstack; ComEval(com, car); com_Bytecode(com, XBC_CSTAR); ComEval(com, cdr); com_Bytecode(com, XBC_CFINI); --com->stack.cpstack; } } void Com_Consp(LispCom *com, LispBuiltin *builtin) /* consp object */ { ComPredicate(com, builtin, XBP_CONSP); } void Com_Dolist(LispCom *com, LispBuiltin *builtin) /* dolist init &rest body */ { int unbound, item; LispObj *symbol, *list, *result; LispObj *init, *body; CodeTree *group, *tree; body = ARGUMENT(1); init = ARGUMENT(0); CHECK_CONS(init); symbol = CAR(init); CHECK_SYMBOL(symbol); CHECK_CONSTANT(symbol); init = CDR(init); if (CONSP(init)) { list = CAR(init); init = CDR(init); } else list = NIL; if (CONSP(init)) { result = CAR(init); if (CONSP(CDR(init))) LispDestroy("%s: too many arguments %s", STRFUN(builtin), STROBJ(CDR(init))); } else result = NIL; /* Generate code for the body of the form. * The generated code uses two objects unavailable to user code, * in the format: * (block NIL * (let ((? list) (item NIL)) * (tagbody * . ; the DOT object as a label * (when (consp list) * (setq item (car ?)) * @body ; code to be executed * (setq ? (cdr ?)) * (go .) * ) * ) * (setq item nil) * result * ) * ) */ /* XXX All of the logic below should be simplified at some time * by adding more opcodes for compound operations ... */ /* Relative offsets the locally added variables will have at run time */ unbound = lisp__data.env.length - lisp__data.env.lex; item = unbound + 1; /* Start BLOCK NIL */ FORM_ENTER(); CompileIniBlock(com, LispBlockTag, NIL); /* Add the variable */ ComPush(com, UNBOUND, list, 1, 0, 0); /* Add the variable */ ComPush(com, symbol, NIL, 0, 0, 0); /* Stack length is increased */ CompileStackEnter(com, 2, 0); /* Bind variables */ com_Bind(com, 2); com->block->bind += 2; lisp__data.env.head += 2; /* Remember that iteration variable is used even if it not referenced */ COM_VARIABLE_USED(symbol->data.atom); /* Initialize the TAGBODY */ FORM_ENTER(); CompileIniBlock(com, LispBlockBody, NIL); /* Create the <.> label */ ComLabel(com, DOT); /* Load variable */ com_BytecodeShort(com, XBC_LOAD, unbound); /* Check if is a list */ com_BytecodeChar(com, XBC_PRED, XBP_CONSP); /* Start WHEN block */ group = NEW_TREE(CodeTreeJumpIf); group->code = XBC_JUMPNIL; /* Load again */ com_BytecodeShort(com, XBC_LOAD, unbound); /* Get CAR of */ com_Bytecode(com, XBC_CAR); /* Store it in */ com_BytecodeShort(com, XBC_SET, item); /* Execute @BODY */ ComProgn(com, body); /* Load again */ com_BytecodeShort(com, XBC_LOAD, unbound); /* Get CDR of */ com_Bytecode(com, XBC_CDR); /* Change value of */ com_BytecodeShort(com, XBC_SET, unbound); /* GO back to <.> */ tree = NEW_TREE(CodeTreeGo); tree->data.object = DOT; /* Finish WHEN block */ tree = NEW_TREE(CodeTreeJumpIf); tree->code = XBC_NOOP; group->group = tree; /* Finish the TAGBODY */ CompileFiniBlock(com); FORM_LEAVE(); /* Set to NIL, in case result references it... * Loaded value is NIL as the CONSP predicate */ com_BytecodeShort(com, XBC_SET, item); /* Evaluate */ ComEval(com, result); /* Unbind variables */ lisp__data.env.head -= 2; lisp__data.env.length -= 2; com->block->bind -= 2; com_Unbind(com, 2); /* Stack length is reduced. */ CompileStackLeave(com, 2, 0); /* Finish BLOCK NIL */ CompileFiniBlock(com); FORM_LEAVE(); } void Com_Eq(LispCom *com, LispBuiltin *builtin) /* eq left right eql left right equal left right equalp left right */ { LispObj *left, *right; LispByteOpcode code; char *name; right = ARGUMENT(1); left = ARGUMENT(0); CompileStackEnter(com, 1, 1); /* Just like preparing to call a builtin function */ ComEval(com, left); com_Bytecode(com, XBC_PUSH); /* The second argument is now loaded */ ComEval(com, right); /* Compare arguments and restore builtin stack */ name = STRFUN(builtin); switch (name[3]) { case 'L': code = XBC_EQL; break; case 'U': code = name[5] == 'P' ? XBC_EQUALP : XBC_EQUAL; break; default: code = XBC_EQ; break; } com_Bytecode(com, code); CompileStackLeave(com, 1, 1); } void Com_Go(LispCom *com, LispBuiltin *builtin) /* go tag */ { int bind; LispObj *tag; CodeTree *tree; CodeBlock *block; tag = ARGUMENT(0); block = com->block; bind = block->bind; while (block) { if (block->type == LispBlockClosure || block->type == LispBlockBody) break; block = block->prev; if (block) bind += block->bind; } if (!block || block->type != LispBlockBody) LispDestroy("%s called not within a block", STRFUN(builtin)); /* Unbind any local variables */ com_Unbind(com, bind); tree = NEW_TREE(CodeTreeGo); tree->data.object = tag; } void Com_If(LispCom *com, LispBuiltin *builtin) /* if test then &optional else */ { CodeTree *group, *tree; LispObj *test, *then, *oelse; oelse = ARGUMENT(2); then = ARGUMENT(1); test = ARGUMENT(0); /* Build code to execute test */ ComEval(com, test); /* Add jump node to use if test is NIL */ group = NEW_TREE(CodeTreeJumpIf); group->code = XBC_JUMPNIL; /* Build T code */ ComEval(com, then); if (oelse != UNSPEC) { /* Remember start of NIL code */ tree = NEW_TREE(CodeTreeJump); tree->code = XBC_JUMP; group->group = tree; group = tree; /* Build NIL code */ ComEval(com, oelse); } /* Remember jump of T code */ tree = NEW_TREE(CodeTreeJumpIf); tree->code = XBC_NOOP; group->group = tree; } void Com_Last(LispCom *com, LispBuiltin *builtin) /* last list &optional count */ { LispObj *list, *count; count = ARGUMENT(1); list = ARGUMENT(0); ComEval(com, list); CompileStackEnter(com, 1, 1); com_Bytecode(com, XBC_PUSH); if (count == UNSPEC) count = FIXNUM(1); ComEval(com, count); CompileStackLeave(com, 1, 1); com_Bytecode(com, XBC_LAST); } void Com_Length(LispCom *com, LispBuiltin *builtin) /* length sequence */ { LispObj *sequence; sequence = ARGUMENT(0); ComEval(com, sequence); com_Bytecode(com, XBC_LENGTH); } void Com_Let(LispCom *com, LispBuiltin *builtin) /* let init &rest body */ { int count; LispObj *symbol, *value, *pair; LispObj *init, *body; body = ARGUMENT(1); init = ARGUMENT(0); if (init == NIL) { /* If no local variables */ ComProgn(com, body); return; } CHECK_CONS(init); /* Could optimize if the body is empty and the * init form is known to have no side effects */ for (count = 0; CONSP(init); init = CDR(init), count++) { pair = CAR(init); if (CONSP(pair)) { symbol = CAR(pair); pair = CDR(pair); if (CONSP(pair)) { value = CAR(pair); if (CDR(pair) != NIL) LispDestroy("%s: too much arguments to initialize %s", STRFUN(builtin), STROBJ(symbol)); } else value = NIL; } else { symbol = pair; value = NIL; } CHECK_SYMBOL(symbol); CHECK_CONSTANT(symbol); /* Add the variable */ ComPush(com, symbol, value, 1, 0, 0); } /* Stack length is increased */ CompileStackEnter(com, count, 0); /* Bind the added variables */ com_Bind(com, count); com->block->bind += count; lisp__data.env.head += count; /* Generate code for the body of the form */ ComProgn(com, body); /* Unbind the added variables */ lisp__data.env.head -= count; lisp__data.env.length -= count; com->block->bind -= count; com_Unbind(com, count); /* Stack length is reduced. */ CompileStackLeave(com, count, 0); } void Com_Letx(LispCom *com, LispBuiltin *builtin) /* let* init &rest body */ { int count; LispObj *symbol, *value, *pair; LispObj *init, *body; body = ARGUMENT(1); init = ARGUMENT(0); if (init == NIL) { /* If no local variables */ ComProgn(com, body); return; } CHECK_CONS(body); /* Could optimize if the body is empty and the * init form is known to have no side effects */ for (count = 0; CONSP(init); init = CDR(init), count++) { pair = CAR(init); if (CONSP(pair)) { symbol = CAR(pair); pair = CDR(pair); if (CONSP(pair)) { value = CAR(pair); if (CDR(pair) != NIL) LispDestroy("%s: too much arguments to initialize %s", STRFUN(builtin), STROBJ(symbol)); } else value = NIL; } else { symbol = pair; value = NIL; } CHECK_SYMBOL(symbol); CHECK_CONSTANT(symbol); /* LET* is identical to &AUX arguments, just bind the symbol */ ComPush(com, symbol, value, 1, 0, 0); /* Every added variable is binded */ com_Bind(com, 1); /* Must be binded at compile time also */ ++lisp__data.env.head; ++com->block->bind; } /* Generate code for the body of the form */ CompileStackEnter(com, count, 0); ComProgn(com, body); com_Unbind(com, count); com->block->bind -= count; lisp__data.env.head -= count; lisp__data.env.length -= count; CompileStackLeave(com, count, 0); } void Com_Listp(LispCom *com, LispBuiltin *builtin) /* listp object */ { ComPredicate(com, builtin, XBP_LISTP); } void Com_Loop(LispCom *com, LispBuiltin *builtin) /* loop &rest body */ { CodeTree *tree, *group; LispObj *body; body = ARGUMENT(0); /* Start NIL block */ CompileIniBlock(com, LispBlockTag, NIL); /* Insert node to mark LOOP start */ tree = NEW_TREE(CodeTreeJump); tree->code = XBC_NOOP; /* Execute @BODY */ if (CONSP(body)) ComProgn(com, body); else /* XXX bytecode.c code require that blocks have at least one opcode */ com_Bytecode(com, XBC_NIL); /* Insert node to jump of start of LOOP */ group = NEW_TREE(CodeTreeJump); group->code = XBC_JUMP; group->group = tree; /* Finish NIL block */ CompileFiniBlock(com); } void Com_Nthcdr(LispCom *com, LispBuiltin *builtin) /* nthcdr index list */ { LispObj *oindex, *list; list = ARGUMENT(1); oindex = ARGUMENT(0); ComEval(com, oindex); CompileStackEnter(com, 1, 1); com_Bytecode(com, XBC_PUSH); ComEval(com, list); CompileStackLeave(com, 1, 1); com_Bytecode(com, XBC_NTHCDR); } void Com_Null(LispCom *com, LispBuiltin *builtin) /* null list */ { LispObj *list; list = ARGUMENT(0); if (list == NIL) com_Bytecode(com, XBC_T); else if (ComConstantp(com, list)) com_Bytecode(com, XBC_NIL); else { ComEval(com, list); com_Bytecode(com, XBC_INV); } } void Com_Numberp(LispCom *com, LispBuiltin *builtin) /* numberp object */ { ComPredicate(com, builtin, XBP_NUMBERP); } void Com_Or(LispCom *com, LispBuiltin *builtin) /* or &rest args */ { LispObj *args; args = ARGUMENT(0); if (CONSP(args)) { /* Evaluate first argument */ ComEval(com, CAR(args)); args = CDR(args); /* If more than one argument, create jump list */ if (CONSP(args)) { CodeTree *tree = NULL, *group; group = NEW_TREE(CodeTreeJumpIf); group->code = XBC_JUMPT; for (; CONSP(args); args = CDR(args)) { ComEval(com, CAR(args)); tree = NEW_TREE(CodeTreeJumpIf); tree->code = XBC_JUMPT; group->group = tree; group = tree; } /* Finish form the last CodeTree code is changed to sign the * end of the AND list */ group->code = XBC_NOOP; group->group = tree; } } else /* Identity of OR is NIL */ com_Bytecode(com, XBC_NIL); } void Com_Progn(LispCom *com, LispBuiltin *builtin) /* progn &rest body */ { LispObj *body; body = ARGUMENT(0); ComProgn(com, body); } void Com_Return(LispCom *com, LispBuiltin *builtin) /* return &optional result */ { ComReturnFrom(com, builtin, 0); } void Com_ReturnFrom(LispCom *com, LispBuiltin *builtin) /* return-from name &optional result */ { ComReturnFrom(com, builtin, 1); } void Com_Rplac_(LispCom *com, LispBuiltin *builtin) /* rplac[ad] place value */ { LispObj *place, *value; value = ARGUMENT(1); place = ARGUMENT(0); CompileStackEnter(com, 1, 1); ComEval(com, place); com_Bytecode(com, XBC_PUSH); ComEval(com, value); com_Bytecode(com, STRFUN(builtin)[5] == 'A' ? XBC_RPLACA : XBC_RPLACD); CompileStackLeave(com, 1, 1); } void Com_Setq(LispCom *com, LispBuiltin *builtin) /* setq &rest form */ { int offset; LispObj *form, *symbol, *value; form = ARGUMENT(0); for (; CONSP(form); form = CDR(form)) { symbol = CAR(form); CHECK_SYMBOL(symbol); CHECK_CONSTANT(symbol); form = CDR(form); if (!CONSP(form)) LispDestroy("%s: odd number of arguments", STRFUN(builtin)); value = CAR(form); /* Generate code to load value */ ComEval(com, value); offset = ComGetVariable(com, symbol); if (offset >= 0) com_Set(com, offset); else com_SetSym(com, symbol->data.atom); } } void Com_Tagbody(LispCom *com, LispBuiltin *builtin) /* tagbody &rest body */ { LispObj *body; body = ARGUMENT(0); if (CONSP(body)) { CompileIniBlock(com, LispBlockBody, NIL); ComProgn(com, body); /* Tagbody returns NIL */ com_Bytecode(com, XBC_NIL); CompileFiniBlock(com); } else /* Tagbody always returns NIL */ com_Bytecode(com, XBC_NIL); } void Com_Unless(LispCom *com, LispBuiltin *builtin) /* unless test &rest body */ { CodeTree *group, *tree; LispObj *test, *body; body = ARGUMENT(1); test = ARGUMENT(0); /* Generate code to evaluate test */ ComEval(com, test); /* Add node after test */ group = NEW_TREE(CodeTreeJumpIf); group->code = XBC_JUMPT; /* Generate NIL code */ ComProgn(com, body); /* Insert node to know where to jump if test is T */ tree = NEW_TREE(CodeTreeJumpIf); tree->code = XBC_NOOP; group->group = tree; } void Com_Until(LispCom *com, LispBuiltin *builtin) /* until test &rest body */ { CodeTree *tree, *group, *ltree, *lgroup; LispObj *test, *body; body = ARGUMENT(1); test = ARGUMENT(0); /* Insert node to mark LOOP start */ ltree = NEW_TREE(CodeTreeJump); ltree->code = XBC_NOOP; /* Build code for test */ ComEval(com, test); group = NEW_TREE(CodeTreeJumpIf); group->code = XBC_JUMPT; /* Execute @BODY */ ComProgn(com, body); /* Insert node to jump to test again */ lgroup = NEW_TREE(CodeTreeJump); lgroup->code = XBC_JUMP; lgroup->group = ltree; /* Insert node to know where to jump if test is T */ tree = NEW_TREE(CodeTreeJumpIf); tree->code = XBC_NOOP; group->group = tree; } void Com_When(LispCom *com, LispBuiltin *builtin) /* when test &rest body */ { CodeTree *group, *tree; LispObj *test, *body; body = ARGUMENT(1); test = ARGUMENT(0); /* Generate code to evaluate test */ ComEval(com, test); /* Add node after test */ group = NEW_TREE(CodeTreeJumpIf); group->code = XBC_JUMPNIL; /* Generate T code */ ComProgn(com, body); /* Insert node to know where to jump if test is NIL */ tree = NEW_TREE(CodeTreeJumpIf); tree->code = XBC_NOOP; group->group = tree; } void Com_While(LispCom *com, LispBuiltin *builtin) /* while test &rest body */ { CodeTree *tree, *group, *ltree, *lgroup; LispObj *test, *body; body = ARGUMENT(1); test = ARGUMENT(0); /* Insert node to mark LOOP start */ ltree = NEW_TREE(CodeTreeJump); ltree->code = XBC_NOOP; /* Build code for test */ ComEval(com, test); group = NEW_TREE(CodeTreeJumpIf); group->code = XBC_JUMPNIL; /* Execute @BODY */ ComProgn(com, body); /* Insert node to jump to test again */ lgroup = NEW_TREE(CodeTreeJump); lgroup->code = XBC_JUMP; lgroup->group = ltree; /* Insert node to know where to jump if test is NIL */ tree = NEW_TREE(CodeTreeJumpIf); tree->code = XBC_NOOP; group->group = tree; } /*********************************************************************** * Com_XXX helper functions ***********************************************************************/ static void ComPredicate(LispCom *com, LispBuiltin *builtin, LispBytePredicate predicate) { LispObj *object; object = ARGUMENT(0); if (ComConstantp(com, object)) { switch (predicate) { case XBP_CONSP: com_Bytecode(com, CONSP(object) ? XBC_T : XBC_NIL); break; case XBP_LISTP: com_Bytecode(com, CONSP(object) || object == NIL ? XBC_T : XBC_NIL); break; case XBP_NUMBERP: com_Bytecode(com, NUMBERP(object) ? XBC_T : XBC_NIL); break; } } else { ComEval(com, object); com_BytecodeChar(com, XBC_PRED, predicate); } } /* XXX Could receive an argument telling if is the last statement in the * block(s), i.e. if a jump opcode should be generated or just the * evaluation of the returned value. Probably this is better done in * an optimization step. */ static void ComReturnFrom(LispCom *com, LispBuiltin *builtin, int from) { int bind; CodeTree *tree; LispObj *name, *result; CodeBlock *block = com->block; if (from) { result = ARGUMENT(1); name = ARGUMENT(0); } else { result = ARGUMENT(0); name = NIL; } if (result == UNSPEC) result = NIL; bind = block->bind; while (block) { if (block->type == LispBlockClosure) /* A function call */ break; else if (block->type == LispBlockTag && block->tag == name) break; block = block->prev; if (block) bind += block->bind; } if (!block || block->tag != name) LispDestroy("%s: no visible %s block", STRFUN(builtin), STROBJ(name)); /* Generate code to load result */ ComEval(com, result); /* Check for added variables that the jump is skiping the unbind opcode */ com_Unbind(com, bind); tree = NEW_TREE(CodeTreeReturn); tree->data.block = block; } /*********************************************************************** * Helper functions ***********************************************************************/ static int ComConstantp(LispCom *com, LispObj *object) { switch (OBJECT_TYPE(object)) { case LispAtom_t: /* Keywords are guaranteed to evaluate to itself */ if (object->data.atom->package == lisp__data.keyword) break; return (0); /* Function call */ case LispCons_t: /* Need macro expansion, these are special abstract objects */ case LispQuote_t: case LispBackquote_t: case LispComma_t: case LispFunctionQuote_t: return (0); /* Anything else is a literal constant */ default: break; } return (1); } static int FindIndex(void *item, void **table, int length) { long cmp; int left, right, i; left = 0; right = length - 1; while (left <= right) { i = (left + right) >> 1; cmp = (char*)item - (char*)table[i]; if (cmp == 0) return (i); else if (cmp < 0) right = i - 1; else left = i + 1; } return (-1); } static int compare(const void *left, const void *right) { long cmp = *(char**)left - *(char**)right; return (cmp < 0 ? -1 : 1); } static int BuildTablePointer(void *pointer, void ***pointers, int *num_pointers) { int i; if ((i = FindIndex(pointer, *pointers, *num_pointers)) < 0) { *pointers = LispRealloc(*pointers, sizeof(void*) * (*num_pointers + 1)); (*pointers)[*num_pointers] = pointer; if (++*num_pointers > 1) qsort(*pointers, *num_pointers, sizeof(void*), compare); i = FindIndex(pointer, *pointers, *num_pointers); } return (i); } static void ComAddVariable(LispCom *com, LispObj *symbol, LispObj *value) { LispAtom *atom = symbol->data.atom; if (atom && atom->key && !com->macro) { int i, length = com->block->variables.length; i = BuildTablePointer(atom, (void***)&com->block->variables.symbols, &com->block->variables.length); if (com->block->variables.length != length) { com->block->variables.flags = LispRealloc(com->block->variables.flags, com->block->variables.length * sizeof(int)); /* Variable was inserted in the middle of the list */ if (i < length) memmove(com->block->variables.flags + i + 1, com->block->variables.flags + i, (length - i) * sizeof(int)); com->block->variables.flags[i] = 0; } } LispAddVar(symbol, value); } static int ComGetVariable(LispCom *com, LispObj *symbol) { LispAtom *name; int i, base, offset; Atom_id id; name = symbol->data.atom; if (name->constant) { if (name->package == lisp__data.keyword) /* Just load from the byte stream, keywords are * guaranteed to evaluate to itself. */ return (SYMBOL_KEYWORD); return (SYMBOL_CONSTANT); } offset = name->offset; id = name->key; base = lisp__data.env.lex; i = lisp__data.env.head - 1; /* If variable is local */ if (offset <= i && offset >= com->lex && lisp__data.env.names[offset] == id) { COM_VARIABLE_USED(name); /* Relative offset */ return (offset - base); } /* name->offset may have been changed in a macro expansion */ for (; i >= com->lex; i--) if (lisp__data.env.names[i] == id) { name->offset = i; COM_VARIABLE_USED(name); return (i - base); } if (!name->a_object) { ++com->warnings; LispWarning("variable %s is neither declared nor bound", name->key->value); } /* Not found, resolve at run time */ return (SYMBOL_UNBOUND); } static void ComVariableSetFlag(LispCom *com, LispAtom *atom, int flag) { int i; CodeBlock *block = com->block; while (block) { i = FindIndex(atom, (void**)block->variables.symbols, block->variables.length); if (i >= 0) { block->variables.flags[i] |= flag; /* Descend block list if an argument to function being called * has the same name as a bound variable in the current function. */ if ((flag & VARIABLE_ARGUMENT) || !(block->variables.flags[i] & VARIABLE_ARGUMENT)) break; } block = block->prev; } } /*********************************************************************** * Bytecode compiler functions ***********************************************************************/ static void ComLabel(LispCom *com, LispObj *label) { int i; CodeTree *tree; for (i = 0; i < com->block->tagbody.length; i++) if (label == com->block->tagbody.labels[i]) LispDestroy("TAGBODY: tag %s specified more than once", STROBJ(label)); if (com->block->tagbody.length >= com->block->tagbody.space) { com->block->tagbody.labels = LispRealloc(com->block->tagbody.labels, sizeof(LispObj*) * (com->block->tagbody.space + 8)); /* Reserve space, will be used at link time when * resolving GO jumps. */ com->block->tagbody.codes = LispRealloc(com->block->tagbody.codes, sizeof(CodeTree*) * (com->block->tagbody.space + 8)); com->block->tagbody.space += 8; } com->block->tagbody.labels[com->block->tagbody.length++] = label; tree = NEW_TREE(CodeTreeLabel); tree->data.object = label; } static void ComPush(LispCom *com, LispObj *symbol, LispObj *value, int eval, int builtin, int compile) { /* If is set, it is pushing an argument to one of * Com_XXX functions. */ if (compile) { if (builtin) lisp__data.stack.values[lisp__data.stack.length++] = value; else ComAddVariable(com, symbol, value); return; } /* If macro> is set, it is expanding a macro, just add the local * variable bounded to , so that it will be available * when calling the interpreter to expand the macro. */ else if (com->macro) { ComAddVariable(com, symbol, value); return; } /* If is set, it must generate the opcodes to evaluate . * If is a constant, just generate the opcodes to load it. */ else if (eval && !ComConstantp(com, value)) { switch (OBJECT_TYPE(value)) { case LispAtom_t: { int offset = ComGetVariable(com, value); if (offset >= 0) { /* Load from user stack at the relative offset */ if (builtin) com_LoadPush(com, offset); else com_LoadLet(com, offset, symbol->data.atom); } /* ComConstantp() does not return true for this, as the * current value must be computed. */ else if (offset == SYMBOL_CONSTANT) { value = value->data.atom->property->value; if (builtin) com_LoadConPush(com, value); else com_LoadConLet(com, value, symbol->data.atom); } else { /* Load value bound to at run time */ if (builtin) com_LoadSymPush(com, value->data.atom); else com_LoadSymLet(com, value->data.atom, symbol->data.atom); } } break; default: /* Generate code to evaluate */ ComEval(com, value); if (builtin) com_Bytecode(com, XBC_PUSH); else com_Let(com, symbol->data.atom); break; } /* Remember will be bound, only matters for * the Com_XXX functions */ if (builtin) lisp__data.stack.values[lisp__data.stack.length++] = value; else ComAddVariable(com, symbol, value); return; } if (builtin) { /* Load as a constant in builtin stack */ com_LoadConPush(com, value); lisp__data.stack.values[lisp__data.stack.length++] = value; } else { /* Load as a constant in stack */ com_LoadConLet(com, value, symbol->data.atom); /* Remember will be bound */ ComAddVariable(com, symbol, value); } } /* This function does almost the same job as LispMakeEnvironment, but * it is not optimized for speed, as it is not building argument lists * to user code, but to Com_XXX functions, or helping in generating the * opcodes to load arguments at bytecode run time. */ static int ComCall(LispCom *com, LispArgList *alist, LispObj *name, LispObj *values, int eval, int builtin, int compile) { char *desc; int i, count, base; LispObj **symbols, **defaults, **sforms; if (builtin) { base = lisp__data.stack.length; /* This should never be executed, but make the check for safety */ if (base + alist->num_arguments > lisp__data.stack.space) { do LispMoreStack(); while (base + alist->num_arguments > lisp__data.stack.space); } } else base = lisp__data.env.length; desc = alist->description; switch (*desc++) { case '.': goto normal_label; case 'o': goto optional_label; case 'k': goto key_label; case 'r': goto rest_label; case 'a': goto aux_label; default: goto done_label; } /* Normal arguments */ normal_label: i = 0; symbols = alist->normals.symbols; count = alist->normals.num_symbols; for (; i < count && CONSP(values); i++, values = CDR(values)) { ComPush(com, symbols[i], CAR(values), eval, builtin, compile); if (!builtin && !com->macro) COM_VARIABLE_ARGUMENT(symbols[i]->data.atom); } if (i < count) LispDestroy("%s: too few arguments", STROBJ(name)); switch (*desc++) { case 'o': goto optional_label; case 'k': goto key_label; case 'r': goto rest_label; case 'a': goto aux_label; default: goto done_label; } /* &OPTIONAL */ optional_label: i = 0; count = alist->optionals.num_symbols; symbols = alist->optionals.symbols; defaults = alist->optionals.defaults; sforms = alist->optionals.sforms; for (; i < count && CONSP(values); i++, values = CDR(values)) { ComPush(com, symbols[i], CAR(values), eval, builtin, compile); if (!builtin && !com->macro) COM_VARIABLE_ARGUMENT(symbols[i]->data.atom); if (sforms[i]) { ComPush(com, sforms[i], T, 0, builtin, compile); if (!builtin && !com->macro) COM_VARIABLE_ARGUMENT(sforms[i]->data.atom); } } for (; i < count; i++) { if (!builtin) { int lex = com->lex; int head = lisp__data.env.head; com->lex = base; lisp__data.env.head = lisp__data.env.length; /* default arguments are evaluated for macros */ ComPush(com, symbols[i], defaults[i], 1, 0, compile); if (!com->macro) COM_VARIABLE_ARGUMENT(symbols[i]->data.atom); lisp__data.env.head = head; com->lex = lex; } else ComPush(com, symbols[i], defaults[i], eval, 1, compile); if (sforms[i]) { ComPush(com, sforms[i], NIL, 0, builtin, compile); if (!builtin && !com->macro) COM_VARIABLE_ARGUMENT(sforms[i]->data.atom); } } switch (*desc++) { case 'k': goto key_label; case 'r': goto rest_label; case 'a': goto aux_label; default: goto done_label; } /* &KEY */ key_label: { int varset; LispObj *val, *karg, **keys; count = alist->keys.num_symbols; symbols = alist->keys.symbols; defaults = alist->keys.defaults; sforms = alist->keys.sforms; keys = alist->keys.keys; /* Check if arguments are correctly specified */ for (karg = values; CONSP(karg); karg = CDR(karg)) { val = CAR(karg); if (KEYWORDP(val)) { for (i = 0; i < alist->keys.num_symbols; i++) if (!keys[i] && symbols[i] == val) break; } else if (!builtin && QUOTEP(val) && SYMBOLP(val->data.quote)) { for (i = 0; i < alist->keys.num_symbols; i++) if (keys[i] && ATOMID(keys[i]) == ATOMID(val->data.quote)) break; } else /* Just make the error test true */ i = alist->keys.num_symbols; if (i == alist->keys.num_symbols) { /* If not in argument specification list... */ char function_name[36]; strcpy(function_name, STROBJ(name)); LispDestroy("%s: invalid keyword %s", function_name, STROBJ(val)); } karg = CDR(karg); if (!CONSP(karg)) LispDestroy("%s: &KEY needs arguments as pairs", STROBJ(name)); } /* Add variables */ for (i = 0; i < alist->keys.num_symbols; i++) { val = defaults[i]; varset = 0; if (!builtin && keys[i]) { Atom_id atom = ATOMID(keys[i]); /* Special keyword specification, need to compare ATOMID * and keyword specification must be a quoted object */ for (karg = values; CONSP(karg); karg = CDR(karg)) { val = CAR(karg); if (QUOTEP(val) && atom == ATOMID(val->data.quote)) { val = CADR(karg); varset = 1; break; } karg = CDR(karg); } } else { /* Normal keyword specification, can compare object pointers, * as they point to the same object in the keyword package */ for (karg = values; CONSP(karg); karg = CDR(karg)) { /* Don't check if argument is a valid keyword or * special quoted keyword */ if (symbols[i] == CAR(karg)) { val = CADR(karg); varset = 1; break; } karg = CDR(karg); } } /* Add the variable to environment */ if (varset) { ComPush(com, symbols[i], val, eval, builtin, compile); if (sforms[i]) ComPush(com, sforms[i], T, 0, builtin, compile); } else { /* default arguments are evaluated for macros */ if (!builtin) { int lex = com->lex; int head = lisp__data.env.head; com->lex = base; lisp__data.env.head = lisp__data.env.length; ComPush(com, symbols[i], val, eval, 0, compile); lisp__data.env.head = head; com->lex = lex; } else ComPush(com, symbols[i], val, eval, builtin, compile); if (sforms[i]) ComPush(com, sforms[i], NIL, 0, builtin, compile); } if (!builtin && !com->macro) { COM_VARIABLE_ARGUMENT(symbols[i]->data.atom); if (sforms[i]) COM_VARIABLE_ARGUMENT(sforms[i]->data.atom); } } } if (*desc == 'a') { /* &KEY uses all remaining arguments */ values = NIL; goto aux_label; } goto finished_label; /* &REST */ rest_label: if (!eval || !CONSP(values) || (compile && !builtin)) ComPush(com, alist->rest, values, eval, builtin, compile); else { char *string; LispObj *list, *car = NIL; int count, constantp; /* Count number of arguments and check if it is a list of constants */ for (count = 0, constantp = 1, list = values; CONSP(list); list = CDR(list), count++) { car = CAR(list); if (!ComConstantp(com, car)) constantp = 0; } string = builtin ? ATOMID(name)->value : NULL; /* XXX FIXME should have a flag indicating if function call * change the &REST arguments even if it is a constant list * (or if the returned value may be changed). */ if (string && (count < MAX_BCONS || constantp) && strcmp(string, "LIST") && strcmp(string, "APPLY") && /* XXX depends on function argument */ strcmp(string, "VECTOR") && /* Append does not copy the last/single list */ (strcmp(string, "APPEND") || !CONSP(car))) { if (constantp) { /* If the builtin function changes the &REST parameters, must * define a Com_XXX function for it. */ ComPush(com, alist->rest, values, 0, builtin, compile); } else { CompileStackEnter(com, count - 1, 1); for (; CONSP(CDR(values)); values = CDR(values)) { /* Evaluate this argument */ ComEval(com, CAR(values)); /* Save result in builtin stack */ com_Bytecode(com, XBC_PUSH); } CompileStackLeave(com, count - 1, 1); /* The last argument is not saved in the stack */ ComEval(com, CAR(values)); values = NIL; com_Bytecode(com, (LispByteOpcode)(XBC_BCONS + (count - 1))); } } else { /* Allocate a fresh list of cons */ /* Generate code to load object */ ComEval(com, CAR(values)); com->stack.cpstack += 2; if (com->stack.pstack < com->stack.cpstack) com->stack.pstack = com->stack.cpstack; /* Start building a gc protected list, with the loaded value */ com_Bytecode(com, XBC_LSTAR); for (values = CDR(values); CONSP(values); values = CDR(values)) { /* Generate code to load object */ ComEval(com, CAR(values)); /* Add loaded value to gc protected list */ com_Bytecode(com, XBC_LCONS); } /* Finish gc protected list */ com_Bytecode(com, XBC_LFINI); /* Push loaded value */ if (builtin) com_Bytecode(com, XBC_PUSH); else { com_Let(com, alist->rest->data.atom); /* Remember this symbol will be bound */ ComAddVariable(com, alist->rest, values); } com->stack.cpstack -= 2; } } if (!builtin && !com->macro) COM_VARIABLE_ARGUMENT(alist->rest->data.atom); if (*desc != 'a') goto finished_label; /* &AUX */ aux_label: i = 0; count = alist->auxs.num_symbols; symbols = alist->auxs.symbols; defaults = alist->auxs.initials; if (!builtin && !compile) { int lex = com->lex; com->lex = base; lisp__data.env.head = lisp__data.env.length; for (; i < count; i++) { ComPush(com, symbols[i], defaults[i], 1, 0, 0); if (!com->macro) COM_VARIABLE_ARGUMENT(symbols[i]->data.atom); ++lisp__data.env.head; } com->lex = lex; } else { for (; i < count; i++) { ComPush(com, symbols[i], defaults[i], eval, builtin, compile); if (!builtin && !com->macro) COM_VARIABLE_ARGUMENT(symbols[i]->data.atom); } } done_label: if (CONSP(values)) LispDestroy("%s: too many arguments", STROBJ(name)); finished_label: if (builtin) lisp__data.stack.base = base; else lisp__data.env.head = lisp__data.env.length; return (base); } static void ComFuncall(LispCom *com, LispObj *function, LispObj *arguments, int eval) { int base, compile; LispAtom *atom; LispArgList *alist; LispBuiltin *builtin; LispObj *lambda; switch (OBJECT_TYPE(function)) { case LispFunction_t: function = function->data.atom->object; case LispAtom_t: atom = function->data.atom; alist = atom->property->alist; if (atom->a_builtin) { builtin = atom->property->fun.builtin; compile = builtin->compile != NULL; /* If one of: * o expanding a macro * o calling a builtin special form * o builtin function is a macro * don't evaluate arguments. */ if (com->macro || compile || builtin->type == LispMacro) eval = 0; if (!com->macro && builtin->type == LispMacro) { /* Set flag of variable used, in case variable is only * used as a builtin macro argument. */ LispObj *obj; for (obj = arguments; CONSP(obj); obj = CDR(obj)) { if (SYMBOLP(CAR(obj))) COM_VARIABLE_USED(CAR(obj)->data.atom); } } FORM_ENTER(); if (!compile && !com->macro) CompileStackEnter(com, alist->num_arguments, 1); /* Build argument list in the interpreter stacks */ base = ComCall(com, alist, function, arguments, eval, 1, compile); /* If is set, it is a special form */ if (compile) builtin->compile(com, builtin); /* Else, generate opcodes to call builtin function */ else { com_Call(com, alist->num_arguments, builtin); CompileStackLeave(com, alist->num_arguments, 1); } lisp__data.stack.base = lisp__data.stack.length = base; FORM_LEAVE(); } else if (atom->a_function) { int macro; lambda = atom->property->fun.function; macro = lambda->funtype == LispMacro; /* If is set, expand macro */ if (macro) ComMacroCall(com, alist, function, lambda, arguments); else { if (com->toplevel->type == LispBlockClosure && com->toplevel->tag == function) ComRecursiveCall(com, alist, function, arguments); else { #if 0 ComInlineCall(com, alist, function, arguments, lambda->data.lambda.code); #else com_Funcall(com, function, arguments); #endif } } } else if (atom->a_defstruct && atom->property->structure.function != STRUCT_NAME && atom->property->structure.function != STRUCT_CONSTRUCTOR) { LispObj *definition = atom->property->structure.definition; if (!CONSP(arguments) || CONSP(CDR(arguments))) LispDestroy("%s: too %s arguments", atom->key->value, CONSP(arguments) ? "many" : "few"); ComEval(com, CAR(arguments)); if (atom->property->structure.function == STRUCT_CHECK) com_Structp(com, definition); else com_Struct(com, atom->property->structure.function, definition); } else if (atom->a_compiled) { FORM_ENTER(); CompileStackEnter(com, alist->num_arguments, 0); /* Build argument list in the interpreter stacks */ base = ComCall(com, alist, function, arguments, 1, 0, 0); com_Bytecall(com, alist->num_arguments, atom->property->fun.function); CompileStackLeave(com, alist->num_arguments, 0); lisp__data.env.head = lisp__data.env.length = base; FORM_LEAVE(); } else { /* Not yet defined function/macro. */ ++com->warnings; LispWarning("call to undefined function %s", atom->key->value); com_Funcall(com, function, arguments); } break; case LispLambda_t: lambda = function->data.lambda.code; alist = (LispArgList*)function->data.lambda.name->data.opaque.data; ComInlineCall(com, alist, NIL, arguments, lambda->data.lambda.code); break; case LispCons_t: if (CAR(function) == Olambda) { function = EVAL(function); if (LAMBDAP(function)) { GC_ENTER(); GC_PROTECT(function); lambda = function->data.lambda.code; alist = (LispArgList*)function->data.lambda.name->data.opaque.data; ComInlineCall(com, alist, NIL, arguments, lambda->data.lambda.code); GC_LEAVE(); break; } } default: /* XXX If bytecode objects are made available, should * handle it here. */ LispDestroy("EVAL: %s is invalid as a function", STROBJ(function)); /*NOTREACHED*/ break; } } /* Generate opcodes for an implicit PROGN */ static void ComProgn(LispCom *com, LispObj *code) { if (CONSP(code)) { for (; CONSP(code); code = CDR(code)) ComEval(com, CAR(code)); } else /* If no code to execute, empty PROGN returns NIL */ com_Bytecode(com, XBC_NIL); } /* Generate opcodes to evaluate . */ static void ComEval(LispCom *com, LispObj *object) { int offset; LispObj *form; switch (OBJECT_TYPE(object)) { case LispAtom_t: if (IN_TAGBODY()) ComLabel(com, object); else { offset = ComGetVariable(com, object); if (offset >= 0) /* Load from user stack at relative offset */ com_Load(com, offset); else if (offset == SYMBOL_KEYWORD) com_LoadCon(com, object); else if (offset == SYMBOL_CONSTANT) /* Symbol defined as constant, just load it's value */ com_LoadCon(com, LispGetVar(object)); else /* Load value bound to symbol at run time */ com_LoadSym(com, object->data.atom); } break; case LispCons_t: { /* Macro expansion may be done in the object form */ form = com->form; com->form = object; ComFuncall(com, CAR(object), CDR(object), 1); com->form = form; } break; case LispQuote_t: com_LoadCon(com, object->data.quote); break; case LispBackquote_t: /* Macro expansion is stored in the current value of com->form */ ComMacroBackquote(com, object); break; case LispComma_t: LispDestroy("EVAL: comma outside of backquote"); break; case LispFunctionQuote_t: object = object->data.quote; if (SYMBOLP(object)) object = LispSymbolFunction(object); else if (CONSP(object) && CAR(object) == Olambda) { /* object will only be associated with bytecode later, * so, make sure it is protected until compilation finishes */ object = EVAL(object); RPLACD(com->plist, CONS(CAR(com->plist), CDR(com->plist))); RPLACA(com->plist, object); } else LispDestroy("FUNCTION: %s is not a function", STROBJ(object)); com_LoadCon(com, object); break; case LispFixnum_t: if (IN_TAGBODY()) { ComLabel(com, object); break; } /*FALLTROUGH*/ default: /* Constant object */ com_LoadCon(com, object); break; } } /*********************************************************************** * Lambda expansion helper functions ***********************************************************************/ static void ComRecursiveCall(LispCom *com, LispArgList *alist, LispObj *name, LispObj *arguments) { int base, lex; /* Save state */ lex = lisp__data.env.lex; FORM_ENTER(); /* Generate code to push function arguments in the stack */ base = ComCall(com, alist, name, arguments, 1, 0, 0); /* Stack will grow this amount */ CompileStackEnter(com, alist->num_arguments, 0); #if 0 /* Make the variables available at run time */ com_Bind(com, alist->num_arguments); com->block->bind += alist->num_arguments; #endif com_BytecodeChar(com, XBC_LETREC, alist->num_arguments); #if 0 /* The variables are now unbound */ com_Unbind(com, alist->num_arguments); com->block->bind -= alist->num_arguments; #endif /* Stack length is reduced */ CompileStackLeave(com, alist->num_arguments, 0); FORM_LEAVE(); /* Restore state */ lisp__data.env.lex = lex; lisp__data.env.head = lisp__data.env.length = base; } static void ComInlineCall(LispCom *com, LispArgList *alist, LispObj *name, LispObj *arguments, LispObj *lambda) { int base, lex; /* Save state */ lex = lisp__data.env.lex; FORM_ENTER(); /* Start the inline function block */ CompileIniBlock(com, LispBlockClosure, name); /* Generate code to push function arguments in the stack */ base = ComCall(com, alist, name, arguments, 1, 0, 0); /* Stack will grow this amount */ CompileStackEnter(com, alist->num_arguments, 0); /* Make the variables available at run time */ com_Bind(com, alist->num_arguments); com->block->bind += alist->num_arguments; /* Expand the lambda list */ ComProgn(com, lambda); /* The variables are now unbound */ com_Unbind(com, alist->num_arguments); com->block->bind -= alist->num_arguments; /* Stack length is reduced */ CompileStackLeave(com, alist->num_arguments, 0); /* Finish the inline function block */ CompileFiniBlock(com); FORM_LEAVE(); /* Restore state */ lisp__data.env.lex = lex; lisp__data.env.head = lisp__data.env.length = base; } /*********************************************************************** * Macro expansion helper functions. ***********************************************************************/ static LispObj * ComMacroExpandBackquote(LispCom *com, LispObj *object) { return (LispEvalBackquote(object->data.quote, 1)); } static LispObj * ComMacroExpandFuncall(LispCom *com, LispObj *function, LispObj *arguments) { return (LispFuncall(function, arguments, 1)); } static LispObj * ComMacroExpandEval(LispCom *com, LispObj *object) { LispObj *result; switch (OBJECT_TYPE(object)) { case LispAtom_t: result = LispGetVar(object); /* Macro expansion requires bounded symbols */ if (result == NULL) LispDestroy("EVAL: the variable %s is unbound", STROBJ(object)); break; case LispCons_t: result = ComMacroExpandFuncall(com, CAR(object), CDR(object)); break; case LispQuote_t: result = object->data.quote; break; case LispBackquote_t: result = ComMacroExpandBackquote(com, object); break; case LispComma_t: LispDestroy("EVAL: comma outside of backquote"); case LispFunctionQuote_t: result = EVAL(object); break; default: result = object; break; } return (result); } static LispObj * ComMacroExpand(LispCom *com, LispObj *lambda) { LispObj *result, **presult = &result; int jumped, *pjumped = &jumped, backquote, *pbackquote = &backquote; LispBlock *block; int interpreter_lex, interpreter_head, interpreter_base; /* Save interpreter state */ interpreter_base = lisp__data.stack.length; interpreter_head = lisp__data.env.length; interpreter_lex = lisp__data.env.lex; /* Use the variables */ *presult = NIL; *pjumped = 1; *pbackquote = !CONSP(lambda); block = LispBeginBlock(NIL, LispBlockProtect); if (setjmp(block->jmp) == 0) { if (!backquote) { for (; CONSP(lambda); lambda = CDR(lambda)) result = ComMacroExpandEval(com, CAR(lambda)); } else result = ComMacroExpandBackquote(com, lambda); *pjumped = 0; } LispEndBlock(block); /* If tried to jump out of the macro expansion block */ if (!lisp__data.destroyed && jumped) LispDestroy("*** EVAL: bad jump in macro expansion"); /* Macro expansion did something wrong */ if (lisp__data.destroyed) { LispMessage("*** EVAL: aborting macro expansion"); LispDestroy("."); } /* Restore interpreter state */ lisp__data.env.lex = interpreter_lex; lisp__data.stack.length = interpreter_base; lisp__data.env.head = lisp__data.env.length = interpreter_head; return (result); } static void ComMacroCall(LispCom *com, LispArgList *alist, LispObj *name, LispObj *lambda, LispObj *arguments) { int base; LispObj *body; ++com->macro; base = ComCall(com, alist, name, arguments, 0, 0, 0); body = lambda->data.lambda.code; body = ComMacroExpand(com, body); --com->macro; lisp__data.env.head = lisp__data.env.length = base; /* Macro is expanded, store the result */ CAR(com->form) = body; ComEval(com, body); } static void ComMacroBackquote(LispCom *com, LispObj *lambda) { LispObj *body; ++com->macro; body = ComMacroExpand(com, lambda); --com->macro; /* Macro is expanded, store the result */ CAR(com->form) = body; com_LoadCon(com, body); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/pathname.c0000664000000000000000000006323512472175711016236 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/pathname.c,v 1.17tsi Exp $ */ #include /* including dirent.h first may cause problems */ #include #include #include #include #include "lisp/pathname.h" #include "lisp/private.h" #define NOREAD_SKIP 0 #define NOREAD_ERROR 1 /* * Initialization */ LispObj *Oparse_namestring, *Kerror, *Kabsolute, *Krelative, *Kskip; /* * Implementation */ void LispPathnameInit(void) { Kerror = KEYWORD("ERROR"); Oparse_namestring = STATIC_ATOM("PARSE-NAMESTRING"); Kabsolute = KEYWORD("ABSOLUTE"); Krelative = KEYWORD("RELATIVE"); } static int glob_match(char *cmp1, char *cmp2) /* * Note: this code was written from scratch, and may generate incorrect * results for very complex glob masks. */ { for (;;) { while (*cmp1 && *cmp1 == *cmp2) { ++cmp1; ++cmp2; } if (*cmp2) { if (*cmp1 == '*') { while (*cmp1 == '*') ++cmp1; if (*cmp1) { int count = 0, settmp = 1; char *tmp = cmp2, *sav2; while (*cmp1 && *cmp1 == '?') { ++cmp1; ++count; } /* need to recurse here to make sure * all cases are tested. */ while (*cmp2 && *cmp2 != *cmp1) ++cmp2; if (!*cmp1 && cmp2 - tmp < count) return (0); sav2 = cmp2; /* if recursive calls fails, make sure all '?' * following '*' are processed */ while (*sav2 && sav2 - tmp < count) ++sav2; for (; *cmp2;) { if (settmp) /* repeated letters: *?o? => boot, root */ tmp = cmp2; else settmp = 1; while (*cmp2 && *cmp2 != *cmp1) ++cmp2; if (cmp2 - tmp < count) { if (*cmp2) ++cmp2; settmp = 0; continue; } if (*cmp2) { if (glob_match(cmp1, cmp2)) return (1); ++cmp2; } } cmp2 = sav2; } else { while (*cmp2) ++cmp2; break; } } else if (*cmp1 == '?') { while (*cmp1 == '?' && *cmp2) { ++cmp1; ++cmp2; } continue; } else break; } else { while (*cmp1 == '*') ++cmp1; break; } } return (*cmp1 == '\0' && *cmp2 == '\0'); } /* * Since directory is a function to be extended by the implementation, * current extensions are: * all => list files and directories * it is an error to call * (directory "/" :all t) * if non nil, it is like the shell command * echo , but normally, not in the * same order, as the code does not sort the result. * !=nil => list files and directories * (default) nil => list only files, or only directories if * ends with PATH_SEP char. * if-cannot-read => if opendir fails on a directory * :error => generate an error * (default) :skip => skip search in this directory */ LispObj * Lisp_Directory(LispBuiltin *builtin) /* directory pathname &key all if-cannot-read */ { GC_ENTER(); DIR *dir; struct stat st; struct dirent *ent; int length, listdirs, i, ndirs, nmatches; char name[PATH_MAX + 1], path[PATH_MAX + 2], directory[PATH_MAX + 2]; char *sep, *base, *ptr, **dirs, **matches, dot[] = {'.', PATH_SEP, '\0'}, dotdot[] = {'.', '.', PATH_SEP, '\0'}; int cannot_read; LispObj *pathname, *all, *if_cannot_read, *result, *cons, *object; if_cannot_read = ARGUMENT(2); all = ARGUMENT(1); pathname = ARGUMENT(0); result = NIL; cons = NIL; if (if_cannot_read != UNSPEC) { if (!KEYWORDP(if_cannot_read) || (if_cannot_read != Kskip && if_cannot_read != Kerror)) LispDestroy("%s: bad :IF-CANNOT-READ %s", STRFUN(builtin), STROBJ(if_cannot_read)); if (if_cannot_read != Kskip) cannot_read = NOREAD_SKIP; else cannot_read = NOREAD_ERROR; } else cannot_read = NOREAD_SKIP; if (PATHNAMEP(pathname)) pathname = CAR(pathname->data.pathname); else if (STREAMP(pathname) && pathname->data.stream.type == LispStreamFile) pathname = CAR(pathname->data.stream.pathname->data.pathname); else if (!STRINGP(pathname)) LispDestroy("%s: %s is not a pathname", STRFUN(builtin), STROBJ(pathname)); strncpy(name, THESTR(pathname), sizeof(name) - 1); name[sizeof(name) - 1] = '\0'; length = strlen(name); if (length < STRLEN(pathname)) LispDestroy("%s: pathname too long %s", STRFUN(builtin), name); if (length == 0) { if (getcwd(path, sizeof(path) - 2) == NULL) LispDestroy("%s: getcwd(): %s", STRFUN(builtin), strerror(errno)); length = strlen(path); if (!length || path[length - 1] != PATH_SEP) { path[length++] = PATH_SEP; path[length] = '\0'; } result = APPLY1(Oparse_namestring, LSTRING(path, length)); GC_LEAVE(); return (result); } if (name[length - 1] == PATH_SEP) { listdirs = 1; if (length > 1) { --length; name[length] = '\0'; } } else listdirs = 0; if (name[0] != PATH_SEP) { if (getcwd(path, sizeof(path) - 2) == NULL) LispDestroy("%s: getcwd(): %s", STRFUN(builtin), strerror(errno)); length = strlen(path); if (!length || path[length - 1] != PATH_SEP) { path[length++] = PATH_SEP; path[length] = '\0'; } } else path[0] = '\0'; result = NIL; /* list intermediate directories */ matches = NULL; nmatches = 0; dirs = LispMalloc(sizeof(char*)); ndirs = 1; if (snprintf(directory, sizeof(directory), "%s%s%c", path, name, PATH_SEP) > PATH_MAX) LispDestroy("%s: pathname too long %s", STRFUN(builtin), directory); /* Remove ../ */ sep = directory; for (sep = strstr(sep, dotdot); sep; sep = strstr(sep, dotdot)) { if (sep <= directory + 1) strcpy(directory, sep + 2); else if (sep[-1] == PATH_SEP) { for (base = sep - 2; base > directory; base--) if (*base == PATH_SEP) break; strcpy(base, sep + 2); sep = base; } else ++sep; } /* Remove "./" */ sep = directory; for (sep = strstr(sep, dot); sep; sep = strstr(sep, dot)) { if (sep == directory || sep[-1] == PATH_SEP) strcpy(sep, sep + 2); else ++sep; } /* This will happen when there are too many '../' in the path */ if (directory[1] == '\0') { directory[1] = PATH_SEP; directory[2] = '\0'; } base = directory; sep = strchr(base + 1, PATH_SEP); dirs[0] = LispMalloc(2); dirs[0][0] = PATH_SEP; dirs[0][1] = '\0'; for (base = directory + 1, sep = strchr(base, PATH_SEP); ; base = sep + 1, sep = strchr(base, PATH_SEP)) { *sep = '\0'; if (sep[1] == '\0') sep = NULL; length = strlen(base); if (length == 0) { if (sep) *sep = PATH_SEP; else break; continue; } for (i = 0; i < ndirs; i++) { length = strlen(dirs[i]); if (length > 1) dirs[i][length - 1] = '\0'; /* remove trailing / */ if ((dir = opendir(dirs[i])) != NULL) { (void)readdir(dir); /* "." */ (void)readdir(dir); /* ".." */ if (length > 1) dirs[i][length - 1] = PATH_SEP; /* add trailing / again */ snprintf(path, sizeof(path), "%s", dirs[i]); length = strlen(path); ptr = path + length; while ((ent = readdir(dir)) != NULL) { int isdir; unsigned d_namlen = strlen(ent->d_name); if (length + d_namlen + 2 < sizeof(path)) strcpy(ptr, ent->d_name); else { closedir(dir); LispDestroy("%s: pathname too long %s", STRFUN(builtin), dirs[i]); } if (stat(path, &st) != 0) isdir = 0; else isdir = S_ISDIR(st.st_mode); if (all != UNSPEC || ((isdir && (listdirs || sep)) || (!listdirs && !sep && !isdir))) { if (glob_match(base, ent->d_name)) { if (isdir) { length = strlen(ptr); ptr[length++] = PATH_SEP; ptr[length] = '\0'; } /* XXX won't closedir on memory allocation failure! */ matches = LispRealloc(matches, sizeof(char*) * nmatches + 1); matches[nmatches++] = LispStrdup(ptr); } } } closedir(dir); if (nmatches == 0) { if (sep || !listdirs || *base) { LispFree(dirs[i]); if (i + 1 < ndirs) memmove(dirs + i, dirs + i + 1, sizeof(char*) * (ndirs - (i + 1))); --ndirs; --i; /* XXX playing with for loop */ } } else { int j; length = strlen(dirs[i]); if (nmatches > 1) { dirs = LispRealloc(dirs, sizeof(char*) * (ndirs + nmatches)); if (i + 1 < ndirs) memmove(dirs + i + nmatches, dirs + i + 1, sizeof(char*) * (ndirs - (i + 1))); } for (j = 1; j < nmatches; j++) { dirs[i + j] = LispMalloc(length + strlen(matches[j]) + 1); sprintf(dirs[i + j], "%s%s", dirs[i], matches[j]); } dirs[i] = LispRealloc(dirs[i], length + strlen(matches[0]) + 1); strcpy(dirs[i] + length, matches[0]); i += nmatches - 1; /* XXX playing with for loop */ ndirs += nmatches - 1; for (j = 0; j < nmatches; j++) LispFree(matches[j]); LispFree(matches); matches = NULL; nmatches = 0; } } else { if (cannot_read == NOREAD_ERROR) LispDestroy("%s: opendir(%s): %s", STRFUN(builtin), dirs[i], strerror(errno)); else { LispFree(dirs[i]); if (i + 1 < ndirs) memmove(dirs + i, dirs + i + 1, sizeof(char*) * (ndirs - (i + 1))); --ndirs; --i; /* XXX playing with for loop */ } } } if (sep) *sep = PATH_SEP; else break; } for (i = 0; i < ndirs; i++) { object = APPLY1(Oparse_namestring, STRING2(dirs[i])); if (result == NIL) { result = cons = CONS(object, NIL); GC_PROTECT(result); } else { RPLACD(cons, CONS(object, NIL)); cons = CDR(cons); } } LispFree(dirs); GC_LEAVE(); return (result); } LispObj * Lisp_ParseNamestring(LispBuiltin *builtin) /* parse-namestring object &optional host defaults &key start end junk-allowed */ { GC_ENTER(); LispObj *result; LispObj *object, *host, *defaults, *ostart, *oend, *junk_allowed; junk_allowed = ARGUMENT(5); oend = ARGUMENT(4); ostart = ARGUMENT(3); defaults = ARGUMENT(2); host = ARGUMENT(1); object = ARGUMENT(0); if (host == UNSPEC) host = NIL; if (defaults == UNSPEC) defaults = NIL; RETURN_COUNT = 1; if (STREAMP(object)) { if (object->data.stream.type == LispStreamFile) object = object->data.stream.pathname; /* else just check for JUNK-ALLOWED... */ } if (PATHNAMEP(object)) { RETURN(0) = FIXNUM(0); return (object); } if (host != NIL) { CHECK_STRING(host); } if (defaults != NIL) { if (!PATHNAMEP(defaults)) { defaults = APPLY1(Oparse_namestring, defaults); GC_PROTECT(defaults); } } result = NIL; if (STRINGP(object)) { LispObj *cons, *cdr; char *name = THESTR(object), *ptr, *str, data[PATH_MAX + 1], string[PATH_MAX + 1], *send; const char *namestr, *typestr; long start, end, length, alength, namelen, typelen; LispCheckSequenceStartEnd(builtin, object, ostart, oend, &start, &end, &length); alength = end - start; if (alength > sizeof(data) - 1) LispDestroy("%s: string %s too large", STRFUN(builtin), STROBJ(object)); memcpy(data, name + start, alength); #ifndef KEEP_EXTRA_PATH_SEP ptr = data; send = ptr + alength; while (ptr < send) { if (*ptr++ == PATH_SEP) { for (str = ptr; str < send && *str == PATH_SEP; str++) ; if (str - ptr) { memmove(ptr, str, alength - (str - data)); alength -= str - ptr; send -= str - ptr; } } } #endif data[alength] = '\0'; memcpy(string, data, alength + 1); if (PATHNAMEP(defaults)) defaults = defaults->data.pathname; /* string name */ result = cons = CONS(NIL, NIL); GC_PROTECT(result); /* host */ if (defaults != NIL) defaults = CDR(defaults); cdr = defaults == NIL ? NIL : CAR(defaults); RPLACD(cons, CONS(cdr, NIL)); cons = CDR(cons); /* device */ if (defaults != NIL) defaults = CDR(defaults); cdr = defaults == NIL ? NIL : CAR(defaults); RPLACD(cons, CONS(cdr, NIL)); cons = CDR(cons); /* directory */ if (defaults != NIL) defaults = CDR(defaults); if (*data == PATH_SEP) cdr = CONS(Kabsolute, NIL); else cdr = CONS(Krelative, NIL); RPLACD(cons, CONS(cdr, NIL)); cons = CDR(cons); /* directory components */ ptr = data; send = data + alength; if (*ptr == PATH_SEP) ++ptr; for (str = ptr; str < send; str++) { if (*str == PATH_SEP) break; } while (str < send) { *str++ = '\0'; if (str - ptr > NAME_MAX) LispDestroy("%s: directory name too long %s", STRFUN(builtin), ptr); RPLACD(cdr, CONS(LSTRING(ptr, str - ptr - 1), NIL)); cdr = CDR(cdr); for (ptr = str; str < send; str++) { if (*str == PATH_SEP) break; } } if (str - ptr > NAME_MAX) LispDestroy("%s: file name too long %s", STRFUN(builtin), ptr); if (CAAR(cons) == Krelative && defaults != NIL && CAAR(defaults) == Kabsolute) { /* defaults specify directory and pathname doesn't */ char *tstring; long dlength, tlength; LispObj *dir = CDAR(defaults); for (dlength = 1; CONSP(dir); dir = CDR(dir)) dlength += STRLEN(CAR(dir)) + 1; if (alength + dlength < PATH_MAX) { memmove(data + dlength, data, alength + 1); memmove(string + dlength, string, alength + 1); alength += dlength; ptr += dlength; send += dlength; CAAR(cons) = Kabsolute; for (dir = CDAR(defaults), cdr = CAR(cons); CONSP(dir); dir = CDR(dir)) { RPLACD(cdr, CONS(CAR(dir), CDR(cdr))); cdr = CDR(cdr); } dir = CDAR(defaults); data[0] = string[0] = PATH_SEP; for (dlength = 1; CONSP(dir); dir = CDR(dir)) { tstring = THESTR(CAR(dir)); tlength = STRLEN(CAR(dir)); memcpy(data + dlength, tstring, tlength); memcpy(string + dlength, tstring, tlength); dlength += tlength; data[dlength] = string[dlength] = PATH_SEP; ++dlength; } } } /* name */ if (defaults != NIL) defaults = CDR(defaults); cdr = defaults == NIL ? NIL : CAR(defaults); for (typelen = 0, str = ptr; str < send; str++) { if (*str == PATH_TYPESEP) { typelen = 1; break; } } if (*ptr) cdr = LSTRING(ptr, str - ptr); if (STRINGP(cdr)) { namestr = THESTR(cdr); namelen = STRLEN(cdr); } else { namestr = ""; namelen = 0; } RPLACD(cons, CONS(cdr, NIL)); cons = CDR(cons); /* type */ if (defaults != NIL) defaults = CDR(defaults); cdr = defaults == NIL ? NIL : CAR(defaults); ptr = str + typelen; if (*ptr) cdr = LSTRING(ptr, send - ptr); if (STRINGP(cdr)) { typestr = THESTR(cdr); typelen = STRLEN(cdr); } else { typestr = ""; typelen = 0; } RPLACD(cons, CONS(cdr, NIL)); cons = CDR(cons); /* version */ if (defaults != NIL) defaults = CDR(defaults); cdr = defaults == NIL ? NIL : CAR(defaults); RPLACD(cons, CONS(cdr, NIL)); /* string representation, must be done here to use defaults */ for (ptr = string + alength; ptr >= string; ptr--) { if (*ptr == PATH_SEP) break; } if (ptr >= string) ++ptr; else ptr = string; *ptr = '\0'; length = ptr - string; alength = namelen; if (alength) { if (length + alength + 2 > sizeof(string)) alength = sizeof(string) - length - 2; memcpy(string + length, namestr, alength); length += alength; } alength = typelen; if (alength) { if (length + 2 < sizeof(string)) string[length++] = PATH_TYPESEP; if (length + alength + 2 > sizeof(string)) alength = sizeof(string) - length - 2; memcpy(string + length, typestr, alength); length += alength; } string[length] = '\0'; RPLACA(result, LSTRING(string, length)); RETURN(0) = FIXNUM(end); result = PATHNAME(result); } else if (junk_allowed == UNSPEC || junk_allowed == NIL) LispDestroy("%s: bad argument %s", STRFUN(builtin), STROBJ(object)); else RETURN(0) = NIL; GC_LEAVE(); return (result); } LispObj * Lisp_MakePathname(LispBuiltin *builtin) /* make-pathname &key host device directory name type version defaults */ { GC_ENTER(); int length, alength; char *string, pathname[PATH_MAX + 1]; LispObj *result, *cdr, *cons; LispObj *host, *device, *directory, *name, *type, *version, *defaults; defaults = ARGUMENT(6); version = ARGUMENT(5); type = ARGUMENT(4); name = ARGUMENT(3); directory = ARGUMENT(2); device = ARGUMENT(1); host = ARGUMENT(0); if (host != UNSPEC) { CHECK_STRING(host); } if (device != UNSPEC) { CHECK_STRING(device); } if (directory != UNSPEC) { LispObj *dir; CHECK_CONS(directory); dir = CAR(directory); CHECK_KEYWORD(dir); if (dir != Kabsolute && dir != Krelative) LispDestroy("%s: directory type %s unknown", STRFUN(builtin), STROBJ(dir)); } if (name != UNSPEC) { CHECK_STRING(name); } if (type != UNSPEC) { CHECK_STRING(type); } if (version != UNSPEC && version != NIL) { switch (OBJECT_TYPE(version)) { case LispFixnum_t: if (FIXNUM_VALUE(version) >= 0) goto version_ok; case LispInteger_t: if (INT_VALUE(version) >= 0) goto version_ok; break; case LispDFloat_t: if (DFLOAT_VALUE(version) >= 0.0) goto version_ok; break; default: break; } LispDestroy("%s: %s is not a positive real number", STRFUN(builtin), STROBJ(version)); } version_ok: if (defaults != UNSPEC && !PATHNAMEP(defaults) && (host == UNSPEC || device == UNSPEC || directory == UNSPEC || name == UNSPEC || type == UNSPEC || version == UNSPEC)) { defaults = APPLY1(Oparse_namestring, defaults); GC_PROTECT(defaults); } if (defaults != UNSPEC) { defaults = defaults->data.pathname; defaults = CDR(defaults); /* host */ if (host == UNSPEC) host = CAR(defaults); defaults = CDR(defaults); /* device */ if (device == UNSPEC) device = CAR(defaults); defaults = CDR(defaults); /* directory */ if (directory == UNSPEC) directory = CAR(defaults); defaults = CDR(defaults); /* name */ if (name == UNSPEC) name = CAR(defaults); defaults = CDR(defaults); /* type */ if (type == UNSPEC) type = CAR(defaults); defaults = CDR(defaults); /* version */ if (version == UNSPEC) version = CAR(defaults); } /* string representation */ length = 0; if (CONSP(directory)) { if (CAR(directory) == Kabsolute) pathname[length++] = PATH_SEP; for (cdr = CDR(directory); CONSP(cdr); cdr = CDR(cdr)) { CHECK_STRING(CAR(cdr)); string = THESTR(CAR(cdr)); alength = STRLEN(CAR(cdr)); if (alength > NAME_MAX) LispDestroy("%s: directory name too long %s", STRFUN(builtin), string); if (length + alength + 2 > sizeof(pathname)) alength = sizeof(pathname) - length - 2; memcpy(pathname + length, string, alength); length += alength; pathname[length++] = PATH_SEP; } } if (STRINGP(name)) { int xlength = 0; if (STRINGP(type)) xlength = STRLEN(type) + 1; string = THESTR(name); alength = STRLEN(name); if (alength + xlength > NAME_MAX) LispDestroy("%s: file name too long %s", STRFUN(builtin), string); if (length + alength + 2 > sizeof(pathname)) alength = sizeof(pathname) - length - 2; memcpy(pathname + length, string, alength); length += alength; } if (STRINGP(type)) { if (length + 2 < sizeof(pathname)) pathname[length++] = PATH_TYPESEP; string = THESTR(type); alength = STRLEN(type); if (length + alength + 2 > sizeof(pathname)) alength = sizeof(pathname) - length - 2; memcpy(pathname + length, string, alength); length += alength; } pathname[length] = '\0'; result = cons = CONS(LSTRING(pathname, length), NIL); GC_PROTECT(result); /* host */ RPLACD(cons, CONS(host == UNSPEC ? NIL : host, NIL)); cons = CDR(cons); /* device */ RPLACD(cons, CONS(device == UNSPEC ? NIL : device, NIL)); cons = CDR(cons); /* directory */ if (directory == UNSPEC) cdr = CONS(Krelative, NIL); else cdr = directory; RPLACD(cons, CONS(cdr, NIL)); cons = CDR(cons); /* name */ RPLACD(cons, CONS(name == UNSPEC ? NIL : name, NIL)); cons = CDR(cons); /* type */ RPLACD(cons, CONS(type == UNSPEC ? NIL : type, NIL)); cons = CDR(cons); /* version */ RPLACD(cons, CONS(version == UNSPEC ? NIL : version, NIL)); GC_LEAVE(); return (PATHNAME(result)); } LispObj * Lisp_PathnameHost(LispBuiltin *builtin) /* pathname-host pathname */ { return (LispPathnameField(PATH_HOST, 0)); } LispObj * Lisp_PathnameDevice(LispBuiltin *builtin) /* pathname-device pathname */ { return (LispPathnameField(PATH_DEVICE, 0)); } LispObj * Lisp_PathnameDirectory(LispBuiltin *builtin) /* pathname-device pathname */ { return (LispPathnameField(PATH_DIRECTORY, 0)); } LispObj * Lisp_PathnameName(LispBuiltin *builtin) /* pathname-name pathname */ { return (LispPathnameField(PATH_NAME, 0)); } LispObj * Lisp_PathnameType(LispBuiltin *builtin) /* pathname-type pathname */ { return (LispPathnameField(PATH_TYPE, 0)); } LispObj * Lisp_PathnameVersion(LispBuiltin *builtin) /* pathname-version pathname */ { return (LispPathnameField(PATH_VERSION, 0)); } LispObj * Lisp_FileNamestring(LispBuiltin *builtin) /* file-namestring pathname */ { return (LispPathnameField(PATH_NAME, 1)); } LispObj * Lisp_DirectoryNamestring(LispBuiltin *builtin) /* directory-namestring pathname */ { return (LispPathnameField(PATH_DIRECTORY, 1)); } LispObj * Lisp_EnoughNamestring(LispBuiltin *builtin) /* enough-pathname pathname &optional defaults */ { LispObj *pathname, *defaults; defaults = ARGUMENT(1); pathname = ARGUMENT(0); if (defaults != UNSPEC && defaults != NIL) { char *ppathname, *pdefaults, *pp, *pd; if (!STRINGP(pathname)) { if (PATHNAMEP(pathname)) pathname = CAR(pathname->data.pathname); else if (STREAMP(pathname) && pathname->data.stream.type == LispStreamFile) pathname = CAR(pathname->data.stream.pathname->data.pathname); else LispDestroy("%s: bad PATHNAME %s", STRFUN(builtin), STROBJ(pathname)); } if (!STRINGP(defaults)) { if (PATHNAMEP(defaults)) defaults = CAR(defaults->data.pathname); else if (STREAMP(defaults) && defaults->data.stream.type == LispStreamFile) defaults = CAR(defaults->data.stream.pathname->data.pathname); else LispDestroy("%s: bad DEFAULTS %s", STRFUN(builtin), STROBJ(defaults)); } ppathname = pp = THESTR(pathname); pdefaults = pd = THESTR(defaults); while (*ppathname && *pdefaults && *ppathname == *pdefaults) { ppathname++; pdefaults++; } if (*pdefaults == '\0' && pdefaults > pd) --pdefaults; if (*ppathname && *pdefaults && *pdefaults != PATH_SEP) { --ppathname; while (*ppathname != PATH_SEP && ppathname > pp) --ppathname; if (*ppathname == PATH_SEP) ++ppathname; } return (STRING(ppathname)); } else { if (STRINGP(pathname)) return (pathname); else if (PATHNAMEP(pathname)) return (CAR(pathname->data.pathname)); else if (STREAMP(pathname)) { if (pathname->data.stream.type == LispStreamFile) return (CAR(pathname->data.stream.pathname->data.pathname)); } } LispDestroy("%s: bad PATHNAME %s", STRFUN(builtin), STROBJ(pathname)); return (NIL); } LispObj * Lisp_Namestring(LispBuiltin *builtin) /* namestring pathname */ { return (LispPathnameField(PATH_STRING, 1)); } LispObj * Lisp_HostNamestring(LispBuiltin *builtin) /* host-namestring pathname */ { return (LispPathnameField(PATH_HOST, 1)); } LispObj * Lisp_Pathnamep(LispBuiltin *builtin) /* pathnamep object */ { LispObj *object; object = ARGUMENT(0); return (PATHNAMEP(object) ? T : NIL); } /* XXX only checks if host is a string and only checks the HOME enviroment * variable */ LispObj * Lisp_UserHomedirPathname(LispBuiltin *builtin) /* user-homedir-pathname &optional host */ { GC_ENTER(); int length; char *home = getenv("HOME"), data[PATH_MAX + 1]; LispObj *result; LispObj *host; host = ARGUMENT(0); if (host != UNSPEC && !STRINGP(host)) LispDestroy("%s: bad hostname %s", STRFUN(builtin), STROBJ(host)); length = 0; if (home) { length = strlen(home); strncpy(data, home, length); if (length && home[length - 1] != PATH_SEP) data[length++] = PATH_SEP; } data[length] = '\0'; result = LSTRING(data, length); GC_PROTECT(result); result = APPLY1(Oparse_namestring, result); GC_LEAVE(); return (result); } LispObj * Lisp_Truename(LispBuiltin *builtin) { return (LispProbeFile(builtin, 0)); } LispObj * Lisp_ProbeFile(LispBuiltin *builtin) { return (LispProbeFile(builtin, 1)); } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp/read.h0000664000000000000000000000335512472175711015356 0ustar /* * Copyright (c) 2002 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp/read.h,v 1.3tsi Exp $ */ #ifndef Lisp_read_h #define Lisp_read_h #include "lisp/io.h" /* * Prototypes */ LispObj *LispRead(void); LispObj *Lisp_Read(LispBuiltin*); LispObj *Lisp_ReadChar(LispBuiltin*); LispObj *Lisp_ReadCharNoHang(LispBuiltin*); LispObj *Lisp_ReadLine(LispBuiltin*); #endif /* Lisp_read_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/util.h0000664000000000000000000000511112472175711014441 0ustar /* * Copyright (c) 2007,2008 Paulo Cesar Pereira de Andrade * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Author: Paulo Cesar Pereira de Andrade */ /* Generic hash table */ #ifndef _util_h #define _util_h /* * Types */ typedef struct _hash_key hash_key; typedef struct _hash_entry hash_entry; typedef struct _hash_table hash_table; typedef int (*hash_compare)(hash_key *left, hash_key *right); struct _hash_key { char *value; unsigned int length; }; struct _hash_entry { hash_key *key; hash_entry *next; }; struct _hash_table { hash_entry **entries; unsigned int count; /* length of entries */ unsigned int length; /* sum of entries */ hash_compare compare; struct { int offset; hash_entry *entry; } iter; }; /* * Prototypes */ hash_table *hash_new(unsigned int length, hash_compare compare); hash_entry *hash_put(hash_table *hash, hash_entry *entry); hash_entry *hash_get(hash_table *hash, hash_key *name); hash_entry * hash_check(hash_table *hash, const char *name, unsigned int length); void hash_rem(hash_table *hash, hash_entry *entry); /* Removes from hash table but doesn't release any memory */ hash_entry *hash_rem_no_free(hash_table *hash, hash_entry *entry); void hash_rehash(hash_table *hash, unsigned int length); hash_entry *hash_iter_first(hash_table *hash); hash_entry *hash_iter_next(hash_table *hash); /* Frees all data. When casting to another type, use the * iterator to free extra data */ void hash_clr(hash_table *hash); void hash_del(hash_table *hash); #endif /* _util_h */ x11-apps-7.7+5+nmu1ubuntu1/xedit/hash.c0000664000000000000000000001724412472175711014414 0ustar /* * Copyright (c) 2007,2008 Paulo Cesar Pereira de Andrade * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Author: Paulo Cesar Pereira de Andrade */ #include "util.h" #include #include /* * This is a very simplified and adapted version of the hash tables I am * using in a personal project. It was added to try to have a single hash * table implementation in xedit. The lisp (for user code) version was not * converted, but the following hastables have been converted: * ispell.c - list of replace and ignore words * hook.c - list of auto replace words * internal lisp data structures: * atoms * strings * packages * opaque types * also, all code traversing hash tables is now using * hash_iter_first() and hash_iter_next() * conversion isn't as good as I originally wanted, code is using hash_check * instead of hash_get, but this is due to the code not having a basic * { void *data; int length; } object to store string like objects * * Also, this hash table implementation was added mainly for the tags * support. */ /* * Prototypes */ static int hash_equal(hash_table *hash, hash_key *left, hash_key *right); static unsigned int hash_value(hash_key *key); /* * Implementation */ static int hash_equal(hash_table *hash, hash_key *left, hash_key *right) { if (left->length == right->length) { if (left == right) return (1); if (hash->compare) return (hash->compare(left, right)); return (memcmp(left->value, right->value, left->length) == 0); } return (0); } static unsigned int hash_data(const char *value, unsigned int length) { const char *ptr; unsigned int i, key; for (i = key = 0, ptr = value; i < length; i++) key = (key << (key & 1)) ^ ptr[i]; return (key); } static unsigned int hash_value(hash_key *key) { return (hash_data(key->value, key->length)); } hash_table * hash_new(unsigned int length, hash_compare compare) { hash_table *hash; hash = calloc(1, sizeof(hash_table)); if (hash) { hash->entries = calloc(length, sizeof(hash_entry *)); if (hash->entries) { hash->length = length; hash->compare = compare; hash->iter.offset = -1; } else { free(hash); hash = (hash_table *)0; } } return (hash); } hash_entry * hash_put(hash_table *hash, hash_entry *entry) { unsigned int key; hash_entry *prev, *ptr; /* Offset in hash table vector for this entry */ key = hash_value(entry->key) % hash->length; /* We hope this is nil for most calls */ ptr = hash->entries[key]; /* Check if clashed with another entry */ for (prev = ptr; ptr; prev = ptr, ptr = ptr->next) { /* Replace current entry */ if (hash_equal(hash, entry->key, ptr->key)) { /* If not trying to readd same value */ if (entry != ptr) { if (ptr == prev) hash->entries[key] = entry; else prev->next = entry; entry->next = ptr->next; /* Finished */ } else ptr = (hash_entry *)0; goto hash_put_done; } } /* Add new entry */ if (prev == (hash_entry *)0) /* If no entry in offset */ hash->entries[key] = entry; else /* Add to end of clashing list */ prev->next = entry; entry->next = (hash_entry *)0; /* Increase sum of entries counter*/ ++hash->count; hash_put_done: /* ptr will be nil if no entry was replaced, of tried to add * again an entry already in the hash table */ return (ptr); } hash_entry * hash_get(hash_table *hash, hash_key *name) { unsigned int key; hash_entry *entry; key = hash_value(name) % hash->length; for (entry = hash->entries[key]; entry; entry = entry->next) { if (hash_equal(hash, name, entry->key)) { return (entry); } } return ((hash_entry *)0); } hash_entry * hash_check(hash_table *hash, const char *name, unsigned int length) { unsigned int key; hash_entry *entry; key = hash_data(name, length) % hash->length; for (entry = hash->entries[key]; entry; entry = entry->next) { if (length == entry->key->length && memcmp(name, entry->key->value, length) == 0) { return (entry); } } return ((hash_entry *)0); } hash_entry * hash_rem_no_free(hash_table *hash, hash_entry *entry) { unsigned int key; hash_entry *ptr, *prev; key = hash_value(entry->key) % hash->length; for (ptr = prev = hash->entries[key]; ptr; prev = ptr, ptr = ptr->next) { if (ptr == entry) { --hash->count; if (ptr == prev) hash->entries[key] = ptr->next; else prev->next = ptr->next; break; } } if (ptr && ptr == hash->iter.entry) hash->iter.entry = ptr->next; /* If entry wasn't in hash table ptr will be nil */ return (ptr); } void hash_rem(hash_table *hash, hash_entry *entry) { entry = hash_rem_no_free(hash, entry); if (entry) { free(entry->key->value); free(entry->key); free(entry); } } void hash_rehash(hash_table *hash, unsigned int length) { unsigned int i, key; hash_entry *entry, *next, **entries; entries = (hash_entry **)calloc(length, sizeof(hash_entry *)); if (entries) { /* Populate the new table, note that clashes are now in reverse order */ for (i = 0; i < hash->length; i++) { for (entry = hash->entries[i]; entry; entry = next) { next = entry->next; key = hash_value(entry->key) % length; entry->next = entries[key]; entries[key] = entry; } } /* Finish updating hash table */ free(hash->entries); hash->entries = entries; hash->length = length; } hash->iter.offset = -1; } hash_entry * hash_iter_first(hash_table *hash) { hash->iter.offset = 0; hash->iter.entry = (hash_entry *)0; return (hash_iter_next(hash)); } hash_entry * hash_iter_next(hash_table *hash) { if (hash->iter.offset >= 0) { if (hash->iter.entry) { if ((hash->iter.entry = hash->iter.entry->next)) return (hash->iter.entry); ++hash->iter.offset; } for (; hash->iter.offset < hash->length; hash->iter.offset++) { if ((hash->iter.entry = hash->entries[hash->iter.offset])) return (hash->iter.entry); } hash->iter.entry = (hash_entry *)0; hash->iter.offset = -1; } return ((hash_entry *)0); } void hash_clr(hash_table *hash) { unsigned int i; hash_entry *entry, *next; /* Extra data should be free'd with the iterator */ for (i = 0; i < hash->length; i++) { entry = hash->entries[i]; if (entry) { for (next = entry; entry; entry = next) { next = entry->next; free(entry->key->value); free(entry->key); free(entry); } hash->entries[i] = (hash_entry *)0; } } hash->count = 0; hash->iter.offset = -1; } void hash_del(hash_table *hash) { hash_clr(hash); free(hash->entries); free(hash); } x11-apps-7.7+5+nmu1ubuntu1/xedit/options.c0000664000000000000000000004003212472175711015153 0ustar /* * Copyright (c) 1999 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/options.c,v 1.13 2002/09/22 07:09:05 paulo Exp $ */ #include #include #include "xedit.h" #include #include /* * Prototypes */ static void SetColumns(Widget, XEvent*, String*, Cardinal*); static void ChangeField(Widget, XEvent*, String*, Cardinal*); static void EditCallback(Widget, XtPointer, XtPointer); static void PopupColumnsCallback(Widget, XtPointer, XtPointer); static void CreateColumnsShell(void); static void ProcessColumnsCallback(Widget, XtPointer, XtPointer); /* * Initialization */ extern Widget texts[3]; static Widget edit_popup, wrap_popup, justify_popup, scroll_popup, columns_shell, left_text, right_text; static XFontStruct *fonts[3]; static Pixel foregrounds[3], backgrounds[3]; static XtActionsRec actions[] = { {"set-columns", SetColumns}, {"change-field", ChangeField}, }; #define WRAP_NEVER 1 #define WRAP_LINE 2 #define WRAP_WORD 3 #define AUTO_FILL 4 #define JUST_LEFT 5 #define JUST_RIGHT 6 #define JUST_CENTER 7 #define JUST_FULL 8 #define SCROLL_VERT 9 #define SCROLL_HORIZ 10 static Widget autoFill, wrapNever, wrapLine, wrapWord, justifyLeft, justifyRight, justifyCenter, justifyFull, breakColumns, scrollVert, scrollHoriz; void CreateEditPopup(void) { Arg args[1]; edit_popup = XtCreatePopupShell("editMenu", simpleMenuWidgetClass, topwindow, NULL, 0); XtRealizeWidget(edit_popup); wrap_popup = XtCreatePopupShell("wrapMenu", simpleMenuWidgetClass, edit_popup, NULL, 0); XtRealizeWidget(wrap_popup); XtSetArg(args[0], XtNmenuName, "wrapMenu"); XtCreateManagedWidget("wrapMenuItem", smeBSBObjectClass, edit_popup, args, 1); wrapNever = XtCreateManagedWidget("never", smeBSBObjectClass, wrap_popup, NULL, 0); XtAddCallback(wrapNever, XtNcallback, EditCallback, (XtPointer)WRAP_NEVER); wrapLine = XtCreateManagedWidget("line", smeBSBObjectClass, wrap_popup, NULL, 0); XtAddCallback(wrapLine, XtNcallback, EditCallback, (XtPointer)WRAP_LINE); wrapWord = XtCreateManagedWidget("word", smeBSBObjectClass, wrap_popup, NULL, 0); XtAddCallback(wrapWord, XtNcallback, EditCallback, (XtPointer)WRAP_WORD); autoFill = XtCreateManagedWidget("autoFill", smeBSBObjectClass, edit_popup, NULL, 0); XtAddCallback(autoFill, XtNcallback, EditCallback, (XtPointer)AUTO_FILL); justify_popup = XtCreatePopupShell("justifyMenu", simpleMenuWidgetClass, edit_popup, NULL, 0); XtRealizeWidget(justify_popup); XtSetArg(args[0], XtNmenuName, "justifyMenu"); XtCreateManagedWidget("justifyMenuItem", smeBSBObjectClass, edit_popup, args, 1); justifyLeft = XtCreateManagedWidget("left", smeBSBObjectClass, justify_popup, NULL, 0); XtAddCallback(justifyLeft, XtNcallback, EditCallback, (XtPointer)JUST_LEFT); justifyRight = XtCreateManagedWidget("right", smeBSBObjectClass, justify_popup, NULL, 0); XtAddCallback(justifyRight, XtNcallback, EditCallback, (XtPointer)JUST_RIGHT); justifyCenter = XtCreateManagedWidget("center", smeBSBObjectClass, justify_popup, NULL, 0); XtAddCallback(justifyCenter, XtNcallback, EditCallback, (XtPointer)JUST_CENTER); justifyFull = XtCreateManagedWidget("full", smeBSBObjectClass, justify_popup, NULL, 0); XtAddCallback(justifyFull, XtNcallback, EditCallback, (XtPointer)JUST_FULL); breakColumns = XtCreateManagedWidget("breakColumns", smeBSBObjectClass, edit_popup, NULL, 0); XtAddCallback(breakColumns, XtNcallback, PopupColumnsCallback, NULL); scroll_popup = XtCreatePopupShell("scrollMenu", simpleMenuWidgetClass, edit_popup, NULL, 0); XtRealizeWidget(scroll_popup); XtSetArg(args[0], XtNmenuName, "scrollMenu"); XtCreateManagedWidget("scrollMenuItem", smeBSBObjectClass, edit_popup, args, 1); scrollVert = XtCreateManagedWidget("vertical", smeBSBObjectClass, scroll_popup, NULL, 0); XtAddCallback(scrollVert, XtNcallback, EditCallback, (XtPointer)SCROLL_VERT); scrollHoriz = XtCreateManagedWidget("horizontal", smeBSBObjectClass, scroll_popup, NULL, 0); XtAddCallback(scrollHoriz, XtNcallback, EditCallback, (XtPointer)SCROLL_HORIZ); CreateEditModePopup(edit_popup); } void SetEditMenu(void) { Arg args[7]; Cardinal num_args; Boolean auto_fill; XawTextWrapMode wrap_mode; XawTextJustifyMode justify; XawTextScrollMode vscroll, hscroll; short left, right; num_args = 0; XtSetArg(args[num_args], XtNwrap, &wrap_mode); ++num_args; XtSetArg(args[num_args], XtNautoFill, &auto_fill); ++num_args; XtSetArg(args[num_args], XtNjustifyMode, &justify); ++num_args; XtSetArg(args[num_args], XtNleftColumn, &left); ++num_args; XtSetArg(args[num_args], XtNrightColumn, &right); ++num_args; XtSetArg(args[num_args], XtNscrollVertical, &vscroll); ++num_args; XtSetArg(args[num_args], XtNscrollHorizontal, &hscroll); ++num_args; XtGetValues(textwindow, args, num_args); if (flist.pixmap) { XtSetArg(args[0], XtNleftBitmap, None); XtSetArg(args[1], XtNleftBitmap, flist.pixmap); if (!auto_fill) XtSetValues(autoFill, &args[0], 1); else XtSetValues(autoFill, &args[1], 1); switch (wrap_mode) { case XawtextWrapNever: XtSetValues(wrapLine, &args[0], 1); XtSetValues(wrapWord, &args[0], 1); XtSetValues(wrapNever, &args[1], 1); break; case XawtextWrapLine: XtSetValues(wrapNever, &args[0], 1); XtSetValues(wrapWord, &args[0], 1); XtSetValues(wrapLine, &args[1], 1); break; case XawtextWrapWord: XtSetValues(wrapNever, &args[0], 1); XtSetValues(wrapLine, &args[0], 1); XtSetValues(wrapWord, &args[1], 1); break; } switch (justify) { case XawjustifyLeft: XtSetValues(justifyRight, &args[0], 1); XtSetValues(justifyCenter, &args[0], 1); XtSetValues(justifyFull, &args[0], 1); XtSetValues(justifyLeft, &args[1], 1); break; case XawjustifyRight: XtSetValues(justifyLeft, &args[0], 1); XtSetValues(justifyCenter, &args[0], 1); XtSetValues(justifyFull, &args[0], 1); XtSetValues(justifyRight, &args[1], 1); break; case XawjustifyCenter: XtSetValues(justifyLeft, &args[0], 1); XtSetValues(justifyRight, &args[0], 1); XtSetValues(justifyFull, &args[0], 1); XtSetValues(justifyCenter, &args[1], 1); break; case XawjustifyFull: XtSetValues(justifyLeft, &args[0], 1); XtSetValues(justifyRight, &args[0], 1); XtSetValues(justifyCenter, &args[0], 1); XtSetValues(justifyFull, &args[1], 1); break; } if (!vscroll) XtSetValues(scrollVert, &args[0], 1); else XtSetValues(scrollVert, &args[1], 1); if (!hscroll) XtSetValues(scrollHoriz, &args[0], 1); else XtSetValues(scrollHoriz, &args[1], 1); } if (!auto_fill) { XtSetSensitive(wrapNever, True); XtSetSensitive(wrapLine, True); XtSetSensitive(wrapWord, True); XtSetSensitive(justifyLeft, False); XtSetSensitive(justifyRight, False); XtSetSensitive(justifyCenter, False); XtSetSensitive(justifyFull, False); XtSetSensitive(breakColumns, False); } else { XtSetSensitive(wrapNever, False); XtSetSensitive(wrapLine, False); XtSetSensitive(wrapWord, False); XtSetSensitive(justifyLeft, left < right); XtSetSensitive(justifyRight, left < right); XtSetSensitive(justifyCenter, left < right); XtSetSensitive(justifyFull, left < right); XtSetSensitive(breakColumns, True); } SetEditModeMenu(); } /*ARGSUSED*/ static void EditCallback(Widget sme, XtPointer client_data, XtPointer call_data) { Arg args[1]; Boolean auto_fill; XawTextScrollMode scroll; xedit_flist_item *item = FindTextSource(XawTextGetSource(textwindow), NULL); Bool foreach = False; switch ((long)client_data) { case WRAP_NEVER: XtSetArg(args[0], XtNwrap, XawtextWrapNever); if (item) { item->flags |= WRAP_BIT; item->wrap = XawtextWrapNever; foreach = True; } break; case WRAP_LINE: XtSetArg(args[0], XtNwrap, XawtextWrapLine); if (item) { item->flags |= WRAP_BIT; item->wrap = XawtextWrapLine; foreach = True; } break; case WRAP_WORD: XtSetArg(args[0], XtNwrap, XawtextWrapWord); if (item) { item->flags |= WRAP_BIT; item->wrap = XawtextWrapWord; foreach = True; } break; case AUTO_FILL: XtSetArg(args[0], XtNautoFill, &auto_fill); XtGetValues(textwindow, args, 1); XtSetArg(args[0], XtNautoFill, !auto_fill); break; case JUST_LEFT: XtSetArg(args[0], XtNjustifyMode, XawjustifyLeft); break; case JUST_RIGHT: XtSetArg(args[0], XtNjustifyMode, XawjustifyRight); break; case JUST_CENTER: XtSetArg(args[0], XtNjustifyMode, XawjustifyCenter); break; case JUST_FULL: XtSetArg(args[0], XtNjustifyMode, XawjustifyFull); break; case SCROLL_VERT: XtSetArg(args[0], XtNscrollVertical, &scroll); XtGetValues(textwindow, args, 1); XtSetArg(args[0], XtNscrollVertical, scroll == XawtextScrollNever ? XawtextScrollAlways : XawtextScrollNever); break; case SCROLL_HORIZ: XtSetArg(args[0], XtNscrollHorizontal, &scroll); XtGetValues(textwindow, args, 1); XtSetArg(args[0], XtNscrollHorizontal, scroll == XawtextScrollNever ? XawtextScrollAlways : XawtextScrollNever); break; } if (foreach) { int i; for (i = 0; i < 3; i++) XtSetValues(texts[i], args, 1); } else XtSetValues(textwindow, args, 1); } static void CreateColumnsShell(void) { Atom delete_window; Widget form, ok, cancel; if (columns_shell) return; XtAppAddActions(XtWidgetToApplicationContext(topwindow), actions, XtNumber(actions)); columns_shell = XtCreatePopupShell("columns", transientShellWidgetClass, topwindow, NULL, 0); form = XtCreateManagedWidget("form", formWidgetClass, columns_shell, NULL, 0); XtCreateManagedWidget("leftLabel", labelWidgetClass, form, NULL, 0); left_text = XtVaCreateManagedWidget("left", asciiTextWidgetClass, form, XtNeditType, XawtextEdit, NULL); XtCreateManagedWidget("rightLabel", labelWidgetClass, form, NULL, 0); right_text = XtVaCreateManagedWidget("right", asciiTextWidgetClass, form, XtNeditType, XawtextEdit, NULL); ok = XtCreateManagedWidget("ok", commandWidgetClass, form, NULL, 0); XtAddCallback(ok, XtNcallback, ProcessColumnsCallback, (XtPointer)True); cancel = XtCreateManagedWidget("cancel", commandWidgetClass, form, NULL, 0); XtAddCallback(cancel, XtNcallback, ProcessColumnsCallback, (XtPointer)False); XtRealizeWidget(columns_shell); delete_window = XInternAtom(XtDisplay(columns_shell), "WM_DELETE_WINDOW", False); XSetWMProtocols(XtDisplay(columns_shell), XtWindow(columns_shell), &delete_window, 1); XtSetKeyboardFocus(columns_shell, left_text); } /*ARGSUSED*/ static void PopupColumnsCallback(Widget w, XtPointer client_data, XtPointer call_data) { Arg args[3]; char sleft[6], sright[6]; short left, right; Dimension width, height, b_width; Window r, c; int x, y, wx, wy, max_x, max_y; unsigned mask; CreateColumnsShell(); XQueryPointer(XtDisplay(columns_shell), XtWindow(columns_shell), &r, &c, &x, &y, &wx, &wy, &mask); XtSetArg(args[0], XtNwidth, &width); XtSetArg(args[1], XtNheight, &height); XtSetArg(args[2], XtNborderWidth, &b_width); XtGetValues(columns_shell, args, 3); width += b_width << 1; height += b_width << 1; x -= (Position)(width >> 1); if (x < 0) x = 0; if (x > (max_x = (Position)(XtScreen(columns_shell)->width - width))) x = max_x; y -= (Position)(height >> 1); if (y < 0) y = 0; if (y > (max_y = (Position)(XtScreen(columns_shell)->height - height))) y = max_y; XtSetArg(args[0], XtNx, x); XtSetArg(args[1], XtNy, y); XtSetValues(columns_shell, args, 2); XtSetArg(args[0], XtNleftColumn, &left); XtSetArg(args[1], XtNrightColumn, &right); XtGetValues(textwindow, args, 2); XmuSnprintf(sleft, sizeof(sleft), "%d", left); XmuSnprintf(sright, sizeof(sright), "%d", right); XtSetArg(args[0], XtNstring, sleft); XtSetValues(left_text, args, 1); XtSetArg(args[0], XtNstring, sright); XtSetValues(right_text, args, 1); XtPopup(columns_shell, XtGrabExclusive); } /*ARGSUSED*/ static void ProcessColumnsCallback(Widget w, XtPointer client_data, XtPointer call_data) { if (client_data) { Arg args[2]; char *left, *right; short leftc, rightc; left = GetString(left_text); right = GetString(right_text); leftc = atoi(left); rightc = atoi(right); XtSetArg(args[0], XtNleftColumn, leftc); XtSetArg(args[1], XtNrightColumn, rightc); XtSetValues(textwindow, args, 2); } XtPopdown(columns_shell); } /*ARGSUSED*/ static void SetColumns(Widget w, XEvent *event, String *params, Cardinal *num_params) { Bool ok = False; if (*num_params && (params[0][0] == 'o' || params[0][0] == 'O')) ok = True; ProcessColumnsCallback(w, (XtPointer)(long)ok, NULL); } /*ARGSUSED*/ static void ChangeField(Widget w, XEvent *event, String *params, Cardinal *num_params) { Widget focus = XtGetKeyboardFocusWidget(columns_shell); XtSetKeyboardFocus(columns_shell, focus == left_text ? right_text : left_text); } void UpdateTextProperties(int force) { Arg args[4]; Cardinal num_args; xedit_flist_item *item; XawTextPropertyList *prop; Widget text, source, sink; int i; /* save default information */ if (fonts[0] == NULL) { for (i = 0; i < 3; i++) { num_args = 0; XtSetArg(args[num_args], XtNfont, &fonts[i]); ++num_args; XtSetArg(args[num_args], XtNforeground, &foregrounds[i]); ++num_args; XtSetArg(args[num_args], XtNbackground, &backgrounds[i]); ++num_args; XtGetValues(XawTextGetSink(texts[i]), args, num_args); } } for (i = 0; i < 3; i++) { text = texts[i]; source = XawTextGetSource(text); sink = XawTextGetSink(text); item = FindTextSource(source, NULL); XtSetArg(args[0], XawNtextProperties, &prop); XtGetValues(sink, args, 1); if (item == NULL || (!force && prop == item->properties)) continue; XtSetArg(args[0], XawNtextProperties, item->properties); num_args = 1; if (item->properties == NULL) { XtSetArg(args[num_args], XtNfont, fonts[i]); ++num_args; XtSetArg(args[num_args], XtNforeground, foregrounds[i]); ++num_args; XtSetArg(args[num_args], XtNbackground, backgrounds[i]); ++num_args; } XtSetValues(sink, args, num_args); if (text == textwindow) { XtSetArg(args[0], XtNdisplayCaret, False); XtSetValues(text, args, 1); } _XawTextBuildLineTable((TextWidget)text, XawTextTopPosition(text), True); XawTextDisplay(text); if (text == textwindow) { XtSetArg(args[0], XtNdisplayCaret, True); XtSetValues(text, args, 1); } } } x11-apps-7.7+5+nmu1ubuntu1/xedit/lisp.c0000664000000000000000000001620212472175711014431 0ustar /* * Copyright (c) 2001 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XFree86: xc/programs/xedit/lisp.c,v 1.20tsi Exp $ */ #include "xedit.h" #include "lisp/lisp.h" #include "lisp/xedit.h" #include #include #include #include #include /* * Prototypes */ static void XeditDoLispEval(Widget); static void EditModeCallback(Widget, XtPointer, XtPointer); /* * Initialization */ static int lisp_initialized; extern Widget scratch; static Widget edit_mode_menu, edit_mode_entry, edit_mode_none; /* * Implementation */ void XeditLispInitialize(void) { setlocale(LC_NUMERIC, "C"); lisp_initialized = 1; LispBegin(); LispXeditInitialize(); } void XeditLispCleanUp(void) { LispEnd(); } void XeditLispEval(Widget w, XEvent *event, String *params, Cardinal *num_params) { XeditDoLispEval(messwidget); } void XeditPrintLispEval(Widget w, XEvent *event, String *params, Cardinal *num_params) { if (XawTextGetSource(w) == scratch) { XtCallActionProc(w, "newline", event, params, *num_params); XeditDoLispEval(w); } else XtCallActionProc(w, "newline-and-indent", event, params, *num_params); } void XeditKeyboardReset(Widget w, XEvent *event, String *params, Cardinal *num_params) { XtCallActionProc(w, "keyboard-reset", event, params, *num_params); } void SetTextProperties(xedit_flist_item *item) { if (lisp_initialized) { Widget source = XawTextGetSource(textwindow); XawTextPosition top = XawTextTopPosition(textwindow); if (source != item->source) XawTextSetSource(textwindow, item->source, 0); XeditLispSetEditMode(item, NULL); if (source != item->source) XawTextSetSource(textwindow, source, top); } } void UnsetTextProperties(xedit_flist_item *item) { XeditLispUnsetEditMode(item); } static void XeditDoLispEval(Widget output) { Widget src; XawTextBlock block; XawTextPosition position, end; /* get lisp expression */ src = XawTextGetSource(textwindow); position = XawTextGetInsertionPoint(textwindow); --position; while (position >= 0) { (void)XawTextSourceRead(src, position, &block, 1); if (!isspace(block.ptr[0])) break; --position; } end = position + 1; if (block.ptr[0] != ')') { while (position >= 0) { (void)XawTextSourceRead(src, position, &block, 1); if (isspace(block.ptr[0]) || block.ptr[0] == '(' || block.ptr[0] == ')' || block.ptr[0] == '"' || block.ptr[0] == '|') break; --position; } if (!isspace(block.ptr[0])) ++position; } else { /* XXX note that embedded '(' and ')' will confuse this code */ XawTextPosition last, tmp; int level = 0; char ptr[2]; last = position; ptr[1] = '\0'; block.ptr = ptr; do { block.ptr[0] = '('; position = XawTextSourceSearch(src, last, XawsdLeft, &block); if (position == XawTextSearchError) { Feep(); return; } block.ptr[0] = ')'; tmp = position; do { tmp = XawTextSourceSearch(src, tmp, XawsdRight, &block); if (tmp == XawTextSearchError) { Feep(); return; } if (tmp <= last) ++level; } while (++tmp <= last); --level; last = position; } while (level); /* check for extra characters */ while (position > 0) { (void)XawTextSourceRead(src, position - 1, &block, 1); if (block.length != 1 || isspace(block.ptr[0]) || block.ptr[0] == ')' || block.ptr[0] == '"' || block.ptr[0] == '|') break; --position; } } if (position < 0 || position >= end) Feep(); else XeditLispExecute(output, position, end); } void CreateEditModePopup(Widget parent) { int i; Widget sme; static char *editModes = "editModes"; XtVaCreateManagedWidget("modeMenuItem", smeBSBObjectClass, parent, XtNmenuName, editModes, NULL); edit_mode_menu = XtCreatePopupShell(editModes, simpleMenuWidgetClass, parent, NULL, 0); XtRealizeWidget(edit_mode_menu); edit_mode_none = XtCreateManagedWidget("none", smeBSBObjectClass, edit_mode_menu, NULL, 0); XtAddCallback(edit_mode_none, XtNcallback, EditModeCallback, NULL); for (i = 0; i < num_mode_infos; i++) { sme = XtVaCreateManagedWidget("mode", smeBSBObjectClass, edit_mode_menu, XtNlabel, mode_infos[i].desc, NULL); XtAddCallback(sme, XtNcallback, EditModeCallback, (XtPointer)(mode_infos + i)); mode_infos[i].sme = sme; } } void SetEditModeMenu(void) { int i; Widget old_entry = edit_mode_entry, new_entry = edit_mode_none; xedit_flist_item *item = FindTextSource(XawTextGetSource(textwindow), NULL); for (i = 0; i < num_mode_infos; i++) { if (item->xldata && item->xldata->syntax && mode_infos[i].syntax == item->xldata->syntax) { new_entry = mode_infos[i].sme; break; } } if (old_entry != new_entry) { if (old_entry) XtVaSetValues(old_entry, XtNleftBitmap, None, NULL); XtVaSetValues(new_entry, XtNleftBitmap, flist.pixmap, NULL); edit_mode_entry = new_entry; } } static void EditModeCallback(Widget w, XtPointer client_data, XtPointer call_data) { Widget source = XawTextGetSource(textwindow); EditModeInfo *info = (EditModeInfo*)client_data; xedit_flist_item *item = FindTextSource(source, NULL); /* If no edit mode selected and selecting the plain/none mode */ if ((info == NULL && (item->xldata == NULL || item->xldata->syntax == NULL)) || /* if selecting the current mode */ (info && item && item->xldata && info->syntax && info->syntax == item->xldata->syntax)) return; XawTextSourceClearEntities(source, XawTextSourceScan(source, 0, XawstAll, XawsdLeft, 1, True), XawTextSourceScan(source, 0, XawstAll, XawsdRight, 1, True)); XeditLispUnsetEditMode(item); if (info) XeditLispSetEditMode(item, info->symbol); else item->properties = NULL; UpdateTextProperties(1); } x11-apps-7.7+5+nmu1ubuntu1/xedit/strcasecmp.c0000664000000000000000000000156212472175711015631 0ustar /* $XFree86: xc/programs/xedit/strcasecmp.c,v 1.1 1999/06/14 02:38:07 dawes Exp $ */ #include #include #ifndef LISP #include "xedit.h" #endif /* Just like the BSD version. It assumes that tolower() is ANSI-compliant */ int strcasecmp(const char *s1, const char *s2) { const unsigned char *us1 = (const unsigned char *)s1; const unsigned char *us2 = (const unsigned char *)s2; while (tolower(*us1) == tolower(*us2++)) if (*us1++ == '\0') return 0; return tolower(*us1) - tolower(*--us2); } int strncasecmp(const char *s1, const char *s2, size_t n) { if (n != 0) { const unsigned char *us1 = (const unsigned char *)s1; const unsigned char *us2 = (const unsigned char *)s2; do { if (tolower(*us1) != tolower(*us2++)) return tolower(*us1) - tolower(*--us2); if (*us1++ == '\0') break; } while (--n != 0); } return 0; } x11-apps-7.7+5+nmu1ubuntu1/xedit/ispell.c0000664000000000000000000016255712472175711014771 0ustar /* * Copyright (c) 1999 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ /* $XdotOrg: xc/programs/xedit/ispell.c,v 1.6 2004/12/04 00:43:13 kuhn Exp $ */ /* $XFree86: xc/programs/xedit/ispell.c,v 1.19 2002/10/19 20:04:20 herrb Exp $ */ #include "xedit.h" #include "util.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define RECEIVE 1 #define SEND 2 #define CHECK 0 #define ADD 1 #define REMOVE 2 #define ASIS 1 #define UNCAP 2 /* * Types */ #define UNDO_DEPTH 16 typedef struct _ispell_undo { char *undo_str; int undo_count; XawTextPosition undo_pos; Boolean repeat; /* two (misspelled?) words together */ Boolean terse; int format; /* remember text formatting style */ struct _ispell_undo *next, *prev; } ispell_undo; typedef struct _ispell_dict { Widget sme; char *wchars; struct _ispell_dict *next; } ispell_dict; #define TEXT 0 #define HTML 1 struct _ispell_format { char *name; int value; Widget sme; }; static struct _ispell_format ispell_format[] = { {"text", TEXT}, {"html", HTML}, }; struct _ispell { Widget shell, form, mispelled, repeated, word, replacement, text, suggestions, viewport, list, commands, replace, status, replaceAll, undo, ignore, ignoreAll, add, addUncap, suspend, cancel, check, look, terse, options, dict, dictMenu, format, formatMenu; Widget ascii, source; XtInputId id; int pid, ifd[2], ofd[2]; XawTextPosition left, right; char *item; Bool lock; Bool repeat; Bool checkit; int stat; char *buf; int bufsiz; int buflen; char sendbuf[1024]; char sentbuf[1024]; int undo_depth; ispell_undo *undo_head, *undo_base; char *undo_for; char *wchars; char *cmd; char *skip; char *command; Boolean terse_mode, undo_terse_mode; char *guess_label, *miss_label, *root_label, *none_label, *eof_label, *compound_label, *ok_label, *repeat_label, *working_label, *look_label; char *look_cmd; char *words_file; char *dictionary; char *dict_list; ispell_dict *dict_info; int format_mode; /* to undo correctly */ char *formatting; struct _ispell_format *format_info; }; typedef struct _ReplaceEntry ReplaceEntry; struct _ReplaceEntry { hash_key *word; ReplaceEntry*next; char *replace; }; typedef struct _IgnoreEntry IgnoreEntry; struct _IgnoreEntry { hash_key *word; IgnoreEntry *next; int add; }; /* * Prototypes */ static void AddIspell(Widget, XtPointer, XtPointer); static void ChangeDictionaryIspell(Widget, XtPointer, XtPointer); static void ChangeFormatIspell(Widget, XtPointer, XtPointer); static void CheckIspell(Widget, XtPointer, XtPointer); static void IgnoreIspell(Widget, XtPointer, XtPointer); static Bool InitIspell(void); static void IspellCheckUndo(void); static int IspellConvertHtmlAmp(char*); static Bool IspellDoIgnoredWord(char*, int, int); static Bool IspellIgnoredWord(char*, int, int); static void IspellInputCallback(XtPointer, int*, XtInputId*); static void IspellKillUndoBuffer(void); static Bool IspellReceive(void); static char *IspellReplacedWord(char*, char*); static int IspellSend(void); static void IspellSetSelection(XawTextPosition, XawTextPosition); static void IspellSetRepeated(Bool); static void IspellSetSensitive(Bool); static void IspellSetStatus(char*); static void IspellSetTerseMode(Bool); static Bool IspellStartProcess(void); static Bool IspellCheckProcess(void); static Bool IspellEndProcess(Bool, Bool); static void LookIspell(Widget, XtPointer, XtPointer); static void PopdownIspell(Widget, XtPointer, XtPointer); static void ReplaceIspell(Widget, XtPointer, XtPointer); static void RevertIspell(Widget, XtPointer, XtPointer); static void SelectIspell(Widget, XtPointer, XtPointer); static void ToggleTerseIspell(Widget, XtPointer, XtPointer); static void timeout_signal(int); static void (*old_timeout)(int); static void UndoIspell(Widget, XtPointer, XtPointer); Bool _XawTextSrcUndo(TextSrcObject, XawTextPosition*); /* * Initialization */ static struct _ispell ispell; #define RSTRTBLSZ 23 #define ISTRTBLSZ 71 static hash_table *replace_hash; static hash_table *ignore_hash; #ifndef XtCStatus #define XtCStatus "Status" #endif #define Offset(field) XtOffsetOf(struct _ispell, field) static XtResource resources[] = { {"wordChars", "Chars", XtRString, sizeof(char*), Offset(wchars), XtRString, ""}, {"ispellCommand", "CommandLine", XtRString, sizeof(char*), Offset(cmd), XtRString, "/usr/local/bin/ispell"}, {"terseMode", "Terse", XtRBoolean, sizeof(Boolean), Offset(terse_mode), XtRImmediate, (XtPointer)False}, {"guessLabel", XtCStatus, XtRString, sizeof(String), Offset(guess_label), XtRString, "Guess"}, {"missLabel", XtCStatus, XtRString, sizeof(String), Offset(miss_label), XtRString, "Miss"}, {"rootLabel", XtCStatus, XtRString, sizeof(String), Offset(root_label), XtRString, "Root:"}, {"noneLabel", XtCStatus, XtRString, sizeof(String), Offset(none_label), XtRString, "None"}, {"compoundLabel", XtCStatus, XtRString, sizeof(String), Offset(compound_label), XtRString, "Compound"}, {"okLabel", XtCStatus, XtRString, sizeof(String), Offset(ok_label), XtRString, "Ok"}, {"eofLabel", XtCStatus, XtRString, sizeof(String), Offset(eof_label), XtRString, "End Of File"}, {"repeatLabel", XtCStatus, XtRString, sizeof(String), Offset(repeat_label), XtRString, "Repeat"}, {"workingLabel", XtCStatus, XtRString, sizeof(String), Offset(working_label), XtRString, "..."}, {"lookLabel", XtCStatus, XtRString, sizeof(String), Offset(look_label), XtRString, "Look"}, {"lookCommand", "CommandLine", XtRString, sizeof(char*), Offset(look_cmd), XtRString, "/usr/bin/egrep -i"}, {"wordsFile", "Words", XtRString, sizeof(char*), Offset(words_file), XtRString, "/usr/share/dict/words"}, {"dictionary", "Dictionary", XtRString, sizeof(char*), Offset(dictionary), XtRString, "american"}, {"dictionaries", "Dictionary", XtRString, sizeof(char*), Offset(dict_list), XtRString, "american americanmed+ english"}, {"formatting", "TextFormat", XtRString, sizeof(char*), Offset(formatting), XtRString, "text"}, }; #undef Offset #ifdef NO_LIBC_I18N static int ToLower(int ch) { char buf[2]; *buf = ch; XmuNCopyISOLatin1Lowered(buf, buf, sizeof(buf)); return (*buf); } static int ToUpper(int ch) { char buf[2]; *buf = ch; XmuNCopyISOLatin1Uppered(buf, buf, sizeof(buf)); return (*buf); } static int IsLower(int ch) { char upbuf[2]; char lobuf[2]; *upbuf = *lobuf = ch; XmuNCopyISOLatin1Lowered(lobuf, lobuf, sizeof(lobuf)); XmuNCopyISOLatin1Uppered(upbuf, upbuf, sizeof(upbuf)); return (*lobuf != *upbuf && ch == *lobuf); } static int IsUpper(int ch) { char upbuf[2]; char lobuf[2]; *upbuf = *lobuf = ch; XmuNCopyISOLatin1Lowered(lobuf, lobuf, sizeof(lobuf)); XmuNCopyISOLatin1Uppered(upbuf, upbuf, sizeof(upbuf)); return (*lobuf != *upbuf && ch == *upbuf); } #else #define ToLower tolower #define ToUpper toupper #define IsLower islower #define IsUpper isupper #endif /* * Implementation */ #ifdef STDERR_FILENO # define WRITES(s) write(STDERR_FILENO, s, strlen(s)) #else # define WRITES(s) write(fileno(stderr), s, strlen(s)) #endif /*ARGSUSED*/ static void timeout_signal(int unused) { int olderrno = errno; WRITES("Warning: Timeout waiting ispell process to die.\n"); kill(ispell.pid, SIGTERM); errno = olderrno; } static void IspellSetSelection(XawTextPosition left, XawTextPosition right) { /* Try to make sure the selected word is completely visible */ XawTextSetInsertionPoint(ispell.ascii, right); XawTextSetInsertionPoint(ispell.ascii, left); XawTextSetSelection(ispell.ascii, left, right); } static void IspellSetStatus(char *label) { Arg args[1]; XtSetArg(args[0], XtNlabel, label); XtSetValues(ispell.status, args, 1); } static void IspellSetRepeated(Bool state) { static char *mispelled, *repeated; Arg args[1]; if (mispelled == NULL) { XtSetArg(args[0], XtNlabel, &mispelled); XtGetValues(ispell.mispelled, args, 1); mispelled = XtNewString(mispelled); } if (repeated == NULL) { XtSetArg(args[0], XtNlabel, &repeated); XtGetValues(ispell.repeated, args, 1); repeated = XtNewString(repeated); } XtSetSensitive(ispell.replaceAll, !state); XtSetSensitive(ispell.ignoreAll, !state); XtSetSensitive(ispell.add, !state); XtSetSensitive(ispell.addUncap, !state); if (!state) { XtSetArg(args[0], XtNlabel, mispelled); XtSetValues(ispell.mispelled, args, 1); } else { XtSetArg(args[0], XtNlabel, repeated); XtSetValues(ispell.mispelled, args, 1); } } static void IspellSetSensitive(Bool state) { XtSetSensitive(ispell.replace, state); XtSetSensitive(ispell.replaceAll, state); XtSetSensitive(ispell.ignore, state); XtSetSensitive(ispell.ignoreAll, state); XtSetSensitive(ispell.add, state); XtSetSensitive(ispell.addUncap, state); } static void IspellSetTerseMode(Bool mode) { Arg args[1]; XtSetArg(args[0], XtNstate, ispell.terse_mode = mode); XtSetValues(ispell.terse, args, 1); write(ispell.ofd[1], mode ? "!\n" : "%\n", 2); } static void IspellCheckUndo(void) { ispell_undo *undo = XtNew(ispell_undo); if (ispell.undo_for && strcmp(ispell.undo_for, ispell.dictionary)) { XeditPrintf("Undo: Dictionary changed. Previous undo information lost.\n"); IspellKillUndoBuffer(); Feep(); } undo->next = NULL; undo->repeat = False; undo->terse = ispell.undo_terse_mode; undo->format = ispell.format_mode; if ((undo->prev = ispell.undo_head) != NULL) undo->prev->next = undo; else undo->prev = NULL; ++ispell.undo_depth; if (!ispell.undo_base) { ispell.undo_base = undo; XtSetSensitive(ispell.undo, True); } else if (ispell.undo_depth > UNDO_DEPTH) { ispell_undo *tmp; if (ispell.undo_base->undo_str) XtFree(ispell.undo_base->undo_str); tmp = ispell.undo_base->next; XtFree((char*)ispell.undo_base); tmp->prev = NULL; ispell.undo_base = tmp; ispell.undo_depth = UNDO_DEPTH; } ispell.undo_head = undo; } static char * IspellReplacedWord(char *word, char *replace) { int word_len; hash_key *word_key; ReplaceEntry *entry; word_len = strlen(word); entry = (ReplaceEntry *)hash_check(replace_hash, word, word_len); if (entry == NULL) { word_key = XtNew(hash_key); word_key->value = XtNewString(word); word_key->length = word_len; entry = XtNew(ReplaceEntry); entry->word = word_key; entry->replace = NULL; entry->next = NULL; hash_put(replace_hash, (hash_entry *)entry); } if (replace) { XtFree(entry->replace); entry->replace = XtNewString(replace); } return (entry->replace); } static Bool IspellDoIgnoredWord(char *word, int cmd, int add) { int word_len; hash_key *word_key; IgnoreEntry *entry; word_len = strlen(word); entry = (IgnoreEntry *)hash_check(ignore_hash, word, word_len); if (entry == NULL) { if (cmd != ADD) return (False); word_key = XtNew(hash_key); word_key->value = XtNewString(word); word_key->length = word_len; entry = XtNew(IgnoreEntry); entry->word = word_key; entry->add = add; entry->next = NULL; hash_put(ignore_hash, (hash_entry *)entry); return (True); } else if (cmd == REMOVE) hash_rem(ignore_hash, (hash_entry *)entry); return (cmd == CHECK); } static Bool IspellIgnoredWord(char *word, int cmd, int add) { if (add != UNCAP && IspellDoIgnoredWord(word, cmd, add)) return (True); /* add/remove uncapped word to/of list, * or cheks for correct capitalization */ if (add == UNCAP || cmd == CHECK) { unsigned char *str = (unsigned char*)word; unsigned char string[1024]; Bool upper, status; int i; status = True; upper = IsUpper(*str); *string = upper ? ToLower(*str) : *str; if (*str) str++; if (IsLower(*str)) upper = False; for (i = 1; *str && i < sizeof(string) - 1; i++, str++) { if (upper && IsLower(*str)) status = False; else if (!upper && IsUpper(*str)) status = False; string[i] = ToLower(*str); } string[i] = '\0'; if ((cmd != CHECK || status) && IspellDoIgnoredWord((char*)string, cmd, add)) return (True); } return (False); } /*ARGSUSED*/ static Bool IspellReceive(void) { int i, len, old_len; Arg args[2]; char *str, *end, **list, **old_list; char *tmp, word[1024]; int j; if (ispell.lock || ispell.stat != RECEIVE) return (False); while (1) { /* read the entire line */ if (ispell.buflen >= ispell.bufsiz - 1) ispell.buf = XtRealloc(ispell.buf, ispell.bufsiz += BUFSIZ); if ((len = read(ispell.ifd[0], &ispell.buf[ispell.buflen], ispell.bufsiz - ispell.buflen - 1)) <= 0) break; ispell.buflen += len; } if (ispell.buflen <= 0) return (False); len = 0; i = ispell.buflen - 1; while (i >= 0 && ispell.buf[i] == '\n') { ++len; --i; } if (len < 2 - ((ispell.terse_mode && i == -1) || ispell.buf[0] == '@')) return (False); ispell.buf[ispell.buflen - len] = '\0'; ispell.buflen = 0; if ((tmp = strchr(ispell.sendbuf, '\n')) != NULL) *tmp = '\0'; switch (ispell.buf[0]) { case '&': /* MISS */ case '?': /* GUESS */ str = strchr(&ispell.buf[2], ' '); if (!ispell.checkit) { *str = '\0'; XtSetArg(args[0], XtNlabel, &ispell.buf[2]); XtSetValues(ispell.word, args, 1); } ++str; list = NULL; str = strchr(str, ':') + 1; for (i = 0; ; i++) { end = strchr(str, ','); if (end) *end = '\0'; if ((i % 16) == 0) list = (char**)XtRealloc((char*)list, (i + 16) * sizeof(char*)); tmp = word; for (j = 1; j < sizeof(word) && str[j]; j++) { if (str[j] == '+') continue; else if (str[j] == '-' && str[j+1] != '-' && str[j-1] != '-') { char *p, string[256]; int k, l; for (l = 0, k = j + 1; str[k] != '+' && str[k] != '-' && str[k] && l < sizeof(string) - 1; k++, l++) string[l] = str[k]; string[l] = '\0'; *tmp = '\0'; if (l && (p = strstr(word, string)) != NULL) { char *sav = p; while ((p = strstr(p + l, string)) != NULL) sav = p; p = sav; if (strcmp(p, string) == 0) { tmp = p; j = k - 1; } else *tmp++ = '-'; } else *tmp++ = '-'; } else *tmp++ = str[j]; } *tmp = '\0'; list[i] = XtNewString(word); if (end) str = end + 1; else break; } len = i + 1; XtSetArg(args[0], XtNlist, &old_list); XtSetArg(args[1], XtNnumberStrings, &old_len); XtGetValues(ispell.list, args, 2); ispell.item = NULL; if ((str = IspellReplacedWord(&ispell.buf[2], NULL)) != NULL) for (i = 0; i < len; i++) { if (strcmp(list[i], str) == 0) { ispell.item = list[i]; break; } } else ispell.item = list[i = 0]; if (!ispell.item) { list = (char**)XtRealloc((char*)list, (len + 1) * sizeof(char*)); ispell.item = list[i] = XtNewString(str); ++len; } XtSetArg(args[0], XtNlist, list); XtSetArg(args[1], XtNnumberStrings, len); XtSetValues(ispell.list, args, 2); XtSetSensitive(ispell.list, True); if (!ispell.checkit) XawListHighlight(ispell.list, i); if (old_len > 1 || (XtName(ispell.list) != old_list[0])) { while (--old_len > -1) XtFree(old_list[old_len]); XtFree((char*)old_list); } if (!ispell.checkit) { XtSetArg(args[0], XtNstring, ispell.item); XtSetValues(ispell.text, args, 1); IspellSetSelection(ispell.left, ispell.right); if (ispell.repeat) IspellSetRepeated(ispell.repeat = False); } IspellSetStatus(ispell.buf[0] == '?' ? ispell.guess_label : ispell.miss_label); ispell.undo_terse_mode = ispell.terse_mode; ispell.format_mode = ispell.format_info->value; ispell.lock = True; break; case '#': /* NONE */ case '-': /* COMPOUND */ case '+': /* ROOT */ check_label: str = &ispell.sendbuf[1]; if (!ispell.checkit) { XtSetArg(args[0], XtNlabel, str); XtSetValues(ispell.word, args, 1); } XtSetArg(args[0], XtNlist, &old_list); XtSetArg(args[1], XtNnumberStrings, &old_len); XtGetValues(ispell.list, args, 2); ispell.item = NULL; list = (char**)XtMalloc(sizeof(char**)); if ((tmp = IspellReplacedWord(str, NULL)) != NULL) str = tmp; if (tmp == NULL && ispell.buf[0] == '#') list[0] = XtNewString(""); else list[0] = XtNewString(str); XtSetArg(args[0], XtNlist, list); XtSetArg(args[1], XtNnumberStrings, 1); XtSetValues(ispell.list, args, 2); if (tmp == NULL && ispell.buf[0] == '#') { XawListUnhighlight(ispell.list); XtSetSensitive(ispell.list, False); } else { XtSetSensitive(ispell.list, True); if (!ispell.checkit) XawListHighlight(ispell.list, 0); } if (old_len > 1 || (XtName(ispell.list) != old_list[0])) { while (--old_len > -1) XtFree(old_list[old_len]); XtFree((char*)old_list); } if (!ispell.checkit) { XtSetArg(args[0], XtNstring, str); XtSetValues(ispell.text, args, 1); IspellSetSelection(ispell.left, ispell.right); if (ispell.repeat) IspellSetRepeated(ispell.repeat = False); } ispell.undo_terse_mode = ispell.terse_mode; ispell.format_mode = ispell.format_info->value; ispell.lock = True; if (ispell.buf[0] == '+') { if ((tmp = strchr(&ispell.buf[2], '\n')) != NULL) *tmp = '\0'; XmuSnprintf(word, sizeof(word), "%s %s", ispell.root_label, &ispell.buf[2]); IspellSetStatus(word); } else IspellSetStatus(ispell.buf[0] == '#' ? ispell.none_label : ispell.buf[0] == '-' ? ispell.compound_label : ispell.ok_label); break; case '*': /* OK */ case '\0': /* when running in terse mode */ if (!ispell.checkit) (void)IspellIgnoredWord(&ispell.sendbuf[1], ADD, 0); else goto check_label; ispell.lock = False; break; case '@': /* Ispell banner */ /* it only happens when the dictionary is changed */ if (!ispell.repeat) { XawTextPosition left, right; ispell.stat = SEND; while (IspellSend() == 0) ; /* word chars may have changed */ XawTextGetSelectionPos(ispell.ascii, &left, &right); if (left != ispell.left || right != ispell.right) { XtSetArg(args[0], XtNstring, &ispell.sendbuf[1]); XtSetValues(ispell.text, args, 1); IspellSetSelection(ispell.left, ispell.right); } ispell.checkit = True; } else { IspellSetStatus(ispell.repeat_label); ispell.undo_terse_mode = ispell.terse_mode; ispell.format_mode = ispell.format_info->value; ispell.lock = True; return (True); } break; default: fprintf(stderr, "Unknown ispell command '%c'\n", ispell.buf[0]); return (False); } if (!ispell.lock && !ispell.checkit) { ispell.stat = SEND; while (IspellSend() == 0) ; } return (True); } static int IspellConvertHtmlAmp(char *buf) { int len, ch = '?'; /* this function is static, so I can do it */ *strchr(++buf, ';') = '\0'; len = strlen(buf); if (len == 0) return ('&'); if (len > 1) { if (strcasecmp(&buf[1], "lt") == 0) ch = '<'; else if (strcasecmp(&buf[1], "gt") == 0) ch = '>'; else if (strcasecmp(&buf[1], "nbsp") == 0) ch = ' '; else if (strcasecmp(&buf[1], "amp") == 0) ch = '&'; else if (strcasecmp(&buf[1], "quot") == 0) ch = '"'; else if (*buf == '#') { char *tmp; if (len == 1) return ('?'); ch = strtol(&buf[1], &tmp, 10); if (*tmp) fprintf(stderr, "Warning: bad html interpreting '&#' mark.\n"); } else if (strcmp(&buf[1], "acute") == 0) { switch (*buf) { case 'a': ch = 0xe1; break; case 'e': ch = 0xe9; break; case 'i': ch = 0xed; break; case 'o': ch = 0xf3; break; case 'u': ch = 0xfa; break; case 'A': ch = 0xc1; break; case 'E': ch = 0xc9; break; case 'I': ch = 0xcd; break; case 'O': ch = 0xd3; break; case 'U': ch = 0xda; break; } } else if (strcmp(&buf[1], "grave") == 0) { switch (*buf) { case 'a': ch = 0xe0; break; case 'e': ch = 0xe8; break; case 'i': ch = 0xec; break; case 'o': ch = 0xf2; break; case 'u': ch = 0xf9; break; case 'A': ch = 0xc0; break; case 'E': ch = 0xc8; break; case 'I': ch = 0xcc; break; case 'O': ch = 0xd2; break; case 'U': ch = 0xd9; break; } } else if (strcmp(&buf[1], "tilde") == 0) { switch (*buf) { case 'a': ch = 0xe3; break; case 'o': ch = 0xf5; break; case 'n': ch = 0xf1; break; case 'A': ch = 0xe3; break; case 'O': ch = 0xd5; break; case 'N': ch = 0xd1; break; } } else if (strcmp(&buf[1], "circ") == 0) { switch (*buf) { case 'a': ch = 0xe2; break; case 'e': ch = 0xea; break; case 'i': ch = 0xee; break; case 'o': ch = 0xf4; break; case 'u': ch = 0xfb; break; case 'A': ch = 0xc2; break; case 'E': ch = 0xca; break; case 'I': ch = 0xce; break; case 'O': ch = 0xd4; break; case 'U': ch = 0xdb; break; } } else if (strcmp(&buf[1], "cedil") == 0) { switch (*buf) { case 'c': ch = 0xe7; break; case 'C': ch = 0xc7; break; } } /* add more cases here */ } return (ch); } /*ARGSUSED*/ static int IspellSend(void) { XawTextPosition position, old_left, pos; XawTextBlock block; int i, len, spaces, nls; Bool nl, html, inside_html; char ampbuf[32]; int amplen; if (ispell.lock || ispell.stat != SEND) return (-1); len = 1; ispell.sendbuf[0] = '^'; /* don't evaluate following characters as commands */ spaces = nls = 0; html = ispell.format_info->value == HTML; inside_html = False; amplen = 0; /* skip non word characters */ pos = position = ispell.right; nl = False; while (1) { Bool done = False; char mb[sizeof(wchar_t)]; retry_html_space: position = XawTextSourceRead(ispell.source, position, &block, BUFSIZ); if (block.length == 0) { /* end of file */ ispell.stat = 0; ispell.lock = True; XawTextSetInsertionPoint(ispell.ascii, ispell.right); XawTextUnsetSelection(ispell.ascii); IspellSetSensitive(False); IspellSetStatus(ispell.eof_label); return (-1); } for (i = 0; i < block.length; i++) { if (international) wctomb(mb, ((wchar_t*)block.ptr)[i]); else mb[0] = block.ptr[i]; if (amplen) { if (amplen + 2 >= sizeof(ampbuf)) { if (!ispell.terse_mode) fprintf(stderr, "Warning: error interpreting '&' mark.\n"); amplen = 0; position = pos + 1; goto retry_html_space; } else if ((ampbuf[amplen++] = *mb) == ';') { int ch; ampbuf[amplen] = '\0'; ch = IspellConvertHtmlAmp(ampbuf); amplen = 0; if (isalpha(ch) || (ch && strchr(ispell.wchars, ch))) { /* interpret it again */ ispell.right = pos; i = 0; done = True; break; } else if ((ch == '\n' || isspace(ch)) && spaces >= 0) ++spaces; else spaces = -1; } } else if (html && *mb == '&') { ampbuf[amplen++] = *mb; pos = block.firstPos + i; continue; } else if ((!html || !inside_html) && (isalpha(*mb) || (*mb && strchr(ispell.wchars, *mb)))) { done = True; break; } else if (!html && *mb == '\n') { nl = True; if (++nls > 1 && (!html || !inside_html)) spaces = -1; else if (spaces >= 0) ++spaces; } else if (nl) { nl = False; if (*mb && strchr(ispell.skip, *mb)) { position = ispell.right = XawTextSourceScan(ispell.source, ispell.right + i, XawstEOL, XawsdRight, 1, False); i = 0; break; } else if (spaces >= 0 && isspace(*mb)) ++spaces; else spaces = -1; } else if (html && inside_html) { if (*mb == '>') inside_html = False; } else if (html && *mb == '<') inside_html = True; else if (spaces >= 0 && (isspace(*mb) || (html && *mb == '\n'))) ++spaces; else spaces = -1; } ispell.right += i; if (done) break; } old_left = ispell.left; /* read a word */ position = ispell.left = ispell.right; while (1) { Bool done = False; char mb[sizeof(wchar_t)]; retry_html_word: position = XawTextSourceRead(ispell.source, position, &block, BUFSIZ); if (block.length == 0 && len == 1) { /* end of file */ ispell.stat = 0; ispell.lock = True; XawTextSetInsertionPoint(ispell.ascii, ispell.right); XawTextUnsetSelection(ispell.ascii); IspellSetSensitive(False); IspellSetStatus(ispell.eof_label); return (-1); } for (i = 0; i < block.length; i++) { if (international) wctomb(mb, ((wchar_t*)block.ptr)[i]); else mb[0] = block.ptr[i]; if (amplen) { if (amplen + 2 >= sizeof(ampbuf)) { if (!ispell.terse_mode) fprintf(stderr, "Warning: error interpreting '&' mark.\n"); amplen = 0; position = pos + 1; if (strchr(ispell.wchars, '&')) { if (len + 1 >= sizeof(ispell.sendbuf) - 1) { done = True; fprintf(stderr, "Warning: word is too large!\n"); break; } ispell.sendbuf[len++] = '&'; goto retry_html_word; } else { ispell.right = position; i = 0; done = True; break; } } else if ((ampbuf[amplen++] = *mb) == ';') { int ch; ampbuf[amplen] = '\0'; ch = IspellConvertHtmlAmp(ampbuf); amplen = 0; if (!isalpha(ch) && (!ch || !strchr(ispell.wchars, ch))) { ispell.right = pos; i = 0; done = True; break; } *mb = ch; } else continue; } else if (html && *mb == '&') { ampbuf[amplen++] = *mb; pos = block.firstPos + i; continue; } else if (!isalpha(*mb) && (!*mb || !strchr(ispell.wchars, *mb))) { done = True; break; } ispell.sendbuf[len] = *mb; if (++len >= sizeof(ispell.sendbuf) - 1) { done = True; fprintf(stderr, "Warning: word is too large!\n"); break; } } ispell.right += i; if (done || block.length == 0) break; } ispell.sendbuf[len] = '\0'; if (spaces > 0 && spaces <= 32 && strcmp(ispell.sendbuf, ispell.sentbuf) == 0) { Arg args[2]; int old_len; char **list, **old_list; char label[sizeof(ispell.sendbuf) + sizeof(ispell.sentbuf) + 32]; strcpy(label, &ispell.sendbuf[1]); for (i = 0; i < spaces; i++) label[len + i - 1] = ' '; strcpy(&label[len + i - 1], &ispell.sendbuf[1]); XtSetArg(args[0], XtNlabel, label); XtSetValues(ispell.word, args, 1); XtSetArg(args[0], XtNstring, &ispell.sendbuf[1]); XtSetValues(ispell.text, args, 1); XtSetArg(args[0], XtNlist, &old_list); XtSetArg(args[1], XtNnumberStrings, &old_len); XtGetValues(ispell.list, args, 2); list = (char**)XtMalloc(sizeof(char**)); list[0] = XtNewString(&ispell.sendbuf[1]); XtSetArg(args[0], XtNlist, list); XtSetArg(args[1], XtNnumberStrings, 1); XtSetValues(ispell.list, args, 2); XtSetSensitive(ispell.list, True); XawListHighlight(ispell.list, 0); if (old_len > 1 || (XtName(ispell.list) != old_list[0])) { while (--old_len > -1) XtFree(old_list[old_len]); XtFree((char*)old_list); } IspellSetRepeated(True); IspellSetSelection(old_left, ispell.right); IspellSetStatus(ispell.repeat_label); ispell.repeat = ispell.lock = True; return (1); } strcpy(ispell.sentbuf, ispell.sendbuf); if (len <= 2 || IspellIgnoredWord(&ispell.sendbuf[1], CHECK, 0)) return (0); ispell.sendbuf[len++] = '\n'; write(ispell.ofd[1], ispell.sendbuf, len); ispell.stat = RECEIVE; return (1); } /*ARGSUSED*/ static void IspellInputCallback(XtPointer closure, int *source, XtInputId *id) { if (ispell.right < 0) { int len; char buf[1024]; ispell.right = XawTextGetInsertionPoint(ispell.ascii); ispell.right = XawTextSourceScan(ispell.source, ispell.right, XawstEOL, XawsdLeft, 1, True); len = read(ispell.ifd[0], buf, sizeof(buf)); if (strncmp(buf, "@(#)", 4) == 0) { Arg args[1]; buf[len - 1] = '\0'; XtSetArg(args[0], XtNtitle, &buf[5]); XtSetValues(ispell.shell, args, 1); } else fprintf(stderr, "Error: is ispell talking with me?\n"); IspellSetTerseMode(ispell.terse_mode); while (IspellSend() == 0) ; } else if (ispell.source) IspellReceive(); } /*ARGSUSED*/ void IspellCallback(Widget w, XtPointer client_data, XtPointer call_data) { Cardinal zero = 0; IspellAction(textwindow, NULL, NULL, &zero); } /*ARGSUSED*/ void IspellAction(Widget w, XEvent *event, String *params, Cardinal *num_params) { Arg args[3]; Cardinal num_args; char **strs, **list; int n_strs; Bool first_time = InitIspell(); if (*num_params == 1 && (params[0][0] == 'e' || params[0][0] == 'E')) { PopdownIspell(w, (XtPointer)True, NULL); return; } if (!XtIsSubclass(w, textWidgetClass) || ispell.source) { Feep(); return; } ispell.source = XawTextGetSource(ispell.ascii = w); if (first_time) { /* let the user choose the better position for the ispell window */ Dimension width, height, b_width; Position x, y, max_x, max_y; x = y = -1; if (event) { switch (event->type) { case ButtonPress: case ButtonRelease: x = event->xbutton.x_root; y = event->xbutton.y_root; break; case KeyPress: case KeyRelease: x = event->xkey.x_root; y = event->xkey.y_root; break; } } if (x < 0 || y < 0) { Window r, c; int rx, ry, wx, wy; unsigned mask; XQueryPointer(XtDisplay(ispell.shell), XtWindow(ispell.shell), &r, &c, &rx, &ry, &wx, &wy, &mask); x = rx; y = ry; } num_args = 0; XtSetArg(args[num_args], XtNwidth, &width); num_args++; XtSetArg(args[num_args], XtNheight, &height); num_args++; XtSetArg(args[num_args], XtNborderWidth, &b_width); num_args++; XtGetValues(ispell.shell, args, num_args); width += b_width << 1; height += b_width << 1; x -= (Position)(width >> 1); if (x < 0) x = 0; if (x > (max_x = (Position)(XtScreen(w)->width - width))) x = max_x; y -= (Position)(height >> 1); if (y < 0) y = 0; if (y > (max_y = (Position)(XtScreen(w)->height - height))) y = max_y; num_args = 0; XtSetArg(args[num_args], XtNx, x); num_args++; XtSetArg(args[num_args], XtNy, y); num_args++; XtSetValues(ispell.shell, args, num_args); } if (ispell.repeat) IspellSetRepeated(False); ispell.lock = ispell.repeat = ispell.checkit = False; ispell.stat = SEND; IspellSetSensitive(True); XtSetSensitive(ispell.undo, False); XtSetArg(args[0], XtNlabel, ""); XtSetValues(ispell.word, args, 1); XtSetArg(args[0], XtNstring, ""); XtSetValues(ispell.text, args, 1); XtSetArg(args[0], XtNlist, &strs); XtSetArg(args[1], XtNnumberStrings, &n_strs); XtGetValues(ispell.list, args, 2); list = (char**)XtMalloc(sizeof(char**)); list[0] = XtNewString(""); XtSetArg(args[0], XtNlist, list); XtSetArg(args[1], XtNnumberStrings, 1); XtSetValues(ispell.list, args, 2); if (n_strs > 1 || (XtName(ispell.list) != strs[0])) { while (--n_strs > -1) XtFree(strs[n_strs]); XtFree((char*)strs); } IspellSetStatus(ispell.working_label); if (!ispell.pid) (void)IspellStartProcess(); else { ispell.right = XawTextGetInsertionPoint(ispell.ascii); ispell.right = XawTextSourceScan(ispell.source, ispell.right, XawstEOL, XawsdLeft, 1, True); while (IspellSend() == 0) ; } XtPopup(ispell.shell, XtGrabExclusive); XtSetKeyboardFocus(ispell.shell, ispell.text); } static Bool IspellStartProcess(void) { if (!ispell.pid) { int len; char format[32]; static char *command; ispell.source = XawTextGetSource(ispell.ascii); if (command) XtFree(command); strcpy(format, "%s -a"); len = strlen(ispell.cmd) + 4; if (ispell.dictionary && *ispell.dictionary) { len += strlen(ispell.dictionary) + 6; strcat(format, " -d '%s'"); if (ispell.wchars && *ispell.wchars) { len += strlen(ispell.wchars + 6); strcat(format, " -w '%s'"); } } command = XtMalloc(len); XmuSnprintf(command, len, format, ispell.cmd, ispell.dictionary, ispell.wchars); pipe(ispell.ifd); pipe(ispell.ofd); if ((ispell.pid = fork()) == 0) { close(0); close(1); dup2(ispell.ofd[0], 0); dup2(ispell.ifd[1], 1); close(ispell.ofd[0]); close(ispell.ofd[1]); close(ispell.ifd[0]); close(ispell.ifd[1]); if (!international) setlocale(LC_ALL, "ISO-8859-1"); execl("/bin/sh", "sh", "-c", command, NULL); exit(-127); } else if (ispell.pid < 0) { fprintf(stderr, "Cannot fork\n"); exit(1); } ispell.buf = XtMalloc(ispell.bufsiz = BUFSIZ); ispell.right = -1; ispell.id = XtAppAddInput(XtWidgetToApplicationContext(ispell.shell), ispell.ifd[0], (XtPointer)XtInputReadMask, IspellInputCallback, NULL); fcntl(ispell.ifd[0], F_SETFL, O_NONBLOCK); } else return (False); return (True); } /*ARGSUSED*/ static void PopdownIspell(Widget w, XtPointer client_data, XtPointer call_data) { (void)IspellEndProcess((Bool)(long)client_data, True); XtPopdown(ispell.shell); *ispell.sentbuf = '\0'; } static Bool IspellCheckProcess(void) { int status; if (ispell.pid) { waitpid(ispell.pid, &status, WNOHANG); if (WIFEXITED(status)) { ispell.pid = 0; } else return (True); } return (False); } static Bool IspellEndProcess(Bool killit, Bool killundo) { ispell.source = NULL; if (ispell.pid) { IgnoreEntry *ientry; ReplaceEntry *rentry; /* insert added words in private dictionary */ for (ientry = (IgnoreEntry *)hash_iter_first(ignore_hash); ientry; ientry = (IgnoreEntry *)hash_iter_next(ignore_hash)) { if (ientry->add) { if (ientry->add == UNCAP) write(ispell.ofd[1], "&", 1); else write(ispell.ofd[1], "*", 1); write(ispell.ofd[1], ientry->word->value, ientry->word->length); write(ispell.ofd[1], "\n", 1); } } write(ispell.ofd[1], "#\n", 2); /* save dictionary */ hash_clr(ignore_hash); if (killit) { XtRemoveInput(ispell.id); close(ispell.ofd[0]); close(ispell.ofd[1]); close(ispell.ifd[0]); close(ispell.ifd[1]); /* if something goes wrong, we don't want to block here forever */ old_timeout = signal(SIGALRM, timeout_signal); alarm(10); waitpid(ispell.pid, NULL, 0); alarm(0); signal(SIGALRM, old_timeout); ispell.pid = 0; if (ispell.buf) XtFree(ispell.buf); ispell.buf = NULL; /* forget about replace matches */ for (rentry = (ReplaceEntry *)hash_iter_first(replace_hash); rentry; rentry = (ReplaceEntry *)hash_iter_next(replace_hash)) { XtFree(rentry->replace); } hash_clr(replace_hash); } if (killundo) IspellKillUndoBuffer(); } else return (False); return (True); } static void IspellKillUndoBuffer(void) { ispell_undo *undo, *pundo; undo = pundo = ispell.undo_base; while (undo) { undo = undo->next; if (pundo->undo_str) XtFree(pundo->undo_str); XtFree((char*)pundo); pundo = undo; } ispell.undo_base = ispell.undo_head = NULL; ispell.undo_for = NULL; ispell.undo_depth = 0; XtSetSensitive(ispell.undo, False); } /*ARGSUSED*/ static void RevertIspell(Widget w, XtPointer client_data, XtPointer call_data) { Arg args[1]; char *string, *repstr = NULL; XtSetArg(args[0], XtNlabel, &string); XtGetValues(ispell.word, args, 1); if ((repstr = strchr(string, ' ')) != NULL) { string = repstr = XtNewString(string); *strchr(repstr, ' ') = '\0'; } XtSetArg(args[0], XtNstring, string); XtSetValues(ispell.text, args, 1); if (repstr) XtFree(repstr); } /*ARGSUSED*/ static void SelectIspell(Widget w, XtPointer client_data, XtPointer call_data) { XawListReturnStruct *info = (XawListReturnStruct *)call_data; Arg args[1]; XtSetArg(args[0], XtNstring, ispell.item = info->string); XtSetValues(ispell.text, args, 1); } /*ARGSUSED*/ void ReplaceIspell(Widget w, XtPointer client_data, XtPointer call_data) { XawTextPosition pos = XawTextGetInsertionPoint(ispell.ascii); XawTextBlock check, search, replace; Arg args[1]; char *text; if (!ispell.lock) return; XtSetArg(args[0], XtNlabel, &text); XtGetValues(ispell.word, args, 1); search.ptr = text; search.format = XawFmt8Bit; search.firstPos = 0; search.length = ispell.right - pos; XtSetArg(args[0], XtNstring, &text); XtGetValues(ispell.text, args, 1); replace.ptr = text; replace.format = XawFmt8Bit; replace.firstPos = 0; replace.length = strlen(text); if (strcmp(search.ptr, replace.ptr) != 0 && XawTextReplace(ispell.ascii, pos, pos + search.length, &replace) == XawEditDone) { ispell.right += replace.length - search.length; IspellCheckUndo(); ispell.undo_head->undo_str = NULL; ispell.undo_head->undo_pos = pos; ispell.undo_head->undo_count = 1; if (ispell.repeat) { ispell.undo_head->repeat = 2; /* To recognize later it was replaced */ ispell.undo_head->undo_count = ispell.right; ispell.undo_head->undo_str = XtNewString(search.ptr); } if (client_data && !ispell.repeat) { XawTextDisableRedisplay(ispell.ascii); pos = ispell.right; while ((pos = XawTextSourceSearch(ispell.source, pos, XawsdRight, &search)) != XawTextSearchError) { Bool do_replace = True; char mb[sizeof(wchar_t)]; if (XawTextSourceRead(ispell.source, pos - 1, &check, 1) > 0) { if (international) wctomb(mb, *(wchar_t*)check.ptr); else mb[0] = check.ptr[0]; do_replace = !isalpha(*mb) && *mb && !strchr(ispell.wchars, *mb); } if (do_replace && XawTextSourceRead(ispell.source, pos + search.length, &check, 1) > 0) { if (international) wctomb(mb, *(wchar_t*)check.ptr); else mb[0] = check.ptr[0]; do_replace = !isalpha(*mb) && *mb && !strchr(ispell.wchars, *mb); } if (do_replace) { XawTextReplace(ispell.ascii, pos, pos + search.length, &replace); ++ispell.undo_head->undo_count; } pos += search.length; } XawTextEnableRedisplay(ispell.ascii); } (void)IspellReplacedWord(search.ptr, replace.ptr); strncpy(&ispell.sentbuf[1], replace.ptr, sizeof(ispell.sentbuf) - 2); ispell.sentbuf[sizeof(ispell.sentbuf) - 1] = '\0'; } else Feep(); if (ispell.repeat) ispell.right = ispell.left = XawTextGetInsertionPoint(ispell.ascii); else if (!ispell.terse_mode || !ispell.item || strcmp(ispell.item, replace.ptr)) ispell.right = ispell.left; /* check it again! */ ispell.lock = ispell.checkit = False; ispell.stat = SEND; IspellSetStatus(ispell.working_label); while (IspellSend() == 0) ; } /*ARGSUSED*/ void IgnoreIspell(Widget w, XtPointer client_data, XtPointer call_data) { Arg args[1]; char *text; if (!ispell.lock) return; XtSetArg(args[0], XtNlabel, &text); XtGetValues(ispell.word, args, 1); IspellCheckUndo(); if ((ispell.undo_head->repeat = ispell.repeat) != False) { ispell.undo_head->undo_count = ispell.right; ispell.undo_head->undo_str = XtNewString(text); } else ispell.undo_head->undo_count = 0; ispell.undo_head->undo_pos = XawTextGetInsertionPoint(ispell.ascii); if (!ispell.repeat) { if (client_data) { IspellIgnoredWord(text, ADD, 0); ispell.undo_head->undo_str = XtNewString(text); } else ispell.undo_head->undo_str = NULL; } ispell.lock = ispell.checkit = False; ispell.stat = SEND; IspellSetStatus(ispell.working_label); while (IspellSend() == 0) ; } /*ARGSUSED*/ void AddIspell(Widget w, XtPointer client_data, XtPointer call_data) { Arg args[1]; char *text; int cmd = (long)client_data; if (!ispell.lock || ispell.repeat) return; XtSetArg(args[0], XtNlabel, &text); XtGetValues(ispell.word, args, 1); IspellCheckUndo(); ispell.undo_head->undo_str = XtNewString(text); ispell.undo_head->undo_pos = XawTextGetInsertionPoint(ispell.ascii); ispell.undo_head->undo_count = -cmd; (void)IspellIgnoredWord(text, ADD, cmd); ispell.lock = ispell.checkit = False; ispell.stat = SEND; IspellSetStatus(ispell.working_label); while (IspellSend() == 0) ; } /*ARGSUSED*/ static void UndoIspell(Widget w, XtPointer client_data, XtPointer call_data) { Bool enable_redisplay = False; ispell_undo *undo = ispell.undo_head; if ((!ispell.lock && ispell.stat) || !undo) return; if (ispell.undo_for && strcmp(ispell.undo_for, ispell.dictionary)) { XeditPrintf("Undo: Dictionary changed. Undo information was lost.\n"); IspellKillUndoBuffer(); Feep(); return; } if (undo->terse != ispell.terse_mode) IspellSetTerseMode(undo->terse); if (undo->format != ispell.format_info->value) { struct _ispell_format *fmt = &ispell_format[undo->format]; ChangeFormatIspell(fmt->sme, (XtPointer)fmt, NULL); } if (undo->undo_count > 0 && !undo->repeat) { XawTextPosition tmp; enable_redisplay = undo->undo_count > 1; if (enable_redisplay) XawTextDisableRedisplay(ispell.ascii); while (undo->undo_count--) if (!_XawTextSrcUndo((TextSrcObject)ispell.source, &tmp)) { Feep(); break; } } else if (undo->undo_count < 0) { if (undo->undo_str) (void)IspellIgnoredWord(undo->undo_str, REMOVE, -undo->undo_count); } else if (undo->undo_str) { if (!undo->repeat) IspellIgnoredWord(undo->undo_str, REMOVE, 0); } XawTextSetInsertionPoint(ispell.ascii, ispell.right = ispell.left = undo->undo_pos); if (enable_redisplay) XawTextEnableRedisplay(ispell.ascii); /* need to do it because may be two misspelled words together */ if (undo->repeat) { char **list, **old_list; int old_len; Arg args[2]; if (undo->repeat > 1) { XawTextDisableRedisplay(ispell.ascii); if (!_XawTextSrcUndo((TextSrcObject)ispell.source, &ispell.right)) Feep(); XawTextEnableRedisplay(ispell.ascii); } else ispell.right = (XawTextPosition)undo->undo_count; IspellSetRepeated(ispell.repeat = True); XtSetArg(args[0], XtNlabel, undo->undo_str); XtSetValues(ispell.word, args, 1); XmuSnprintf(ispell.sentbuf, sizeof(ispell.sentbuf), "^%s", strrchr(undo->undo_str, ' ') + 1); strcpy(ispell.sendbuf, ispell.sentbuf); XtSetArg(args[0], XtNstring, &ispell.sentbuf[1]); XtSetValues(ispell.text, args, 1); XtSetArg(args[0], XtNlist, &old_list); XtSetArg(args[1], XtNnumberStrings, &old_len); XtGetValues(ispell.list, args, 2); list = (char **)XtMalloc(sizeof(char*)); list[0] = XtNewString(&ispell.sentbuf[1]); XtSetArg(args[0], XtNlist, list); XtSetArg(args[1], XtNnumberStrings, 1); XtSetValues(ispell.list, args, 2); XtSetSensitive(ispell.list, True); XawListHighlight(ispell.list, 0); if (old_len > 1 || (XtName(ispell.list) != old_list[0])) { while (--old_len > -1) XtFree(old_list[old_len]); XtFree((char*)old_list); } IspellSetSelection(ispell.left, ispell.right); IspellSetStatus(ispell.repeat_label); ispell.lock = True; ispell.checkit = False; } else if (ispell.repeat) { *ispell.sentbuf = '\0'; IspellSetRepeated(ispell.repeat = False); } if (undo->prev) undo->prev->next = NULL; ispell.undo_head = undo->prev; if (undo == ispell.undo_base) { ispell.undo_base = NULL; ispell.undo_for = NULL; XtSetSensitive(ispell.undo, False); } if (undo->undo_str) XtFree(undo->undo_str); XtFree((char*)undo); --ispell.undo_depth; if (!ispell.stat || ispell.checkit) IspellSetSensitive(True); if (!ispell.repeat) { ispell.lock = ispell.checkit = False; ispell.stat = SEND; IspellSetStatus(ispell.working_label); while (IspellSend() == 0) ; } } /*ARGSUSED*/ static void CheckIspell(Widget w, XtPointer client_data, XtPointer call_data) { Arg args[1]; char *text, *str, string[1024]; int i, len; if (!ispell.lock) return; XtSetArg(args[0], XtNstring, &text); XtGetValues(ispell.text, args, 1); /* Check only a word at a time */ len = 0; str = text; while (*str) { if (isalpha(*str) || strchr(ispell.wchars, *str)) break; ++str; ++len; } i = 0; while (*str) { if (isalpha(*str) || strchr(ispell.wchars, *str)) string[i++] = *str++; else break; } string[i] = '\0'; if (strcmp(text, string)) { XawTextPosition pos = XawTextGetInsertionPoint(ispell.text) - len; XtSetArg(args[0], XtNstring, string); XtSetValues(ispell.text, args, 1); XawTextSetInsertionPoint(ispell.text, pos); Feep(); } if (i == 0) { Feep(); return; } len = XmuSnprintf(ispell.sendbuf, sizeof(ispell.sendbuf), "^%s\n", string); ispell.sendbuf[sizeof(ispell.sendbuf) - 1] = '\n'; write(ispell.ofd[1], ispell.sendbuf, len); ispell.lock = False; ispell.checkit = True; ispell.stat = RECEIVE; } /*ARGSUSED*/ static void LookIspell(Widget w, XtPointer client_data, XtPointer call_data) { int len, old_len; FILE *fd; Arg args[2]; char *text, *str, **list, **old_list, command[1024], buffer[1024]; Bool sensitive = True; if (!ispell.lock) return; XtSetArg(args[0], XtNstring, &text); XtGetValues(ispell.text, args, 1); if (!*text) { Feep(); return; } if (strlen(ispell.look_cmd) + strlen(text) + strlen(ispell.words_file) + 8 > sizeof(command) - 1) { fprintf(stderr, "Command line too large\n"); return; } XmuSnprintf(command, sizeof(command), "%s '^%s.*$' %s", ispell.look_cmd, text, ispell.words_file); if ((fd = popen(command, "r")) == NULL) { fprintf(stderr, "Cannot popen '%s'\n", ispell.look_cmd); return; } list = NULL; len = 0; #define MAX_LOOK_RESULTS 256 while (fgets(buffer, sizeof(buffer), fd) != NULL) { if ((str = strchr(buffer, '\n')) == NULL) { fprintf(stderr, "String is too large\n"); break; } *str = '\0'; if ((len % 16) == 0) list = (char**)XtRealloc((char*)list, sizeof(char*) * (len + 16)); list[len] = XtNewString(buffer); if (++len >= MAX_LOOK_RESULTS) { Feep(); break; } } #undef MAX_LOOK_RESULTS XtSetArg(args[0], XtNlist, &old_list); XtSetArg(args[1], XtNnumberStrings, &old_len); XtGetValues(ispell.list, args, 2); if (len == 0) { list = (char**)XtMalloc(sizeof(char*)); list[0] = XtNewString(""); len = 1; sensitive = False; } XtSetArg(args[0], XtNlist, list); XtSetArg(args[1], XtNnumberStrings, len); XtSetValues(ispell.list, args, 2); XtSetSensitive(ispell.list, sensitive); IspellSetStatus(sensitive ? ispell.look_label : ispell.none_label); if (old_len > 1 || (XtName(ispell.list) != old_list[0])) { while (--old_len > -1) XtFree(old_list[old_len]); XtFree((char*)old_list); } pclose(fd); } /*ARGSUSED*/ static void ToggleTerseIspell(Widget w, XtPointer client_data, XtPointer call_data) { if (!ispell.lock) return; ispell.terse_mode = !ispell.terse_mode; write(ispell.ofd[1], ispell.terse_mode ? "!\n" : "%\n", 2); } /*ARGSUSED*/ static void ChangeDictionaryIspell(Widget w, XtPointer client_data, XtPointer call_data) { ispell_dict *tmp, *dic = (ispell_dict*)client_data; XawTextPosition pos = XawTextGetInsertionPoint(ispell.ascii); XawTextPosition right = ispell.right; Arg args[1]; if (strcmp(XtName(dic->sme), ispell.dictionary) == 0) return; if (!ispell.lock) { if (IspellCheckProcess()) { Feep(); return; } } for (tmp = ispell.dict_info; tmp; tmp = tmp->next) if (strcmp(XtName(tmp->sme), ispell.dictionary) == 0) { XtSetArg(args[0], XtNleftBitmap, None); XtSetValues(tmp->sme, args, 1); } if (ispell.undo_base && !ispell.undo_for) ispell.undo_for = ispell.dictionary; XtSetArg(args[0], XtNleftBitmap, flist.pixmap); XtSetValues(dic->sme, args, 1); ispell.dictionary = XtName(dic->sme); ispell.wchars = dic->wchars; XtSetArg(args[0], XtNlabel, XtName(dic->sme)); XtSetValues(ispell.dict, args, 1); IspellSetStatus(ispell.working_label); (void)IspellEndProcess(True, False); ispell.lock = ispell.checkit = False; (void)IspellStartProcess(); ispell.stat = RECEIVE; /* restart at the same selected word */ if (ispell.repeat == False) ispell.left = ispell.right = pos; else ispell.right = right; } /*ARGSUSED*/ static void ChangeFormatIspell(Widget w, XtPointer client_data, XtPointer call_data) { struct _ispell_format *fmt = (struct _ispell_format*)client_data; Arg args[1]; if (strcmp(fmt->name, ispell.formatting) == 0) return; if (!ispell.lock) { Feep(); return; } XtSetArg(args[0], XtNleftBitmap, None); XtSetValues(ispell.format_info->sme, args, 1); XtSetArg(args[0], XtNleftBitmap, flist.pixmap); XtSetValues(fmt->sme, args, 1); ispell.formatting = fmt->name; ispell.format_info = fmt; XtSetArg(args[0], XtNlabel, fmt->name); XtSetValues(ispell.format, args, 1); } static Bool InitIspell(void) { Atom delete_window; char *str, *list; XtResource dict_res; ispell_dict *dict, *prev_dict; int i; static XtResource text_res[] = { {"skipLines", "Skip", XtRString, sizeof(char*), XtOffsetOf(struct _ispell, skip), XtRString, "#"}, }; if (ispell.shell) return (False); replace_hash = hash_new(RSTRTBLSZ, NULL); ignore_hash = hash_new(ISTRTBLSZ, NULL); ispell.shell = XtCreatePopupShell("ispell", transientShellWidgetClass, topwindow, NULL, 0); XtGetApplicationResources(ispell.shell, (XtPointer)&ispell, resources, XtNumber(resources), NULL, 0); ispell.form = XtCreateManagedWidget("form", formWidgetClass, ispell.shell, NULL, 0); ispell.mispelled = XtCreateManagedWidget("mispelled", labelWidgetClass, ispell.form, NULL, 0); ispell.repeated = XtCreateWidget("repeated", labelWidgetClass, ispell.form, NULL, 0); ispell.word = XtCreateManagedWidget("word", commandWidgetClass, ispell.form, NULL, 0); XtAddCallback(ispell.word, XtNcallback, RevertIspell, NULL); ispell.replacement = XtCreateManagedWidget("replacement", labelWidgetClass, ispell.form, NULL, 0); ispell.text = XtVaCreateManagedWidget("text", asciiTextWidgetClass, ispell.form, XtNeditType, XawtextEdit, NULL); ispell.suggestions = XtCreateManagedWidget("suggestions", labelWidgetClass, ispell.form, NULL, 0); ispell.viewport = XtCreateManagedWidget("viewport", viewportWidgetClass, ispell.form, NULL, 0); ispell.list = XtCreateManagedWidget("list", listWidgetClass, ispell.viewport, NULL, 0); XtAddCallback(ispell.list, XtNcallback, SelectIspell, NULL); ispell.commands = XtCreateManagedWidget("commands", formWidgetClass, ispell.form, NULL, 0); ispell.check = XtCreateManagedWidget("check", commandWidgetClass, ispell.commands, NULL, 0); XtAddCallback(ispell.check, XtNcallback, CheckIspell, NULL); ispell.look = XtCreateManagedWidget("look", commandWidgetClass, ispell.commands, NULL, 0); XtAddCallback(ispell.look, XtNcallback, LookIspell, NULL); ispell.undo = XtCreateManagedWidget("undo", commandWidgetClass, ispell.commands, NULL, 0); XtAddCallback(ispell.undo, XtNcallback, UndoIspell, NULL); ispell.replace = XtCreateManagedWidget("replace", commandWidgetClass, ispell.commands, NULL, 0); XtAddCallback(ispell.replace, XtNcallback, ReplaceIspell, (XtPointer)False); ispell.replaceAll = XtCreateManagedWidget("replaceAll", commandWidgetClass, ispell.commands, NULL, 0); XtAddCallback(ispell.replaceAll, XtNcallback, ReplaceIspell, (XtPointer)True); ispell.ignore = XtCreateManagedWidget("ignore", commandWidgetClass, ispell.commands, NULL, 0); XtAddCallback(ispell.ignore, XtNcallback, IgnoreIspell, (XtPointer)False); ispell.ignoreAll = XtCreateManagedWidget("ignoreAll", commandWidgetClass, ispell.commands, NULL, 0); XtAddCallback(ispell.ignoreAll, XtNcallback, IgnoreIspell, (XtPointer)True); ispell.add = XtCreateManagedWidget("add", commandWidgetClass, ispell.commands, NULL, 0); XtAddCallback(ispell.add, XtNcallback, AddIspell, (XtPointer)ASIS); ispell.addUncap = XtCreateManagedWidget("addUncap", commandWidgetClass, ispell.commands, NULL, 0); XtAddCallback(ispell.addUncap, XtNcallback, AddIspell, (XtPointer)UNCAP); ispell.suspend = XtCreateManagedWidget("suspend", commandWidgetClass, ispell.commands, NULL, 0); XtAddCallback(ispell.suspend, XtNcallback, PopdownIspell, (XtPointer)False); ispell.cancel = XtCreateManagedWidget("cancel", commandWidgetClass, ispell.commands, NULL, 0); XtAddCallback(ispell.cancel, XtNcallback, PopdownIspell, (XtPointer)True); ispell.terse = XtVaCreateManagedWidget("terse", toggleWidgetClass, ispell.commands, XtNstate, ispell.terse_mode, NULL); XtAddCallback(ispell.terse, XtNcallback, ToggleTerseIspell, NULL); ispell.status = XtCreateManagedWidget("status", labelWidgetClass, ispell.form, NULL, 0); ispell.options = XtCreateManagedWidget("options", formWidgetClass, ispell.form, NULL, 0); ispell.dict = XtVaCreateManagedWidget("dict", menuButtonWidgetClass, ispell.options, XtNmenuName, "dictionaries", NULL); ispell.dictMenu = XtCreatePopupShell("dictionaries", simpleMenuWidgetClass, ispell.options, NULL, 0); XtRealizeWidget(ispell.dictMenu); ispell.format = XtVaCreateManagedWidget("format", menuButtonWidgetClass, ispell.options, XtNmenuName, "formats", NULL); ispell.formatMenu = XtCreatePopupShell("formats", simpleMenuWidgetClass, ispell.options, NULL, 0); XtRealizeWidget(ispell.formatMenu); XtRealizeWidget(ispell.shell); for (i = 0; i < sizeof(ispell_format) / sizeof(ispell_format[0]); i++) { struct _ispell_format *fmt = &ispell_format[i]; fmt->sme = XtCreateManagedWidget(fmt->name, smeBSBObjectClass, ispell.formatMenu, NULL, 0); XtAddCallback(fmt->sme, XtNcallback, ChangeFormatIspell, (XtPointer)fmt); if (strcmp(fmt->name, ispell.formatting) == 0) { Arg args[1]; XtSetArg(args[0], XtNlabel, ispell.formatting); XtSetValues(ispell.format, args, 1); XtSetArg(args[0], XtNleftBitmap, flist.pixmap); XtSetValues(fmt->sme, args, 1); ispell.format_info = fmt; } } if (ispell.format_info == NULL) { Arg args[1]; char msg[256]; ispell.format_info = &ispell_format[TEXT]; XmuSnprintf(msg, sizeof(msg), "Unrecognized formatting type \"%s\", will use \"%s\"", ispell.formatting, ispell.format_info->name); XtAppWarning(XtWidgetToApplicationContext(ispell.shell), msg); ispell.formatting = ispell.format_info->name; XtSetArg(args[0], XtNlabel, ispell.format_info->name); XtSetValues(ispell.format, args, 1); XtSetArg(args[0], XtNleftBitmap, flist.pixmap); XtSetValues(ispell.format_info->sme, args, 1); } XtGetApplicationResources(ispell_format[TEXT].sme, (XtPointer)&ispell, text_res, XtNumber(text_res), NULL, 0); dict_res.resource_name = "wordChars"; dict_res.resource_class = "Chars"; dict_res.resource_type = XtRString; dict_res.resource_size = sizeof(char*); dict_res.resource_offset = XtOffsetOf(ispell_dict, wchars); dict_res.default_type = XtRString; dict_res.default_addr = ""; list = XtNewString(ispell.dict_list); /* Create first empty entry */ dict = XtNew(ispell_dict); dict->sme = XtCreateManagedWidget("", smeBSBObjectClass, ispell.dictMenu, NULL, 0); dict->wchars = ""; XtAddCallback(dict->sme, XtNcallback, ChangeDictionaryIspell, (XtPointer)dict); ispell.dict_info = prev_dict = dict; for (str = strtok(list, " \t,"); str; str = strtok(NULL, " \t,")) { dict = XtNew(ispell_dict); dict->sme = XtCreateManagedWidget(str, smeBSBObjectClass, ispell.dictMenu, NULL, 0); XtGetApplicationResources(dict->sme, (XtPointer)dict, &dict_res, 1, NULL, 0); XtAddCallback(dict->sme, XtNcallback, ChangeDictionaryIspell, (XtPointer)dict); prev_dict->next = dict; prev_dict = dict; dict->next = NULL; } XtFree(list); for (dict = ispell.dict_info; dict; dict = dict->next) { if (strcmp(XtName(dict->sme), ispell.dictionary) == 0) { Arg args[1]; XtSetArg(args[0], XtNleftBitmap, flist.pixmap); XtSetValues(dict->sme, args, 1); XtSetArg(args[0], XtNlabel, XtName(dict->sme)); XtSetValues(ispell.dict, args, 1); ispell.wchars = dict->wchars; break; } } delete_window = XInternAtom(XtDisplay(ispell.shell), "WM_DELETE_WINDOW", False); XSetWMProtocols(XtDisplay(ispell.shell), XtWindow(ispell.shell), &delete_window, 1); return (True); } x11-apps-7.7+5+nmu1ubuntu1/xedit/config.h.in0000664000000000000000000000346512656634657015365 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the declaration of `_SC_PAGESIZE', and to 0 if you don't. */ #undef HAVE_DECL__SC_PAGESIZE /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION x11-apps-7.7+5+nmu1ubuntu1/xedit/AUTHORS0000664000000000000000000000502712472175711014371 0ustar (Original author based on manpage) Chris D. Peterson, MIT X Consortium commands.c util.c xedit.c xedit.h ------------------------------------------------------------------------ Paulo Cesar Pereira de Andrade xedit: hook.c hash.c ispell.c lisp.c options.c tags.c util.h xedit lisp interface: lisp/bytecode.c lisp/bytecode.h lisp/compile.c lisp/core.c lisp/core.h lisp/debugger.c lisp/debugger.h lisp/format.c lisp/format.h lisp/internal.h lisp/io.c lisp/io.h lisp/hash.c lisp/hash.h lisp/helper.c lisp/helper.h lisp/lisp.c lisp/lisp.h lisp/math.c lisp/math.h lisp/mathimp.c lisp/package.c lisp/package.h lisp/pathname.c lisp/pathname.h lisp/private.h lisp/read.c lisp/read.h lisp/regex.c lisp/regex.h lisp/require.c lisp/require.h lisp/stream.c lisp/stream.h lisp/string.c lisp/string.h lisp/struct.c lisp/struct.h lisp/time.c lisp/time.h lisp/write.c lisp/write.h lisp/xedit.c lisp/xedit.h bignum math library: lisp/mp/mp.h lisp/mp/mpr.c lisp/mp/mpi.c lisp/mp/mp.c command line lisp interpreter: lisp/lsp.c regex library: lisp/re/re.c lisp/re/re.h lisp/re/reo.c lisp/re/rep.h lisp/re/rec.c lisp/re/tests.c lisp/re/tests.txt source files to test the lisp interpreter: lisp/test/widgets.lsp lisp/test/list.lsp lisp/test/hello.lsp lisp/test/regex.lsp lisp/test/stream.lsp lisp/test/math.lsp lisp binary modules: lisp/modules/psql.c lisp/modules/x11.c lisp/modules/xaw.c lisp/modules/xt.c lisp source modules: lisp/modules/indent.lsp lisp/modules/lisp.lsp lisp/modules/syntax.lsp lisp/modules/xedit.lsp lisp syntax highlight and indentation rules definitions: lisp/modules/progmodes/c.lsp lisp/modules/progmodes/html.lsp lisp/modules/progmodes/imake.lsp lisp/modules/progmodes/lisp.lsp lisp/modules/progmodes/make.lsp lisp/modules/progmodes/man.lsp lisp/modules/progmodes/patch.lsp lisp/modules/progmodes/rpm.lsp lisp/modules/progmodes/sgml.lsp lisp/modules/progmodes/sh.lsp lisp/modules/progmodes/xconf.lsp lisp/modules/progmodes/xlog.lsp lisp/modules/progmodes/xrdb.lsp ------------------------------------------------------------------------ Files required when compiling with xprint support: (Based on Copyright notice) Roland Mainz xedit: print.c print.h printdialog.c printdialog.h printdialogprivates.h ------------------------------------------------------------------------ Files required for systems that don't have the required calls in the standard libraries: (Based on Copyright notice) Constantin S. Svintsoff realpath.c (No author information, using CVS tag) David Dawes strcasecmp.c x11-apps-7.7+5+nmu1ubuntu1/xedit/man/0000775000000000000000000000000012656635743014102 5ustar x11-apps-7.7+5+nmu1ubuntu1/xedit/man/xedit.man0000664000000000000000000003505312472175711015710 0ustar '\" t .\" $XConsortium: xedit.man,v 1.23 94/04/17 20:43:39 matt Exp $ .\" Copyright (c) 1994 X Consortium .\" .\" Permission is hereby granted, free of charge, to any person obtaining .\" a copy of this software and associated documentation files (the .\" "Software"), to deal in the Software without restriction, including .\" without limitation the rights to use, copy, modify, merge, publish, .\" distribute, sublicense, and/or sell copies of the Software, and to .\" permit persons to whom the Software is furnished to do so, subject to .\" the following conditions: .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of the X Consortium shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from the X Consortium. .\" .\" $XFree86: xc/programs/xedit/xedit.man,v 1.18 2002/10/12 16:06:48 herrb Exp $ .\" .TH XEDIT 1 __vendorversion__ .SH NAME xedit \- simple text editor for X .SH SYNTAX .B xedit [ .I \-toolkitoption \&.\|.\|. ] [ .I filename \&.\|.\|. ] .SH DESCRIPTION .I Xedit provides a window consisting of the following four areas: .IP "Commands Section" 25 A set of commands that allow you to exit \fIxedit\fP, save the file, or load a new file into the edit window. .IP "Message Window" 25 Displays \fIxedit\fP messages. In addition, this window can be also used as a scratch pad. .IP "Filename Display" Displays the name of the file currently being edited, and whether this file is \fIRead-Write\fP or \fIRead Only\fP. .IP "Edit Window" 25 Displays the text of the file that you are editing or creating. .SH OPTIONS .I Xedit accepts all of the standard X Toolkit command line options (see .IR X (__miscmansuffix__)). The order of the command line options is not important. .TP 8 .I filename Specifies the file(s) that are to be loaded during start-up. This is the file which will be edited. If a file is not specified, .I xedit lets you load files or create new files after it has started up. .SH EDITING The Athena Text widget is used for the three sections of this application that allow text input. The characters typed will go to the Text widget that has the input focus, or the Text widget that the pointer cursor is currently over. .PP The following keystroke combinations are defined: .sp .TS l l. Ctrl-a Beginning Of Line Meta-b Backward Word Ctrl-b Backward Character Meta-f Forward Word Ctrl-d Delete Next Character Meta-i Insert File Ctrl-e End Of Line Meta-k Kill To End Of Paragraph Ctrl-f Forward Character Meta-q Form Paragraph Ctrl-g Keyboard Reset Meta-v Previous Page Ctrl-h Delete Previous Character Meta-y Insert Current Selection Ctrl-j Newline And Indent Meta-z Scroll One Line Down Ctrl-k Kill To End Of Line Meta-d Delete Next Word Ctrl-l Redraw Display Meta-D Kill Word Ctrl-m Newline Meta-h Delete Previous Word Ctrl-n Next Line Meta-H Backward Kill Word Ctrl-o Newline And Backup Meta-< Beginning Of File Ctrl-p Previous Line Meta-> End Of File Ctrl-r Search/Replace Backward Meta-] Forward Paragraph Ctrl-s Search/Replace Forward Meta-[ Backward Paragraph Ctrl-t Transpose Characters Ctrl-u [\fInumber\fP] Multiply by 4 or \fInumber\fP Meta-Delete Delete Previous Word Ctrl-v Next Page Meta-Shift Delete Kill Previous Word Ctrl-w Kill Selection Meta-Backspace Delete Previous Word Ctrl-y Unkill Meta-Shift Backspace Kill Previous Word Ctrl-z Scroll One Line Up Meta-z Scroll One Line Down Ctrl-_ Undo Escape Line Edit Mode .TE .sp In addition, the pointer may be used to cut and paste text: .TS l l. Button 1 Down Start Selection Button 1 Motion Adjust Selection Button 1 Up End Selection (cut) Button 2 Down Insert Current Selection (paste) Button 3 Down Extend Current Selection Button 3 Motion Adjust Selection Button 3 Up End Selection (cut) .TE .sp .SH LINE EDIT MODE .I Line edit mode enables several shortcut commands for searching and replacing text in a xedit buffer. .I Line edit mode commands have the format: .br .nf [\fIline-number\fP[,\fIline-number\fP]]\fIcommand\fP[\fIparameters\fP] .fi .I Line number may be specified as: .TP 8 \&. The current text line. .TP 8 $ The last line of the file. .TP 8 number The literal line \fInumber\fP. .TP 8 - or ^ The previous line. Equivalent to \fI-1\fP. .TP 8 -number or ^number The current line minus \fInumber\fP. .TP 8 + The next line. Equivalent to \fI+1\fP. .TP 8 +number The current line plus \fInumber\fP. .TP 8 , or % From the first to the last line. Equivalent to \fI1,$\fP. .TP 8 ; From the current to the last line. Equivalent to \fI.,$\fP. .PP .I Command may be specified as: .TP 8 s Substitute text in the specified lines. .TP 8 /re/ Search forward for the regular expression pattern \fIre\fP. .TP 8 ?re? Search backward for the regular expression pattern \fIre\fP. .PP .I Parameters may be specified as: .TP 8 /re/ Works as a parameter to \fIi\fP or as a command. .TP 8 /re/text/ Search forward for \fIre\fP and substitute by \fItext\fP. .PP .I Options may follow or be parameters, known values are: .TP 8 i Case insensitive search. .TP 8 g \fIGlobal\fP match when replacing text. Unless specified, only the nth, that defaults to 1, match will be replaced. .TP 8 c \fIConfirm\fP before replacing text. .TP 8 number Replace only the occurrence referenced by \fInumber\fP. .PP Commands accept some variations, examples: .br .nf /pattern/i i/pattern/ i/pattern .fi Search forward for \fIpattern\fP. .br .nf ,sc/pattern/text ,sc/pattern/text/ ,s/pattern/text/c .fi Search the entire buffer and ask confirmation to replace \fIpattern\fP with \fItext\fP. .br .nf ,s/pattern/text/number .fi Replace the match \fInumber\fP in the text line. If not specified, defaults to the first occurrence. .PP When searching for text, type to go to the next match. When interactively replacing text, type \fIy\fP or \fIY\fP to accept the change, and \fIn\fP or \fIN\fP to ignore it and go to the next match. .SH COMMANDS .IP Quit 8 Quits the current editing session. If any changes have not been saved, .I xedit displays a warning message, allowing the user to save them. .IP Save If file backups are enabled (see RESOURCES, below) .I xedit stores a copy of the original, unedited file in \fIfile\fP, then overwrites the \fIfile\fP with the contents of the edit window. The filename is retrieved from the Text widget directly to the right of the \fILoad\fP button. .IP Load Loads the file named in the text widget immediately to the right of the this button and displays it in the Edit window. .SH RESOURCES For \fIxedit\fP the available resources are: .TP 8 .B tagsName (\fPClass\fB TagsName) Specifies the name of the tags file to search when loading a new file. Default value is \fItags\fP. .TP 8 .B loadTags (\fPClass\fB LoadTags) Boolean value to enable or disabling searching for tags files. Default is \fITrue\fP. .TP 8 .B enableBackups (\fPClass\fB EnableBackups) Specifies that, when edits made to an existing file are saved, .I xedit is to copy the original version of that file to \fIfile\fP before it saves the changes. The default value for this resource is ``on,'' stating that backups should be created. .TP 8 .B backupNamePrefix (\fPClass\fB BackupNamePrefix) Specifies a string that is to be prepended to the backup filename. The default is that no string shall be prepended. .TP 8 .B backupNameSuffix (\fPClass\fB BackupNameSuffix) Specifies a string that is to be appended to the backup filename. The default is to use ``~'' as the suffix. .TP 8 .B positionFormat (\fPClass\fB Format) Specifies a format string used to display the cursor position. This string uses printf(__libmansuffix__) like notation, where .B %l prints the line number, .B %c prints the column number, .B %p prints the insert position offset, and .B %s prints the current file size. It is also allowed to specify field sizes, with the notation .B %\-?[0\-9]+ \&. The default format string is ``L%l'', which shows the character ``L'' followed by the line number. .TP 8 .B hints (\fPClass\fB Hints) Specifies a list of strings, separated by new lines, that will be displayed in the bc_label window. .TP 8 .B hintsInterval (\fPClass \fBInterval) Specifies the interval in seconds, which the hint string in the bc_label window will be changed. .TP 8 .B changedBitmap (\fPClass \fBBitmap) Specifies the name of the Bitmap that will be displayed in the fileMenu, when the file being edited is changed. .TP 8 .B autoReplace (\fPClass \fBReplace) This resource is useful to automatically correct common misspelling errors, but can also be used to create simple macros. The format is \fI{non-blanks}{blanks}[{string}]\fP. Fields are separated by newlines. Example of use: \" .br .nf nto not\\n\\ /macro some long string with \\\\\\n newlines \\\\\\n .fi \" .br Will automatically replace the word \fInto\fP by \fInot\fP, and \fI/macro\fP by \fIsome long string with newlines \fP when you type that words. .TP 8 .B ispell.dictionaries (\fPClass \fBispell.Dictionary) Specifies a list of dictionary names, separated by spaces, available to the ispell program. The default value is \fI"american americamed+ english"\fP. .TP 8 .B ispell.dictionary (\fPClass \fBispell.Dictionary) Specifies the default dictionary to use. .TP 8 .B ispell*.wordChars (\fPClass \fBispell*Chars) Specifies a set of characters that can be part of a legal word. The \fI\fP field is one of the dictionaries specified in the \fIdictionaries\fP resource. .TP 8 .B ispell.ispellCommand (\fPClass \fBispell.CommandLine) The path to the ispell program, and possibly, additional arguments. You don't need to specify the ``-w'' option, neither the ``-a'' option. Refer to the \fIispell\fP(__appmansuffix__) manpage for more information on ispell options. .TP 8 .B ispell.formatting (\fPClass \fPispell.TextFormat) Specifies which text formatting to use while spell checking the file. The available formats are \fItext\fP and \fIhtml\fP. .TP 8 .B ispell*text.skipLines (\fPClass \fBispell*text.Skip) Lines starting with one of the characters in this string will not be spell checked. This resource is only used in \fItext\fP mode. .TP 8 .B ispell.terseMode (\fPClass \fBispell.Terse) When enabled, runs ispell in terse mode, not asking user interaction for words generated through compound formation (when using the ispell ``-C'' option), or words generated through affix removal. The default value is False. .TP 8 .B ispell.lookCommand (\fPClass \fBispell.CommandLine) The path to the program to search for alternate words, and possibly, additional arguments. The default program used is \fI/usr/bin/egrep\fP. .TP 8 .B ispell.wordsFile (\fPClass \fBispell.Words) The path to the file[s] to search for alternate words. The default file is \fI/usr/share/dict/words\fP. .TP 8 .B ispell.guessLabel (\fPClass \fBispell.Status) String displayed in the ispell status bar when ispell returns a guess list of one or more words. The default value is \fIGuess\fP. .TP 8 .B ispell.missLabel (\fPClass \fBispell.Status) String displayed in the ispell status bar when ispell returns a list of one or more words to match a misspelled one. The default value is \fIMiss\fP. .TP 8 .B ispell.rootLabel (\fPClass \fBispell.Status) String displayed in the ispell status bar when the word is not in the dictionary, but it can be formed through a root one. The default value is \fIRoot:\fP, and is followed by a space and the root word. .TP 8 .B ispell.noneLabel (\fPClass \fBispell.Status) String displayed in the ispell status bar when there is no near misses. The default value is \fINone\fP. .TP 8 .B ispell.compoundLabel (\fPClass \fBispell.Status) String displayed in the ispell status bar when the word being checked is formed by concatenation of two words. The default value is \fICompound\fP. .TP 8 .B ispell.okLabel (\fPClass \fBispell.Status) String displayed in the ispell status bar when the checked word is in the dictionary. This string is only displayed when using the \fIcheck\fP button in the xedit ispell interface. The default value is \fIOk\fP. .TP 8 .B ispell.eofLabel (\fPClass \fBispell.Status) The string displayed in the ispell status bar when the end of the file is reached. The default value is \fIEnd Of File\fP. .TP 8 .B ispell.repeatLabel (\fPClass \fBispell.Status) The string displayed in the ispell status bar when two identical words are found together in the file. The default value is \fIRepeat\fP. .TP 8 .B ispell.lookLabel (\fPClass \fBispell.Status) The string displayed in the ispell status bar after displaying the results of the \fILook\fP command. If no results are found, the value of the \fIispell.noneLabel\fP resource is shown. .TP 8 .B ispell.workingLabel (\fPClass \fBispell.Status) The string displayed in the ispell status bar while xedit is communicating with ispell. The default value is \fI...\fP. .SH WIDGETS In order to specify resources, it is useful to know the hierarchy of the widgets which compose \fIxedit\fR. In the notation below, indentation indicates hierarchical structure. The widget class name is given first, followed by the widget instance name. .sp .nf .ft CW Xedit xedit Paned paned Paned buttons Command quit Command save Command load Text filename Label bc_label Text messageWindow Label labelWindow Text editWindow .ft .fi .sp .SH ENVIRONMENT .PP .TP 20 .I DISPLAY to get the default host and display number. .TP 20 .I XENVIRONMENT to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH FILES .TP 20 .I __apploaddir__/Xedit specifies required resources .SH "SEE ALSO" .IR X (__miscmansuffix__), .IR xrdb (__appmansuffix__), .I "Athena Widget Set" .SH RESTRICTIONS Xedit is not a replacement to Emacs. .SH COPYRIGHT Copyright 1988, Digital Equipment Corporation. .br Copyright 1989, X Consortium .br Copyright 1998, The XFree86 Project .br See .IR X (__miscmansuffix__) for a full statement of rights and permissions. .SH AUTHORS Chris D. Peterson, MIT X Consortium .br Paulo Cesar Pereira de Andrade, The XFree86 Project x11-apps-7.7+5+nmu1ubuntu1/xedit/man/Makefile.am0000664000000000000000000000052312472175711016124 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = xedit.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/xedit/xedit.h0000664000000000000000000001444212472175711014610 0ustar /* * rcs_id[] = "$XConsortium: xedit.h,v 1.19 89/10/07 14:59:46 kit Exp $"; */ /* * COPYRIGHT 1987 * DIGITAL EQUIPMENT CORPORATION * MAYNARD, MASSACHUSETTS * ALL RIGHTS RESERVED. * * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR * ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. * * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT RIGHTS, * APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN ADDITION TO THAT * SET FORTH ABOVE. * * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Digital Equipment Corporation not be * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ /* $XFree86: xc/programs/xedit/xedit.h,v 1.17 2002/10/06 17:11:39 paulo Exp $ */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* for the property list definition */ #include #define LSCAN(from, count, include) \ XawTextSourceScan(source, from, XawstEOL, XawsdLeft, count, include) #define RSCAN(from, count, include) \ XawTextSourceScan(source, from, XawstEOL, XawsdRight, count, include) typedef struct _xedit_hints { char *resource; unsigned long interval; XtIntervalId timer; char **hints; unsigned num_hints; unsigned cur_hint; } xedit_hints; typedef enum {NO_READ, READ_OK, WRITE_OK} FileAccess; typedef struct _XeditLispData XeditLispData; typedef struct _XeditTagsInfo XeditTagsInfo; #define CHANGED_BIT 0x01 #define EXISTS_BIT 0x02 #define WRAP_BIT 0x10 typedef struct _xedit_flist_item { Widget source, sme; String name; String filename; int flags; FileAccess file_access; XawTextPosition display_position, insert_position; int mode; time_t mtime; XawTextPropertyList *properties; XawTextWrapMode wrap; XeditLispData *xldata; XeditTagsInfo *tags; } xedit_flist_item; extern struct _xedit_flist { Widget popup; Pixmap pixmap; xedit_flist_item **itens; xedit_flist_item *current, *other; Cardinal num_itens; } flist; extern Widget options_popup; extern struct _app_resources { Boolean enableBackups; char *backupNamePrefix; char *backupNameSuffix; xedit_hints hints; char *changed_pixmap_name; char *position_format; char *auto_replace; char *tagsName; Boolean loadTags; } app_resources; extern Widget topwindow, textwindow, labelwindow, filenamewindow, messwidget; extern Widget dirlabel, dirwindow; extern Boolean international; extern Boolean line_edit; /* externals in xedit.c */ void Feep(void); /* externals in util.c */ void XeditPrintf(const char *format, ...); Widget MakeCommandButton(Widget, char*, XtCallbackProc); Widget MakeStringBox(Widget, String, String); String GetString(Widget); FileAccess MaybeCreateFile(const char*), CheckFilePermissions(const char*, Boolean*); xedit_flist_item *AddTextSource(Widget, const char *, const char *, int, FileAccess); xedit_flist_item *FindTextSource(Widget, const char*); Bool KillTextSource(xedit_flist_item*); char *ResolveName(char*); void DeleteWindow(Widget, XEvent*, String*, Cardinal*); void SplitWindow(Widget, XEvent*, String*, Cardinal*); void SwitchTextSource(xedit_flist_item*); void PopupMenu(Widget, XEvent*, String*, Cardinal*); void OtherWindow(Widget, XEvent*, String*, Cardinal*); void SwitchSource(Widget, XEvent*, String*, Cardinal*); void XeditFocus(Widget, XEvent*, String*, Cardinal*); void SwitchDirWindow(Bool); void DirWindow(Widget, XEvent*, String*, Cardinal*); /* externs in commands.c */ void DoQuit(Widget, XtPointer, XtPointer); void QuitAction(Widget, XEvent*, String*, Cardinal*); void DoSave(Widget, XtPointer, XtPointer); void SaveFile(Widget, XEvent*, String*, Cardinal*); void DoLoad(Widget, XtPointer, XtPointer); void CancelFindFile(Widget, XEvent*, String*, Cardinal*); void FindFile(Widget, XEvent*, String*, Cardinal*); void LoadFile(Widget, XEvent*, String*, Cardinal*); Bool LoadFileInTextwindow(char *name, char *resolved_name); void FileCompletion(Widget, XEvent*, String*, Cardinal*); void KillFile(Widget, XEvent*, String*, Cardinal*); void DirWindowCB(Widget, XtPointer, XtPointer); void SourceChanged(Widget, XtPointer, XtPointer); /* externs in ispell.c */ void IspellAction(Widget, XEvent*, String*, Cardinal*); void IspellCallback(Widget, XtPointer, XtPointer); /* externs in options.c */ void CreateEditPopup(void); void SetEditMenu(void); void UpdateTextProperties(int); /* externs in hook.c */ Bool StartHooks(XtAppContext); void LineEditAction(Widget, XEvent*, String*, Cardinal*); void LineEdit(Widget); /* externs in lisp.c */ void XeditLispInitialize(void); void XeditLispEval(Widget, XEvent*, String*, Cardinal*); void XeditPrintLispEval(Widget, XEvent*, String*, Cardinal*); void XeditKeyboardReset(Widget, XEvent*, String*, Cardinal*); void XeditLispCleanUp(void); void SetTextProperties(xedit_flist_item*); void UnsetTextProperties(xedit_flist_item*); void CreateEditModePopup(Widget); void SetEditModeMenu(void); /* tags.c */ void TagsAction(Widget, XEvent*, String*, Cardinal*); void SearchTagsFile(xedit_flist_item *item); /* externs for system replacement functions */ #ifdef NEED_STRCASECMP int strcasecmp(const char *s1, const char *s2); int strncasecmp(const char *s1, const char *s2, size_t n); #endif #ifdef NEED_REALPATH #include #if defined(ISC) #ifndef MAXPATHLEN #define MAXPATHLEN 1024 #endif #endif char *realpath(const char *pathname, char resolvedname[MAXPATHLEN]); #endif x11-apps-7.7+5+nmu1ubuntu1/xedit/config.sub0000775000000000000000000010577012472175763015321 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx | dvp \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsEE* | ee | ps2) basic_machine=mips64r5900el-scei case $os in -linux*) ;; *) os=-elf ;; esac ;; iop) basic_machine=mipsel-scei os=-irx ;; dvp) basic_machine=dvp-scei os=-elf ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -irx* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xedit/Makefile.am0000664000000000000000000001244112472175711015353 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = xedit noinst_LIBRARIES = liblisp.a libre.a libmp.a noinst_PROGRAMS = lisp/lsp lisp/re/tests # # libmp.a # libmp_a_CFLAGS = $(CWARNFLAGS) libmp_a_SOURCES = \ lisp/mp/mp.c \ lisp/mp/mp.h \ lisp/mp/mpi.c \ lisp/mp/mpr.c # # liblisp.a # liblisp_a_CFLAGS = $(CWARNFLAGS) -I$(top_srcdir)/lisp/re -I$(top_srcdir)/lisp/mp -DLISP -DLISPDIR=\"$(LISPDIR)\" $(PKGDEPS_CFLAGS) liblisp_a_SOURCES = \ lisp/bytecode.c \ lisp/bytecode.h \ lisp/core.c \ lisp/core.h \ lisp/debugger.c \ lisp/debugger.h \ lisp/format.c \ lisp/format.h \ lisp/hash.c \ lisp/hash.h \ lisp/helper.c \ lisp/helper.h \ lisp/internal.h \ lisp/io.c \ lisp/io.h \ lisp/lisp.c \ lisp/lisp.h \ lisp/math.c \ lisp/math.h \ lisp/package.c \ lisp/package.h \ lisp/pathname.c \ lisp/pathname.h \ lisp/private.h \ lisp/read.c \ lisp/read.h \ lisp/regex.c \ lisp/regex.h \ lisp/require.c \ lisp/require.h \ lisp/stream.c \ lisp/stream.h \ lisp/string.c \ lisp/string.h \ lisp/struct.c \ lisp/struct.h \ lisp/time.c \ lisp/time.h \ lisp/write.c \ lisp/write.h \ lisp/xedit.c \ lisp/xedit.h if NEED_UNSETENV liblisp_a_SOURCES += lisp/getenv.c liblisp_a_SOURCES += lisp/setenv.c endif # # libre.a # libre_a_CFLAGS = $(CWARNFLAGS) libre_a_SOURCES = \ lisp/re/re.c \ lisp/re/rec.c \ lisp/re/re.h \ lisp/re/reo.c \ lisp/re/rep.h # # xedit # xedit_DEPENDENCIES = liblisp.a libmp.a libre.a xedit_CFLAGS = $(CWARNFLAGS) $(PKGDEPS_CFLAGS) -I$(top_srcdir)/lisp/re -D_BSD_SOURCE -DXEDIT xedit_LDADD = -L. -lre -llisp -lmp $(PKGDEPS_LIBS) -lm xedit_SOURCES = \ commands.c \ hash.c \ hook.c \ ispell.c \ lisp.c \ options.c \ tags.c \ util.c \ util.h \ xedit.c \ xedit.h if NEED_REALPATH xedit_SOURCES += realpath.c endif if NEED_STRCASECMP xedit_SOURCES += strcasecmp.c endif # lisp/lsp lisp_lsp_DEPENDENCIES = liblisp.a libre.a libmp.a lisp_lsp_CFLAGS = $(CWARNFLAGS) -I$(top_srcdir)/lisp/re -I$(top_srcdir)/lisp/mp -DLISP -DLISPDIR=\"@LISPDIR@\" -D_BSD_SOURCE lisp_lsp_LDADD = -L. -llisp -lre -lmp -lm lisp_lsp_SOURCES = \ hash.c \ lisp/lsp.c if NEED_REALPATH lisp_lsp_SOURCES += realpath.c endif if NEED_STRCASECMP lisp_lsp_SOURCES += strcasecmp.c endif # re/tests lisp_re_tests_DEPENDENCIES = libre.a lisp_re_tests_CFLAGS = $(CWARNFLAGS) -I$(top_srcdir)/lisp/re -D_BSD_SOURCE lisp_re_tests_LDADD = -L. -lre lisp_re_tests_SOURCES = lisp/re/tests.c # App default files DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ appdefault_DATA = \ app-defaults/Xedit-color \ app-defaults/Xedit lispdir = $(LISPDIR) dist_lisp_DATA = ${srcdir}/lisp/modules/lisp.lsp \ ${srcdir}/lisp/modules/xedit.lsp \ ${srcdir}/lisp/modules/syntax.lsp \ ${srcdir}/lisp/modules/indent.lsp progmodesdir = $(LISPDIR)/progmodes dist_progmodes_DATA = \ ${srcdir}/lisp/modules/progmodes/auto.lsp \ ${srcdir}/lisp/modules/progmodes/c.lsp \ ${srcdir}/lisp/modules/progmodes/html.lsp \ ${srcdir}/lisp/modules/progmodes/imake.lsp \ ${srcdir}/lisp/modules/progmodes/lisp.lsp \ ${srcdir}/lisp/modules/progmodes/make.lsp \ ${srcdir}/lisp/modules/progmodes/man.lsp \ ${srcdir}/lisp/modules/progmodes/patch.lsp \ ${srcdir}/lisp/modules/progmodes/perl.lsp \ ${srcdir}/lisp/modules/progmodes/python.lsp \ ${srcdir}/lisp/modules/progmodes/rpm.lsp \ ${srcdir}/lisp/modules/progmodes/sgml.lsp \ ${srcdir}/lisp/modules/progmodes/sh.lsp \ ${srcdir}/lisp/modules/progmodes/xconf.lsp \ ${srcdir}/lisp/modules/progmodes/xlog.lsp \ ${srcdir}/lisp/modules/progmodes/xrdb.lsp EXTRA_DIST = \ app-defaults/Xedit-color \ app-defaults/Xedit \ app-defaults/Xedit-sample \ lisp/README \ lisp/TODO \ lisp/compile.c \ lisp/mathimp.c \ lisp/modules/psql.c \ lisp/modules/x11.c \ lisp/modules/xaw.c \ lisp/modules/xt.c \ lisp/re/README \ lisp/re/tests.txt \ lisp/test/hello.lsp \ lisp/test/list.lsp \ lisp/test/math.lsp \ lisp/test/psql-1.lsp \ lisp/test/psql-2.lsp \ lisp/test/psql-3.lsp \ lisp/test/regex.lsp \ lisp/test/stream.lsp \ lisp/test/widgets.lsp MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xedit/realpath.c0000664000000000000000000001325212472175711015264 0ustar /* $OpenBSD: realpath.c,v 1.14 2011/07/24 21:03:00 miod Exp $ */ /* * Copyright (c) 2003 Constantin S. Svintsoff * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include #include #include #include #include #include /* * char *realpath(const char *path, char resolved[PATH_MAX]); * * Find the real name of path, by removing all ".", ".." and symlink * components. Returns (resolved) on success, or (NULL) on failure, * in which case the path which caused trouble is left in (resolved). */ char * realpath(const char *path, char *resolved) { struct stat sb; char *p, *q, *s; size_t left_len, resolved_len; unsigned symlinks; int serrno, slen, mem_allocated; char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX]; if (path[0] == '\0') { errno = ENOENT; return (NULL); } serrno = errno; if (resolved == NULL) { resolved = malloc(PATH_MAX); if (resolved == NULL) return (NULL); mem_allocated = 1; } else mem_allocated = 0; symlinks = 0; if (path[0] == '/') { resolved[0] = '/'; resolved[1] = '\0'; if (path[1] == '\0') return (resolved); resolved_len = 1; left_len = strlcpy(left, path + 1, sizeof(left)); } else { if (getcwd(resolved, PATH_MAX) == NULL) { if (mem_allocated) free(resolved); else strlcpy(resolved, ".", PATH_MAX); return (NULL); } resolved_len = strlen(resolved); left_len = strlcpy(left, path, sizeof(left)); } if (left_len >= sizeof(left) || resolved_len >= PATH_MAX) { errno = ENAMETOOLONG; goto err; } /* * Iterate over path components in `left'. */ while (left_len != 0) { /* * Extract the next path component and adjust `left' * and its length. */ p = strchr(left, '/'); s = p ? p : left + left_len; if (s - left >= sizeof(next_token)) { errno = ENAMETOOLONG; goto err; } memcpy(next_token, left, s - left); next_token[s - left] = '\0'; left_len -= s - left; if (p != NULL) memmove(left, s + 1, left_len + 1); if (resolved[resolved_len - 1] != '/') { if (resolved_len + 1 >= PATH_MAX) { errno = ENAMETOOLONG; goto err; } resolved[resolved_len++] = '/'; resolved[resolved_len] = '\0'; } if (next_token[0] == '\0') continue; else if (strcmp(next_token, ".") == 0) continue; else if (strcmp(next_token, "..") == 0) { /* * Strip the last path component except when we have * single "/" */ if (resolved_len > 1) { resolved[resolved_len - 1] = '\0'; q = strrchr(resolved, '/') + 1; *q = '\0'; resolved_len = q - resolved; } continue; } /* * Append the next path component and lstat() it. If * lstat() fails we still can return successfully if * there are no more path components left. */ resolved_len = strlcat(resolved, next_token, PATH_MAX); if (resolved_len >= PATH_MAX) { errno = ENAMETOOLONG; goto err; } if (lstat(resolved, &sb) != 0) { if (errno == ENOENT && p == NULL) { errno = serrno; return (resolved); } goto err; } if (S_ISLNK(sb.st_mode)) { if (symlinks++ > MAXSYMLINKS) { errno = ELOOP; goto err; } slen = readlink(resolved, symlink, sizeof(symlink) - 1); if (slen < 0) goto err; symlink[slen] = '\0'; if (symlink[0] == '/') { resolved[1] = 0; resolved_len = 1; } else if (resolved_len > 1) { /* Strip the last path component. */ resolved[resolved_len - 1] = '\0'; q = strrchr(resolved, '/') + 1; *q = '\0'; resolved_len = q - resolved; } /* * If there are any path components left, then * append them to symlink. The result is placed * in `left'. */ if (p != NULL) { if (symlink[slen - 1] != '/') { if (slen + 1 >= sizeof(symlink)) { errno = ENAMETOOLONG; goto err; } symlink[slen] = '/'; symlink[slen + 1] = 0; } left_len = strlcat(symlink, left, sizeof(left)); if (left_len >= sizeof(left)) { errno = ENAMETOOLONG; goto err; } } left_len = strlcpy(left, symlink, sizeof(left)); } } /* * Remove trailing slash except when the resolved pathname * is a single "/". */ if (resolved_len > 1 && resolved[resolved_len - 1] == '/') resolved[resolved_len - 1] = '\0'; return (resolved); err: if (mem_allocated) free(resolved); return (NULL); } x11-apps-7.7+5+nmu1ubuntu1/xedit/tags.c0000664000000000000000000004135512472175711014427 0ustar /* * Copyright © 2007 Paulo César Pereira de Andrade * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Author: Paulo César Pereira de Andrade */ /* * Certain tag files may require quite some time and memory to load. * Linux kernel 2.6x is an example, the tags file itself is almost 80Mb * and xedit will use over 100Mb to store the data, and take quite some * time to load it (and can grow drastically with every loaded files * due to the memory used by the file contents and internal structures, * like the syntax highlight ones). * Possible workarounds could be to load the tags file in a separate * process or thread. The memory problem would be hard to circunvent, * as the tags file metadata would need to be stored in some very fast * database, or at least some special format that would not require * a linear search in a huge tags file. */ #include "xedit.h" #include "util.h" #include "re.h" #include /* * Types */ typedef struct _TagsEntry TagsEntry; typedef struct _RegexEntry RegexEntry; struct _TagsEntry { hash_key *symbol; TagsEntry *next; int nentries; hash_entry **filenames; char **patterns; }; struct _RegexEntry { hash_key *pattern; RegexEntry *next; re_cod regex; }; struct _XeditTagsInfo { hash_key *pathname; XeditTagsInfo *next; hash_table *entries; hash_table *filenames; hash_table *patterns; /* Used when searching for alternate tags and failing descending to * root directory */ Boolean visited; /* Flag to know if tags file is in xedit cwd and allow using relative * pathnames when loading a file with some tag definition, so that * other code will not fail to write file (or even worse, write to * wrong file) if file is edited and tags is not in the current dir */ Boolean incwd; /* Cache information for circulating over multiple definitions */ XeditTagsInfo *tags; /* If trying another TagsInfo */ TagsEntry *entry; /* Entry in tags->tags */ int offset; Widget textwindow; XawTextPosition position; }; /* * Prototypes */ static XeditTagsInfo *LoadTagsFile(char *tagsfile); static XeditTagsInfo *DoLoadTagsFile(char *tagsfile, int length); static void FindTagFirst(XeditTagsInfo *tags, char *symbol, int length); static void FindTagNext(XeditTagsInfo *tags, Widget window, XawTextPosition position); static void FindTag(XeditTagsInfo *tags); /* * Initialization */ extern Widget texts[3]; static hash_table *ht_tags; /* * Implementation */ void TagsAction(Widget w, XEvent *event, String *params, Cardinal *num_params) { xedit_flist_item *item; char buffer[1024]; XawTextPosition position, left, right; XawTextBlock block; int length, bytes; Widget source; source = XawTextGetSource(w); item = FindTextSource(source, NULL); if (item->tags == NULL) SearchTagsFile(item); if (item->tags) { position = XawTextGetInsertionPoint(w); XawTextGetSelectionPos(w, &left, &right); if (right > left) { length = 0; do { bytes = right - left; left = XawTextSourceRead(source, left, &block, bytes); if (block.length < bytes) bytes = block.length; if (length + bytes + 1 >= sizeof(buffer)) bytes = sizeof(buffer) - length - 1; XmuSnprintf(buffer + length, bytes + 1, "%s", block.ptr); length += bytes; } while (left < right); item->tags->textwindow = w; item->tags->position = position; FindTagFirst(item->tags, buffer, length); } else FindTagNext(item->tags, w, position); } else Feep(); } void SearchTagsFile(xedit_flist_item *item) { if (app_resources.loadTags) { char buffer[BUFSIZ]; char *ptr, *tagsfile; int length; Boolean exists; FileAccess file_access; tagsfile = NULL; /* If path fully specified in resource */ if (app_resources.tagsName[0] == '/') tagsfile = ResolveName(app_resources.tagsName); /* Descend up to root directory searching for a tags file */ else { /* *scratch* buffer */ if (item->filename[0] != '/') { ptr = ResolveName(app_resources.tagsName); strncpy(buffer, ptr ? ptr : "", sizeof(buffer)); } else strncpy(buffer, item->filename, sizeof(buffer)); /* Make sure buffer is nul terminated */ buffer[sizeof(buffer) - 1] = '\0'; ptr = buffer + strlen(buffer); for (;;) { while (ptr > buffer && ptr[-1] != '/') --ptr; if (ptr <= buffer) break; length = ptr - buffer; if (length >= sizeof(buffer)) length = sizeof(buffer); strncpy(ptr, app_resources.tagsName, sizeof(buffer) - length); buffer[sizeof(buffer) - 1] = '\0'; /* Check if tags filename exists */ tagsfile = ResolveName(buffer); if (tagsfile != NULL) { file_access = CheckFilePermissions(tagsfile, &exists); /* Check if can read tagsfile */ if (exists && (file_access == READ_OK || file_access == WRITE_OK)) break; else tagsfile = NULL; } *--ptr = '\0'; } } if (tagsfile) item->tags = LoadTagsFile(tagsfile); else { XeditPrintf("No tags file found." " Run \"ctags -R\" to build a tags file.\n"); item->tags = NULL; } } } static void FindTagFirst(XeditTagsInfo *tags, char *symbol, int length) { char *ptr; TagsEntry *entry; char buffer[BUFSIZ]; /* Check for malformed parameters */ ptr = symbol; while (*ptr) { if (*ptr == ' ' || *ptr == '\t' || *ptr == '\n' || *ptr == '\r' || *ptr == '(' || *ptr == ')') { Feep(); return; } ptr++; } /* First try in buffer tags */ tags->tags = tags; entry = (TagsEntry *)hash_check(tags->entries, symbol, length); if (entry == NULL) { /* Try to find in alternate tags */ strncpy(buffer, tags->pathname->value, tags->pathname->length); buffer[tags->pathname->length] = '\0'; ptr = buffer + tags->pathname->length - 1; for (tags->tags = (XeditTagsInfo *)hash_iter_first(ht_tags); tags->tags; tags->tags = (XeditTagsInfo *)hash_iter_next(ht_tags)) tags->tags->visited = False; tags->visited = True; while (ptr > buffer && entry == NULL) { --ptr; while (ptr > buffer && ptr[-1] != '/') --ptr; if (ptr <= buffer) break; *ptr = '\0'; /* Try an upper directory tags */ tags->tags = (XeditTagsInfo *) hash_check(ht_tags, buffer, ptr - buffer); if (tags->tags) { tags->tags->visited = True; entry = (TagsEntry *) hash_check(tags->tags->entries, symbol, length); } } /* If still failed, check other available tags * for possible different projects */ if (entry == NULL) { for (tags->tags = (XeditTagsInfo *)hash_iter_first(ht_tags); tags->tags; tags->tags = (XeditTagsInfo *)hash_iter_next(ht_tags)) { if (tags->tags->visited == False) { entry = (TagsEntry *) hash_check(tags->tags->entries, symbol, length); /* Stop on first match */ if (entry != NULL) break; } } } if (entry == NULL) { XeditPrintf("Symbol %s not in tags\n", symbol); Feep(); return; } } tags->entry = entry; tags->offset = 0; FindTag(tags); } static void FindTagNext(XeditTagsInfo *tags, Widget window, XawTextPosition position) { if (window != tags->textwindow || position != tags->position) Feep(); else { if (tags->entry->nentries > 1) { if (++tags->offset >= tags->entry->nentries) tags->offset = 0; FindTag(tags); } else Feep(); } } static XeditTagsInfo * LoadTagsFile(char *tagsfile) { XeditTagsInfo *tags; int length; if (ht_tags == NULL) ht_tags = hash_new(11, NULL); /* tags key is only the directory name with ending '/' */ length = strlen(tagsfile) - strlen(app_resources.tagsName); tags = (XeditTagsInfo *)hash_check(ht_tags, tagsfile, length); return (tags ? tags : DoLoadTagsFile(tagsfile, length)); } static XeditTagsInfo * DoLoadTagsFile(char *tagsfile, int length) { char *ptr; FILE *file; XeditTagsInfo *tags; TagsEntry *entry; hash_entry *file_entry; char buffer[BUFSIZ]; char *symbol, *filename, *pattern; file = fopen(tagsfile, "r"); if (file) { char *cwd; tags = XtNew(XeditTagsInfo); cwd = getcwd(buffer, sizeof(buffer)); tags->incwd = cwd && (strlen(cwd) == length - 1 && memcmp(cwd, tagsfile, length - 1) == 0); /* Build pathname as a nul terminated directory specification string */ tags->pathname = XtNew(hash_key); tags->pathname->value = XtMalloc(length + 1); tags->pathname->length = length; memcpy(tags->pathname->value, tagsfile, length); tags->pathname->value[length] = '\0'; tags->next = NULL; tags->entries = hash_new(809, NULL); tags->filenames = hash_new(31, NULL); tags->patterns = hash_new(47, NULL); /* Cache information */ tags->tags = tags; /* :-) */ tags->entry = NULL; tags->offset = 0; tags->textwindow = NULL; tags->position = 0; while (fgets(buffer, sizeof(buffer) - 1, file)) { /* XXX Ignore malformed lines and tags file format information */ if (isspace(buffer[0]) || buffer[0] == '!') continue; /* Symbol name */ symbol = ptr = buffer; while (*ptr && !isspace(*ptr)) ptr++; *ptr++ = '\0'; while (isspace(*ptr)) ptr++; /* Filename with basename of tagsfile for symbol definition */ filename = ptr; while (*ptr && !isspace(*ptr)) ptr++; *ptr++ = '\0'; while (isspace(*ptr)) ptr++; pattern = ptr; /* Check for regex */ if (*pattern == '/' || *pattern == '?') { ptr++; while (*ptr && *ptr != *pattern) { if (*ptr == '\\') { if (ptr[1] == *pattern || ptr[1] == '\\') { /* XXX tags will escape pattern end, and backslash * not sure about other special characters */ memmove(ptr, ptr + 1, strlen(ptr)); } else { ++ptr; if (!*ptr) break; } } ptr++; } if (*ptr != *pattern) continue; ++pattern; /* Will do a RE_NOSPEC search, that means ^ and $ * would be literally search (do this to avoid escaping * other regex characters and building a fast/simple literal * string search pattern. * Expect patterns to be full line */ if (*pattern == '^' && ptr[-1] == '$') { ++pattern; --ptr; } } /* Check for line number */ else if (isdigit(*ptr)) { while (isdigit(*ptr)) ptr++; } /* Format not understood */ else continue; *ptr = '\0'; length = strlen(symbol); entry = (TagsEntry *)hash_check(tags->entries, symbol, length); if (entry == NULL) { entry = XtNew(TagsEntry); entry->symbol = XtNew(hash_key); entry->symbol->value = XtNewString(symbol); entry->symbol->length = length; entry->next = NULL; entry->nentries = 0; entry->filenames = NULL; entry->patterns = NULL; hash_put(tags->entries, (hash_entry *)entry); } length = strlen(filename); file_entry = hash_check(tags->filenames, filename, length); if (file_entry == NULL) { file_entry = XtNew(hash_entry); file_entry->key = XtNew(hash_key); file_entry->key->value = XtNewString(filename); file_entry->key->length = length; file_entry->next = NULL; hash_put(tags->filenames, file_entry); } if ((entry->nentries % 4) == 0) { entry->filenames = (hash_entry **) XtRealloc((char *)entry->filenames, sizeof(hash_entry *) * (entry->nentries + 4)); entry->patterns = (char **) XtRealloc((char *)entry->patterns, sizeof(char *) * (entry->nentries + 4)); } entry->filenames[entry->nentries] = file_entry; entry->patterns[entry->nentries] = XtNewString(pattern); ++entry->nentries; } fclose(file); /* Add tags information to global hash table */ hash_put(ht_tags, (hash_entry *)tags); XeditPrintf("Tags file %s loaded\n", tagsfile); } else { XeditPrintf("Failed to load tags file %s\n", tagsfile); tags = NULL; } return (tags); } static void FindTag(XeditTagsInfo *tags) { static String params[] = { "vertical", NULL }; char buffer[BUFSIZ]; char *pattern; int length; char *line; char *text; RegexEntry *regex; re_mat match; XawTextPosition position, left, right, last; Widget source; XawTextBlock block; int size; int lineno; Boolean found; xedit_flist_item *item; Widget otherwindow; XmuSnprintf(buffer, sizeof(buffer), "%s%s", tags->tags->pathname->value, tags->entry->filenames[tags->offset]->key->value); pattern = tags->entry->patterns[tags->offset]; if (isdigit(*pattern)) { lineno = atoi(pattern); regex = NULL; } else { lineno = 0; length = strlen(pattern); regex = (RegexEntry *)hash_check(tags->patterns, pattern, length); if (regex == NULL) { regex = XtNew(RegexEntry); regex->pattern = XtNew(hash_key); regex->pattern->value = XtNewString(pattern); regex->pattern->length = length; regex->next = NULL; if (recomp(®ex->regex, pattern, RE_NOSUB | RE_NOSPEC)) { XeditPrintf("Failed to compile regex %s\n", pattern); Feep(); return; } hash_put(tags->patterns, (hash_entry *)regex); } } /* Short circuit to know if split horizontally */ if (!XtIsManaged(texts[1])) XtCallActionProc(textwindow, "split-window", NULL, params, 1); /* Switch to "other" buffer */ XtCallActionProc(textwindow, "other-window", NULL, NULL, 0); /* This should print an error message if tags file cannot be read */ if (!LoadFileInTextwindow(tags->incwd ? tags->entry->filenames[tags->offset]->key->value : buffer, buffer)) return; otherwindow = textwindow; item = FindTextSource(XawTextGetSource(textwindow), NULL); source = item->source; left = XawTextSourceScan(source, 0, XawstAll, XawsdLeft, 1, True); found = False; if (lineno) { right = RSCAN(left, lineno, False); left = LSCAN(right, 1, False); found = True; } else { right = RSCAN(left, 1, True); last = XawTextSourceScan(source, 0, XawstAll, XawsdRight, 1, True); text = buffer; size = sizeof(buffer); for (;;) { length = right - left; match.rm_so = 0; match.rm_eo = length; XawTextSourceRead(source, left, &block, right - left); if (block.length >= length) line = block.ptr; else { if (length > size) { if (text == buffer) text = XtMalloc(length); else text = XtRealloc(text, length); size = length; } line = text; memcpy(line, block.ptr, block.length); length = block.length; for (position = left + length; position < right; position += block.length) { XawTextSourceRead(source, position, &block, right - position); memcpy(line + length, block.ptr, block.length); length += block.length; } } /* If not last line or if it ends in a newline */ if (right < last || (right > left && line[match.rm_eo - 1] == '\n')) { --match.rm_eo; length = match.rm_eo; } /* Accept as a match when matching the entire line, as the regex * search pattern is optmized to not need to start with ^ and not * need to end with $*/ if (reexec(®ex->regex, line, 1, &match, RE_STARTEND) == 0 && match.rm_eo > match.rm_so && match.rm_so == 0 && match.rm_eo == length) { right = left + match.rm_so + (match.rm_eo - match.rm_so); found = True; break; } else if (right >= last) { XeditPrintf("Failed to match regex %s\n", pattern); Feep(); break; } else { left = LSCAN(right + 1, 1, False); right = RSCAN(left, 1, True); } } if (text != buffer) XtFree(text); } /* Switch back to editing buffer */ XtCallActionProc(otherwindow, "other-window", NULL, NULL, 0); if (found) { if (source != XawTextGetSource(tags->textwindow) || right < tags->position || left > tags->position) { XawTextSetInsertionPoint(otherwindow, left); XawTextSetSelection(otherwindow, left, right); } } } x11-apps-7.7+5+nmu1ubuntu1/xedit/configure.ac0000664000000000000000000000542712472175737015623 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. AC_PREREQ([2.60]) AC_INIT([xedit], [1.2.2], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xedit]) AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects]) # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS AC_CONFIG_HEADERS([config.h]) m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) AC_PROG_RANLIB PKG_PROG_PKG_CONFIG PKG_CHECK_MODULES(PKGDEPS, xaw7 xmu xt >= 1.0 x11) AC_ARG_WITH(lispdir, AS_HELP_STRING([--with-lispdir=PATH], [Directory to install lisp files (default: $libdir/X11/xedit/lisp)]), [ lispdir="$withval"], [ lispdir=${libdir}/X11/xedit/lisp ]) LISPDIR=$lispdir AC_SUBST(LISPDIR) AC_CHECK_DECLS([_SC_PAGESIZE]) AC_CHECK_FUNCS([getpagesize]) AC_CHECK_FUNC(realpath, [], [have_realpath=yes]) AM_CONDITIONAL(NEED_REALPATH, test x$have_realpath = xyes) AC_CHECK_FUNC(strcasecmp, [], [have_strcasecmp=yes]) AM_CONDITIONAL(NEED_STRCASECMP, test x$have_strcasecmp = xyes) AC_CHECK_FUNC(unsetenv, [], [have_unsetenv=yes]) AM_CONDITIONAL(NEED_UNSETENV, test x$have_unsetenv = xyes) PKG_CHECK_MODULES(APPDEFS, xt) xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` AC_ARG_WITH(appdefaultdir, AS_HELP_STRING([--with-appdefaultdir=], [specify directory for app-defaults files (default is autodetected)]), [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xedit/README0000664000000000000000000006517412472175711014212 0ustar Xedit is a simple text editor for X. Please check xedit(1) for information about resources and configurable options. The authors file should list the original authors of all files, but unfortunately most collaborators and people that changed portions of the code is not listed. List of default keyboard commands. Uppercase letters means both, uppercase and lowercase. Lowercase letter usually means Shift key is not pressed. C- Means Control key. M- Means Meta key. Usually Alt key has the same effect. S- Means Shift key. C-A Move cursor to beginning of line. C-B or Left Move cursor backwards one character. C-C Insert CUT_BUFFER0 selection at cursor position. C-D Delete next character. C-E Move cursor to end of line. C-F or Right Move cursor forwards one character. C-G Keyboard reset. Use it to switch direction in the Undo stack, i.e. switch between Undo and Redo. It can also be used to stop the lisp interpreter if it is executing code. C-H Deletes character before cursor. C-J Adds a newline and indent. If the current buffer is the *scratch* buffer, it will work like C-X,C-E, but print the lisp output directly to the scratch buffer. Examples: (list 1 2 3) C-J will print (1 2 3) and move the cursor to the next line. C-K Deletes text from cursor position to end of line. C-L Redraw text window. C-M Adds a newline. C-N or Down Move cursor to next line. C-O Adds one newline at cursor position without moving cursor. C-P or Up Move cursor to previous line. C-R Opens search dialog, searching backwards. C-S Opens search dialog, searching forwards. C-T Transpose characters. C-U Starts multiply mode. Multiply mode means that most keyboard commands will be repeated by its parameter. After pressing C-U type a number, that can be negative. Examples: C-U 10 C-F will move the cursor 10 characters forwards C-U -10 C-F will move the cursor 10 characters backwards If no number is specified, or if the number zero is specified, the default value is 4. C-V or PageDown Move cursor to next page. C-W Kills current selection. C-W is also useful when there is no active selection, to return to the previous position the left mouse was clicked in the text window. C-Y Inserts SECONDARY selection. This usually means text delete with commands other than by just pressing Backspace or Delete (that can be multiplied) C-Z Scroll one line up. M-B or C-Left Move cursor backwards one word. C-Left only moves over alphabetic or numeric characters M-C Capitalize word under cursor position, or next word. M-F or C-Right Move cursor forwards one word. C-Right only moves over alphabetic or numeric characters. M-I Opens a dialog prompting for a file name to be inserted at the cursor position. (This isn't very user friendly, this is a cavemen interface, you will love it, you will never use it). M-K Kills text from cursor position to end of paragraph. M-L Downcase word at cursor position or next word. M-Q Format paragraph. Xedit interfaces Xaw code that allows several types of text formatting. To use it, you need to Select "Auto Fill" in the "Edit Menu" and select values for "Break Columns". After that, Select "Edit Menu"->"Justification" for the available options. Text typed will usually be automatically corrected, but if you need to change text in the middle of a previous line, use M-Q to reformat, and C-_ to undo if required. Examples of text: This text with align left and break columns at 20 and 40. This text with align right and break columns at 25 and 45. Remember that Auto Fill must be selected. And it may be required to press M-Q when going back to edit previous lines. This text with align center and break columns at 40 and 70. A good tip is to make sure there are empty lines before and after the aligned text, so that M-Q will not format more text than it should. This text with full align, note that it will spread the words to fully fill the configured break columns, in this case 15 and 45. Also note that it doesn't remove any extra indentation from the first line. This may be considered a bug or feature, but it doesn't respect 2 spaces after an '.' dot. And it doesn't align the last line of text. This text with Auto Fill disabled. When Auto Fill is disabled, tabs are usually preserved, like this, and this. But it will basically format the text to not be larger than the text widget screen width and. But it the screen is scrolled horizontally, it will not work as expected, the advantage over the above interface is that is considers font characters width, while the other interface assumes fixed width characters. Notice that "auto formatting" with Auto Fill mode is done when pressing enter, but information isn't saved per paragraph, so if values of align or break columns are changed, trying to edit a text block with different configuration will not give the expected results. Also notice that lines starting with non printable characters aren't automatically formatted. This is helpful for some editing modes where symbols can be used before lines in a paragraph. If you don't need this feature, usually pressing Space or Tab is enough to put the cursor at the proper position. M-U Upcase word at cursor position or next word. M-V or PageUp Move cursor to previous page. M-Y Kill ring yank feature. Basically it will circulate over all text that has been cut in the current session. Keep pressing it until happy :-) M-Z Scrolls one line down. M-D Kill word at cursor position or next word. S-M-D Delete word at cursor position or next word. Does not go to the kill ring. M-H or M-Delete or M-Backspace. Kill word at cursor position or previous word. S-M-H or S-M-Delete or S-M-Backspace Delete word at cursor position or previous word. Does not go to the kill ring. M-. Find definition/declaration of symbol string of selected text, and/or finds next tag when more than one definition exists for the symbol. M-< or Home Move cursor to beginning of file. M-> or End Move cursor to end of file. M-] or C-Down Move cursor to next paragraph. M-[ or C-Up Move cursor to previous paragraph. C-_ or C-X,U Undo. If enabled in the given textwidget. Not enabled by default in the message window and filename window, or any of the other text widgets in the several available dialogs. C-\ or C-Kanji Reconnect Input Method. In international mode (probably broken interface). S-Insert Insert PRIMARY selection from CUT_BUFFER0. C-Q Followed by any character, will insert the next typed character useful to insert control characters. For example C-Q,C-L will insert ^L at the cursor position. LeftMouseButton When pressed marks the start of a PRIMARY selection at CUTBUFFER0 When moved while pressed extends the selection. MiddleMouseButton When pressed, inserts the PRIMARY selection at CUTBUFFER0 at the cursor position. RightMouseButton Can be used to adjust a selection done with LeftMouseButton. C-A,Tab If the loaded file has a indentation rules file, C or Lisp, xedit will reindent the line. Also, entering a fresh character on a newline should be enough to move the cursor to the proper position. To override it, you may need to use the C-U to multiply the action, as it will only indent if only one character was added. C-X,C-C or (Pressing the Quit button) Exits xedit. If there are unsaved files, a message will be printed asking to "exit" again, or save the files. C-X,C-E Execute lisp expression before the cursor position. C-X,C-F Changes keyboard input focus to the filename text input window. In this mode, pressing Tab will try to complete the filename being typed. When more than one match exists, pressing Tab again will display the directory navigation window. The initial search path usually is the basename of the file loaded in the current textwindow, or currently directory from where xedit was started if the *scratch* is the current "buffer". The character ~ can be used as a shortcut for the home directory and ~username will be replaced by the home directory of "username" if it exists. C-X,C-S or (Pressing the Save button) Saves the file in the current text window. C-X,Tab Indents the current paragraph. Use the C-U modifier to specify the number of spaces to insert or remove if the C-U parameter is negative. C-X,0 Deletes the current window. The file being edited is not unloaded. C-X,1 Deletes the other window. The file being edited is not unloaded. C-X,2 Splits vertically the current window. C-X,3 Splits vertically the current window. C-X,b Switch the contents of the current window to the next file in the list of loaded files. C-X,d Displays the directory listing window. In this window, it is possible to navigate in the file system to choose a file to edit. Usually, this is the same as pressing C-X,C-F,Tab See C-X,C-F for more information. C-X,k Unloads the file being edited. If the file has not been saved, a message will be displayed, asking to either press C-X,k again, or save the file The *scratch* buffer cannot be killed and will always prints a warning when exiting xedit. This is the expected behavior. C-X,o Switch input focus to the other window, making it the current one If the editor doesn't have splited windows, this command is ignored. Insert Switches between insert and overwrite mode. In overwrite mode text is typed over existing file contents, only extending the file contents when typing at the end of a line (or file). Escape Enters the line edit mode. In this mode it is possible to use regex expressions to search and replace the contents of the file loaded in the current text window. Refer to the xedit(1) manpage for more information of the regex expression format. Note that the regex used by xedit isn't IEEE Std 1003.2 compliant, and not compliant with most regex implementations in that it doesn't support some complex search patterns, usually involving patterns like ((.*)+)? that may require too much restarts or have several correct interpretations for multiple matches. Also, it always does minimal matching, and it is not configurable like in pcre, example: searching "a1a1a1" with the pattern "(.*)\d" will find "a1" and not "a1a1a1" as could be expected. Please refer to lisp/re/README for more information on the supported regex expressions. C-LeftMouseButton Displays the "File Menu" from where it is possible to select a new file to be edited in the current window. C-MiddleMouseButton Displays the "Edit Menu" that usually has the following options: +------------------+-------------+ | Wrapping -> | Never | | | Line | | | Word | | Auto Fill +-------------+ | +-------------+ | Justification -> | Left | | | Right | | | Center | | | Full | | +-------------+ | Break Columns... | | +-------------+ | Scrollbars -> | Vertical | | | Horizontal | | +-------------+ | +-------------+ | Edit Mode -> | Plain/None | | | C/C++ | | | Lisp/Scheme | | | X imake | | | Makefile | | | Unix shell | | | SGML | | | HTML | | | Man page | | | X resource | | | XF86Config | | | RPM spec | | | XFree86 log | | | Patch file | +------------------+-------------+ "Wrapping" is disabled if "Auto Fill" is enabled. "Justification" and "Break Columns..." are enabled if "Auto Fill" is also enabled. "Edit Mode" lists the available syntax highlight and indentation rules defined. Note that most of these options don't work in "international" mode. Several xedit interfaces works only with 8 bits encodings, and doesn't properly handle UTF-8. C-RightMouseButton Displays the "Option Menu". Currently the only option is an Ispell frontend. FourthMouseButton (usually also moving up the mouse wheel) Scroll one line down FifthMouseButton (usually also moving down the mouse wheel) Scroll one line up There is also some documentation in lisp/README, lisp/TODO, lisp/re/README, lisp/re/tests.txt, and comments/justifications/wishlists for the cases the interpreter fail to give the proper result for a given test. The lisp interpreter implements most of a standard COMMON LISP environment, but the compiler generates only byte code and not everything can be compiled, in those cases the interpreter does the work. Examples are constructs involving UNWIND-PROTECT or any kind of jump outside of the current function body. For more information please consult any COMMON LISP documentation or tutorial. Simple tutorial on writing a "foolang" syntax highlight mode for xedit. Create a file called foolang.lsp Add: -- (require "syntax") (require "indent") (in-package "XEDIT") -- to foolang.lsp Check the available files if you want a custom property, or to know about the available ones. One example is: -- (defsynprop *prop-foolang* "foolang" :font "fixed" :foreground "rgb:a/b/c" :background "rgb:1/2/3" :underline t :overstrike t) -- Check lisp/modules/xedit.lsp for the other options, like subscript, superscript and/or combining XLFD properties. Create a syntax definition for foolang. Check the definition of defsyntax in lisp/modules/syntax.lsp for more details. One example for foolang is: -- (defsyntax *foolang-mode* :foolang nil nil nil ;; use the sample property created for foolang whenever the string ;; foolang is found at the toplevel (syntoken "\\" :property *prop-foolang*) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; process C style comments (syntoken "/*" :nospec t :begin :comment :contained t) ;; contained is an option to not "export" this definition to child ;; tables (syntable :comment *prop-comment* #'default-indent ;; #'default-indent means a very simple indent that follows indentation ;; of previous line. Use nil for no indentation ;; Don't start a new table, instead flag as an error if nested (syntoken "/*" :nospec t :property *prop-error*) ;; :nospec t sets the RE_NOSPEC flag for the regex, i.e. searches ;; a literal string, and * will not be a special character (syntoken "XXX|TODO|FIXME" :property *prop-annotation*) ;; just to make it easier to flag some important comment (syntoken "*/" :nospec t :switch -1) ;; The :switch argument is the number of tables to "pop", in ;; this case, we are at table :comment, and :switch -1 returns ;; to table :foolang, that is the "root" table ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Process lisp comments that can nest (syntable :lisp-comment *prop-comment* nil ;; Start a comment, possibly nested (syntoken "#|" :nospec t :begin :lisp-comment) ;; Returns to previous comment in stack or to main :foolang table (syntoken "|#" :nospec t :switch -1) ;; For easier flagging important comments (syntoken "XXX|FIXME|TODO" :property *prop-annotation*) ) ;; This is usually in the end of the list, but can be anywhere, ;; just that if it isn't at the end, conflicting rules are resolved ;; by declaration order (synaugment :lisp-comment) ;; Adds the :lisp-comment table to :foolang table ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Lisp like strings that don't need a \ at the end of the line (syntable :lisp-string *prop-string* nil ;; ignore a escaped " in the middle of the string (syntoken "\\\\.") ;; Note that no options are used, just keep using the current ;; property. Unfortunately, backslashes must be escaped twice. ;; Once for the lisp reader and once for the regex compiler. (syntoken "\"" :nospec: t :switch -1) ;; :nospec is used just to create a faster regex. switch -1 ;; returns to the previous syntax table. It isn't an error to ;; try to go down the "root" table, but if that happens, it ;; probably means either wrong syntax definition of malformed input. ) (synaugment :lisp-string) ;; Adds the :lisp-string table to :foolang table ;; Note that since there isn't a rule to start a string in the ;; :lisp-string table, it cannot nest, maybe because the ending ;; character is the starting character ? :-)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; C style string rules (syntable :string *prop-string* nil ;; Ignore escaped characters (syntoken "\\\\.") ;; Match, most, printf arguments. (syntoken "%%|%([+-]?\\d+)?(l?[deEfgiouxX]|[cdeEfgiopsuxX])" :property *prop-format*) ;; Just for fun. This makes easier to see printf formats in strings ;; *prop-format* is *prop-string* with the :underline option (syntoken "\\\\$") ;; a backslash extends the string to the next line ;; A nonscaped " inside a string finishes it, since this table doesn't ;; have sub tables, and cannot nest, should return to :foolang table ;; from here (syntoken "\"" :nospec t :switch -1) ;; This token rule starts a new table called :error because end of line ;; has been matched. Note that it is defined last, so that a line ;; ending with " or \ will be processed first. (syntoken ".?$" :begin :error) (synaugment :string) ;; Adds the :string table to :foolang table ;; This table is used by :string, but could be shared for other patterns ;; like characters constants, etc. ;; It uses :switch -2 because it is started inside the :string table, ;; but it is also a table, so, pops two tables from the table stack (syntable :error *prop-error* nil (syntoken "^.*$" :switch -2) ) ) -- Indentation rules are significantly more complex. I suggest looking at lisp/modules/indent.lsp for the macros and function definitions; and lisp/modules/progmodes/lisp.lsp and lisp/modules/progmodes/c.lsp for two sample implementations of indentation for Lisp/Scheme and C/C++ respectively. Note also that indentation is parsed backwards, what can cause some confusion, and make "visualization" of order or precedence of evaluation for rules harder to understand. A simple indentation rules definition for foolang could be: -- (defindent *foolang-mode-indent* :foolang ;; This must be the first token and usually the only token matching ;; BOL (Beginning of Line) (indtoken "^\\s*" :indent :code (or *offset* (setq *offset* (+ *ind-offset* *ind-length*)))) ;; the keyword :indent is a pattern put on a list when there is ;; a match, so that later patterns can be "reduced" by some other ;; rule, i.e.: (:indent :indent) could be reduced to (:indent) (indtoken "//.*$" nil) ;; C++ style comment. Returning nil instead of a token basically ;; ignores the token, as it should not enter the reduction pattern ;; list ;; Sample C comment pattern (indtoken "*/" :ccomment :nospec t :begin :comment) ;; Note that the indaugment macro doesn't need to be used, and actually ;; would be an error. In this example, the indentation compiler checks ;; the :begin :comment and handles it internally, as it already needs ;; to check for things like typos, unreachable labels, detectable ;; non resolving rules, etc. There is runtime check also, so it should ;; never enter an infinite loop when trying to resolve reduction rules. ;; Check lisp/modules/indent.lsp:(compile-indent-table) for the ;; implementation and more comments. ;; Indentation rules also have stacked tables (indtable :comment (indtoken "/*" :ocomment :nospec t :switch -1)) ;; Note that the name is :ocomment (open comment), but that the ;; the table is finished when matching the open comment pattern ;; A simple initialization of a variable used by the indentation rules (indinit (parens 0)) ;; This variable can be declared anywhere in the body of defindent, ;; It will be properly moved to a "variables declaration section" ;; when expanding and compiling the table. (indtoken "(" :oparen :nospec t :code (incf parens)) (indtoken ")" :cparen :nospec t :code (decf parens)) ;; These two tokes add the patterns :oparen and :cparen to the ;; "pattern list", and also have code to remember the balancing ;; of parenthesis. ;; One of the simplest reduction rules :-) (indreduce nil t ((:comment))) ;; Once the boundings of a comment are found, just ignore it, like ;; what was done with the // pattern, but in that case, the boundings ;; were readily available. ;; The t (True) parameter means that this rule is always evaluated, ;; but conditional code may be used, and implicit code may be added ;; to the end of the indreduce macro. ;; Since it is a macro, code can be compiled to optimized bytecode ;; after the macro is expanded. (indinit (indent 0)) ;; Note that there is a special *indent* variable that should hold the ;; proper indentation value, but it may be required to "overwrite" ;; without forgetting that value, for things like: ;; ;; foo(bar(baz(blah ;; ^ ^ ;; | | ;; indent | ;; effective indentation to be used ;; ;; where it is desirable to align the code in the next line with the ;; last open parenthesis. Since the interface is, unfortunately, complex enough to not expect casual users to have something like a $HOME/.xedit file, if you want to add new modes, please check lisp/modules/xedit.lsp:*auto-modes* There is some documentation about the variable. It should be possible to change/update the variable from the lisp interface in the *scratch* buffer, but for safety, it is suggested that if you add new rules, you should restart xedit after it. Also note that there is compiled code in lisp/xedit.c that expects that variable to follow an specific format. You may notice that several .lsp files aren't "properly indented"; this is because the lisp indentation rules file was made long after most of the other files were done, and it was considered a bad practice to gratuitously reindent all files. At the time of this writing, the ispell interface should be again functional, but it may be required to use some old ispell program to handle non utf8 text. But it should work properly for the english language, and in international mode, should work with any language. But there are problems in international mode not fixed. I (Paulo Cesar) considered several times to extend the normal textwidget to handle utf8, but this is probably a lot of work/time badly spent and I prefer to work on other personal projects, but still xedit is the editor I use for programming. The XPRINT support unfortunately is broken due to it. Note that xedit, like pretty much any other Xaw application can be linked against Xaw with XPRINT support. In the case of xedit, a flag could be used, like the "international" variable to, at runtime, disable all the related code, if required. Also at the time of this writing, the tags interface was added, as well as several other bug fixes. The tags interface is documented in the manpage, but the action shortcut may not be clear. The default shortcut is M-. . There is no support for more than one tags file, or changing the tags file at runtime. But the code should be easy to adapt for this case, as all related functions receive pointers to the appropriate structures. One option could be to descend from the directory of the loaded file searching for a tags file, and then associate the file with the tags definition, if it isn't already loaded. Shouldn't be hard to implement. For "inter project" files, it should be better to have one xedit window per "project", i.e. searching the definition of something like a libc symbol should probably be done in another xedit window. x11-apps-7.7+5+nmu1ubuntu1/xedit/COPYING0000664000000000000000000002162012472175711014351 0ustar Copyright (c) 2003 Constantin S. Svintsoff Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright (c) 1987, 1993 The Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright (c) 1987 Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. COPYRIGHT 1987 DIGITAL EQUIPMENT CORPORATION MAYNARD, MASSACHUSETTS ALL RIGHTS RESERVED. THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN ADDITION TO THAT SET FORTH ABOVE. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital Equipment Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Copyright 2004 Roland Mainz Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright (c) 1999-2002 by The XFree86 Project, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the XFree86 Project shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project. Copyright (c) 2007 Paulo Cesar Pereira de Andrade Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. x11-apps-7.7+5+nmu1ubuntu1/xedit/INSTALL0000664000000000000000000003660012472176532014355 0ustar Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xload/0000775000000000000000000000000012656635743013321 5ustar x11-apps-7.7+5+nmu1ubuntu1/xload/m4/0000775000000000000000000000000012202404415013612 5ustar x11-apps-7.7+5+nmu1ubuntu1/xload/m4/ax_define_dir.m40000664000000000000000000000325212177355732016660 0ustar # =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_define_dir.html # =========================================================================== # # SYNOPSIS # # AX_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION]) # # DESCRIPTION # # This macro sets VARNAME to the expansion of the DIR variable, taking # care of fixing up ${prefix} and such. # # VARNAME is then offered as both an output variable and a C preprocessor # symbol. # # Example: # # AX_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.]) # # LICENSE # # Copyright (c) 2008 Stepan Kasal # Copyright (c) 2008 Andreas Schwab # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2008 Alexandre Oliva # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 6 AU_ALIAS([AC_DEFINE_DIR], [AX_DEFINE_DIR]) AC_DEFUN([AX_DEFINE_DIR], [ prefix_NONE= exec_prefix_NONE= test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn dnl refers to ${prefix}. Thus we have to use `eval' twice. eval ax_define_dir="\"[$]$2\"" eval ax_define_dir="\"$ax_define_dir\"" AC_SUBST($1, "$ax_define_dir") AC_DEFINE_UNQUOTED($1, "$ax_define_dir", [$3]) test "$prefix_NONE" && prefix=NONE test "$exec_prefix_NONE" && exec_prefix=NONE ]) x11-apps-7.7+5+nmu1ubuntu1/xload/get_rload.c0000664000000000000000000000266712177355732015433 0ustar #include #include #include #include #include #include "xload.h" /* Not all OS supports get_rload steal the STUB idea from get_load */ #if defined(QNX4) || defined(__CYGWIN__) #define RLOADSTUB #endif #ifdef RLOADSTUB void GetRLoadPoint( Widget w, /* unused */ XtPointer closure, /* unused */ XtPointer call_data) /* pointer to (double) return value */ { *(double *)call_data = 1.0; } #else /* RLOADSTUB */ #include #ifndef _PATH_RWHODIR #define _PATH_RWHODIR "/var/spool/rwho" #endif #define WHDRSIZE ((int)(sizeof (buf) - sizeof (buf.wd_we))) void GetRLoadPoint( Widget w, /* unused */ XtPointer closure, /* unused */ XtPointer call_data) /* pointer to (double) return value */ { int f; static char *fname = NULL; static struct whod buf; int cc; *(double *)call_data = 0.0; /* to be on the safe side */ if (fname == NULL) { if ((fname = malloc(strlen(_PATH_RWHODIR)+strlen("/whod.")+strlen(resources.remote)+1)) == NULL) { fprintf(stderr,"GetRLoadPoint: malloc() failed\n"); exit(1); } strcpy(fname,_PATH_RWHODIR); strcat(fname,"/whod."); strcat(fname,resources.remote); } if ((f = open(fname, O_RDONLY, 0)) < 0) return; cc = read(f, &buf, sizeof(buf)); close(f); if (cc < WHDRSIZE) return; *(double *)call_data = buf.wd_loadav[0] / 100.0; } #endif /* RLOADSTUB */ x11-apps-7.7+5+nmu1ubuntu1/xload/app-defaults/0000775000000000000000000000000012202404415015657 5ustar x11-apps-7.7+5+nmu1ubuntu1/xload/app-defaults/XLoad0000664000000000000000000000015212177355732016631 0ustar XLoad.input: false *Label*Justify: left *JumpScroll: 1 *internalBorderWidth: 0 *showGrip: FALSE x11-apps-7.7+5+nmu1ubuntu1/xload/ChangeLog0000664000000000000000000007123212177355753015076 0ustar commit 0705cf954e2d92b379493accd1f0f984d87ec575 Author: Alan Coopersmith Date: Sat Aug 3 21:42:59 2013 -0700 xload 1.1.2 Signed-off-by: Alan Coopersmith commit 51fd2af788ddf81b301f50050cf04e9bcba0f8e3 Author: Alan Coopersmith Date: Thu Jul 18 23:37:36 2013 -0700 Add noreturn attribute to usage() as suggested by -Wmissing-noreturn Signed-off-by: Alan Coopersmith commit 2f6ff61d2edbffdd2949a0546a7df67603462fca Author: Alan Coopersmith Date: Sat Mar 30 08:44:33 2013 -0700 Use C99 struct initializers for XKeyboardControl values Signed-off-by: Alan Coopersmith commit 0f8ad26dc4baed4c1807e23c1560907b0c145073 Author: Alan Coopersmith Date: Sun Feb 24 17:48:39 2013 -0800 Use 'imdent' to make the deeply nested #ifdef levels easier to follow Signed-off-by: Alan Coopersmith commit 84e1b2ef03315927cb8a927bcecca73778e5f6c1 Author: Alan Coopersmith Date: Sun Feb 24 17:47:45 2013 -0800 Cleanup trailing whitespace Signed-off-by: Alan Coopersmith commit d436ab2166c03a54e58f6f4b48e876ba1c147d13 Author: Alan Coopersmith Date: Sun Feb 24 13:05:45 2013 -0800 Make getloadavg() the first choice on Unix systems that have it Only fall back to complex, platform specific code if the simpler, more portable option isn't found by configure. Signed-off-by: Alan Coopersmith commit b0613198f87af22be989fa54e785c64e147debb6 Author: Alan Coopersmith Date: Sun Feb 24 12:53:08 2013 -0800 unifdef -UX_NOT_POSIX This just provided a declaration for lseek() for some of the ancient Unix variants that were missing it in system headers. Signed-off-by: Alan Coopersmith commit da4390ce2dbc08292833ba141a4a98ac3da9f0d5 Author: Alan Coopersmith Date: Sun Feb 24 12:49:56 2013 -0800 unifdef -U__UNIXOS2__ Signed-off-by: Alan Coopersmith commit 0e3449e7ac9fecfe9fbc51e0c132ebb32691ec66 Author: Alan Coopersmith Date: Sun Feb 24 12:48:49 2013 -0800 unifdef -Usequent Signed-off-by: Alan Coopersmith commit d496979565669a5590280eca717998470ab4ab9b Author: Alan Coopersmith Date: Sun Feb 24 12:45:59 2013 -0800 unifdef -Uhcx Signed-off-by: Alan Coopersmith commit 0e301928d923d5ad875118e23ec6fdb4ae45f5d5 Author: Alan Coopersmith Date: Sun Feb 24 08:46:35 2013 -0800 unifdef -UUTEK Signed-off-by: Alan Coopersmith commit 85cf38eafaae6da715699e0209dbc4281b8c7453 Author: Alan Coopersmith Date: Sun Feb 24 08:45:18 2013 -0800 unifdef -Ualliant Signed-off-by: Alan Coopersmith commit 6f106ec95c47e6e36aaa24fa5ebfbfabc4203435 Author: Alan Coopersmith Date: Sun Feb 24 08:38:54 2013 -0800 unifdef -Usony Signed-off-by: Alan Coopersmith commit 8bc6852a27343737d662f64c0523648f6fe14e43 Author: Alan Coopersmith Date: Sun Feb 24 08:37:02 2013 -0800 unifdef -Uumips Signed-off-by: Alan Coopersmith commit a9c3d8ae9af214435eaf7741df0555e24f8dae45 Author: Alan Coopersmith Date: Sun Feb 24 08:32:56 2013 -0800 unifdef -UMOTOROLA Signed-off-by: Alan Coopersmith commit 0a7b2ab5abfbf557dc7f59bc3db15f3f580cbe1f Author: Alan Coopersmith Date: Sun Feb 24 08:30:13 2013 -0800 unifdef -UAIXV3 Signed-off-by: Alan Coopersmith commit b7ac64d925d89d117ccf3c7165f3325be59264ca Author: Alan Coopersmith Date: Sun Feb 24 08:29:03 2013 -0800 unifdef -UCRAY Signed-off-by: Alan Coopersmith commit 8aa0329166dcb3ed4981ef0a782a475ced27f166 Author: Alan Coopersmith Date: Wed Feb 20 20:43:52 2013 -0800 Combine usage message strings Signed-off-by: Alan Coopersmith commit a370e2ede4cff90f233a0249a0c34bef18f57907 Author: Eric S. Raymond Date: Thu Aug 23 12:10:16 2012 -0400 Eliminate use of tab stops. Helps with translation to DocBook. Signed-off-by: Eric S. Raymond commit 632b2054421d43ad8cc63203412d4ee0209f27e3 Author: Alan Coopersmith Date: Thu Mar 22 22:43:58 2012 -0700 xload 1.1.1 Signed-off-by: Alan Coopersmith commit c32c291c02cfd299d42e6d0b6560adcdabba7808 Author: Alan Coopersmith Date: Tue Jan 17 20:21:41 2012 -0800 Solaris: use getloadavg from libc instead of kstats The simpler interface (based on the BSD function) has been in libc since Solaris 7, and avoids datasize bugs like the previous fix, so might as well use it. Purge all the other ancient Solaris & SunOS support variants as well. This does mean if you want to keep running xload on a Sun OS version from before 1998 you will need to use a branch of xload from before 2012 (such as the one included in those old releases). Signed-off-by: Alan Coopersmith commit 4a54dee95260d36d0c8b5f8a35ac905f36b36f17 Author: Alan Coopersmith Date: Tue Jan 17 20:05:45 2012 -0800 Solaris: Read avenrun_1min kstat as a uint32, not a long Fixes garbage data & crashes when built as a 64-bit binary on Solaris SPARC, since the high 32-bits was being filled with randomness. Signed-off-by: Alan Coopersmith Reviewed-by: Arvind Umrao Reviewed-by: Jay Cotton commit 1918be9695e0e912cb536373dd3da385473ab9e5 Author: Alan Coopersmith Date: Tue Dec 20 18:35:17 2011 -0800 Remove DG/UX support Signed-off-by: Alan Coopersmith commit f2b4a35060e6ebe55846b62780ca01c6d519c84f Author: Alan Coopersmith Date: Tue Dec 20 18:26:38 2011 -0800 Convert sprintf to snprintf Signed-off-by: Alan Coopersmith commit fad963fc4d1d8dc0a860ee3c7e3280a13124e296 Author: Alan Coopersmith Date: Tue Dec 20 18:04:26 2011 -0800 Mark domaindir variable as const char * for gcc -Wwrite-strings Signed-off-by: Alan Coopersmith commit 7cccec04962741b0d37bc92e580e1029b2d49849 Author: Alan Coopersmith Date: Tue Dec 20 18:01:35 2011 -0800 Mark xload_error as noreturn Silences a gcc warning Raises the minimum version of xproto needed to build to 7.0.17 Signed-off-by: Alan Coopersmith commit 6ec57ead120a3d42afcb76da012109dd713f12d9 Author: Alan Coopersmith Date: Tue Dec 20 17:55:39 2011 -0800 Mark string arguments to xload_error as const char * for gcc -Wwrite-strings Signed-off-by: Alan Coopersmith commit a53164911c182e73a03eb2eceaa5dfa81f4f98c3 Author: Gaetan Nadon Date: Wed Jan 19 10:06:56 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 822065fd4d359f0a0147168a3056ffe2acc485f7 Author: Gaetan Nadon Date: Thu Jan 13 17:15:36 2011 -0500 man: replace hard coded man page section with substitution strings Signed-off-by: Gaetan Nadon commit 26201189d66f48451bd6cc31288a38d8c7378720 Author: Gaetan Nadon Date: Thu Jan 13 11:15:47 2011 -0500 man: remove trailing spaces and tabs Using s/[ \t]*$// Signed-off-by: Gaetan Nadon commit 6f4a03f20a9d268850727dc330e83978cdba2253 Author: Gaetan Nadon Date: Wed Jan 12 15:29:50 2011 -0500 config: replace deprecated AC_HELP_STRING with AS_HELP_STRING This silences an Automake warning. Signed-off-by: Gaetan Nadon commit b6e677512cf4ef9999846492100824c9e2a68ab6 Author: Alan Coopersmith Date: Sat Nov 20 19:37:11 2010 -0800 Purge RCS/CVS version tags Signed-off-by: Alan Coopersmith commit 83746b56b235a0bc4d30dcfd470f6d536333a502 Author: Alan Coopersmith Date: Sat Nov 20 19:33:28 2010 -0800 Remove ancient Domain/OS support (unifdef -Uapollo) Signed-off-by: Alan Coopersmith commit a3725bfb525de82b7c27d02476a2486e1fe343fd Author: Alan Coopersmith Date: Sat Nov 20 19:31:32 2010 -0800 Remove ancient A/UX support (unifdef -UmacII) Signed-off-by: Alan Coopersmith commit 5d8db8b359c13b8a48060cbaa0fda358913c8b36 Author: Alan Coopersmith Date: Sat Nov 20 19:26:28 2010 -0800 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS Regroup AC statements under the Autoconf initialization section. Regroup AM statements under the Automake initialization section. Add missing AC_CONFIG_SRCDIR Signed-off-by: Alan Coopersmith commit e25648983336d4ed3b56ba3d295208f265f95ce2 Author: Yaakov Selkowitz Date: Mon Oct 4 22:00:57 2010 -0500 Fix old-style function definitions on Cygwin get_load.c: In function ‘InitLoadPoint’: get_load.c:74:6: warning: old-style function definition get_load.c: In function ‘GetLoadPoint’: get_load.c:92:6: warning: old-style function definition Signed-off-by: Yaakov Selkowitz Reviewed-by: Alan Coopersmith Reviewed-by: Jon TURNEY Tested-by: Jon TURNEY commit 1652442c2f82d30d0ed4d9cfbd6d3725b09f4a29 Author: Yaakov Selkowitz Date: Mon Oct 4 21:43:47 2010 -0500 Avoid excess Win32 includes on Cygwin Fixes compilation errors due to recent w32api , which is not needed to compile xload. Signed-off-by: Yaakov Selkowitz Reviewed-by: Jon TURNEY Tested-by: Jon TURNEY commit 600c46eaccd89417a5e44e86d18f9c733af64dc9 Author: Alan Coopersmith Date: Sun Sep 26 13:06:17 2010 -0700 xload 1.1.0 Signed-off-by: Alan Coopersmith commit 9a17373f8d3181b8dc2e86d9cadc04cd97f7b5e5 Author: Alan Coopersmith Date: Thu Sep 23 20:49:06 2010 -0700 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now Signed-off-by: Alan Coopersmith commit 2e1374266ef546a77218ec9bc00e12de142d888a Author: Gaetan Nadon Date: Tue Jul 20 18:45:18 2010 -0400 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon commit f77024a7f7e25bf10b945a0240eb34b532fccbe7 Author: Alan Coopersmith Date: Fri Aug 6 09:23:58 2010 -0700 Sun copyrights are now owned by Oracle Signed-off-by: Alan Coopersmith commit f1dc039a28e15b20037fd0e3a359712cacf269c9 Author: Alan Coopersmith Date: Thu Jul 1 18:14:35 2010 -0700 Xmu functions are called directly, so include it in PKG_CHECK_MODULES Signed-off-by: Alan Coopersmith commit 4efb36a101d94b678fc1996b035038a1e03d5165 Author: Alan Coopersmith Date: Thu Jul 1 18:11:32 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS The existing statement can now be removed from the configuration file. Use XORG_DEFAULT_OPTIONS provided $(SED) Use platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit c57e77c5620dbf2573e630a4eceec5dd5c5985d9 Author: Gaetan Nadon Date: Wed Mar 31 17:07:36 2010 -0400 config: ignore xload.po when using GETTEXT Signed-off-by: Gaetan Nadon commit a458825e9c6afe109460ebc1d0ca1fc08c6661a1 Author: Gaetan Nadon Date: Wed Mar 31 16:52:55 2010 -0400 config: update and relocate AX_DEFINE_DIR macro Remove deprecated acinclude.m4 macro container file Use separate macro files as per autoconf recommendation Use the latest macro from GNU Signed-off-by: Gaetan Nadon commit 396dd7f191773a903dc13f476e0f968dc1645407 Author: Matthieu Herrb Date: Sun Feb 14 15:20:30 2010 +0100 Let xload build on systems without gettext(). Signed-off-by: Matthieu Herrb Reviewed-by: Julien Cristau Reviewed-by: Alan Coopersmith commit 36659aa666808e5b42f5d98bce8f84bf82e88c0e Author: Alan Coopersmith Date: Fri Jan 15 22:20:56 2010 -0800 Integrate gettext support with autotools build system Mostly cribbed from prior work for libXpm Signed-off-by: Alan Coopersmith commit 6d96dd3d2df7d896a41d770ba380629948ead4d6 Author: Jay Hobson Date: Fri Aug 25 14:29:09 2000 -0700 Internationalize xload: Call gettext on strings printed to stderr Originally done for Solaris 9 to fix Sun bug 4365629 http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=4365629 Signed-off-by: Alan Coopersmith commit d957cad1a453a84309cef3e30237c39d0541ecc4 Author: Alan Coopersmith Date: Fri Jan 15 21:22:39 2010 -0800 Use automake silencer on man page generation too Signed-off-by: Alan Coopersmith commit 67b8eba82dba74f12f1ee4fac6f5ee8968b1f14c Author: Alan Coopersmith Date: Fri Jan 15 21:20:50 2010 -0800 Move CWARNFLAGS addition from configure.ac to Makefile.am Signed-off-by: Alan Coopersmith commit a6040d867412b88e0586665079b96c0725b0a42c Author: Alan Coopersmith Date: Fri Jan 15 21:16:53 2010 -0800 Raise xorg-macros requirement to 1.4 Needed since the changes in f5eb18cefb774c5a5d43923d21b61c180a96b8ad depend on the INSTALL file delivered in xorg-macros 1.4 Signed-off-by: Alan Coopersmith commit 0ddbf8aa2a67fb7a6b06c00b5ce2a654bd41c8df Author: Gaetan Nadon Date: Sat Dec 19 20:48:48 2009 -0500 configure.ac: use backticks rather than $() for cmd subs Use "$PKG_CONFIG" rather than hard coded "pkg-config" Signed-off-by: Gaetan Nadon commit f8bd2a195bd12161ba1fe16ef3e8ac0013d6eec2 Author: Gaetan Nadon Date: Thu Nov 26 09:19:54 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit f5eb18cefb774c5a5d43923d21b61c180a96b8ad Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit c9117984a135aab376978da41ea31aba3ce34f3b Author: Gaetan Nadon Date: Tue Oct 27 15:07:25 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit 187d6b083f5ae87ce7d10ce1b263c9d32bcfaa73 Author: Gaetan Nadon Date: Mon Oct 26 22:08:39 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit 038407d1c5f4ee08cca7c23476fd9dae06a0080f Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit 141aa01f04e98d6e7ddf15726da85e3f2b8b71ab Author: Alan Coopersmith Date: Thu Oct 1 14:54:25 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit 68bad5a59d3619372cb4a48563f5c7423f54163d Author: Paulo Cesar Pereira de Andrade Date: Thu Jan 22 15:31:58 2009 -0200 Correct make distcheck and sparse warnings. commit 0436471fd8007826d40a2f57710e9964c0768d50 Author: Paulo Cesar Pereira de Andrade Date: Sun Mar 16 18:44:12 2008 -0300 Compile warning fixes. Ansify some functions with K&R definitions. commit b91f8e903b1004a35dfe01204852c628367475b7 Author: James Cloos Date: Wed Aug 20 10:32:51 2008 -0400 xaw8 is gone, use xaw7 commit 5c84833c7f383685763550a348a3493025948cba Author: Alan Coopersmith Date: Mon Jul 7 18:52:39 2008 -0700 Fill in COPYING file commit e80401dc35403df68532b8e80c32452f7a7f02f3 Author: Alan Coopersmith Date: Mon Jul 7 18:43:26 2008 -0700 Update man page to note that /dev/kmem access is only on old platforms commit 59281ce7182a7fb679339af89a1dc72e0695b7ab Author: Julien Cristau Date: Fri May 16 14:20:03 2008 +0200 $(builddir) is the current directory Apparently automake doesn't always export the builddir variable. This fixes my previous commit. commit d6bf0deb5ad6b540246b23a46fa2b5d21cd9b02c Author: Jeremy Huddleston Date: Tue May 6 02:02:00 2008 -0700 __DARWIN__ -> __APPLE__ https://bugs.freedesktop.org/show_bug.cgi?id=9017 commit d1e5eb3dff370bb7c65a62dbe3ba0822b86aecbc Author: Julien Cristau Date: Sun Apr 20 19:20:51 2008 +0200 Fix build with builddir != srcdir commit 5e806152643740057bd43869122ea8ff05a9d384 Author: Julien Cristau Date: Sun Apr 20 19:18:19 2008 +0200 Use AM_CFLAGS instead of xload_CFLAGS and remove AM_PROG_CC_C_O commit 771817cc3923a0f142b941234047fa0020cb231d Author: Jeremy Huddleston Date: Thu Mar 27 20:27:49 2008 -0700 Added missing AM_PROG_CC_C_O commit 9004465b586104fed48bb301de843003c1fa2ad0 Author: Jeremy Huddleston Date: Thu Mar 27 20:07:47 2008 -0700 Build fix for file systems that are not case sensitive commit 2d8250c1d56dc20f7afc3b3a155bcf8ac4cb7e9f Author: James Cloos Date: Thu Dec 6 16:37:20 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit 5c043a1cec89e884593f541f59b8abd237d91e50 Author: Peter Dyballa Date: Mon Sep 24 14:13:39 2007 -0700 Bug #12534: nlist() needs to be handled differently in Mac OS X X.Org Bugzilla #12534 Patch #11704 commit 91088ab94b28877ca85151c1d1cf241f8e775555 Author: James Cloos Date: Mon Sep 3 05:51:30 2007 -0400 Add *~ to .gitignore to skip patch/emacs droppings commit 6d6757b2e0abe6811aeec72fc4835748801cdcd4 Author: James Cloos Date: Thu Aug 23 19:24:57 2007 -0400 Rename .cvsignore to .gitignore commit 8a4ffe593e55cc618599fcd9d643d799debe546a Author: Jeremy C. Reed Date: Thu Mar 22 00:30:44 2007 -0500 Update version for another release. commit 1dbb7df5ccec3e3d9fecded33850730486d6374d Author: Matthieu Herrb Date: Tue Jun 20 19:25:51 2006 +0000 Check setuid() return value. Bugzilla #7116. commit 382ca2392d31870cfb4b8b01cd2751040c479f86 Author: Kevin E Martin Date: Wed Dec 21 02:29:51 2005 +0000 Update package version for X11R7 release. commit 3d963be1c92843f29e331c7f4228473507f537ff Author: Adam Jackson Date: Mon Dec 19 16:22:45 2005 +0000 Stub COPYING files commit d16274715e8f529a89d01d4be1e26e9f08a6565d Author: Kevin E Martin Date: Thu Dec 15 00:24:08 2005 +0000 Update package version number for final X11R7 release candidate. commit 93d83b89292b73fa6d1a48064e4730f43a6fce3e Author: Kevin E Martin Date: Wed Dec 7 16:18:00 2005 +0000 Change to use the app-defaults default dir configured in libXt. commit ade038820780c806a8f43fadf2f9c9f4df50478d Author: Kevin E Martin Date: Tue Dec 6 22:48:23 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit 3fd55a3ea19b8c09caa10b4a9134b4a18b240975 Author: Kevin E Martin Date: Sat Dec 3 05:49:25 2005 +0000 Update package version number for X11R7 RC3 release. commit 9a3724aed228bbbd3294141d1a01c06fff6480f3 Author: Alan Coopersmith Date: Mon Nov 28 22:01:44 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit b589edc59845fd9b86f825597af6bb33dec13934 Author: Eric Anholt Date: Mon Nov 21 10:35:02 2005 +0000 Another pass at .cvsignores for apps. commit dfd95c81cc88972565c79cb78b42e1780638a504 Author: Eric Anholt Date: Sun Nov 20 22:08:53 2005 +0000 Add/improve .cvsignore files for apps. commit 3fedcca82c2c9d55938928d25015720c8324e6a6 Author: Kevin E Martin Date: Wed Oct 19 02:47:55 2005 +0000 Update package version number for RC1 release. commit d872304e1e6aab8cf83f09cc3090f45cc245e5fa Author: Alan Coopersmith Date: Tue Oct 18 00:32:54 2005 +0000 Change default install dir for app-default files from $(sysconfdir)/X11/app-defaults to $(libdir)/X11/app-defaults to match the monolith & allow localization commit 0620fa99ef09fb0401e842dfeb9aa76b8d403ac6 Author: Alan Coopersmith Date: Mon Oct 17 23:56:23 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 90ecdb5eb628266037755e3b0be48f13d703b8e5 Author: Alan Coopersmith Date: Fri Oct 14 00:25:46 2005 +0000 Use sed to fill in variables in man page commit 09af03bf3b2f573c0b58c8a5fd84af1772707c6f Author: Alan Coopersmith Date: Sun Oct 2 21:17:48 2005 +0000 Bug #3811 GNU/kFreeBSD support for xload & memleak (Robert Millan) commit 80cf9497a8c7776e67377a0d1eb623739206b695 Author: Alan Coopersmith Date: Mon Aug 1 20:25:30 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit 5d24389cad4d0669e1ec109a84fb0315805c0e66 Author: Kevin E Martin Date: Fri Jul 29 21:22:35 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit 3fa36d6e984b2f5c2958d078ff19c1a3cf46f9b6 Author: Alan Coopersmith Date: Wed Jul 27 00:41:27 2005 +0000 Add check for libkstat to get load averages on Solaris commit f61e34fce870f45136a2cfcb73133b63df5321af Author: Alan Coopersmith Date: Wed Jul 27 00:34:57 2005 +0000 Switch xload on Solaris from libkvm to libkstat so it works with both 32-bit and 64-bit kernels, and without group kmem. Add #include "config.h" for modularization commit 662e42f98213df8dc834fa6be7b83e99cc07bacc Author: Alan Coopersmith Date: Tue Jul 26 15:44:02 2005 +0000 Replace more GNU make-ism's with more portable macros commit 52bbf03241ae94019be87858375b6e77b96ad3a6 Author: Matthieu Herrb Date: Sat Jul 23 16:38:19 2005 +0000 fix GNU-make only app-default rule commit 4cb25771597a2e1102bf5fd91e6cabf191eeecf2 Author: Adam Jackson Date: Wed Jul 20 19:31:57 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit 62d4ea34f0fd64e258abb993004c8966eecc6cf7 Author: Søren Sandmann Pedersen Date: Tue Jul 5 22:36:58 2005 +0000 Build system for xload commit f74edc7a9e0494657c36f34208141f6a2aa3e1f9 Author: Egbert Eich Date: Fri Apr 23 19:54:57 2004 +0000 Merging XORG-CURRENT into trunk commit cc45a7487b867b181a5615eef75519d22f91d4f8 Author: Egbert Eich Date: Sun Mar 14 08:35:37 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit 89d070def1fb7c692443c9dc2aee49424193cf45 Author: Egbert Eich Date: Wed Mar 3 12:13:14 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit 90d8b0a47218ed5a024ac3b0cde9cc6bc0bb684a Author: Egbert Eich Date: Thu Feb 26 13:36:26 2004 +0000 readding XFree86's cvs IDs commit 9d4dadc605b80ae83864242fb3d997bd511c7205 Author: Egbert Eich Date: Thu Feb 26 09:24:14 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit 8c79399521f61d18280f0096d77338cfc4664490 Author: Egbert Eich Date: Thu Jan 29 08:09:16 2004 +0000 Importing vendor version xf86-012804-2330 on Thu Jan 29 00:06:33 PST 2004 commit 7cc0e6a6b51025d08ec9c6a17b3f514ebaa80fdc Author: Kaleb Keithley Date: Fri Dec 19 20:56:01 2003 +0000 XFree86 4.3.99.902 (RC 2) commit 57ef7c68cb375b3361ff5381b494ff52c1e77807 Author: Kaleb Keithley Date: Thu Dec 4 22:03:56 2003 +0000 XFree86 4.3.99.901 (RC 1) commit c9e855362fe29db861bf847ec714f1b0ce3237a1 Author: Kaleb Keithley Date: Tue Nov 25 19:29:14 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit 346b7376f252cbab44456541dd917489b6b25d35 Author: Kaleb Keithley Date: Fri Nov 14 16:49:23 2003 +0000 XFree86 4.3.0.1 commit 0f22ecbb798add2e02b586894434884765f7daae Author: Kaleb Keithley Date: Fri Nov 14 16:49:23 2003 +0000 Initial revision x11-apps-7.7+5+nmu1ubuntu1/xload/xload.h0000664000000000000000000000072612177355732014601 0ustar #ifndef _XLOAD_H_ #define _XLOAD_H_ #include /* * Definition of the Application resources structure. */ typedef struct _XLoadResources { Boolean show_label; Boolean use_lights; String remote; } XLoadResources; extern void InitLoadPoint(void); extern void GetLoadPoint(Widget w, XtPointer closure, XtPointer call_data); extern void GetRLoadPoint(Widget w, XtPointer closure, XtPointer call_data); extern XLoadResources resources; #endif x11-apps-7.7+5+nmu1ubuntu1/xload/xload.c0000664000000000000000000002554612177355732014603 0ustar /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /* * xload - display system load average in a window */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include "xload.h" #ifdef USE_GETTEXT # include # include #else # define gettext(a) (a) #endif #include "xload.bit" static char *ProgramName; static void quit(Widget w, XEvent *event, String *params, Cardinal *num_params); static void ClearLights(Display *dpy); static void SetLights(XtPointer data, XtIntervalId *timer); /* * Command line options table. Only resources are entered here...there is a * pass over the remaining options after XtParseCommand is let loose. */ static XrmOptionDescRec options[] = { {"-scale", "*load.minScale", XrmoptionSepArg, NULL}, {"-update", "*load.update", XrmoptionSepArg, NULL}, {"-hl", "*load.highlight", XrmoptionSepArg, NULL}, {"-highlight", "*load.highlight", XrmoptionSepArg, NULL}, {"-label", "*label.label", XrmoptionSepArg, NULL}, {"-nolabel", "*showLabel", XrmoptionNoArg, "False"}, {"-lights", "*useLights", XrmoptionNoArg, "True"}, {"-jumpscroll", "*load.jumpScroll", XrmoptionSepArg, NULL}, {"-remote", "*remote", XrmoptionSepArg, NULL}, }; /* * The structure containing the resource information for the * Xload application resources. */ #define Offset(field) (XtOffsetOf(XLoadResources, field)) static XtResource my_resources[] = { {"showLabel", XtCBoolean, XtRBoolean, sizeof(Boolean), Offset(show_label), XtRImmediate, (XtPointer) TRUE}, {"useLights", XtCBoolean, XtRBoolean, sizeof(Boolean), Offset(use_lights), XtRImmediate, (XtPointer) FALSE}, {"remote", XtCString, XtRString, sizeof(XtRString), Offset(remote), XtRImmediate, (XtPointer) FALSE}, }; #undef Offset XLoadResources resources; static XtActionsRec xload_actions[] = { { "quit", quit }, }; static Atom wm_delete_window; static int light_update = 10 * 1000; /* * Exit with message describing command line format. */ static void _X_NORETURN usage(void) { fprintf (stderr, gettext("usage: %s [-options ...]\n\n%s\n"), ProgramName, gettext( "where options include:\n" " -display X server on which to display\n" " -geometry size and location of window\n" " -fn font to use in label\n" " -scale minimum number of scale lines\n" " -update interval between updates\n" " -label annotation text\n" " -bg background color\n" " -fg graph color\n" " -hl scale and text color\n" " -nolabel removes the label from above the chart.\n" " -jumpscroll number of pixels to scroll on overflow\n" " -lights use keyboard leds to display current load\n" )); exit(1); } int main(int argc, char **argv) { XtAppContext app_con; Widget toplevel, load, pane, label_wid, load_parent; Arg args[1]; Pixmap icon_pixmap = None; char *label, host[256]; const char *domaindir; XtSetLanguageProc ( NULL, NULL, NULL ); ProgramName = argv[0]; /* For security reasons, we reset our uid/gid after doing the necessary system initialization and before calling any X routines. */ InitLoadPoint(); /* reset gid first while still (maybe) root */ if (setgid(getgid()) == -1) { fprintf(stderr, gettext("%s: setgid failed: %s\n"), ProgramName, strerror(errno)); exit(1); } if (setuid(getuid()) == -1) { fprintf(stderr, gettext("%s: setuid failed: %s\n"), ProgramName, strerror(errno)); exit(1); } XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); toplevel = XtAppInitialize(&app_con, "XLoad", options, XtNumber(options), &argc, argv, NULL, NULL, (Cardinal) 0); #ifdef USE_GETTEXT textdomain("xload"); if ((domaindir = getenv ( "TEXTDOMAINDIR" )) == NULL) { domaindir = LOCALEDIR; } bindtextdomain("xload", domaindir); #endif if (argc != 1) usage(); XtGetApplicationResources( toplevel, (XtPointer) &resources, my_resources, XtNumber(my_resources), NULL, (Cardinal) 0); if (resources.use_lights) { char name[1024]; XrmString type; XrmValue db_value; XrmValue int_value; Bool found = False; snprintf (name, sizeof(name), "%s.paned.load.update", XtName(toplevel)); found = XrmGetResource (XtScreenDatabase(XtScreen(toplevel)), name, "XLoad.Paned.StripChart.Interval", &type, &db_value); if (found) { int_value.size = sizeof(int); int_value.addr = (XPointer) &light_update; found = XtConvertAndStore(toplevel, type, &db_value, XtRInt, &int_value); if (found) light_update *= 1000; } ClearLights (XtDisplay (toplevel)); SetLights ((XtPointer) toplevel, (XtIntervalId *) 0); } else { /* * This is a hack so that f.delete will do something useful in this * single-window application. */ XtAppAddActions (app_con, xload_actions, XtNumber(xload_actions)); XtOverrideTranslations(toplevel, XtParseTranslationTable ("WM_PROTOCOLS: quit()")); XtSetArg (args[0], XtNiconPixmap, &icon_pixmap); XtGetValues(toplevel, args, ONE); if (icon_pixmap == None) { XtSetArg(args[0], XtNiconPixmap, XCreateBitmapFromData(XtDisplay(toplevel), XtScreen(toplevel)->root, (char *)xload_bits, xload_width, xload_height)); XtSetValues (toplevel, args, ONE); } if (resources.show_label) { pane = XtCreateManagedWidget ("paned", panedWidgetClass, toplevel, NULL, ZERO); label_wid = XtCreateManagedWidget ("label", labelWidgetClass, pane, NULL, ZERO); XtSetArg (args[0], XtNlabel, &label); XtGetValues(label_wid, args, ONE); if ( strcmp("label", label) == 0 ) { (void) XmuGetHostname (host, 255); XtSetArg (args[0], XtNlabel, host); XtSetValues (label_wid, args, ONE); } load_parent = pane; } else load_parent = toplevel; load = XtCreateManagedWidget ("load", stripChartWidgetClass, load_parent, NULL, ZERO); if (resources.remote) XtAddCallback(load, XtNgetValue, GetRLoadPoint, NULL); else XtAddCallback(load, XtNgetValue, GetLoadPoint, NULL); XtRealizeWidget (toplevel); wm_delete_window = XInternAtom (XtDisplay(toplevel), "WM_DELETE_WINDOW", False); (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel), &wm_delete_window, 1); } XtAppMainLoop(app_con); return 0; } static unsigned long current_leds; static void ClearLights (Display *dpy) { XKeyboardControl cntrl = { .led_mode = LedModeOff }; XChangeKeyboardControl (dpy, KBLedMode, &cntrl); current_leds = 0; } static void SetLights (XtPointer data, XtIntervalId *timer) { Widget toplevel; Display *dpy; double value; unsigned long new_leds, change, bit; int i; toplevel = (Widget) data; dpy = XtDisplay (toplevel); if (resources.remote) GetRLoadPoint (toplevel, (XtPointer) 0, (XtPointer) &value); else GetLoadPoint (toplevel, (XtPointer) 0, (XtPointer) &value); new_leds = (1 << (int) (value + 0.1)) - 1; change = new_leds ^ current_leds; i = 1; bit = 1; while (current_leds != new_leds) { if (change & bit) { XKeyboardControl cntrl = { .led = i, .led_mode = new_leds & bit ? LedModeOn : LedModeOff }; XChangeKeyboardControl (dpy, KBLed|KBLedMode, &cntrl); current_leds ^= bit; } i++; bit <<= 1; } XtAppAddTimeOut(XtWidgetToApplicationContext(toplevel), light_update, SetLights, data); } static void quit (Widget w, XEvent *event, String *params, Cardinal *num_params) { if (event->type == ClientMessage && event->xclient.data.l[0] != wm_delete_window) { XBell (XtDisplay(w), 0); return; } if (resources.use_lights) ClearLights (XtDisplay (w)); XtDestroyApplicationContext(XtWidgetToApplicationContext(w)); exit (0); } x11-apps-7.7+5+nmu1ubuntu1/xload/get_load.c0000664000000000000000000004173512177355732015250 0ustar /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * get_load - get system load * * Authors: Many and varied... * * Call InitLoadPoint() to initialize. * GetLoadPoint() is a callback for the StripChart widget. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include "xload.h" #if defined(__CYGWIN__) # define WIN32_LEAN_AND_MEAN # include typedef struct { DWORD stat; union { LONG vLong; double vDouble; LONGLONG vLongLong; void *string; } u; } COUNTER; static HANDLE query; static HANDLE counter; static HINSTANCE hdll; static long (__stdcall *pdhopen)(LPCSTR, DWORD, HANDLE); static long (__stdcall *pdhaddcounter)(HANDLE, LPCSTR, DWORD, HANDLE*); static long (__stdcall *pdhcollectquerydata)(HANDLE); static long (__stdcall *pdhgetformattedcountervalue)(HANDLE, DWORD, LPDWORD, COUNTER*); # define CYGWIN_PERF void InitLoadPoint(void) { long ret; hdll=LoadLibrary("pdh.dll"); if (!hdll) exit(-1); pdhopen=(void*)GetProcAddress(hdll, "PdhOpenQueryA"); if (!pdhopen) exit(-1); pdhaddcounter=(void*)GetProcAddress(hdll, "PdhAddCounterA"); if (!pdhaddcounter) exit(-1); pdhcollectquerydata=(void*)GetProcAddress(hdll, "PdhCollectQueryData"); if (!pdhcollectquerydata) exit(-1); pdhgetformattedcountervalue=(void*)GetProcAddress(hdll, "PdhGetFormattedCounterValue"); if (!pdhgetformattedcountervalue) exit(-1); ret = pdhopen( NULL , 0, &query ); if (ret!=0) exit(-1); ret = pdhaddcounter(query, "\\Processor(_Total)\\% Processor Time", 0, &counter); if (ret!=0) exit(-1); } void GetLoadPoint( Widget w, /* unused */ XtPointer closure, /* unused */ XtPointer call_data) /* pointer to (double) return value */ { double *loadavg = (double *)call_data; COUNTER fmtvalue; long ret; *loadavg = 0.0; ret = pdhcollectquerydata(query); if (ret!=0) return; ret = pdhgetformattedcountervalue(counter, 0x200, NULL, &fmtvalue); if (ret!=0) return; *loadavg = (fmtvalue.u.vDouble-0.01)/100.0; } #else /* not CYGWIN */ static void xload_error(const char *, const char *) _X_NORETURN; # ifdef HAVE_GETLOADAVG # include # ifdef HAVE_SYS_LOADAVG_H # include /* Solaris definition of getloadavg */ # endif void InitLoadPoint(void) { } void GetLoadPoint( Widget w, /* unused */ XtPointer closure, /* unused */ XtPointer call_data) /* ptr to (double) return value */ { double *loadavg = (double *)call_data; if (getloadavg(loadavg, 1) < 0) xload_error("couldn't obtain load average", ""); } # else /* not HAVE_GETLOADAVG */ # if defined(att) || defined(QNX4) # define LOADSTUB # endif # ifndef LOADSTUB # if !defined(linux) && !defined(__GLIBC__) # include # endif /* !linux && ... */ # endif /* LOADSTUB */ # ifdef CSRG_BASED # include # endif # ifdef sgi # define FSCALE 1024.0 # endif # ifdef __osf__ /* * Use the table(2) interface; it doesn't require setuid root. * * Select 0, 1, or 2 for 5, 30, or 60 second load averages. */ # ifndef WHICH_AVG # define WHICH_AVG 1 # endif # include # endif # ifdef SVR4 # ifndef FSCALE # define FSCALE (1 << 8) # endif # endif # if defined(SYSV) && defined(i386) /* * inspired by 'avgload' by John F. Haugh II */ # include # include # include # include # include # include # define KERNEL_FILE "/unix" # define KMEM_FILE "/dev/kmem" # define VAR_NAME "v" # define PROC_NAME "proc" # define BUF_NAME "buf" # define DECAY 0.8 struct nlist namelist[] = { {VAR_NAME}, {PROC_NAME}, {BUF_NAME}, {0}, }; static int kmem; static struct var v; static struct proc *p; static XtPointer first_buf, last_buf; void InitLoadPoint() /* SYSV386 version */ { int i; nlist( KERNEL_FILE, namelist); for (i=0; namelist[i].n_name; i++) if (namelist[i].n_value == 0) xload_error("cannot get name list from", KERNEL_FILE); if ((kmem = open(KMEM_FILE, O_RDONLY)) < 0) xload_error("cannot open", KMEM_FILE); if (lseek(kmem, namelist[0].n_value, 0) == -1) xload_error("cannot seek", VAR_NAME); if (read(kmem, &v, sizeof(v)) != sizeof(v)) xload_error("cannot read", VAR_NAME); if ((p=(struct proc *)malloc(v.v_proc*sizeof(*p))) == NULL) xload_error("cannot allocat space for", PROC_NAME); first_buf = (XtPointer) namelist[2].n_value; last_buf = (char *)first_buf + v.v_buf * sizeof(struct buf); } /* ARGSUSED */ void GetLoadPoint( w, closure, call_data ) /* SYSV386 version */ Widget w; /* unused */ XtPointer closure; /* unused */ XtPointer call_data; /* pointer to (double) return value */ { double *loadavg = (double *)call_data; static double avenrun = 0.0; int i, nproc, size; (void) lseek(kmem, namelist[0].n_value, 0); (void) read(kmem, &v, sizeof(v)); size = (struct proc *)v.ve_proc - (struct proc *)namelist[1].n_value; (void) lseek(kmem, namelist[1].n_value, 0); (void) read(kmem, p, size * sizeof(struct proc)); for (nproc = 0, i=0; i= (char *)first_buf) && (p[i].p_wchan < (char *)last_buf))) nproc++; /* update the load average using a decay filter */ avenrun = DECAY * avenrun + nproc * (1.0 - DECAY); *loadavg = avenrun; return; } # else /* not (SYSV && i386) */ # if defined(linux) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__)) void InitLoadPoint(void) { return; } void GetLoadPoint( Widget w, /* unused */ XtPointer closure, /* unused */ XtPointer call_data) /* pointer to (double) return value */ { static int fd = -1; int n; char buf[10] = {0, }; # ifndef X_LOCALE char *dp; static char ldp = 0; # endif if (fd < 0) { if (fd == -2 || (fd = open("/proc/loadavg", O_RDONLY)) < 0) { fd = -2; *(double *)call_data = 0.0; return; } # ifndef X_LOCALE ldp = *localeconv()->decimal_point; # endif } else lseek(fd, 0, 0); if ((n = read(fd, buf, sizeof(buf)-1)) > 0) { # ifndef X_LOCALE if (ldp != '.') while ((dp = memchr(buf,'.',sizeof(buf)-1)) != NULL) { *(char *)dp = ldp; } # endif if (sscanf(buf, "%lf", (double *)call_data) == 1) return; } *(double *)call_data = 0.0; /* temporary hiccup */ return; } # else /* linux */ # ifdef __GNU__ # include static processor_set_t default_set; void InitLoadPoint(void) { if (processor_set_default (mach_host_self (), &default_set) != KERN_SUCCESS) xload_error("cannot get processor_set_default", ""); } /* ARGSUSED */ void GetLoadPoint( Widget w, /* unused */ XtPointer closure, /* unused */ XtPointer call_data) /* pointer to (double) return value */ { host_t host; struct processor_set_basic_info info; unsigned info_count; info_count = PROCESSOR_SET_BASIC_INFO_COUNT; if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host, (processor_set_info_t) &info, &info_count) != KERN_SUCCESS) { InitLoadPoint(); info.load_average = 0; } *(double *)call_data = info.load_average * 1000 / LOAD_SCALE; return; } # else /* __GNU__ */ # ifdef __APPLE__ # include static mach_port_t host_priv_port; void InitLoadPoint(void) { host_priv_port = mach_host_self(); } /* ARGSUSED */ void GetLoadPoint( Widget w, /* unused */ XtPointer closure, /* unused */ XtPointer call_data) /* pointer to (double) return value */ { double *loadavg = (double *)call_data; struct host_load_info load_data; int host_count; kern_return_t kr; host_count = sizeof(load_data)/sizeof(integer_t); kr = host_statistics(host_priv_port, HOST_LOAD_INFO, (host_info_t)&load_data, &host_count); if (kr != KERN_SUCCESS) xload_error("cannot get host statistics", ""); *loadavg = (double)load_data.avenrun[0]/LOAD_SCALE; return; } # else /* __APPLE__ */ # ifdef LOADSTUB void InitLoadPoint() { } /* ARGSUSED */ void GetLoadPoint( w, closure, call_data ) Widget w; /* unused */ XtPointer closure; /* unused */ XtPointer call_data; /* pointer to (double) return value */ { *(double *)call_data = 1.0; } # else /* not LOADSTUB */ # ifdef __osf__ void InitLoadPoint() { } /*ARGSUSED*/ void GetLoadPoint( w, closure, call_data ) Widget w; /* unused */ XtPointer closure; /* unused */ XtPointer call_data; /* pointer to (double) return value */ { double *loadavg = (double *)call_data; struct tbl_loadavg load_data; if (table(TBL_LOADAVG, 0, (char *)&load_data, 1, sizeof(load_data)) < 0) xload_error("error reading load average", ""); *loadavg = (load_data.tl_lscale == 0) ? load_data.tl_avenrun.d[WHICH_AVG] : load_data.tl_avenrun.l[WHICH_AVG] / (double)load_data.tl_lscale; } # else /* not __osf__ */ # ifdef __QNXNTO__ # include # include static _Uint64t nto_idle = 0, nto_idle_last = 0; static int nto_idle_id; static struct timespec nto_now, nto_last; void InitLoadPoint(void) { nto_idle_id = ClockId(1, 1); /* Idle thread */ ClockTime(nto_idle_id, NULL, &nto_idle_last); clock_gettime( CLOCK_REALTIME, &nto_last); } /* ARGSUSED */ void GetLoadPoint( /* QNX NTO version */ Widget w, /* unused */ XtPointer closure, /* unused */ XtPointer call_data) /* pointer to (double) return value */ { double *loadavg = (double *)call_data; double timediff; double temp = 0.0; ClockTime(nto_idle_id, NULL, &nto_idle); clock_gettime( CLOCK_REALTIME, &nto_now); timediff = 1000000000.0 * (nto_now.tv_sec - nto_last.tv_sec) + (nto_now.tv_nsec - nto_last.tv_nsec); temp = 1.0 - (nto_idle-nto_idle_last)/timediff; *loadavg = temp >= 0 ? temp : 0; nto_idle_last = nto_idle; nto_last = nto_now; } # else /* not __QNXNTO__ */ # ifdef __bsdi__ # include static struct nlist nl[] = { { "_averunnable" }, # define X_AVERUNNABLE 0 { "_fscale" }, # define X_FSCALE 1 { "" }, }; static kvm_t *kd; static int fscale; void InitLoadPoint(void) { fixpt_t averunnable[3]; /* unused really */ if ((kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL)) == NULL) xload_error("can't open kvm files", ""); if (kvm_nlist(kd, nl) != 0) xload_error("can't read name list", ""); if (kvm_read(kd, (off_t)nl[X_AVERUNNABLE].n_value, (char *)averunnable, sizeof(averunnable)) != sizeof(averunnable)) xload_error("couldn't obtain _averunnable variable", ""); if (kvm_read(kd, (off_t)nl[X_FSCALE].n_value, (char *)&fscale, sizeof(fscale)) != sizeof(fscale)) xload_error("couldn't obtain _fscale variable", ""); return; } void GetLoadPoint( Widget w, /* unused */ XtPointer closure, /* unused */ XtPointer call_data) /* ptr to (double) return value */ { double *loadavg = (double *)call_data; fixpt_t t; if (kvm_read(kd, (off_t)nl[X_AVERUNNABLE].n_value, (char *)&t, sizeof(t)) != sizeof(t)) xload_error("couldn't obtain load average", ""); *loadavg = (double)t/fscale; return; } # else /* not __bsdi__ */ # ifndef KMEM_FILE # define KMEM_FILE "/dev/kmem" # endif # ifndef KERNEL_FILE # ifdef hpux # define KERNEL_FILE "/hp-ux" # endif /* hpux */ # ifdef sgi # if (OSMAJORVERSION > 4) # define KERNEL_FILE "/unix" # endif # endif /* * provide default for everyone else */ # ifndef KERNEL_FILE # ifdef SVR4 # define KERNEL_FILE "/stand/unix" # else # ifdef SYSV # define KERNEL_FILE "/unix" # else /* If a BSD system, check in */ # ifdef BSD # include # ifdef _PATH_UNIX # define KERNEL_FILE _PATH_UNIX # else # ifdef _PATH_KERNEL # define KERNEL_FILE _PATH_KERNEL # else # define KERNEL_FILE "/vmunix" # endif # endif # else /* BSD */ # define KERNEL_FILE "/vmunix" # endif /* BSD */ # endif /* SYSV */ # endif /* SVR4 */ # endif /* KERNEL_FILE */ # endif /* KERNEL_FILE */ # ifndef KERNEL_LOAD_VARIABLE # if defined(BSD) && (BSD >= 199103) # define KERNEL_LOAD_VARIABLE "_averunnable" # endif /* BSD >= 199103 */ # ifdef hpux # ifdef __hp9000s800 # define KERNEL_LOAD_VARIABLE "avenrun" # endif /* hp9000s800 */ # endif /* hpux */ # ifdef sgi # define KERNEL_LOAD_VARIABLE "avenrun" # endif /* sgi */ # endif /* KERNEL_LOAD_VARIABLE */ /* * provide default for everyone else */ # ifndef KERNEL_LOAD_VARIABLE # ifdef USG # define KERNEL_LOAD_VARIABLE "sysinfo" # define SYSINFO # else # ifdef SVR4 # define KERNEL_LOAD_VARIABLE "avenrun" # else # define KERNEL_LOAD_VARIABLE "_avenrun" # endif # endif # endif /* KERNEL_LOAD_VARIABLE */ static struct nlist namelist[] = { /* namelist for vmunix grubbing */ # define LOADAV 0 {KERNEL_LOAD_VARIABLE}, {0} }; static int kmem; static long loadavg_seek; void InitLoadPoint() { # if !defined(SVR4) && !defined(sgi) && !defined(AIXV5) && !(BSD >= 199103) && !defined(__APPLE__) extern void nlist(); # endif nlist( KERNEL_FILE, namelist); /* * Some systems appear to set only one of these to Zero if the entry could * not be found, I hope no_one returns Zero as a good value, or bad things * will happen to you. (I have a hard time believing the value will * ever really be zero anyway). CDP 5/17/89. */ if (namelist[LOADAV].n_type == 0 || namelist[LOADAV].n_value == 0) { xload_error("cannot get name list from", KERNEL_FILE); exit(-1); } loadavg_seek = namelist[LOADAV].n_value; kmem = open(KMEM_FILE, O_RDONLY); if (kmem < 0) xload_error("cannot open", KMEM_FILE); } /* ARGSUSED */ void GetLoadPoint( w, closure, call_data ) Widget w; /* unused */ XtPointer closure; /* unused */ XtPointer call_data; /* pointer to (double) return value */ { double *loadavg = (double *)call_data; (void) lseek(kmem, loadavg_seek, 0); # if defined(SVR4) || defined(sgi) || (BSD >= 199103) { long temp; (void) read(kmem, (char *)&temp, sizeof(long)); *loadavg = (double)temp/FSCALE; } # else /* else not SVR4 or sgi or BSD */ (void) read(kmem, (char *)loadavg, sizeof(double)); # endif /* SVR4 or ... else */ return; } # endif /* __bsdi__ else */ # endif /* __QNXNTO__ else */ # endif /* __osf__ else */ # endif /* LOADSTUB else */ # endif /* __APPLE__ else */ # endif /* __GNU__ else */ # endif /* linux else */ # endif /* SYSV && i386 else */ # endif /* HAVE_GETLOADAVG else */ static void xload_error(const char *str1, const char *str2) { (void) fprintf(stderr,"xload: %s %s\n", str1, str2); # ifdef __bsdi__ if (kd) kvm_close(kd); # endif exit(-1); } #endif /* END of __CYGWIN__ */ x11-apps-7.7+5+nmu1ubuntu1/xload/config.guess0000775000000000000000000013036112342463275015634 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-06-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xload/config.h.in0000664000000000000000000000524112656634673015347 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `getloadavg' function. */ #undef HAVE_GETLOADAVG /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_LOADAVG_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Location of translated messages */ #undef LOCALEDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you want to use the gettext() function. */ #undef USE_GETTEXT /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Version number of package */ #undef VERSION /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE x11-apps-7.7+5+nmu1ubuntu1/xload/man/0000775000000000000000000000000012656635743014074 5ustar x11-apps-7.7+5+nmu1ubuntu1/xload/man/xload.man0000664000000000000000000000773712177355732015711 0ustar .\" .TH XLOAD 1 __xorgversion__ .SH NAME xload \- system load average display for X .SH SYNOPSIS \fBxload\fP [-\fItoolkitoption\fP ...] [-scale \fIinteger\fP] [-update \fIseconds\fP] [-hl \fIcolor\fP] [-highlight \fIcolor\fP] [-remote \fIhost\fP] .br [-jumpscroll \fIpixels\fP] [-label \fIstring\fP] [-nolabel] [-lights] .SH DESCRIPTION The .I xload program displays a periodically updating histogram of the system load average. .SH OPTIONS .PP .I Xload accepts all of the standard X Toolkit command line options (see \fIX(__miscmansuffix__)\fP). The order of the options is unimportant. \fIxload also accepts the following additional options: .PP .TP 8 .B \-hl \fIcolor\fP or \-highlight \fIcolor\fP This option specifies the color of the scale lines. .TP 8 .B \-jumpscroll \fPnumber of pixels\fP The number of pixels to shift the graph to the left when the graph reaches the right edge of the window. The default value is 1/2 the width of the current window. Smooth scrolling can be achieved by setting it to 1. .TP 8 .B \-label \fIstring\fP The string to put into the label above the load average. .TP 8 .B \-nolabel If this command line option is specified then no label will be displayed above the load graph. .TP 8 .B \-lights When specified, this option causes .I xload to display the current load average by using the keyboard leds; for a load average of \fIn\fP, xload lights the first \fIn\fP keyboard leds. This option turns off the usual screen display. .TP 8 .B \-scale \fIinteger\fP This option specifies the minimum number of tick marks in the histogram, where one division represents one load average point. If the load goes above this number, \fIxload\fP will create more divisions, but it will never use fewer than this number. The default is 1. .PP .TP 8 .B \-update \fIseconds\fP This option specifies the interval in seconds at which \fIxload\fP updates its display. The minimum amount of time allowed between updates is 1 second. The default is 10. .TP 8 .B \-remote \fIhost\fP This option tells \fIxload\fP to display the load of \fIhost\fP instead of \fIlocalhost\fP. \fIXload\fP gets the information from the \fIrwhod\fP database and consequently requires \fIrwhod\fP to be executing both on \fIlocalhost\fP and \fIhost\fP. .SH RESOURCES In addition to the resources available to each of the widgets used by \fIxload\fP there is one resource defined by the application itself. .TP 8 .B showLabel (\fPclass\fB Boolean) If False then no label will be displayed. .SH WIDGETS In order to specify resources, it is useful to know the hierarchy of the widgets which compose \fIxload\fR. In the notation below, indentation indicates hierarchical structure. The widget class name is given first, followed by the widget instance name. .sp .nf XLoad xload Paned paned Label label StripChart load .fi .sp .SH ENVIRONMENT .PP .TP 8 .B DISPLAY to get the default host and display number. .TP 8 .B XENVIRONMENT to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH FILES .TP .I __apploaddir__/XLoad specifies required resources .SH SEE ALSO X(__miscmansuffix__), xrdb(__appmansuffix__), mem(__drivermansuffix__), Athena StripChart Widget. .SH BUGS On older platforms, this program may require the ability to open and read the special system file \fI/dev/kmem\fP. Sites that do not allow general access to this file may need to make \fIxload\fP belong to the same group as \fI/dev/kmem\fP and turn on the \fIset group id\fP permission flag. .PP Reading the load average is inherently non-portable. Therefore, the routine used to read it (get_load.c) must be ported to each new operating system. .SH COPYRIGHT Copyright \(co X Consortium .br See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHORS K. Shane Hartman (MIT-LCS) and Stuart A. Malone (MIT-LCS); .br with features added by Jim Gettys (MIT-Athena), Bob Scheifler (MIT-LCS), Tony Della Fera (MIT-Athena), and Chris Peterson (MIT-LCS). x11-apps-7.7+5+nmu1ubuntu1/xload/man/Makefile.am0000664000000000000000000000052312177355732016123 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = xload.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/xload/config.sub0000775000000000000000000010530112167023104015257 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-04-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xload/Makefile.am0000664000000000000000000000355012177355732015353 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = xload AM_CFLAGS = $(CWARNFLAGS) $(XLOAD_CFLAGS) xload_LDADD = $(XLOAD_LIBS) ACLOCAL_AMFLAGS = -I m4 xload_SOURCES = \ get_load.c \ get_rload.c \ xload.c \ xload.h # App default files DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ dist_appdefault_DATA = \ app-defaults/XLoad EXTRA_DIST = xload.bit MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL if USE_GETTEXT noinst_DATA = xload.po xload.po: $(xload_SOURCES:%=$(srcdir)/%) $(AM_V_GEN)xgettext -d xload -n $(xload_SOURCES:%=$(srcdir)/%) CLEANFILES = xload.po endif x11-apps-7.7+5+nmu1ubuntu1/xload/configure.ac0000664000000000000000000000647212177355732015613 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xload], [1.1.2], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xload]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) AC_USE_SYSTEM_EXTENSIONS # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS # Internationalization & localization support AC_SEARCH_LIBS([gettext], [intl], [USE_GETTEXT="yes"], [USE_GETTEXT="no"]) AC_MSG_CHECKING([where to install localized messages]) AC_ARG_WITH([localedir], AS_HELP_STRING([--with-localedir=], [Path to install message files in (default: datadir/locale)]), [LOCALEDIR=${withval}], [LOCALEDIR=${datadir}/locale]) AX_DEFINE_DIR([LOCALEDIR], [LOCALEDIR], [Location of translated messages]) if test "x$LOCALEDIR" = "xno" -o "x$USE_GETTEXT" = "xno" ; then AC_MSG_RESULT([nowhere]) USE_GETTEXT="no" else AC_MSG_RESULT([$LOCALEDIR]) fi if test "x$USE_GETTEXT" = "xyes" ; then AC_DEFINE([USE_GETTEXT], 1, [Define to 1 if you want to use the gettext() function.]) fi AM_CONDITIONAL(USE_GETTEXT, test "x$USE_GETTEXT" = "xyes") ### How to check load average on various OS'es: # getloadavg: 4.3BSD-Reno & later, glibc 2.2 & later, Solaris 7 & later # BSD & GNU libc use , Solaris requires AC_CHECK_FUNCS([getloadavg], [AC_CHECK_HEADERS([sys/loadavg.h])]) # Checks for pkg-config packages PKG_CHECK_MODULES(XLOAD, xaw7 xmu xt x11 [xproto >= 7.0.17]) PKG_CHECK_MODULES(APPDEFS, xt) xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` AC_ARG_WITH(appdefaultdir, AS_HELP_STRING([--with-appdefaultdir=], [specify directory for app-defaults files (default is autodetected)]), [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xload/README0000664000000000000000000000130012177355732014166 0ustar xload displays a periodically updating histogram of the system load average. All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xload http://cgit.freedesktop.org/xorg/app/xload For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xload/xload.bit0000664000000000000000000000164512177355732015131 0ustar #define xload_width 32 #define xload_height 32 #define xload_x_hot 15 #define xload_y_hot 16 static unsigned char xload_bits[] = { 0x00, 0x00, 0xc0, 0x03, 0x1e, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf8, 0x03, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0xfe, 0x03, 0xff, 0xff, 0xff, 0xff, 0x00, 0x80, 0xff, 0x03, 0x00, 0xc0, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x00, 0xe0, 0xff, 0x03, 0x00, 0xf0, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0x03, 0x00, 0xf8, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x00, 0xfc, 0xff, 0x03, 0x00, 0xfc, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x00, 0xfe, 0xff, 0x03, 0x00, 0xfe, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x03, 0x00, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03}; x11-apps-7.7+5+nmu1ubuntu1/xload/COPYING0000664000000000000000000000772612177355732014363 0ustar Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ---------------------------------------- Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ---------------------------------------- get_rload.c (rwhod support) was added in 2001 by the XFree86 Project without a copyright notice, and is thus covered by this general notice: XFree86 code without an explicit copyright is covered by the following copy- right/license: Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is fur- nished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the XFree86 Project shall not be used in advertising or otherwise to promote the sale, use or other deal- ings in this Software without prior written authorization from the XFree86 Project. x11-apps-7.7+5+nmu1ubuntu1/xload/INSTALL0000664000000000000000000002622212177355753014354 0ustar Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 6. Often, you can also type `make uninstall' to remove the installed files again. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *Note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xclock/0000775000000000000000000000000012656635743013475 5ustar x11-apps-7.7+5+nmu1ubuntu1/xclock/Clock.h0000664000000000000000000001173612213015056014663 0ustar /* * $Xorg: Clock.h,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XFree86: xc/programs/xclock/Clock.h,v 1.11 2002/10/17 01:00:01 dawes Exp $ */ #ifndef _XawClock_h #define _XawClock_h /*********************************************************************** * * Clock Widget * ***********************************************************************/ #include /* Parameters: Name Class RepType Default Value ---- ----- ------- ------------- twentyfour Boolean Boolean True analog Boolean Boolean True background Background Pixel white backingStore BackingStore BackingStore default border BorderColor Pixel Black borderWidth BorderWidth Dimension 1 chime Boolean Boolean False destroyCallback Callback Pointer NULL font Font XFontStruct* fixed foreground Foreground Pixel black hand Foreground Pixel black height Height Dimension 164 highlight Foreground Pixel black mappedWhenManaged MappedWhenManaged Boolean True padding Margin int 8 utime Boolean Boolean False update Interval int 60 (seconds) width Width Dimension 164 x Position Position 0 y Position Position 0 */ /* Resource names used to the clock widget */ /* color of hands */ #define XtNhand "hands" /* Boolean: 24-hour if TRUE */ #define XtNtwentyfour "twentyfour" /* Boolean: digital if FALSE */ #define XtNanalog "analog" /* Boolean: only hour/minute if TRUE */ #define XtNbrief "brief" /* String: will be used as format arg to "strftime" if not empty string */ #define XtNstrftime "strftime" /* Boolean: show seconds since Epoch if TRUE */ #define XtNutime "utime" /* Boolean: */ #define XtNchime "chime" /* Int: amount of space around outside of clock */ #define XtNpadding "padding" /* Boolean: use Render extension if TRUE */ #define XtNrender "render" /* Boolean: use backing pixmap for double buffering */ #define XtNbuffer "buffer" /* RenderColor: colors for various clock elements */ #define XtNhourColor "hourColor" #define XtNminuteColor "minuteColor" #define XtNsecondColor "secondColor" #define XtNmajorColor "majorColor" #define XtNminorColor "minorColor" #define XtRXftColor "XftColor" #define XtNface "face" #define XtCFace "Face" #define XtRXftFont "XftFont" /* Boolean: use sharp rendering for Render polygons */ #define XtNsharp "sharp" #define XtCSharp "Sharp" typedef struct _ClockRec *ClockWidget; /* completely defined in ClockP.h */ typedef struct _ClockClassRec *ClockWidgetClass; /* completely defined in ClockP.h */ extern WidgetClass clockWidgetClass; #endif /* _XawClock_h */ /* DON'T ADD STUFF AFTER THIS #endif */ x11-apps-7.7+5+nmu1ubuntu1/xclock/xclock.c0000664000000000000000000001563112213015056015104 0ustar /* $Xorg: xclock.c,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $ */ /* $XdotOrg: $ */ /* * xclock -- Hacked from Tony Della Fera's much hacked clock program. * * "-strftime" option added by George Belotsky, Open Light Software Inc. */ /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* $XFree86: xclock.c,v 1.16 2002/10/21 13:33:08 alanh Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #include "Clock.h" #include #include "clock.bit" #include "clmask.bit" #ifdef XKB #include #endif #ifndef NO_I18N #include /* for setlocale() */ Boolean no_locale = True; /* if True, use old behavior */ #endif #ifdef HAVE_GETPID # include #endif /* Command line options table. Only resources are entered here...there is a pass over the remaining options after XtParseCommand is let loose. */ static XrmOptionDescRec options[] = { {"-chime", "*clock.chime", XrmoptionNoArg, "TRUE"}, {"-hd", "*clock.hands", XrmoptionSepArg, NULL}, {"-hands", "*clock.hands", XrmoptionSepArg, NULL}, {"-hl", "*clock.highlight", XrmoptionSepArg, NULL}, {"-highlight", "*clock.highlight", XrmoptionSepArg, NULL}, {"-update", "*clock.update", XrmoptionSepArg, NULL}, {"-padding", "*clock.padding", XrmoptionSepArg, NULL}, {"-d", "*clock.analog", XrmoptionNoArg, "FALSE"}, {"-digital", "*clock.analog", XrmoptionNoArg, "FALSE"}, {"-analog", "*clock.analog", XrmoptionNoArg, "TRUE"}, {"-twelve", "*clock.twentyfour", XrmoptionNoArg, "FALSE"}, {"-twentyfour", "*clock.twentyfour", XrmoptionNoArg, "TRUE"}, {"-brief", "*clock.brief", XrmoptionNoArg, "TRUE"}, {"-utime", "*clock.utime", XrmoptionNoArg, "TRUE"}, {"-strftime", "*clock.strftime", XrmoptionSepArg, NULL}, #ifdef XRENDER {"-face", "*clock.face", XrmoptionSepArg, NULL}, {"-render", "*clock.render", XrmoptionNoArg, "TRUE"}, {"-norender", "*clock.render", XrmoptionNoArg, "FALSE"}, {"-sharp", "*clock.sharp", XrmoptionNoArg, "TRUE"}, #endif }; static void quit ( Widget w, XEvent *event, String *params, Cardinal *num_params ); static XtActionsRec xclock_actions[] = { { "quit", quit }, }; static Atom wm_delete_window; /* * Report the syntax for calling xclock. */ static void _X_NORETURN Syntax(const char *call) { fprintf (stderr, "Usage: %s %s", call, "[-analog] [-bw ] [-digital] [-brief]\n" " [-utime] [-strftime ]\n" " [-fg ] [-bg ] [-hd ]\n" " [-hl ] [-bd ]\n" " [-fn ] [-help] [-padding ]\n" " [-rv] [-update ] [-display displayname]\n" #ifdef XRENDER " [-[no]render] [-face ] [-sharp]\n" #endif " [-geometry geom] [-twelve] [-twentyfour]\n\n"); exit(1); } static void _X_NORETURN die(Widget w, XtPointer client_data, XtPointer call_data) { XCloseDisplay(XtDisplayOfObject(w)); exit(0); } static void quit(Widget w, XEvent *event, String *params, Cardinal *num_params) { Arg arg; if (event->type == ClientMessage && event->xclient.data.l[0] != wm_delete_window) { #ifdef XKB XkbStdBell(XtDisplay(w), XtWindow(w), 0, XkbBI_MinorError); #else XBell (XtDisplay(w), 0); #endif } else { /* resign from the session */ XtSetArg(arg, XtNjoinSession, False); XtSetValues(w, &arg, ONE); die(w, NULL, NULL); } } static void save(Widget w, XtPointer client_data, XtPointer call_data) { XtCheckpointToken token = (XtCheckpointToken) call_data; /* we have nothing to save */ token->save_success = True; } int main(int argc, char *argv[]) { Widget toplevel; Arg arg; Pixmap icon_pixmap = None; XtAppContext app_con; #ifndef NO_I18N char *locale_name = setlocale(LC_ALL,""); XtSetLanguageProc ( NULL, NULL, NULL ); if(!locale_name || 0 == strcmp(locale_name,"C")) { no_locale = True; } else { no_locale = False; } #endif toplevel = XtOpenApplication(&app_con, "XClock", options, XtNumber(options), &argc, argv, NULL, sessionShellWidgetClass, NULL, ZERO); if (argc != 1) Syntax(argv[0]); XtAddCallback(toplevel, XtNdieCallback, die, NULL); XtAddCallback(toplevel, XtNsaveCallback, save, NULL); XtAppAddActions (app_con, xclock_actions, XtNumber(xclock_actions)); /* * This is a hack so that wm_delete_window will do something useful * in this single-window application. */ XtOverrideTranslations(toplevel, XtParseTranslationTable ("WM_PROTOCOLS: quit()")); XtSetArg(arg, XtNiconPixmap, &icon_pixmap); XtGetValues(toplevel, &arg, ONE); if (icon_pixmap == None) { arg.value = (XtArgVal)XCreateBitmapFromData(XtDisplay(toplevel), XtScreen(toplevel)->root, (char *)clock_bits, clock_width, clock_height); XtSetValues (toplevel, &arg, ONE); } XtSetArg(arg, XtNiconMask, &icon_pixmap); XtGetValues(toplevel, &arg, ONE); if (icon_pixmap == None) { arg.value = (XtArgVal)XCreateBitmapFromData(XtDisplay(toplevel), XtScreen(toplevel)->root, (char *)clock_mask_bits, clock_mask_width, clock_mask_height); XtSetValues (toplevel, &arg, ONE); } XtCreateManagedWidget ("clock", clockWidgetClass, toplevel, NULL, ZERO); XtRealizeWidget (toplevel); wm_delete_window = XInternAtom (XtDisplay(toplevel), "WM_DELETE_WINDOW", False); (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel), &wm_delete_window, 1); #ifdef HAVE_GETPID { unsigned long pid = (unsigned long)getpid(); XChangeProperty(XtDisplay(toplevel), XtWindow(toplevel), XInternAtom(XtDisplay(toplevel), "_NET_WM_PID", False), XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &pid, 1); } #endif XtAppMainLoop (app_con); exit(0); } x11-apps-7.7+5+nmu1ubuntu1/xclock/app-defaults/0000775000000000000000000000000012256611347016050 5ustar x11-apps-7.7+5+nmu1ubuntu1/xclock/app-defaults/XClock-color0000664000000000000000000000036512213015056020262 0ustar ! $XFree86$ #include "XClock" XClock.Clock.hourColor: rgba:7f/00/00/c0 XClock.Clock.minuteColor: rgba:00/7f/7f/c0 XClock.Clock.secondColor: rgba:00/00/ff/80 XClock.Clock.majorColor: rgba:7f/00/00/c0 XClock.Clock.minorColor: rgba:00/7f/7f/c0 x11-apps-7.7+5+nmu1ubuntu1/xclock/app-defaults/XClock0000664000000000000000000000002412213015056017136 0ustar XClock.input: false x11-apps-7.7+5+nmu1ubuntu1/xclock/ChangeLog0000664000000000000000000006343012213015421015223 0ustar commit 66a2f29e7c649d1eb4079910b0211ffdf7dbbd4d Author: Alan Coopersmith Date: Sat Sep 7 23:33:09 2013 -0700 xclock 1.0.7 Signed-off-by: Alan Coopersmith commit 1ac04613b566ba0dde29a16f3ac409832f32d74e Author: Alan Coopersmith Date: Thu Jul 18 21:02:55 2013 -0700 Combine usage message strings & print them to stderr, not stdout Signed-off-by: Alan Coopersmith commit 61f95e11eef3fbfb9060a32233df13c35115a6f3 Author: Alan Coopersmith Date: Thu Jul 18 20:59:01 2013 -0700 Add noreturn attributes suggested by -Wmissing-noreturn Signed-off-by: Alan Coopersmith commit 52bbd1ce31f1adf2b7145b9d6183f6b866fa9301 Author: Alan Coopersmith Date: Thu Jul 18 20:50:17 2013 -0700 Store sine & cosine tables as doubles instead of floats Since they're used as doubles in the calculations, might as well store them that way instead of converting when read from the table at runtime. Costs about 4k more storage in the binary for the doubled tables. Also gets rid of 900 clang warnings, of the form: Clock.c:1708:11: warning: implicit conversion loses floating-point precision: 'double' to 'float' [-Wconversion] 0.000000, 0.001745, 0.003490, 0.005235, 0.006981, 0.008726, 0.010471, 0.012217, (one for each table entry) Signed-off-by: Alan Coopersmith commit 69de4eaa3be6cc177eb53a4754cb6bd35340c585 Author: Eric S. Raymond Date: Thu Aug 23 06:15:01 2012 -0400 Don't rely on being able to set tab stops. Signed-off-by: Eric S. Raymond commit cd184e2f1a6f8f4f9178d29e43dc08d1534504e3 Author: Alan Coopersmith Date: Fri Feb 10 22:03:24 2012 -0800 xclock 1.0.6 Signed-off-by: Alan Coopersmith commit 251461d84de4220f05ffa35a3138aad1cd2e0302 Author: Peter Stuge Date: Thu Aug 26 04:14:27 2010 +0200 Calculate text and window size from LC_CTYPE instead of LC_TIME LC_TIME only defines what will be displayed, LC_CTYPE is what defines the character encoding. References: Bug 15903 - LANG=en_US xclock -digital -font fixed has wrong size https://bugs.freedesktop.org/show_bug.cgi?id=15903 Reviewed-by: Julien Cristau Reviewed-by: Jeremy Huddleston commit 45e936174e39637c09cd10c0a5c6f8752ee2d709 Author: Yaakov Selkowitz Date: Tue Aug 23 19:05:20 2011 -0500 Use AM_ICONV AC_SEARCH_LIBS does not detect GNU libiconv because its symbols are exported in the "libiconv" namespace instead of "iconv". The AM_ICONV macro correctly detects both glibc and GNU libiconv, defines HAVE_ICONV, ICONV_CONST, and LIBICONV depending on the system. The config.rpath file is required by this macro. This adds a dependency on the aclocal macros from gettext (gettext-devel in some distros) when building from git, but not when building from a tarball. Signed-off-by: Yaakov Selkowitz Reviewed-by: Gaetan Nadon commit 27e10658010d314b40dfc9403a92864b26a9d576 Author: Gaetan Nadon Date: Wed Jan 19 10:06:55 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 5f26fbf5384ec03260edfa7d2bd8b39fde380d5b Author: Gaetan Nadon Date: Thu Jan 13 17:15:36 2011 -0500 man: replace hard coded man page section with substitution strings Signed-off-by: Gaetan Nadon commit 64a5168667d30cfac2f6c6038a3b095b824580ac Author: Gaetan Nadon Date: Wed Jan 12 16:28:02 2011 -0500 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS This silences an Autoconf warning commit 0c5674fe5c12ae4258b23bf6d9cdbaac443162b7 Author: Gaetan Nadon Date: Wed Jan 12 15:29:50 2011 -0500 config: replace deprecated AC_HELP_STRING with AS_HELP_STRING This silences an Automake warning. Signed-off-by: Gaetan Nadon commit 8e2adc61b09ca2a2959ed96091b2a49d306339fe Author: Gaetan Nadon Date: Wed Jan 12 15:12:08 2011 -0500 config: remove unrequired AC_SUBST([*_LIBS]) This macro is called by PKG_CHECK_MODULES Signed-off-by: Gaetan Nadon commit 4995928a94c7cc2a295fbdf36d9949ae8f444cf6 Author: Gaetan Nadon Date: Wed Jan 12 13:33:47 2011 -0500 config: remove unrequired AC_SUBST([*_CFLAGS]) This macro is called by PKG_CHECK_MODULES Signed-off-by: Gaetan Nadon commit b7b7a6c4b9227c7b429362c8ef232bf06cea57d1 Author: Gaetan Nadon Date: Wed Jan 12 13:10:21 2011 -0500 config: remove AC_PROG_CC as it overrides AC_PROG_C_C99 XORG_STRICT_OPTION from XORG_DEFAULT_OPTIONS calls AC_PROG_C_C99. This sets gcc with -std=gnu99. If AC_PROG_CC macro is called afterwards, it resets CC to gcc. Signed-off-by: Gaetan Nadon commit c37ee6e4b42776b6dd4147db6022c574e68288b7 Author: Gaetan Nadon Date: Wed Jan 12 11:54:40 2011 -0500 config: use AC_PROG_INSTALL now supplied by XORG_DEFAULT_OPTIONS It depends on util-macros 1.8 or later The existing statement can now be removed from the configuration file. Signed-off-by: Gaetan Nadon commit 97110e50013fc5735c6220f559588b0be9a8b821 Author: Alan Coopersmith Date: Thu Sep 23 18:34:13 2010 -0700 xclock 1.0.5 Signed-off-by: Alan Coopersmith commit 051b0f943db06ee56349dc6a03735f4b4d3f6e0f Author: Gaetan Nadon Date: Tue Jul 20 18:45:18 2010 -0400 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon commit b5ce0b4f7e7b36451872df82c37251fc3d860de4 Author: Jeremy Huddleston Date: Thu Aug 26 08:23:41 2010 -0700 Remove extraneous reference to HAS_STRLCAT Signed-off-by: Jeremy Huddleston commit eefa040512ec291da7cc537774e14d24801b784e Author: David Coppa Date: Thu Jul 29 21:46:11 2010 +0200 Fix a crash on sparc64. The pid variable that is passed to XChangeProperty() is not a long. The libX11 code deferences the variable as a long and on a 64-bit sparc this must be aligned on a 8-byte boundary. Signed-off-by: Matthieu Herrb Reviewed-by: Alan Coopersmith commit ed35a91ebdbe54befb003599364434193d5c8078 Author: Alan Coopersmith Date: Thu Jul 1 16:50:16 2010 -0700 Sun's copyrights now belong to Oracle Signed-off-by: Alan Coopersmith commit cd064a06a4d87c1acb890a0b0f2a543c0e90116b Author: Alan Coopersmith Date: Thu Jul 1 16:46:54 2010 -0700 Xmu functions are called directly, so include it in PKG_CHECK_MODULES Signed-off-by: Alan Coopersmith commit 7b8ac4d10c8d745750a015ad50e07d5e3ef704fa Author: Alan Coopersmith Date: Wed Jun 30 23:25:03 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS The existing statement can now be removed from the configuration file. Use automake provided $(AM_V_GEN) and XORG_DEFAULT_OPTIONS provided $(SED) Enables silent rule and use platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit 3f3532422225e23114427ad6f1fbc039e60b64c9 Author: Alan Coopersmith Date: Fri Jan 15 13:05:38 2010 -0800 Update Sun license notices to current X.Org standard form Signed-off-by: Alan Coopersmith commit bf3695b37628fda8b06fc5363123cf25c77fe76e Author: Gaetan Nadon Date: Sat Dec 19 20:48:47 2009 -0500 configure.ac: use backticks rather than $() for cmd subs Use "$PKG_CONFIG" rather than hard coded "pkg-config" Signed-off-by: Gaetan Nadon commit ee1225481c1c5fe7b6fb9093df5fe4ae9f490e9e Author: Gaetan Nadon Date: Thu Nov 26 09:19:53 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit baf85e944fbd238586805293025a11f62ee56683 Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit 795cd3133fd861d8aa987c76b1227befc641fd17 Author: Gaetan Nadon Date: Tue Oct 27 15:07:24 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit ff0358b1b151f2f07d6bf4345ef32769dab96365 Author: Gaetan Nadon Date: Mon Oct 26 22:08:38 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit 742033062d0153f8e5dcf1214ac904131a27c2cb Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit 30db8ad3c045a4fbcff171435bb8e56ed792a5ec Author: Peter Hutterer Date: Mon Sep 28 08:31:17 2009 +1000 Add INSTALL to .gitignore. (#24157) Avoids git error "fatal: Untracked working tree file 'INSTALL' would be overwritten by merge." when switching between pre-1.0.4 and now. X.Org Bug 24157 Signed-off-by: Peter Hutterer commit 779dd2f2af9a65f96b741c2692d7055bf5970969 Author: Alan Coopersmith Date: Mon Sep 21 21:05:16 2009 -0700 xclock 1.0.4 Signed-off-by: Alan Coopersmith commit b88a85d9021d2e895205ecbe393786d989302cd8 Author: Alan Coopersmith Date: Mon Sep 21 20:59:48 2009 -0700 Fill in COPYING file Signed-off-by: Alan Coopersmith commit 1a1c157c7abccc03a37c26e63ad923fd7dfecc5c Author: Alan Coopersmith Date: Mon Sep 21 20:54:04 2009 -0700 Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS Signed-off-by: Alan Coopersmith commit 8b1af8f1ef0d7cce970a05fe36b7e8e63aa18068 Author: Alan Coopersmith Date: Mon Sep 21 20:51:06 2009 -0700 Trim trailing whitespaces Signed-off-by: Alan Coopersmith commit ce8173a20046c9c21ccfcea45daa0647905c1714 Author: Alan Coopersmith Date: Mon Sep 21 20:47:35 2009 -0700 Add pointers to mailing list, bugzilla, wiki & git repo to README Signed-off-by: Alan Coopersmith commit 82d76c4efcae92709aa07ec9e653f73076f43ebf Author: Paulo Cesar Pereira de Andrade Date: Tue Jan 13 16:26:42 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings. commit 48663cb8af72ea5e0528a341a7dc8865aa84fad2 Author: James Cloos Date: Wed Aug 20 10:32:49 2008 -0400 xaw8 is gone, use xaw7 commit 2d43b9d1c3e3632176fccdb5017b6e196b05b37a Author: Julien Cristau Date: Fri May 16 14:23:54 2008 +0200 $(builddir) is the current directory Apparently automake doesn't always export the builddir variable. This fixes my previous commit. commit 7b16b32d15ea105a3ff77468cea8364193bbdf3c Author: Julien Cristau Date: Sun Apr 20 19:46:18 2008 +0200 Fix build with builddir != srcdir commit 7a6eb7af07301afa6024368544174765d9df0088 Author: Jeremy Huddleston Date: Thu Mar 27 20:07:39 2008 -0700 Build fix for file systems that are not case sensitive commit f149891aea012ace76e63a08fe5ad19a47d9cd52 Author: Matthieu Herrb Date: Sat Mar 8 22:16:23 2008 +0100 Makefile.am: nuke RCS Id commit 8c6739ba1179337c7f8fa25680871e0813ef5181 Author: vdb128 Date: Thu Dec 20 16:08:28 2007 -0800 X.Org Bug 13537: bugs in UTF-8 handling and regularized tick updating X.Org Bugzilla #13537 Patch #12964 commit 870ebb6762f63c6587ee75aba50ee93257fa610b Author: Todd C. Miller Date: Mon Oct 22 21:14:03 2007 +0200 Fix logic inversion in geometry computation in -norender -digital mode. commit 1ea56dd7d67cef80f364fafcf985fb4a6846109d Author: Alan Coopersmith Date: Mon Aug 6 15:37:11 2007 -0700 Version bump: 1.0.3 commit 0c458e28ff7a3f85c0041ac0f01791853c6bdf28 Author: Alan Coopersmith Date: Mon Aug 6 15:36:57 2007 -0700 Replace static changelog with dist-hook to generate from git log commit c94628bef06ea76be371eb0dc8b60bdf0e0009e9 Author: Alan Coopersmith Date: Mon Aug 6 15:32:20 2007 -0700 Fix cast to clear sparse warning: Using plain integer as NULL pointer commit 6f845b1d5516864e143113ca074e98b7be194adb Author: Alan Coopersmith Date: Mon Aug 6 15:25:57 2007 -0700 Change xclock_CFLAGS to AM_CFLAGS to make automake-1.10 happier Clears warning message: Makefile.am:28: compiling `Clock.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.ac' commit a450fbb0f93f8bcdaabfb623fe49ddbb12468287 Author: Alan Coopersmith Date: Wed Jun 13 14:45:51 2007 -0700 Man page: add missing options to synopsis section commit 8476e5fbddafc171903470000e86a68f66dc3958 Author: Alan Coopersmith Date: Wed Jun 13 14:37:39 2007 -0700 Don't segfault if unable to load a usable fontset commit 41503ac2d7c84502074b3b6528478fe017060ef7 Author: Alan Coopersmith Date: Tue Jun 12 19:19:32 2007 -0700 Add pointer to Xft/fontconfig font name format to man page commit 300afc5784cec539a1a9d2babb9f73056aee52cd Author: Alan Coopersmith Date: Tue Jun 12 19:13:23 2007 -0700 X.Org Bug 10775: xclock does not set _NET_WM_PID X.Org Bugzilla #10775: commit 861edc2009b8224d9acf77b9703a9fdb7d4903cc Author: Alan Coopersmith Date: Fri May 18 13:57:47 2007 -0700 renamed: .cvsignore -> .gitignore commit 38e77edd7c3cf9a3f8895e92e46debd0467ecc68 Author: Alan Coopersmith Date: Fri May 18 13:57:15 2007 -0700 Make use of iconv() conditional on configure.ac finding it in libc or libiconv commit 4abb71337d740fdcca30f4f2f57b769b7f422c13 Author: Osamu Sayama Date: Fri May 18 13:27:56 2007 -0700 Sun bug 6518500: Use iconv() to convert other charsets to UTF8 commit d335cefbbe5d23c410f8e8b7af0692559b649e67 Author: Adam Jackson Date: Wed Apr 26 23:37:10 2006 +0000 Bump to 1.0.2 commit a5fd7d91172970d75b1aeaa729125dbbc56615f7 Author: Alan Coopersmith Date: Wed Mar 29 02:10:49 2006 +0000 Bug #6420 Patch #5103 xclock code contains wrong "ifdef RENDER" (Kirill Belokurov) commit 57647f74642e672bc7082aed84141b456659e464 Author: Kevin E Martin Date: Wed Dec 21 02:29:48 2005 +0000 Update package version for X11R7 release. commit cf4d35d1fe4750a81e6842216bf69cbc2b0616aa Author: Adam Jackson Date: Mon Dec 19 16:22:42 2005 +0000 Stub COPYING files commit 21b8bde3c5d7c2d0c53a5abacc59ef0dad28b9cc Author: Kevin E Martin Date: Thu Dec 15 00:24:05 2005 +0000 Update package version number for final X11R7 release candidate. commit 9d2ba2917eea02a77d1e50d74f7449166067d7dd Author: Kevin E Martin Date: Wed Dec 7 16:17:59 2005 +0000 Change to use the app-defaults default dir configured in libXt. commit 2b26c5434f06ee68349b41f332ff46b21bafd557 Author: Kevin E Martin Date: Tue Dec 6 22:48:19 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit 5a833cc25b6913ae41bd2c0263cff2bc9b63f28d Author: Alan Coopersmith Date: Tue Dec 6 16:26:51 2005 +0000 Bugzilla #5251 xclock -digital only shows "20" (Egmont Koblinger) commit 78df2d5bdd53a2dd2febf18ce6c2c9d9e3e4f5f7 Author: Kevin E Martin Date: Sat Dec 3 05:49:18 2005 +0000 Update package version number for X11R7 RC3 release. commit b7954fdcf2ad3298ad2b514d9e5336a9d87c9f22 Author: Alan Coopersmith Date: Mon Nov 28 22:01:40 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit c76fe7d3b795e61aff81672ea2ddd00fae1bd71e Author: Eric Anholt Date: Mon Nov 21 10:34:58 2005 +0000 Another pass at .cvsignores for apps. commit 269b92bf81d7216e147ca9b95013da6bcfaf5c57 Author: Eric Anholt Date: Sun Nov 20 22:08:51 2005 +0000 Add/improve .cvsignore files for apps. commit 5b899caf3dd80e85e61d02796c87f2328f6083d4 Author: Kevin E Martin Date: Wed Oct 19 02:47:52 2005 +0000 Update package version number for RC1 release. commit 9524650fad38958f6be53a65a809a77b4b0c3f12 Author: Alan Coopersmith Date: Tue Oct 18 00:32:53 2005 +0000 Change default install dir for app-default files from $(sysconfdir)/X11/app-defaults to $(libdir)/X11/app-defaults to match the monolith & allow localization commit 648d403d9f57c10c4f6f8906eb365793adc34fcd Author: Alan Coopersmith Date: Mon Oct 17 23:56:21 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 3a45db6788aa23de00379fa73acd9737c6f95ba8 Author: Alan Coopersmith Date: Fri Oct 14 00:25:43 2005 +0000 Use sed to fill in variables in man page commit 9be5366a9bd5b307fd046309ca500a5ad962a167 Author: Alan Coopersmith Date: Thu Oct 13 20:11:00 2005 +0000 Fix app-default files to install under the same names as in the monolith instead of their short names used only for 14-character filename length limited ancient filesystems commit 81149c1a3710d53869bb92f1e4175a479c4204d6 Author: Alan Coopersmith Date: Mon Aug 1 20:25:29 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit e152093bd0a4b8e10282fcd7cbdefdf9204f1e32 Author: Kevin E Martin Date: Fri Jul 29 21:22:31 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit 44223cac61092b5d53ecfcd3816dc3bf113b774d Author: Kevin E Martin Date: Thu Jul 28 15:57:12 2005 +0000 Fix distcheck for remaining apps commit aec9ed75f66e67e9d9d69f04c40867577bcfdf21 Author: Alan Coopersmith Date: Tue Jul 26 15:44:02 2005 +0000 Replace more GNU make-ism's with more portable macros commit ae8ef7b8f5bdd1c53e0f6cb1e1fb1e58333b27a6 Author: Matthieu Herrb Date: Sat Jul 23 16:04:41 2005 +0000 Get rid of DEP_{CFLAGS,LIBS}. This is what was intended, but had a bug in rev 1.2 commit 05bce260dae5db93c178061d411b46b06e0c5e11 Author: Matthieu Herrb Date: Sat Jul 23 15:57:38 2005 +0000 use the DEP_{CFLAGS,LIBS} that were computed in XCLOCK_{CFLAGS,LIBS} commit fe29c745207c2076cd711a23d1dbae033a192143 Author: Adam Jackson Date: Wed Jul 20 19:31:52 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit 575ef4d780ef152a889ee475e4875923c5244589 Author: Alan Coopersmith Date: Sat Jul 16 17:31:45 2005 +0000 Add #include "config.h" for modularization Accept autoconf HAVE_STRLCPY as alias for HAS_STRLCAT commit a4bcc238c730ebadb8c3c67763771bfbefed0879 Author: Alan Coopersmith Date: Sat Jul 16 17:16:05 2005 +0000 Fix app-defaults rule in Makefile.am to work with non-GNU make Add checks for strlcat, xkb, xft2, render, xkb Add --with-* options for XKB & Xft2/Render (enabled by default) commit 80d8b6affb2ee823cf18a368ab33535cb1cf1721 Author: Søren Sandmann Pedersen Date: Fri Jul 1 17:55:48 2005 +0000 Build system for xclock commit ca43036f8cdd456ebff29860fd514248b3699bcf Author: Alan Coopersmith Date: Sat Oct 30 20:33:44 2004 +0000 Add -d flag for compilers like the Sun C compilers that produce dependency lists themselves. To use with the Sun compilers, add to host.def: # define UseCCMakeDepend YES # define DependFlags -cc $(CC) -d -xM (Sun bug id #4245688 - fix by Alan Coopersmith) Add Solaris to the platforms on which mprotect is run to set execute permissions when necessary. (Sun bug id #6175128 - fix by Alan Coopersmith) Internationalize digital output (Sun bug id #4119396 - fix by Steve Swales), add -bgpixmap option to set XPM file as background (originally from STSF project version of xclock by Alan Coopersmith) xc/programs/xmodmap/handle.c,pf.c xmodmap was printing line numbers which are one too low in error messages (Xorg bugzilla #1739, Sun bug id 4637857 - fix by Sam Lau) commit 3f3b1fbe531e0c1ab3b74396bf4e78db861c8bbc Author: Egbert Eich Date: Fri Apr 23 19:54:39 2004 +0000 Merging XORG-CURRENT into trunk commit 850f3f26301d2768b92d0d1de38e0cef467761c0 Author: Egbert Eich Date: Sun Mar 14 08:35:01 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit 4227756d219279272400b4ffc7e77ace44adc600 Author: Egbert Eich Date: Wed Mar 3 12:12:55 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit 61f5ea4644b373e3f8cc7c71d9f4d658707eff9a Author: Egbert Eich Date: Thu Feb 26 13:36:16 2004 +0000 readding XFree86's cvs IDs commit fc5273bdfb2e6c21f305e9de872efa46b81c3910 Author: Egbert Eich Date: Thu Feb 26 09:23:58 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit 5be867cc0e6745ddac1736441a0cc5e11dd6a523 Author: Egbert Eich Date: Thu Jan 29 08:09:03 2004 +0000 Importing vendor version xf86-012804-2330 on Thu Jan 29 00:06:33 PST 2004 commit fd1ae903363dc0a1de353a594ab3524f0abcb0e0 Author: Kaleb Keithley Date: Tue Nov 25 19:29:03 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit c69802c0f421772f1b11e462e1b553e1638afc6f Author: Kaleb Keithley Date: Tue Nov 25 19:29:03 2003 +0000 Initial revision commit f994ad01956aa98c99d6efd85df83fc59493c6ff Author: Kaleb Keithley Date: Fri Nov 14 16:48:58 2003 +0000 XFree86 4.3.0.1 commit 7fa20e0899cf53cbb6d386d0688127df8b6fb0c7 Author: Kaleb Keithley Date: Fri Nov 14 15:54:53 2003 +0000 R6.6 is the Xorg base-line x11-apps-7.7+5+nmu1ubuntu1/xclock/config.rpath0000775000000000000000000004364712213015056015775 0ustar #! /bin/sh # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # # Copyright 1996-2007 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit , 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # The first argument passed to this file is the canonical host specification, # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld # should be set by the caller. # # The set of defined variables is at the end of this script. # Known limitations: # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer # than 256 bytes, otherwise the compiler driver will dump core. The only # known workaround is to choose shorter directory names for the build # directory and/or the installation directory. # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a shrext=.so host="$1" host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # Code taken from libtool.m4's _LT_CC_BASENAME. for cc_temp in $CC""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` # Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. wl= if test "$GCC" = yes; then wl='-Wl,' else case "$host_os" in aix*) wl='-Wl,' ;; darwin*) case $cc_basename in xlc*) wl='-Wl,' ;; esac ;; mingw* | cygwin* | pw32* | os2*) ;; hpux9* | hpux10* | hpux11*) wl='-Wl,' ;; irix5* | irix6* | nonstopux*) wl='-Wl,' ;; newsos6) ;; linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) wl='-Wl,' ;; pgcc | pgf77 | pgf90) wl='-Wl,' ;; ccc*) wl='-Wl,' ;; como) wl='-lopt=' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) wl='-Wl,' ;; esac ;; esac ;; osf3* | osf4* | osf5*) wl='-Wl,' ;; rdos*) ;; solaris*) wl='-Wl,' ;; sunos4*) wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3*) wl='-Wl,' ;; sysv4*MP*) ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) wl='-Wl,' ;; unicos*) wl='-Wl,' ;; uts4*) ;; esac fi # Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no case "$host_os" in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. # Unlike libtool, we use -rpath here, not --rpath, since the documented # option of GNU ld is called -rpath, not --rpath. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' case "$host_os" in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no fi ;; amigaos*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we cannot use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; cygwin* | mingw* | pw32*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then : else ld_shlibs=no fi ;; interix[3-9]*) hardcode_direct=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; netbsd*) ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' else ld_shlibs=no fi ;; esac ;; sunos4*) hardcode_direct=yes ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then hardcode_libdir_flag_spec= fi else case "$host_os" in aix3*) # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac fi hardcode_direct=yes hardcode_libdir_separator=':' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac fi # Begin _LT_AC_SYS_LIBPATH_AIX. echo 'int main () { return 0; }' > conftest.c ${CC} ${LDFLAGS} conftest.c -o conftest aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` fi if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib" fi rm -f conftest.c conftest # End _LT_AC_SYS_LIBPATH_AIX. if test "$aix_use_runtimelinking" = yes; then hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' else hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" fi fi ;; amigaos*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi[45]*) ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' libext=lib ;; darwin* | rhapsody*) hardcode_direct=no if test "$GCC" = yes ; then : else case $cc_basename in xlc*) ;; *) ld_shlibs=no ;; esac fi ;; dgux*) hardcode_libdir_flag_spec='-L$libdir' ;; freebsd1*) ld_shlibs=no ;; freebsd2.2*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; freebsd2*) hardcode_direct=yes hardcode_minus_L=yes ;; freebsd* | dragonfly*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; hpux9*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; hpux10*) if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no ;; *) hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; netbsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; newsos6) hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then hardcode_libdir_flag_spec='${wl}-rpath,$libdir' else case "$host_os" in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) hardcode_libdir_flag_spec='-R$libdir' ;; *) hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; osf3*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) if test "$GCC" = yes; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else # Both cc and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) hardcode_libdir_flag_spec='-R$libdir' ;; sunos4*) hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes ;; sysv4) case $host_vendor in sni) hardcode_direct=yes # is this really true??? ;; siemens) hardcode_direct=no ;; motorola) hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac ;; sysv4.3*) ;; sysv4*MP*) if test -d /usr/nec; then ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) ;; sysv5* | sco3.2v5* | sco5v6*) hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' ;; uts4*) hardcode_libdir_flag_spec='-L$libdir' ;; *) ld_shlibs=no ;; esac fi # Check dynamic linker characteristics # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. # Unlike libtool.m4, here we don't care about _all_ names of the library, but # only about the one the linker finds when passed -lNAME. This is the last # element of library_names_spec in libtool.m4, or possibly two of them if the # linker has special search rules. library_names_spec= # the last element of library_names_spec in libtool.m4 libname_spec='lib$name' case "$host_os" in aix3*) library_names_spec='$libname.a' ;; aix4* | aix5*) library_names_spec='$libname$shrext' ;; amigaos*) library_names_spec='$libname.a' ;; beos*) library_names_spec='$libname$shrext' ;; bsdi[45]*) library_names_spec='$libname$shrext' ;; cygwin* | mingw* | pw32*) shrext=.dll library_names_spec='$libname.dll.a $libname.lib' ;; darwin* | rhapsody*) shrext=.dylib library_names_spec='$libname$shrext' ;; dgux*) library_names_spec='$libname$shrext' ;; freebsd1*) ;; freebsd* | dragonfly*) case "$host_os" in freebsd[123]*) library_names_spec='$libname$shrext$versuffix' ;; *) library_names_spec='$libname$shrext' ;; esac ;; gnu*) library_names_spec='$libname$shrext' ;; hpux9* | hpux10* | hpux11*) case $host_cpu in ia64*) shrext=.so ;; hppa*64*) shrext=.sl ;; *) shrext=.sl ;; esac library_names_spec='$libname$shrext' ;; interix[3-9]*) library_names_spec='$libname$shrext' ;; irix5* | irix6* | nonstopux*) library_names_spec='$libname$shrext' case "$host_os" in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; *) libsuff= shlibsuff= ;; esac ;; esac ;; linux*oldld* | linux*aout* | linux*coff*) ;; linux* | k*bsd*-gnu) library_names_spec='$libname$shrext' ;; knetbsd*-gnu) library_names_spec='$libname$shrext' ;; netbsd*) library_names_spec='$libname$shrext' ;; newsos6) library_names_spec='$libname$shrext' ;; nto-qnx*) library_names_spec='$libname$shrext' ;; openbsd*) library_names_spec='$libname$shrext$versuffix' ;; os2*) libname_spec='$name' shrext=.dll library_names_spec='$libname.a' ;; osf3* | osf4* | osf5*) library_names_spec='$libname$shrext' ;; rdos*) ;; solaris*) library_names_spec='$libname$shrext' ;; sunos4*) library_names_spec='$libname$shrext$versuffix' ;; sysv4 | sysv4.3*) library_names_spec='$libname$shrext' ;; sysv4*MP*) library_names_spec='$libname$shrext' ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) library_names_spec='$libname$shrext' ;; uts4*) library_names_spec='$libname$shrext' ;; esac sed_quote_subst='s/\(["`$\\]\)/\\\1/g' escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` shlibext=`echo "$shrext" | sed -e 's,^\.,,'` escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xclock/man/0000775000000000000000000000000012656635743014250 5ustar x11-apps-7.7+5+nmu1ubuntu1/xclock/man/xclock.man0000664000000000000000000002333712213015056016212 0ustar .\" $Xorg: xclock.man,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $ .\" Copyright 1988, 1994, 1998 The Open Group .\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" .\" $XFree86: xc/programs/xclock/xclock.man,v 1.15 2003/07/04 16:24:30 eich Exp $ .\" .TH XCLOCK 1 __xorgversion__ .SH NAME xclock \- analog / digital clock for X .SH SYNOPSIS \fBxclock\fP [ \fB\-help\fP ] [ \fB\-analog\fP | \fB\-digital\fP ] [ \fB\-brief\fP ] [ \fB\-chime\fP ] [ \fB\-hd\fP \fIcolor\fP ] [ \fB\-hl\fP \fIcolor\fP ] [ \fB\-update\fP \fIseconds\fP ] [ \fB\-strftime\fP \fIformat\fP ] [ \fB\-twelve\fP | \fB-twentyfour\fP | \fB-utime\fP ] [ \fB\-padding\fP \fInumber\fP ] [ \fB\-norender\fP ] [ \fB\-render\fP ] [ \fB\-sharp\fP ] [ \fB\-face\fP \fIpattern\fP ] .SH DESCRIPTION The .I xclock program displays the time in analog or digital form. The time is continuously updated at a frequency which may be specified by the user. .SH OPTIONS .I Xclock accepts all of the standard X Toolkit command line options along with the additional options listed below: .TP 8 .B \-help This option indicates that a brief summary of the allowed options should be printed on the standard error. .TP 8 .B \-analog This option indicates that a conventional 12 hour clock face with tick marks and hands should be used. This is the default. .TP 8 \fB\-digital\fP or \fB\-d\fP This option indicates that a 24 hour digital clock should be used. .TP 8 \fB\-brief\fP This option indicates that the digital clock should only display the hours and minutes fields. The default is to show the full time and date information. .TP 8 \fB\-utime\fP This option indicates that a digital clock should display seconds since the Epoch (in format '970012340 seconds since Epoch' instead of a standard 24-hour time. .TP 8 .B \-strftime \fIformat\fP This option allows an strftime(__libmansuffix__) format string to be specified for the digital clock's display. .TP 8 .B \-twelve This option indicates that a digital clock should display the time in twelve hour format. .TP 8 .B \-twentyfour This option indicates that a digital clock should display the time in twenty-four hour format. This is the default when a digital clock is used. .TP 8 .B \-chime This option indicates that the clock should chime once on the half hour and twice on the hour. .TP 8 \fB\-hands\fP \fIcolor\fP (or \fB\-hd\fP \fIcolor\fP) This option specifies the color of the hands on an analog clock. The default is \fIblack\fP. This option is effectively ignored when Xrender is in use. .TP 8 \fB\-highlight\fP \fIcolor\fP (or \fB\-hl\fP \fIcolor\fP) This option specifies the color of the edges of the hands on an analog clock, and is only useful on color displays. The default is \fIblack\fP. This option is effectively ignored when Xrender is in use. .TP 8 .B \-update \fIseconds\fP This option specifies the frequency in seconds at which \fIxclock\fP should update its display. If the clock is obscured and then exposed, it will be updated immediately. A value of 30 seconds or less will enable a second hand on an analog clock. The default is 60 seconds. .TP 8 .B \-padding \fInumber\fP This option specifies the width in pixels of the padding between the window border and clock text or picture. The default is 10 on a digital clock and 8 on an analog clock. .TP 8 .B \-render This option tells \fIxclock\fP to use the Xrender extension to draw an anti-aliased face. This is the default if \fIxclock\fP has been compiled with Xrender support. Note that the color selection options and resources used when Xrender is in effect differ from the standard options. .TP 8 .B \-norender This option turns off the use of Xrender to draw the clock. .TP 8 .B \-sharp This option tells \fIxclock\fP to use sharper edges when drawn using the Xrender extension. .TP 8 .B \-face \fIpattern\fP This option specifies the font to use in digital mode when the Xrender extension is used. Patterns are specified using the fontconfig face format described in the .I Font Names section of .IR fonts.conf (__filemansuffix__). .SH X DEFAULTS This program uses the .I Clock widget. It understands all of the core resource names and classes as well as: .PP .TP 8 .B width (\fPclass\fB Width) Specifies the width of the clock. The default for analog clocks is 164 pixels; the default for digital clocks is whatever is needed to hold the clock when displayed in the chosen font. .TP 8 .B height (\fPclass\fB Height) Specifies the height of the clock. The default for analog clocks is 164 pixels; the default for digital clocks is whatever is needed to hold the clock when displayed in the chosen font. .TP 8 .B update (\fPclass\fB Interval) Specifies the frequency in seconds at which the time should be redisplayed. .TP 8 .B foreground (\fPclass\fB Foreground) Specifies the color for the tick marks. The default depends on whether \fIreverseVideo\fP is specified. If \fIreverseVideo\fP is specified the default is \fIlwhite\fP, otherwise the default is \fIblack\fP. .TP 8 .B hands (\fPclass\fB Foreground) Specifies the color of the insides of the clock's hands. The default depends on whether \fIreverseVideo\fP is specified. If \fIreverseVideo\fP is specified the default is \fIlwhite\fP, otherwise the default is \fIblack\fP. Note that this resource is not used when Xrender is in effect. .TP 8 .B highlight (\fPclass\fB Foreground) Specifies the color used to highlight the clock's hands. The default is depends on whether \fIreverseVideo\fP is specified. If \fIreverseVideo\fP is specified the default is \fIlwhite\fP, otherwise the default is \fIblack\fP. Note that this resource is not used when Xrender is in effect. .TP 8 .B analog (\fPclass\fB Boolean) Specifies whether or not an analog clock should be used instead of a digital one. The default is True. .TP 8 .B twentyfour (\fPclass\fB Boolean) Specifies whether or not a digital clock should display the time in twenty-four hour format. The default is True. .TP 8 .B chime (\fPclass\fB Boolean) Specifies whether or not a bell should be rung on the hour and half hour. .TP 8 .B padding (\fPclass\fB Margin) Specifies the amount of internal padding in pixels to be used. The default is 8. .TP 8 .B font (\fPclass\fB Font) Specifies the font to be used for the digital clock. Note that variable width fonts currently will not always display correctly. This font is only used when Xrender is not in effect. .TP 8 .B render (\fPclass\fB Boolean) Specifies whether or not the Xrender extension should be used for the display. The default is True if \fIxclock\fP has been compiled with Xrender support. .PP When Xrender is in effect, the following additional resources are understood: .PP .TP 8 .B face (\fPclass\fB FaceName) Specify the pattern for the font to be used for the digital clock when Xrender is used. Patterns are specified using the fontconfig face format described in the .I Font Names section of .IR fonts.conf (__filemansuffix__). .TP 8 .B sharp (\fPclass\fB Boolean) Specifies if sharp edges should be used when rendering the clock. The default is False. .TP 8 .B buffer (\fPclass\fB Boolean) Specifies that the updates of the image are drawn to a pixmap before copied into the window instead drawing them into the window directly. .PP The defaults of the following color resources depend on whether \fIreverseVideo\fP is specified. If \fIreverseVideo\fP is specified the default is \fIlwhite\fP, otherwise the default is \fIblack\fP. .TP 8 .B hourColor (\fPclass\fB Foreground) The color of the hour hand. .TP 8 .B minuteColor (\fPclass\fB Foreground) The color of the minute hand. .TP 8 .B secondColor (\fPclass\fB Foreground) The color of the second hand. .TP 8 .B majorColor (\fPclass\fB Foreground) The color of the major scale ticks (i. e. each five minutes). .TP 8 .B minorColor (\fPclass\fB Foreground) The color of the minor scale ticks (between major ticks). .SH WIDGETS In order to specify resources, it is useful to know the hierarchy of the widgets which compose \fIxclock\fR. In the notation below, indentation indicates hierarchical structure. The widget class name is given first, followed by the widget instance name. .sp .ft CW .nf XClock xclock Clock clock .fi .ft .sp .SH ENVIRONMENT .PP .TP 8 .B DISPLAY to get the default host and display number. .TP 8 .B XENVIRONMENT to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH FILES .TP .I __apploaddir__/XClock specifies required resources .SH "SEE ALSO" X(__miscmansuffix__), xrdb(__appmansuffix__), time(__libmansuffix__), fonts.conf (__filemansuffix__). .SH BUGS .I Xclock believes the system clock. .PP When in digital mode, the string should be centered automatically. .SH AUTHORS Tony Della Fera (MIT-Athena, DEC) .br Dave Mankins (MIT-Athena, BBN) .br Ed Moy (UC Berkeley) x11-apps-7.7+5+nmu1ubuntu1/xclock/man/Makefile.am0000664000000000000000000000052412213015056016257 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = xclock.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/xclock/Clock.c0000664000000000000000000021134712213015056014656 0ustar /* $Xorg: Clock.c,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $ */ /* $XdotOrg: xc/programs/xclock/Clock.c,v 1.3 2004/10/30 20:33:44 alanc Exp $ */ /*********************************************************** Copyright 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /* * Authors: I18N - Steve Swales - March 2000 * bgpixmap - Alan Coopersmith (as part of STSF project) - Sept. 2001 */ /* $XFree86: xc/programs/xclock/Clock.c,v 3.25 2003/07/04 16:24:30 eich Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include "ClockP.h" #include #include #include #include #if !defined(NO_I18N) && defined(HAVE_ICONV) #include #include #include #include #endif #if defined(XawVersion) && (XawVersion >= 7000002L) #define USE_XAW_PIXMAP_CVT #else #include #endif #include #define Time_t time_t #ifdef XKB #include #endif #ifndef NO_I18N #include /* for getenv() */ #include extern Boolean no_locale; /* if True, use old (unlocalized) behaviour */ #endif /* Private Definitions */ #define VERTICES_IN_HANDS 6 /* to draw triangle */ #define PI 3.14159265358979 #define TWOPI (2. * PI) #define MINOR_TICK_FRACT 95 #define SECOND_HAND_FRACT 90 #define MINUTE_HAND_FRACT 70 #define HOUR_HAND_FRACT 40 #define HAND_WIDTH_FRACT 7 #define SECOND_WIDTH_FRACT 5 #define SECOND_HAND_TIME 30 #define ANALOG_SIZE_DEFAULT 164 #define max(a, b) ((a) > (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) /* #define abs(a) ((a) < 0 ? -(a) : (a)) */ /* Initialization of defaults */ #define offset(field) XtOffsetOf(ClockRec, clock.field) #define goffset(field) XtOffsetOf(WidgetRec, core.field) static XtResource resources[] = { {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), goffset(width), XtRImmediate, (XtPointer) 0}, {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), goffset(height), XtRImmediate, (XtPointer) 0}, {XtNupdate, XtCInterval, XtRInt, sizeof(int), offset(update), XtRImmediate, (XtPointer) 60 }, #ifndef XRENDER {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), offset(fgpixel), XtRString, XtDefaultForeground}, #endif {XtNhand, XtCForeground, XtRPixel, sizeof(Pixel), offset(Hdpixel), XtRString, XtDefaultForeground}, {XtNhighlight, XtCForeground, XtRPixel, sizeof(Pixel), offset(Hipixel), XtRString, XtDefaultForeground}, {XtNutime, XtCBoolean, XtRBoolean, sizeof(Boolean), offset(utime), XtRImmediate, (XtPointer) FALSE}, {XtNanalog, XtCBoolean, XtRBoolean, sizeof(Boolean), offset(analog), XtRImmediate, (XtPointer) TRUE}, {XtNtwentyfour, XtCBoolean, XtRBoolean, sizeof(Boolean), offset(twentyfour), XtRImmediate, (XtPointer) TRUE}, {XtNbrief, XtCBoolean, XtRBoolean, sizeof(Boolean), offset(brief), XtRImmediate, (XtPointer) FALSE}, {XtNstrftime, XtCString, XtRString, sizeof(String), offset(strftime), XtRString, ""}, {XtNchime, XtCBoolean, XtRBoolean, sizeof(Boolean), offset(chime), XtRImmediate, (XtPointer) FALSE }, {XtNpadding, XtCMargin, XtRInt, sizeof(int), offset(padding), XtRImmediate, (XtPointer) 8}, {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), offset(font), XtRString, XtDefaultFont}, #ifndef NO_I18N {XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet), offset(fontSet), XtRString, XtDefaultFontSet}, #endif {XtNbackingStore, XtCBackingStore, XtRBackingStore, sizeof (int), offset (backing_store), XtRString, "default"}, #ifdef XRENDER {XtNrender, XtCBoolean, XtRBoolean, sizeof(Boolean), offset(render), XtRImmediate, (XtPointer) TRUE }, {XtNbuffer, XtCBoolean, XtRBoolean, sizeof(Boolean), offset(buffer), XtRImmediate, (XtPointer) TRUE }, {XtNsharp, XtCBoolean, XtRBoolean, sizeof(Boolean), offset(sharp), XtRImmediate, (XtPointer) FALSE }, {XtNforeground, XtCForeground, XtRXftColor, sizeof(XftColor), offset(fg_color), XtRString, XtDefaultForeground}, {XtNhourColor, XtCForeground, XtRXftColor, sizeof(XftColor), offset(hour_color), XtRString, XtDefaultForeground}, {XtNminuteColor, XtCForeground, XtRXftColor, sizeof(XftColor), offset(min_color), XtRString, XtDefaultForeground}, {XtNsecondColor, XtCForeground, XtRXftColor, sizeof(XftColor), offset(sec_color), XtRString, XtDefaultForeground}, {XtNmajorColor, XtCForeground, XtRXftColor, sizeof(XftColor), offset(major_color), XtRString, XtDefaultForeground}, {XtNminorColor, XtCForeground, XtRXftColor, sizeof(XftColor), offset(minor_color), XtRString, XtDefaultForeground}, {XtNface, XtCFace, XtRXftFont, sizeof (XftFont *), offset (face), XtRString, ""}, #endif }; #undef offset #undef goffset static void ClassInitialize ( void ); static void Initialize ( Widget request, Widget new, ArgList args, Cardinal *num_args ); static void Realize ( Widget gw, XtValueMask *valueMask, XSetWindowAttributes *attrs ); static void Destroy ( Widget gw ); static void Resize ( Widget gw ); static void Redisplay ( Widget gw, XEvent *event, Region region ); static void clock_tic ( XtPointer client_data, XtIntervalId *id ); static void erase_hands ( ClockWidget w, struct tm *tm ); static void ClockAngle ( int tick_units, double *sinp, double *cosp ); static void DrawLine ( ClockWidget w, Dimension blank_length, Dimension length, int tick_units ); static void DrawHand ( ClockWidget w, Dimension length, Dimension width, int tick_units ); static void DrawSecond ( ClockWidget w, Dimension length, Dimension width, Dimension offset, int tick_units ); static void SetSeg ( ClockWidget w, int x1, int y1, int x2, int y2 ); static void DrawClockFace ( ClockWidget w ); static int clock_round ( double x ); static Boolean SetValues ( Widget gcurrent, Widget grequest, Widget gnew, ArgList args, Cardinal *num_args ); #if !defined(NO_I18N) && defined(HAVE_ICONV) static char *clock_to_utf8(const char *str, int in_len); #endif ClockClassRec clockClassRec = { { /* core fields */ /* superclass */ (WidgetClass) &simpleClassRec, /* class_name */ "Clock", /* widget_size */ sizeof(ClockRec), /* class_initialize */ ClassInitialize, /* class_part_initialize */ NULL, /* class_inited */ FALSE, /* initialize */ Initialize, /* initialize_hook */ NULL, /* realize */ Realize, /* actions */ NULL, /* num_actions */ 0, /* resources */ resources, /* resource_count */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, /* compress_exposure */ XtExposeCompressMaximal, /* compress_enterleave */ TRUE, /* visible_interest */ FALSE, /* destroy */ Destroy, /* resize */ Resize, /* expose */ Redisplay, /* set_values */ SetValues, /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ NULL, /* query_geometry */ XtInheritQueryGeometry, /* display_accelerator */ XtInheritDisplayAccelerator, /* extension */ NULL }, { /* simple fields */ /* change_sensitive */ XtInheritChangeSensitive }, { /* clock fields */ /* ignore */ 0 } }; WidgetClass clockWidgetClass = (WidgetClass) &clockClassRec; /**************************************************************** * * Private Procedures * ****************************************************************/ #ifndef USE_XAW_PIXMAP_CVT static void CvtStringToPixmap( XrmValue* args, Cardinal* num_args, XrmValuePtr fromVal, XrmValuePtr toVal ) { static Pixmap pmap; Pixmap shapemask; char *name = (char *)fromVal->addr; Screen *screen; Display *dpy; if (*num_args != 1) XtErrorMsg("wrongParameters","cvtStringToPixmap","XtToolkitError", "String to pixmap conversion needs screen argument", (String *)NULL, (Cardinal *)NULL); if (strcmp(name, "None") == 0) { pmap = None; } else { screen = *((Screen **) args[0].addr); dpy = DisplayOfScreen(screen); XpmReadFileToPixmap(dpy, RootWindowOfScreen(screen), name, &pmap, &shapemask, NULL); } (*toVal).size = sizeof(Pixmap); (*toVal).addr = (XPointer) &pmap ; } #endif #ifdef XRENDER static XtConvertArgRec xftColorConvertArgs[] = { {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen), sizeof(Screen *)}, {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.colormap), sizeof(Colormap)} }; #define donestr(type, value, tstr) \ { \ if (toVal->addr != NULL) { \ if (toVal->size < sizeof(type)) { \ toVal->size = sizeof(type); \ XtDisplayStringConversionWarning(dpy, \ (char*) fromVal->addr, tstr); \ return False; \ } \ *(type*)(toVal->addr) = (value); \ } \ else { \ static type static_val; \ static_val = (value); \ toVal->addr = (XPointer)&static_val; \ } \ toVal->size = sizeof(type); \ return True; \ } static void XmuFreeXftColor (XtAppContext app, XrmValuePtr toVal, XtPointer closure, XrmValuePtr args, Cardinal *num_args) { Screen *screen; Colormap colormap; XftColor *color; if (*num_args != 2) { XtAppErrorMsg (app, "freeXftColor", "wrongParameters", "XtToolkitError", "Freeing an XftColor requires screen and colormap arguments", (String *) NULL, (Cardinal *)NULL); return; } screen = *((Screen **) args[0].addr); colormap = *((Colormap *) args[1].addr); color = (XftColor *) toVal->addr; XftColorFree (DisplayOfScreen (screen), DefaultVisual (DisplayOfScreen (screen), XScreenNumberOfScreen (screen)), colormap, color); } static Boolean XmuCvtStringToXftColor(Display *dpy, XrmValue *args, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, XtPointer *converter_data) { char *spec; XRenderColor renderColor; XftColor xftColor; Screen *screen; Colormap colormap; if (*num_args != 2) { XtAppErrorMsg (XtDisplayToApplicationContext (dpy), "cvtStringToXftColor", "wrongParameters", "XtToolkitError", "String to render color conversion needs screen and colormap arguments", (String *) NULL, (Cardinal *)NULL); return False; } screen = *((Screen **) args[0].addr); colormap = *((Colormap *) args[1].addr); spec = (char *) fromVal->addr; if (strcasecmp (spec, XtDefaultForeground) == 0) { renderColor.red = 0; renderColor.green = 0; renderColor.blue = 0; renderColor.alpha = 0xffff; } else if (strcasecmp (spec, XtDefaultBackground) == 0) { renderColor.red = 0xffff; renderColor.green = 0xffff; renderColor.blue = 0xffff; renderColor.alpha = 0xffff; } else if (!XRenderParseColor (dpy, spec, &renderColor)) return False; if (!XftColorAllocValue (dpy, DefaultVisual (dpy, XScreenNumberOfScreen (screen)), colormap, &renderColor, &xftColor)) return False; donestr (XftColor, xftColor, XtRXftColor); } static void XmuFreeXftFont (XtAppContext app, XrmValuePtr toVal, XtPointer closure, XrmValuePtr args, Cardinal *num_args) { Screen *screen; XftFont *font; if (*num_args != 1) { XtAppErrorMsg (app, "freeXftFont", "wrongParameters", "XtToolkitError", "Freeing an XftFont requires screen argument", (String *) NULL, (Cardinal *)NULL); return; } screen = *((Screen **) args[0].addr); font = *((XftFont **) toVal->addr); if (font) XftFontClose (DisplayOfScreen (screen), font); } static Boolean XmuCvtStringToXftFont(Display *dpy, XrmValue *args, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, XtPointer *converter_data) { char *name; XftFont *font; Screen *screen; if (*num_args != 1) { XtAppErrorMsg (XtDisplayToApplicationContext (dpy), "cvtStringToXftFont", "wrongParameters", "XtToolkitError", "String to XftFont conversion needs screen argument", (String *) NULL, (Cardinal *)NULL); return False; } screen = *((Screen **) args[0].addr); name = (char *) fromVal->addr; font = XftFontOpenName (dpy, XScreenNumberOfScreen (screen), name); if (font) { donestr (XftFont *, font, XtRXftFont); } XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRXftFont); return False; } static XtConvertArgRec xftFontConvertArgs[] = { {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen), sizeof(Screen *)}, }; #endif static void ClassInitialize(void) { #ifdef USE_XAW_PIXMAP_CVT XawInitializeWidgetSet(); #else static XtConvertArgRec scrnConvertArg[] = { {XtBaseOffset, (XtPointer) XtOffset(Widget, core.screen), sizeof(Screen *)} }; XtAddConverter( XtRString, XtRPixmap, CvtStringToPixmap, scrnConvertArg, XtNumber(scrnConvertArg)); #endif XtAddConverter( XtRString, XtRBackingStore, XmuCvtStringToBackingStore, NULL, 0 ); #ifdef XRENDER XtSetTypeConverter (XtRString, XtRXftColor, XmuCvtStringToXftColor, xftColorConvertArgs, XtNumber(xftColorConvertArgs), XtCacheByDisplay, XmuFreeXftColor); XtSetTypeConverter (XtRString, XtRXftFont, XmuCvtStringToXftFont, xftFontConvertArgs, XtNumber(xftFontConvertArgs), XtCacheByDisplay, XmuFreeXftFont); #endif } static char * TimeString (ClockWidget w, struct tm *tm) { if (w->clock.brief) { if (w->clock.twentyfour) { static char brief[6]; sprintf (brief, "%02d:%02d", tm->tm_hour, tm->tm_min); return brief; } else { static char brief[9]; int hour = tm->tm_hour % 12; if (!hour) hour = 12; sprintf (brief, "%02d:%02d %cM", hour, tm->tm_min, tm->tm_hour >= 12 ? 'P' : 'A'); return brief; } } else if (w->clock.utime) { static char utime[35]; Time_t tsec; tsec = time(NULL); sprintf (utime, "%10lu seconds since Epoch", (unsigned long)tsec); return utime; } else if (*w->clock.strftime) { /*Note: this code is probably excessively paranoid about buffer overflow. The extra size 10 padding is also meant as a further guard against programmer error, although it is a little controversial*/ static char ctime[STRFTIME_BUFF_SIZE+10]; ctime[0] = ctime[STRFTIME_BUFF_SIZE] = '\0'; if (0 < strftime (ctime, STRFTIME_BUFF_SIZE-1,w->clock.strftime, tm)) { ctime[STRFTIME_BUFF_SIZE-1] = '\0'; return ctime; } else { return asctime (tm); } } else if (w->clock.twentyfour) return asctime (tm); else { static char long12[28]; strftime(long12, sizeof long12, "%a %b %d %I:%M:%S %p %Y", tm); return long12; } } /* ARGSUSED */ static void Initialize (Widget request, Widget new, ArgList args, Cardinal *num_args) { ClockWidget w = (ClockWidget)new; XtGCMask valuemask; XGCValues myXGCV; int min_height, min_width; valuemask = GCForeground | GCBackground | GCFont | GCLineWidth; if (w->clock.font != NULL) myXGCV.font = w->clock.font->fid; else valuemask &= ~GCFont; /* use server default font */ min_width = min_height = ANALOG_SIZE_DEFAULT; if(!w->clock.analog) { char *str; struct tm tm; Time_t time_value; int len; #ifndef NO_I18N w->clock.utf8 = False; if (!no_locale) { char *time_locale = setlocale(LC_CTYPE, NULL); if (strstr(time_locale, "UTF-8") || strstr(time_locale, "utf8")) { w->clock.utf8 = True; } /* * initialize time format from CFTIME if set, otherwise * default to "%c". This emulates ascftime, but we use * strftime so we can limit the string buffer size to * avoid possible buffer overflow. */ if ((w->clock.strftime == NULL) || (w->clock.strftime[0] == 0)) { w->clock.strftime = getenv("CFTIME"); if (w->clock.strftime == NULL) { w->clock.strftime = "%c"; } } } #endif /* NO_I18N */ (void) time(&time_value); tm = *localtime(&time_value); str = TimeString (w, &tm); len = strlen(str); if (len && str[len - 1] == '\n') str[--len] = '\0'; #ifdef XRENDER if (w->clock.render) { XGlyphInfo extents; #ifndef NO_I18N # ifdef HAVE_ICONV char *utf8_str; # endif if (w->clock.utf8) XftTextExtentsUtf8 (XtDisplay (w), w->clock.face, (FcChar8 *) str, len, &extents); # ifdef HAVE_ICONV else if ((utf8_str = clock_to_utf8(str, len)) != NULL) { XftTextExtentsUtf8 (XtDisplay (w), w->clock.face, (FcChar8 *)utf8_str, strlen(utf8_str), &extents); free(utf8_str); } # endif else #endif XftTextExtents8 (XtDisplay (w), w->clock.face, (FcChar8 *) str, len, &extents); min_width = extents.xOff + 2 * w->clock.padding; min_height = w->clock.face->ascent + w->clock.face->descent + 2 * w->clock.padding; /*fprintf(stderr, "render min_width %i\n", min_width);*/ } else #endif { /* not XRENDER block */ #ifndef NO_I18N if (!no_locale) { XFontSetExtents *fse; if(w->clock.fontSet == NULL) { char **missing, *default_str; int n_missing; w->clock.fontSet = XCreateFontSet( XtDisplay(w), XtDefaultFontSet, &missing, &n_missing, &default_str); } if (w->clock.fontSet != NULL) { /* don't free this... it's freed with the XFontSet. */ fse = XExtentsOfFontSet(w->clock.fontSet); min_width = XmbTextEscapement(w->clock.fontSet,str,len) + 2 * w->clock.padding; min_height = fse->max_logical_extent.height + 3 * w->clock.padding; /*fprintf(stderr, "fontset min_width %i\n", min_width);*/ } else { no_locale = True; } } if (no_locale) #endif /* NO_I18N */ { if (w->clock.font == NULL) w->clock.font = XQueryFont( XtDisplay(w), XGContextFromGC( DefaultGCOfScreen(XtScreen(w))) ); min_width = XTextWidth(w->clock.font, str, len) + 2 * w->clock.padding; min_height = w->clock.font->ascent + w->clock.font->descent + 2 * w->clock.padding; /*fprintf(stderr, "font min_width %i\n", min_width);*/ } } /* not XRENDER block */ } if (w->core.width == 0) w->core.width = min_width; if (w->core.height == 0) w->core.height = min_height; myXGCV.foreground = ClockFgPixel (w); myXGCV.background = w->core.background_pixel; if (w->clock.font != NULL) myXGCV.font = w->clock.font->fid; else valuemask &= ~GCFont; /* use server default font */ myXGCV.line_width = 0; w->clock.myGC = XtGetGC((Widget)w, valuemask, &myXGCV); valuemask = GCForeground | GCLineWidth | GCGraphicsExposures; myXGCV.foreground = w->core.background_pixel; if (w->core.background_pixmap != XtUnspecifiedPixmap) { myXGCV.tile = w->core.background_pixmap; myXGCV.fill_style = FillTiled; valuemask |= (GCTile | GCFillStyle); } myXGCV.graphics_exposures = False; w->clock.EraseGC = XtGetGC((Widget)w, valuemask, &myXGCV); valuemask &= ~(GCTile | GCFillStyle); myXGCV.foreground = w->clock.Hipixel; w->clock.HighGC = XtGetGC((Widget)w, valuemask, &myXGCV); valuemask = GCForeground; myXGCV.foreground = w->clock.Hdpixel; w->clock.HandGC = XtGetGC((Widget)w, valuemask, &myXGCV); /* make invalid update's use a default */ /*if (w->clock.update <= 0) w->clock.update = 60;*/ w->clock.show_second_hand = (abs(w->clock.update) <= SECOND_HAND_TIME); w->clock.numseg = 0; w->clock.interval_id = 0; memset (&w->clock.otm, '\0', sizeof (w->clock.otm)); #ifdef XRENDER { int major, minor; if (XRenderQueryVersion (XtDisplay (w), &major, &minor) && (major > 0 || (major == 0 && minor >= 4))) { w->clock.can_polygon = True; } else w->clock.can_polygon = False; } w->clock.pixmap = 0; w->clock.draw = NULL; w->clock.damage.x = 0; w->clock.damage.y = 0; w->clock.damage.height = 0; w->clock.damage.width = 0; #endif } #ifdef XRENDER static void RenderPrepare (ClockWidget w, XftColor *color) { if (!w->clock.draw) { Drawable d = XtWindow (w); if (w->clock.buffer) { if (!w->clock.pixmap) { Arg arg[1]; w->clock.pixmap = XCreatePixmap (XtDisplay (w), d, w->core.width, w->core.height, w->core.depth); arg[0].name = XtNbackgroundPixmap; arg[0].value = 0; XtSetValues ((Widget) w, arg, 1); } d = w->clock.pixmap; } w->clock.draw = XftDrawCreate (XtDisplay (w), d, DefaultVisual (XtDisplay (w), DefaultScreen(XtDisplay (w))), w->core.colormap); w->clock.picture = XftDrawPicture (w->clock.draw); } if (color) w->clock.fill_picture = XftDrawSrcPicture (w->clock.draw, color); } static void RenderClip (ClockWidget w) { Region r; Drawable d; RenderPrepare (w, NULL); if (w->clock.buffer) d = w->clock.pixmap; else d = XtWindow (w); XFillRectangle (XtDisplay (w), d, w->clock.EraseGC, w->clock.damage.x, w->clock.damage.y, w->clock.damage.width, w->clock.damage.height); r = XCreateRegion (); XUnionRectWithRegion (&w->clock.damage, r, r); XftDrawSetClip (w->clock.draw, r); XDestroyRegion (r); } static void RenderTextBounds (ClockWidget w, char *str, int off, int len, XRectangle *bounds, int *xp, int *yp) { XGlyphInfo head, tail; int x, y; #ifndef NO_I18N # ifdef HAVE_ICONV char *utf8_str; # endif if (w->clock.utf8) { XftTextExtentsUtf8 (XtDisplay (w), w->clock.face, (FcChar8 *) str, off, &head); XftTextExtentsUtf8 (XtDisplay (w), w->clock.face, (FcChar8 *) str + off, len - off, &tail); } # ifdef HAVE_ICONV else if ((utf8_str = clock_to_utf8(str, off)) != NULL) { XftTextExtentsUtf8 (XtDisplay (w), w->clock.face, (FcChar8 *)utf8_str, strlen(utf8_str), &head); free(utf8_str); if ((utf8_str = clock_to_utf8(str+off, len-off)) != NULL) { XftTextExtentsUtf8 (XtDisplay (w), w->clock.face, (FcChar8 *)utf8_str, strlen(utf8_str), &tail); free(utf8_str); } else goto fallback; } # endif else #endif { fallback: XftTextExtents8 (XtDisplay (w), w->clock.face, (FcChar8 *) str, off, &head); XftTextExtents8 (XtDisplay (w), w->clock.face, (FcChar8 *) str + off, len - off, &tail); } /* * Compute position of tail */ x = w->clock.padding + head.xOff; y = w->clock.face->ascent + w->clock.padding + head.yOff; /* * Compute bounds of tail, pad a bit as the bounds aren't exact */ bounds->x = x - tail.x - 1; bounds->y = y - tail.y - 1; bounds->width = tail.width + 2; bounds->height = tail.height + 2; if (xp) *xp = x; if (yp) *yp = y; } static void RenderUpdateRectBounds (XRectangle *damage, XRectangle *bounds) { int x1 = bounds->x; int y1 = bounds->y; int x2 = bounds->x + bounds->width; int y2 = bounds->y + bounds->height; int d_x1 = damage->x; int d_y1 = damage->y; int d_x2 = damage->x + damage->width; int d_y2 = damage->y + damage->height; if (x1 == x2) { x1 = d_x1; x2 = d_x2; } else { if (d_x1 < x1) x1 = d_x1; if (d_x2 > x2) x2 = d_x2; } if (y1 == y2) { y1 = d_y1; y2 = d_y2; } else { if (d_y1 < y1) y1 = d_y1; if (d_y2 > y2) y2 = d_y2; } bounds->x = x1; bounds->y = y1; bounds->width = x2 - x1; bounds->height = y2 - y1; } static Boolean RenderRectIn (XRectangle *rect, XRectangle *bounds) { int x1 = bounds->x; int y1 = bounds->y; int x2 = bounds->x + bounds->width; int y2 = bounds->y + bounds->height; int r_x1 = rect->x; int r_y1 = rect->y; int r_x2 = rect->x + rect->width; int r_y2 = rect->y + rect->height; return r_x1 < x2 && x1 < r_x2 && r_y1 < y2 && y1 < r_y2; } #define LINE_WIDTH 0.01 #include #define XCoord(x,w) ((x) * (w)->clock.x_scale + (w)->clock.x_off) #define YCoord(y,w) ((y) * (w)->clock.y_scale + (w)->clock.y_off) static void RenderUpdateBounds (XPointDouble *points, int npoints, XRectangle *bounds) { int x1 = bounds->x; int y1 = bounds->y; int x2 = bounds->x + bounds->width; int y2 = bounds->y + bounds->height; while (npoints--) { int r_x1 = points[0].x; int r_y1 = points[0].y; int r_x2 = points[0].x + 1; int r_y2 = points[0].y + 1; if (x1 == x2) x2 = x1 = r_x1; if (y1 == y2) y2 = y1 = r_y1; if (r_x1 < x1) x1 = r_x1; if (r_y1 < y1) y1 = r_y1; if (r_x2 > x2) x2 = r_x2; if (r_y2 > y2) y2 = r_y2; points++; } bounds->x = x1; bounds->y = y1; bounds->width = x2 - x1; bounds->height = y2 - y1; } static Boolean RenderCheckBounds (XPointDouble *points, int npoints, XRectangle *bounds) { int x1 = bounds->x; int y1 = bounds->y; int x2 = bounds->x + bounds->width; int y2 = bounds->y + bounds->height; while (npoints--) { if (x1 <= points->x && points->x <= x2 && y1 <= points->y && points->y <= y2) return True; points++; } return False; } static void RenderUpdate (ClockWidget w) { if (w->clock.buffer && w->clock.pixmap) { XCopyArea (XtDisplay (w), w->clock.pixmap, XtWindow (w), w->clock.EraseGC, w->clock.damage.x, w->clock.damage.y, w->clock.damage.width, w->clock.damage.height, w->clock.damage.x, w->clock.damage.y); } } static void RenderResetBounds (XRectangle *bounds) { bounds->x = 0; bounds->y = 0; bounds->width = 0; bounds->height = 0; } static void RenderLine (ClockWidget w, XDouble x1, XDouble y1, XDouble x2, XDouble y2, XftColor *color, Boolean draw) { XPointDouble poly[4]; XDouble dx = (x2 - x1); XDouble dy = (y2 - y1); XDouble len = sqrt (dx*dx + dy*dy); XDouble ldx = (LINE_WIDTH/2.0) * dy / len; XDouble ldy = (LINE_WIDTH/2.0) * dx / len; poly[0].x = XCoord (x1 + ldx, w); poly[0].y = YCoord (y1 - ldy, w); poly[1].x = XCoord (x2 + ldx, w); poly[1].y = YCoord (y2 - ldy, w); poly[2].x = XCoord (x2 - ldx, w); poly[2].y = YCoord (y2 + ldy, w); poly[3].x = XCoord (x1 - ldx, w); poly[3].y = YCoord (y1 + ldy, w); RenderUpdateBounds (poly, 4, &w->clock.damage); if (draw) { if (RenderCheckBounds (poly, 4, &w->clock.damage)) { RenderPrepare (w, color); XRenderCompositeDoublePoly (XtDisplay (w), PictOpOver, w->clock.fill_picture, w->clock.picture, w->clock.mask_format, 0, 0, 0, 0, poly, 4, EvenOddRule); } } else RenderUpdateBounds (poly, 4, &w->clock.damage); } static void RenderRotate (ClockWidget w, XPointDouble *out, double x, double y, double s, double c) { out->x = XCoord (x * c - y * s, w); out->y = YCoord (y * c + x * s, w); } static void RenderHand (ClockWidget w, int tick_units, int size, XftColor *color, Boolean draw) { double c, s; XPointDouble poly[3]; double outer_x; double inner_y; ClockAngle (tick_units, &c, &s); s = -s; /* compute raw positions */ outer_x = size / 100.0; inner_y = HAND_WIDTH_FRACT / 100.0; /* rotate them into position */ RenderRotate (w, &poly[0], outer_x, 0.0, s, c); RenderRotate (w, &poly[1], -inner_y, inner_y, s, c); RenderRotate (w, &poly[2], -inner_y, -inner_y, s, c); if (draw) { if (RenderCheckBounds (poly, 3, &w->clock.damage)) { RenderPrepare (w, color); XRenderCompositeDoublePoly (XtDisplay (w), PictOpOver, w->clock.fill_picture, w->clock.picture, w->clock.mask_format, 0, 0, 0, 0, poly, 3, EvenOddRule); } } RenderUpdateBounds (poly, 3, &w->clock.damage); } static void RenderHands (ClockWidget w, struct tm *tm, Boolean draw) { RenderHand (w, tm->tm_hour * 300 + tm->tm_min*5, HOUR_HAND_FRACT, &w->clock.hour_color, draw); RenderHand (w, tm->tm_min * 60 + tm->tm_sec, MINUTE_HAND_FRACT, &w->clock.min_color, draw); } static void RenderSec (ClockWidget w, struct tm *tm, Boolean draw) { double c, s; XPointDouble poly[10]; double inner_x, middle_x, outer_x, far_x; double middle_y; double line_y; ClockAngle (tm->tm_sec * 60, &c, &s); s = -s; /* * Compute raw positions */ line_y = LINE_WIDTH; inner_x = (MINUTE_HAND_FRACT / 100.0); middle_x = ((SECOND_HAND_FRACT + MINUTE_HAND_FRACT) / 200.0); outer_x = (SECOND_HAND_FRACT / 100.0); far_x = (MINOR_TICK_FRACT / 100.0); middle_y = (SECOND_WIDTH_FRACT / 100.0); /* * Rotate them into position */ RenderRotate (w, &poly[0], -line_y, line_y, s, c); RenderRotate (w, &poly[1], inner_x, line_y, s, c); RenderRotate (w, &poly[2], middle_x, middle_y, s, c); RenderRotate (w, &poly[3], outer_x, line_y, s, c); RenderRotate (w, &poly[4], far_x, line_y, s, c); RenderRotate (w, &poly[5], far_x, -line_y, s, c); RenderRotate (w, &poly[6], outer_x, -line_y, s, c); RenderRotate (w, &poly[7], middle_x, -middle_y, s, c); RenderRotate (w, &poly[8], inner_x, -line_y, s, c); RenderRotate (w, &poly[9], -line_y, -line_y, s, c); if (draw) { if (RenderCheckBounds (poly, 10, &w->clock.damage)) { RenderPrepare (w, &w->clock.sec_color); XRenderCompositeDoublePoly (XtDisplay (w), PictOpOver, w->clock.fill_picture, w->clock.picture, w->clock.mask_format, 0, 0, 0, 0, poly, 10, EvenOddRule); } } else { RenderUpdateBounds (poly, 10, &w->clock.damage); } } #endif static void Realize(Widget gw, XtValueMask *valueMask, XSetWindowAttributes *attrs) { ClockWidget w = (ClockWidget) gw; #ifdef notdef *valueMask |= CWBitGravity; attrs->bit_gravity = ForgetGravity; #endif switch (w->clock.backing_store) { case Always: case NotUseful: case WhenMapped: *valueMask |=CWBackingStore; attrs->backing_store = w->clock.backing_store; break; } (*clockWidgetClass->core_class.superclass->core_class.realize) (gw, valueMask, attrs); Resize(gw); } static void Destroy(Widget gw) { ClockWidget w = (ClockWidget) gw; if (w->clock.interval_id) XtRemoveTimeOut (w->clock.interval_id); #ifdef XRENDER if (w->clock.picture) XRenderFreePicture (XtDisplay(w), w->clock.picture); if (w->clock.fill_picture) XRenderFreePicture (XtDisplay(w), w->clock.fill_picture); #endif XtReleaseGC (gw, w->clock.myGC); XtReleaseGC (gw, w->clock.HighGC); XtReleaseGC (gw, w->clock.HandGC); XtReleaseGC (gw, w->clock.EraseGC); } static void Resize(Widget gw) { ClockWidget w = (ClockWidget) gw; /* don't do this computation if window hasn't been realized yet. */ if (XtIsRealized(gw) && w->clock.analog) { /* need signed value since Dimension is unsigned */ int radius = ((int) min(w->core.width, w->core.height) - (int) (2 * w->clock.padding)) / 2; w->clock.radius = (Dimension) max (radius, 1); w->clock.second_hand_length = (int)(SECOND_HAND_FRACT * w->clock.radius) / 100; w->clock.minute_hand_length = (int)(MINUTE_HAND_FRACT * w->clock.radius) / 100; w->clock.hour_hand_length = (int)(HOUR_HAND_FRACT * w->clock.radius) / 100; w->clock.hand_width = (int)(HAND_WIDTH_FRACT * w->clock.radius) / 100; w->clock.second_hand_width = (int)(SECOND_WIDTH_FRACT * w->clock.radius) / 100; w->clock.centerX = w->core.width / 2; w->clock.centerY = w->core.height / 2; } #ifdef XRENDER w->clock.x_scale = 0.45 * w->core.width; w->clock.y_scale = 0.45 * w->core.height; w->clock.x_off = 0.5 * w->core.width; w->clock.y_off = 0.5 * w->core.height; if (w->clock.pixmap) { XFreePixmap (XtDisplay (w), w->clock.pixmap); w->clock.pixmap = 0; if (w->clock.draw) { XftDrawDestroy (w->clock.draw); w->clock.draw = NULL; } w->clock.picture = 0; } #endif } /* ARGSUSED */ static void Redisplay(Widget gw, XEvent *event, Region region) { ClockWidget w = (ClockWidget) gw; if (w->clock.analog) { #ifdef XRENDER if (w->clock.render && w->clock.can_polygon) XClipBox (region, &w->clock.damage); else #endif { if (w->clock.numseg != 0) erase_hands (w, (struct tm *) 0); DrawClockFace(w); } } else { #ifdef XRENDER if (w->clock.render) XClipBox (region, &w->clock.damage); #endif w->clock.prev_time_string[0] = '\0'; } clock_tic((XtPointer)w, (XtIntervalId *)NULL); } /* Choose the update times for well-defined clock states. * * For example, in HH:MM:SS notation the last number rolls over * every 60 seconds and has at most 60 display states. The sequence * depends on its initial value t0 and the update period u, e.g. * * u (s) d (s) ti (s) m (states) l (s) * 2 2 {0,2, .. 58} 30 60 * 7 1 {0,7, .. 56,3, .. 53} 60 420 * 15 15 {0,15,30,45} 4 60 * 45 15 {0,45,30,15} 4 180 * 53 1 {0,53,46, .. 4,57, .. 7} 60 3180 * 58 2 {0,58,56, .. 2} 30 1740 * 60 60 {0} 1 60 * * u= update period in seconds, * ti= time at update i from the reference, HH:MM:00 or HH:00:00, * n= the roll over time, the modulus, 60 s or 3600 s, * m= the sequence length, the order of u in the modulo n group Z/nZ, * l= the total sequence duration =m*u. * d= gcd(n,u) the greatest common divisor * * The time t(i) determines the clock state. It follows from * * t(i)=t(i-1)+u mod n <=> t(i)=t(0)+i*u mod n * * which defines a { t(0) .. t(m-1) } sequence of m unique elements. * Hence, u generates a subgroup U={k*u mod n : k in Z} of Z/nZ so * its order m divides n. This m satisfies * * t(m)=t(0) <=> m*u mod n = 0 <=> m*u = r*n <=> m=n/d, r=u/d * * where d divides n and u. Choosing * * d=gcd(n,u) <=> n/d and u/d are coprime => m=n/d is minimum * * thus gives the order. Furthermore, the greatest common divisor d is * also the minimum value generator of the set U. Assume a generator e * where * * e|{n,u} <=> Ai,Ej: i*u mod n = j*e <=> j=f(i)=(i*u mod n)/e * * such that f maps i to m=ord(u) unique values of j. Its properties are * * j=i*u/e mod n/e ==> 0<=j J={j=f(i)}, |J|=m * * ord(e)=n/gcd(n,e)=n/e * * from wich follows * * e=d ==> f: I={0,..,m-1} -> J={0,..,m-1}: j=i*r mod m is bijective * ==> D={k*d mod n : k in Z} = U. * * Any value e below d is no generator since it yields a non contiguous * J such that an l=0..n/e-1 exists not in J with l*e not in U. * * The update sequence t(i) could be followed using the algorithm: * * 1. restore the expected value into t(i), * 2. calculate the next timeout t(i+1)=t(i)+u mod n, * 3. verify that the current tc(i) is between t(i)..t(i+1), * 4. calculate the time to wait w=t(i+1)-tc(i) mod n, * 5. store t(i+1), * * which implements state tracking. This approach doesn't work well * since the set timeout w does not guarantee a next call at time * t(i+1), e.g. due to progam sleeps, time adjustments, and leap * seconds. A robust method should only rely on the current time * tc(i) to identify t(i). The derivation above shows 2 options: * * 1. n={60,3600} and round to a multiple of d, * but if d0) { long tcur; int trem; tcur=tm->tm_sec+60*(tm->tm_min+60*(tm->tm_hour+24*tm->tm_yday)); /* ti=floor(tcur/u)*u, w=u-(tcur-ti), and tcur-ti==tcur % u */ trem=tcur % update; twait=update-trem; } else { twait=-update; } if(tv->tv_usec>0) { long usec; twait--; usec=1000000-tv->tv_usec; twaitms=(usec+999)/1000; /* must round up to avoid zero retval */ } else { twaitms=0; } retval=(unsigned long)labs(twaitms+1000*twait); return retval; } /* ARGSUSED */ static void clock_tic(XtPointer client_data, XtIntervalId *id) { ClockWidget w = (ClockWidget)client_data; struct tm tm; Time_t time_value; struct timeval tv; char *time_ptr; register Display *dpy = XtDisplay(w); register Window win = XtWindow(w); X_GETTIMEOFDAY (&tv); time_value = tv.tv_sec; tm = *localtime(&time_value); if (w->clock.update && (id || !w->clock.interval_id)) w->clock.interval_id = XtAppAddTimeOut( XtWidgetToApplicationContext( (Widget) w), waittime(w->clock.update, &tv, &tm), clock_tic, (XtPointer)w ); /* * Beep on the half hour; double-beep on the hour. */ if (w->clock.chime == TRUE) { if (w->clock.beeped && (tm.tm_min != 30) && (tm.tm_min != 0)) w->clock.beeped = FALSE; if (((tm.tm_min == 30) || (tm.tm_min == 0)) && (!w->clock.beeped)) { w->clock.beeped = TRUE; #ifdef XKB if (tm.tm_min==0) { XkbStdBell(dpy,win,50,XkbBI_ClockChimeHour); XkbStdBell(dpy,win,50,XkbBI_RepeatingLastBell); } else { XkbStdBell(dpy,win,50,XkbBI_ClockChimeHalf); } #else XBell(dpy, 50); if (tm.tm_min == 0) XBell(dpy, 50); #endif } } if( w->clock.analog == FALSE ) { int clear_from = w->core.width; int i, len, prev_len; time_ptr = TimeString (w, &tm); len = strlen (time_ptr); if (len && time_ptr[len - 1] == '\n') time_ptr[--len] = '\0'; prev_len = strlen (w->clock.prev_time_string); for (i = 0; ((i < len) && (i < prev_len) && (w->clock.prev_time_string[i] == time_ptr[i])); i++); #ifdef XRENDER if (w->clock.render) { XRectangle old_tail, new_tail, head; int x, y; #if !defined(NO_I18N) && defined(HAVE_ICONV) char *utf8_str; #endif RenderTextBounds (w, w->clock.prev_time_string, i, prev_len, &old_tail, NULL, NULL); RenderUpdateRectBounds (&old_tail, &w->clock.damage); RenderTextBounds (w, time_ptr, i, len, &new_tail, NULL, NULL); RenderUpdateRectBounds (&new_tail, &w->clock.damage); while (i) { RenderTextBounds (w, time_ptr, 0, i, &head, NULL, NULL); if (!RenderRectIn (&head, &w->clock.damage)) break; i--; } RenderTextBounds (w, time_ptr, i, len, &new_tail, &x, &y); RenderClip (w); RenderPrepare (w, NULL); #ifndef NO_I18N if (w->clock.utf8) { XftDrawStringUtf8 (w->clock.draw, &w->clock.fg_color, w->clock.face, x, y, (FcChar8 *) time_ptr + i, len - i); } # ifdef HAVE_ICONV else if ((utf8_str = clock_to_utf8(time_ptr + i, len - i)) != NULL) { XftDrawStringUtf8 (w->clock.draw, &w->clock.fg_color, w->clock.face, x, y, (FcChar8 *)utf8_str, strlen(utf8_str) ); free(utf8_str); } # endif else #endif { XftDrawString8 (w->clock.draw, &w->clock.fg_color, w->clock.face, x, y, (FcChar8 *) time_ptr + i, len - i); } RenderUpdate (w); RenderResetBounds (&w->clock.damage); } else #endif #ifndef NO_I18N if(!no_locale) { if(0 < len) { XFontSetExtents *fse = XExtentsOfFontSet(w->clock.fontSet); XmbDrawImageString(dpy,win,w->clock.fontSet,w->clock.myGC, (2+w->clock.padding + (i?XmbTextEscapement(w->clock.fontSet, time_ptr,i):0)), 2+w->clock.padding+fse->max_logical_extent.height, time_ptr+i,len-i ); /* * Clear any left over bits */ clear_from = XmbTextEscapement (w->clock.fontSet,time_ptr, len) + 2+w->clock.padding; } } else #endif /* NO_I18N */ { XDrawImageString (dpy, win, w->clock.myGC, (1+w->clock.padding + XTextWidth (w->clock.font, time_ptr, i)), w->clock.font->ascent+w->clock.padding, time_ptr + i, len - i); /* * Clear any left over bits */ clear_from = XTextWidth (w->clock.font, time_ptr, len) + 2 + w->clock.padding; } if (clear_from < (int)w->core.width) XClearArea (dpy, win, clear_from, 0, w->core.width - clear_from, w->core.height, False); #ifdef HAVE_STRLCPY strlcpy (w->clock.prev_time_string+i, time_ptr+i, sizeof(w->clock.prev_time_string)-i); #else strncpy (w->clock.prev_time_string+i, time_ptr+i, sizeof(w->clock.prev_time_string)-i); w->clock.prev_time_string[sizeof(w->clock.prev_time_string)-1] = 0; #endif } else { /* * The second (or minute) hand is sec (or min) * sixtieths around the clock face. The hour hand is * (hour + min/60) twelfths of the way around the * clock-face. The derivation is left as an excercise * for the reader. */ /* * 12 hour clock. */ if(tm.tm_hour >= 12) tm.tm_hour -= 12; #ifdef XRENDER if (w->clock.render && w->clock.can_polygon) { w->clock.mask_format = XRenderFindStandardFormat (XtDisplay (w), w->clock.sharp ? PictStandardA1 : PictStandardA8); /* * Compute repaint area */ if (tm.tm_min != w->clock.otm.tm_min || tm.tm_hour != w->clock.otm.tm_hour || tm.tm_sec != w->clock.otm.tm_sec) { RenderHands (w, &w->clock.otm, False); RenderHands (w, &tm, False); } if (w->clock.show_second_hand && tm.tm_sec != w->clock.otm.tm_sec) { RenderSec (w, &w->clock.otm, False); RenderSec (w, &tm, False); } if (w->clock.damage.width && w->clock.damage.height) { RenderClip (w); DrawClockFace (w); RenderHands (w, &tm, True); if (w->clock.show_second_hand == TRUE) RenderSec (w, &tm, True); } w->clock.otm = tm; RenderUpdate (w); RenderResetBounds (&w->clock.damage); return; } #endif erase_hands (w, &tm); if (w->clock.numseg == 0 || tm.tm_min != w->clock.otm.tm_min || tm.tm_hour != w->clock.otm.tm_hour) { w->clock.segbuffptr = w->clock.segbuff; w->clock.numseg = 0; /* * Calculate the hour hand, fill it in with its * color and then outline it. Next, do the same * with the minute hand. This is a cheap hidden * line algorithm. */ DrawHand(w, w->clock.minute_hand_length, w->clock.hand_width, tm.tm_min * 60 ); if(w->clock.Hdpixel != w->core.background_pixel) XFillPolygon( dpy, win, w->clock.HandGC, w->clock.segbuff, VERTICES_IN_HANDS, Convex, CoordModeOrigin ); XDrawLines( dpy, win, w->clock.HighGC, w->clock.segbuff, VERTICES_IN_HANDS, CoordModeOrigin); w->clock.hour = w->clock.segbuffptr; DrawHand(w, w->clock.hour_hand_length, w->clock.hand_width, tm.tm_hour * 300 + tm.tm_min * 5 ); if(w->clock.Hdpixel != w->core.background_pixel) { XFillPolygon(dpy, win, w->clock.HandGC, w->clock.hour, VERTICES_IN_HANDS, Convex, CoordModeOrigin ); } XDrawLines( dpy, win, w->clock.HighGC, w->clock.hour, VERTICES_IN_HANDS, CoordModeOrigin ); w->clock.sec = w->clock.segbuffptr; } if (w->clock.show_second_hand == TRUE) { w->clock.segbuffptr = w->clock.sec; DrawSecond(w, w->clock.second_hand_length - 2, w->clock.second_hand_width, w->clock.minute_hand_length + 2, tm.tm_sec * 60 ); if(w->clock.Hdpixel != w->core.background_pixel) XFillPolygon( dpy, win, w->clock.HandGC, w->clock.sec, VERTICES_IN_HANDS -2, Convex, CoordModeOrigin ); XDrawLines( dpy, win, w->clock.HighGC, w->clock.sec, VERTICES_IN_HANDS-1, CoordModeOrigin ); } w->clock.otm = tm; } } static void erase_hands(ClockWidget w, struct tm *tm) { /* * Erase old hands. */ if(w->clock.numseg > 0) { Display *dpy; Window win; dpy = XtDisplay (w); win = XtWindow (w); if (w->clock.show_second_hand == TRUE) { XDrawLines(dpy, win, w->clock.EraseGC, w->clock.sec, VERTICES_IN_HANDS-1, CoordModeOrigin); if(w->clock.Hdpixel != w->core.background_pixel) { XFillPolygon(dpy, win, w->clock.EraseGC, w->clock.sec, VERTICES_IN_HANDS-2, Convex, CoordModeOrigin ); } } if(!tm || tm->tm_min != w->clock.otm.tm_min || tm->tm_hour != w->clock.otm.tm_hour) { XDrawLines( dpy, win, w->clock.EraseGC, w->clock.segbuff, VERTICES_IN_HANDS, CoordModeOrigin); XDrawLines( dpy, win, w->clock.EraseGC, w->clock.hour, VERTICES_IN_HANDS, CoordModeOrigin); if(w->clock.Hdpixel != w->core.background_pixel) { XFillPolygon( dpy, win, w->clock.EraseGC, w->clock.segbuff, VERTICES_IN_HANDS, Convex, CoordModeOrigin); XFillPolygon( dpy, win, w->clock.EraseGC, w->clock.hour, VERTICES_IN_HANDS, Convex, CoordModeOrigin); } } } } static double const Sines[] = { 0.000000, 0.001745, 0.003490, 0.005235, 0.006981, 0.008726, 0.010471, 0.012217, 0.013962, 0.015707, 0.017452, 0.019197, 0.020942, 0.022687, 0.024432, 0.026176, 0.027921, 0.029666, 0.031410, 0.033155, 0.034899, 0.036643, 0.038387, 0.040131, 0.041875, 0.043619, 0.045362, 0.047106, 0.048849, 0.050592, 0.052335, 0.054078, 0.055821, 0.057564, 0.059306, 0.061048, 0.062790, 0.064532, 0.066273, 0.068015, 0.069756, 0.071497, 0.073238, 0.074978, 0.076719, 0.078459, 0.080198, 0.081938, 0.083677, 0.085416, 0.087155, 0.088894, 0.090632, 0.092370, 0.094108, 0.095845, 0.097582, 0.099319, 0.101056, 0.102792, 0.104528, 0.106264, 0.107999, 0.109734, 0.111468, 0.113203, 0.114937, 0.116670, 0.118403, 0.120136, 0.121869, 0.123601, 0.125333, 0.127064, 0.128795, 0.130526, 0.132256, 0.133986, 0.135715, 0.137444, 0.139173, 0.140901, 0.142628, 0.144356, 0.146083, 0.147809, 0.149535, 0.151260, 0.152985, 0.154710, 0.156434, 0.158158, 0.159881, 0.161603, 0.163325, 0.165047, 0.166768, 0.168489, 0.170209, 0.171929, 0.173648, 0.175366, 0.177084, 0.178802, 0.180519, 0.182235, 0.183951, 0.185666, 0.187381, 0.189095, 0.190808, 0.192521, 0.194234, 0.195946, 0.197657, 0.199367, 0.201077, 0.202787, 0.204496, 0.206204, 0.207911, 0.209618, 0.211324, 0.213030, 0.214735, 0.216439, 0.218143, 0.219846, 0.221548, 0.223250, 0.224951, 0.226651, 0.228350, 0.230049, 0.231747, 0.233445, 0.235142, 0.236838, 0.238533, 0.240228, 0.241921, 0.243615, 0.245307, 0.246999, 0.248689, 0.250380, 0.252069, 0.253757, 0.255445, 0.257132, 0.258819, 0.260504, 0.262189, 0.263873, 0.265556, 0.267238, 0.268919, 0.270600, 0.272280, 0.273959, 0.275637, 0.277314, 0.278991, 0.280666, 0.282341, 0.284015, 0.285688, 0.287360, 0.289031, 0.290702, 0.292371, 0.294040, 0.295708, 0.297374, 0.299040, 0.300705, 0.302369, 0.304033, 0.305695, 0.307356, 0.309016, 0.310676, 0.312334, 0.313992, 0.315649, 0.317304, 0.318959, 0.320612, 0.322265, 0.323917, 0.325568, 0.327217, 0.328866, 0.330514, 0.332161, 0.333806, 0.335451, 0.337095, 0.338737, 0.340379, 0.342020, 0.343659, 0.345298, 0.346935, 0.348572, 0.350207, 0.351841, 0.353474, 0.355106, 0.356737, 0.358367, 0.359996, 0.361624, 0.363251, 0.364876, 0.366501, 0.368124, 0.369746, 0.371367, 0.372987, 0.374606, 0.376224, 0.377840, 0.379456, 0.381070, 0.382683, 0.384295, 0.385906, 0.387515, 0.389123, 0.390731, 0.392337, 0.393941, 0.395545, 0.397147, 0.398749, 0.400349, 0.401947, 0.403545, 0.405141, 0.406736, 0.408330, 0.409923, 0.411514, 0.413104, 0.414693, 0.416280, 0.417867, 0.419452, 0.421035, 0.422618, 0.424199, 0.425779, 0.427357, 0.428935, 0.430511, 0.432085, 0.433659, 0.435231, 0.436801, 0.438371, 0.439939, 0.441505, 0.443071, 0.444635, 0.446197, 0.447759, 0.449318, 0.450877, 0.452434, 0.453990, 0.455544, 0.457097, 0.458649, 0.460199, 0.461748, 0.463296, 0.464842, 0.466386, 0.467929, 0.469471, 0.471011, 0.472550, 0.474088, 0.475624, 0.477158, 0.478691, 0.480223, 0.481753, 0.483282, 0.484809, 0.486335, 0.487859, 0.489382, 0.490903, 0.492423, 0.493941, 0.495458, 0.496973, 0.498487, 0.499999, 0.501510, 0.503019, 0.504527, 0.506033, 0.507538, 0.509041, 0.510542, 0.512042, 0.513541, 0.515038, 0.516533, 0.518027, 0.519519, 0.521009, 0.522498, 0.523985, 0.525471, 0.526955, 0.528438, 0.529919, 0.531398, 0.532876, 0.534352, 0.535826, 0.537299, 0.538770, 0.540240, 0.541708, 0.543174, 0.544639, 0.546101, 0.547563, 0.549022, 0.550480, 0.551936, 0.553391, 0.554844, 0.556295, 0.557745, 0.559192, 0.560638, 0.562083, 0.563526, 0.564967, 0.566406, 0.567843, 0.569279, 0.570713, 0.572145, 0.573576, 0.575005, 0.576432, 0.577857, 0.579281, 0.580702, 0.582122, 0.583541, 0.584957, 0.586372, 0.587785, 0.589196, 0.590605, 0.592013, 0.593418, 0.594822, 0.596224, 0.597625, 0.599023, 0.600420, 0.601815, 0.603207, 0.604599, 0.605988, 0.607375, 0.608761, 0.610145, 0.611527, 0.612907, 0.614285, 0.615661, 0.617035, 0.618408, 0.619779, 0.621147, 0.622514, 0.623879, 0.625242, 0.626603, 0.627963, 0.629320, 0.630675, 0.632029, 0.633380, 0.634730, 0.636078, 0.637423, 0.638767, 0.640109, 0.641449, 0.642787, 0.644123, 0.645457, 0.646789, 0.648119, 0.649448, 0.650774, 0.652098, 0.653420, 0.654740, 0.656059, 0.657375, 0.658689, 0.660001, 0.661311, 0.662620, 0.663926, 0.665230, 0.666532, 0.667832, 0.669130, 0.670426, 0.671720, 0.673012, 0.674302, 0.675590, 0.676875, 0.678159, 0.679441, 0.680720, 0.681998, 0.683273, 0.684547, 0.685818, 0.687087, 0.688354, 0.689619, 0.690882, 0.692143, 0.693401, 0.694658, 0.695912, 0.697165, 0.698415, 0.699663, 0.700909, 0.702153, 0.703394, 0.704634, 0.705871, 0.707106, }; static double const Cosines[] = { 1.000000, 0.999998, 0.999993, 0.999986, 0.999975, 0.999961, 0.999945, 0.999925, 0.999902, 0.999876, 0.999847, 0.999815, 0.999780, 0.999742, 0.999701, 0.999657, 0.999610, 0.999559, 0.999506, 0.999450, 0.999390, 0.999328, 0.999262, 0.999194, 0.999122, 0.999048, 0.998970, 0.998889, 0.998806, 0.998719, 0.998629, 0.998536, 0.998440, 0.998341, 0.998239, 0.998134, 0.998026, 0.997915, 0.997801, 0.997684, 0.997564, 0.997440, 0.997314, 0.997185, 0.997052, 0.996917, 0.996778, 0.996637, 0.996492, 0.996345, 0.996194, 0.996041, 0.995884, 0.995724, 0.995561, 0.995396, 0.995227, 0.995055, 0.994880, 0.994702, 0.994521, 0.994337, 0.994150, 0.993960, 0.993767, 0.993571, 0.993372, 0.993170, 0.992965, 0.992757, 0.992546, 0.992331, 0.992114, 0.991894, 0.991671, 0.991444, 0.991215, 0.990983, 0.990747, 0.990509, 0.990268, 0.990023, 0.989776, 0.989525, 0.989272, 0.989015, 0.988756, 0.988493, 0.988228, 0.987959, 0.987688, 0.987413, 0.987136, 0.986855, 0.986572, 0.986285, 0.985996, 0.985703, 0.985407, 0.985109, 0.984807, 0.984503, 0.984195, 0.983885, 0.983571, 0.983254, 0.982935, 0.982612, 0.982287, 0.981958, 0.981627, 0.981292, 0.980955, 0.980614, 0.980271, 0.979924, 0.979575, 0.979222, 0.978867, 0.978508, 0.978147, 0.977783, 0.977415, 0.977045, 0.976672, 0.976296, 0.975916, 0.975534, 0.975149, 0.974761, 0.974370, 0.973975, 0.973578, 0.973178, 0.972775, 0.972369, 0.971961, 0.971549, 0.971134, 0.970716, 0.970295, 0.969872, 0.969445, 0.969015, 0.968583, 0.968147, 0.967709, 0.967267, 0.966823, 0.966376, 0.965925, 0.965472, 0.965016, 0.964557, 0.964095, 0.963630, 0.963162, 0.962691, 0.962217, 0.961741, 0.961261, 0.960779, 0.960293, 0.959805, 0.959313, 0.958819, 0.958322, 0.957822, 0.957319, 0.956813, 0.956304, 0.955793, 0.955278, 0.954760, 0.954240, 0.953716, 0.953190, 0.952661, 0.952129, 0.951594, 0.951056, 0.950515, 0.949972, 0.949425, 0.948876, 0.948323, 0.947768, 0.947210, 0.946649, 0.946085, 0.945518, 0.944948, 0.944376, 0.943800, 0.943222, 0.942641, 0.942057, 0.941470, 0.940880, 0.940288, 0.939692, 0.939094, 0.938493, 0.937888, 0.937281, 0.936672, 0.936059, 0.935444, 0.934825, 0.934204, 0.933580, 0.932953, 0.932323, 0.931691, 0.931055, 0.930417, 0.929776, 0.929132, 0.928485, 0.927836, 0.927183, 0.926528, 0.925870, 0.925209, 0.924546, 0.923879, 0.923210, 0.922538, 0.921863, 0.921185, 0.920504, 0.919821, 0.919135, 0.918446, 0.917754, 0.917060, 0.916362, 0.915662, 0.914959, 0.914253, 0.913545, 0.912834, 0.912120, 0.911403, 0.910683, 0.909961, 0.909236, 0.908508, 0.907777, 0.907044, 0.906307, 0.905568, 0.904827, 0.904082, 0.903335, 0.902585, 0.901832, 0.901077, 0.900318, 0.899557, 0.898794, 0.898027, 0.897258, 0.896486, 0.895711, 0.894934, 0.894154, 0.893371, 0.892585, 0.891797, 0.891006, 0.890212, 0.889416, 0.888617, 0.887815, 0.887010, 0.886203, 0.885393, 0.884580, 0.883765, 0.882947, 0.882126, 0.881303, 0.880477, 0.879648, 0.878817, 0.877982, 0.877146, 0.876306, 0.875464, 0.874619, 0.873772, 0.872922, 0.872069, 0.871213, 0.870355, 0.869494, 0.868631, 0.867765, 0.866896, 0.866025, 0.865151, 0.864274, 0.863395, 0.862513, 0.861629, 0.860742, 0.859852, 0.858959, 0.858064, 0.857167, 0.856267, 0.855364, 0.854458, 0.853550, 0.852640, 0.851726, 0.850811, 0.849892, 0.848971, 0.848048, 0.847121, 0.846193, 0.845261, 0.844327, 0.843391, 0.842452, 0.841510, 0.840566, 0.839619, 0.838670, 0.837718, 0.836764, 0.835807, 0.834847, 0.833885, 0.832921, 0.831954, 0.830984, 0.830012, 0.829037, 0.828060, 0.827080, 0.826098, 0.825113, 0.824126, 0.823136, 0.822144, 0.821149, 0.820151, 0.819152, 0.818149, 0.817144, 0.816137, 0.815127, 0.814115, 0.813100, 0.812083, 0.811063, 0.810041, 0.809016, 0.807989, 0.806960, 0.805928, 0.804893, 0.803856, 0.802817, 0.801775, 0.800731, 0.799684, 0.798635, 0.797583, 0.796529, 0.795473, 0.794414, 0.793353, 0.792289, 0.791223, 0.790155, 0.789084, 0.788010, 0.786935, 0.785856, 0.784776, 0.783693, 0.782608, 0.781520, 0.780430, 0.779337, 0.778243, 0.777145, 0.776046, 0.774944, 0.773840, 0.772733, 0.771624, 0.770513, 0.769399, 0.768283, 0.767165, 0.766044, 0.764921, 0.763796, 0.762668, 0.761538, 0.760405, 0.759271, 0.758134, 0.756995, 0.755853, 0.754709, 0.753563, 0.752414, 0.751264, 0.750111, 0.748955, 0.747798, 0.746638, 0.745475, 0.744311, 0.743144, 0.741975, 0.740804, 0.739631, 0.738455, 0.737277, 0.736097, 0.734914, 0.733729, 0.732542, 0.731353, 0.730162, 0.728968, 0.727772, 0.726574, 0.725374, 0.724171, 0.722967, 0.721760, 0.720551, 0.719339, 0.718126, 0.716910, 0.715692, 0.714472, 0.713250, 0.712026, 0.710799, 0.709570, 0.708339, 0.707106, }; static void ClockAngle(int tick_units, double *sinp, double *cosp) { int reduced, upper; reduced = tick_units % 450; upper = tick_units / 450; if (upper & 1) reduced = 450 - reduced; if ((upper + 1) & 2) { *sinp = Cosines[reduced]; *cosp = Sines[reduced]; } else { *sinp = Sines[reduced]; *cosp = Cosines[reduced]; } if (upper >= 2 && upper < 6) *cosp = -*cosp; if (upper >= 4) *sinp = -*sinp; } /* * DrawLine - Draws a line. * * blank_length is the distance from the center which the line begins. * length is the maximum length of the hand. * Tick_units is a number between zero and 12*60 indicating * how far around the circle (clockwise) from high noon. * * The blank_length feature is because I wanted to draw tick-marks around the * circle (for seconds). The obvious means of drawing lines from the center * to the perimeter, then erasing all but the outside most pixels doesn't * work because of round-off error (sigh). */ static void DrawLine(ClockWidget w, Dimension blank_length, Dimension length, int tick_units) { double dblank_length = (double)blank_length, dlength = (double)length; double cosangle, sinangle; int cx = w->clock.centerX, cy = w->clock.centerY, x1, y1, x2, y2; /* * Angles are measured from 12 o'clock, clockwise increasing. * Since in X, +x is to the right and +y is downward: * * x = x0 + r * sin(theta) * y = y0 - r * cos(theta) * */ ClockAngle(tick_units, &sinangle, &cosangle); /* break this out so that stupid compilers can cope */ x1 = cx + (int)(dblank_length * sinangle); y1 = cy - (int)(dblank_length * cosangle); x2 = cx + (int)(dlength * sinangle); y2 = cy - (int)(dlength * cosangle); SetSeg(w, x1, y1, x2, y2); } /* * DrawHand - Draws a hand. * * length is the maximum length of the hand. * width is the half-width of the hand. * Tick_units is a number between zero and 12*60 indicating * how far around the circle (clockwise) from high noon. * */ static void DrawHand(ClockWidget w, Dimension length, Dimension width, int tick_units) { double cosangle, sinangle; register double ws, wc; Position x, y, x1, y1, x2, y2; /* * Angles are measured from 12 o'clock, clockwise increasing. * Since in X, +x is to the right and +y is downward: * * x = x0 + r * sin(theta) * y = y0 - r * cos(theta) * */ ClockAngle(tick_units, &sinangle, &cosangle); /* * Order of points when drawing the hand. * * 1,4 * / \ * / \ * / \ * 2 ------- 3 */ wc = width * cosangle; ws = width * sinangle; SetSeg(w, x = w->clock.centerX + clock_round(length * sinangle), y = w->clock.centerY - clock_round(length * cosangle), x1 = w->clock.centerX - clock_round(ws + wc), y1 = w->clock.centerY + clock_round(wc - ws)); /* 1 ---- 2 */ /* 2 */ SetSeg(w, x1, y1, x2 = w->clock.centerX - clock_round(ws - wc), y2 = w->clock.centerY + clock_round(wc + ws)); /* 2 ----- 3 */ SetSeg(w, x2, y2, x, y); /* 3 ----- 1(4) */ } /* * DrawSecond - Draws the second hand (diamond). * * length is the maximum length of the hand. * width is the half-width of the hand. * offset is direct distance from center to tail end. * Tick_units is a number between zero and 12*60 indicating * how far around the circle (clockwise) from high noon. * */ static void DrawSecond(ClockWidget w, Dimension length, Dimension width, Dimension offset, int tick_units) { double cosangle, sinangle; register double ms, mc, ws, wc; register int mid; Position x, y; /* * Angles are measured from 12 o'clock, clockwise increasing. * Since in X, +x is to the right and +y is downward: * * x = x0 + r * sin(theta) * y = y0 - r * cos(theta) * */ ClockAngle(tick_units, &sinangle, &cosangle); /* * Order of points when drawing the hand. * * 1,5 * / \ * / \ * / \ * 2< >4 * \ / * \ / * \ / * - 3 * | * | * offset * | * | * - + center */ mid = (int) (length + offset) / 2; mc = mid * cosangle; ms = mid * sinangle; wc = width * cosangle; ws = width * sinangle; /*1 ---- 2 */ SetSeg(w, x = w->clock.centerX + clock_round(length * sinangle), y = w->clock.centerY - clock_round(length * cosangle), w->clock.centerX + clock_round(ms - wc), w->clock.centerY - clock_round(mc + ws) ); SetSeg(w, w->clock.centerX + clock_round(offset *sinangle), w->clock.centerY - clock_round(offset * cosangle), /* 2-----3 */ w->clock.centerX + clock_round(ms + wc), w->clock.centerY - clock_round(mc - ws)); w->clock.segbuffptr->x = x; w->clock.segbuffptr++->y = y; w->clock.numseg ++; } static void SetSeg(ClockWidget w, int x1, int y1, int x2, int y2) { w->clock.segbuffptr->x = x1; w->clock.segbuffptr++->y = y1; w->clock.segbuffptr->x = x2; w->clock.segbuffptr++->y = y2; w->clock.numseg += 2; } /* * Draw the clock face (every fifth tick-mark is longer * than the others). */ static void DrawClockFace(ClockWidget w) { register int i; register int delta = (int)(w->clock.radius - w->clock.second_hand_length) / 3; w->clock.segbuffptr = w->clock.segbuff; w->clock.numseg = 0; for (i = 0; i < 60; i++) { #ifdef XRENDER if (w->clock.render && w->clock.can_polygon) { double s, c; XDouble x1, y1, x2, y2; XftColor *color; ClockAngle (i * 60, &s, &c); x1 = c; y1 = s; if (i % 5) { x2 = c * (MINOR_TICK_FRACT / 100.0); y2 = s * (MINOR_TICK_FRACT / 100.0); color = &w->clock.minor_color; } else { x2 = c * (SECOND_HAND_FRACT / 100.0); y2 = s * (SECOND_HAND_FRACT / 100.0); color = &w->clock.major_color; } RenderLine (w, x1, y1, x2, y2, color, True); } else #endif { DrawLine(w, ( (i % 5) == 0 ? w->clock.second_hand_length : (w->clock.radius - delta) ), w->clock.radius, i * 60); } } #ifdef XRENDER if (w->clock.render && w->clock.can_polygon) return; #endif /* * Go ahead and draw it. */ XDrawSegments(XtDisplay(w), XtWindow(w), w->clock.myGC, (XSegment *) &(w->clock.segbuff[0]), w->clock.numseg/2); w->clock.segbuffptr = w->clock.segbuff; w->clock.numseg = 0; } static int clock_round(double x) { return(x >= 0.0 ? (int)(x + .5) : (int)(x - .5)); } #ifdef XRENDER static Boolean sameColor (XftColor *old, XftColor *new) { if (old->color.red != new->color.red) return False; if (old->color.green != new->color.green) return False; if (old->color.blue != new->color.blue) return False; if (old->color.alpha != new->color.alpha) return False; return True; } #endif /* ARGSUSED */ static Boolean SetValues(Widget gcurrent, Widget grequest, Widget gnew, ArgList args, Cardinal *num_args) { ClockWidget current = (ClockWidget) gcurrent; ClockWidget new = (ClockWidget) gnew; Boolean redisplay = FALSE; XtGCMask valuemask; XGCValues myXGCV; /* first check for changes to clock-specific resources. We'll accept all the changes, but may need to do some computations first. */ if (new->clock.update != current->clock.update) { if (current->clock.interval_id) XtRemoveTimeOut (current->clock.interval_id); if (new->clock.update && XtIsRealized( (Widget) new)) new->clock.interval_id = XtAppAddTimeOut( XtWidgetToApplicationContext(gnew), abs(new->clock.update)*1000, clock_tic, (XtPointer)gnew); new->clock.show_second_hand =(abs(new->clock.update) <= SECOND_HAND_TIME); if (new->clock.show_second_hand != current->clock.show_second_hand) redisplay = TRUE; } if (new->clock.padding != current->clock.padding) redisplay = TRUE; if (new->clock.analog != current->clock.analog) redisplay = TRUE; if (new->clock.font != current->clock.font) redisplay = TRUE; #ifndef NO_I18N if (new->clock.fontSet != current->clock.fontSet) redisplay = TRUE; #endif if ((ClockFgPixel(new) != ClockFgPixel (current)) || (new->core.background_pixel != current->core.background_pixel)) { valuemask = GCForeground | GCBackground | GCFont | GCLineWidth; myXGCV.foreground = ClockFgPixel (new); myXGCV.background = new->core.background_pixel; myXGCV.font = new->clock.font->fid; myXGCV.line_width = 0; XtReleaseGC (gcurrent, current->clock.myGC); new->clock.myGC = XtGetGC(gcurrent, valuemask, &myXGCV); redisplay = TRUE; } if (new->clock.Hipixel != current->clock.Hipixel) { valuemask = GCForeground | GCLineWidth; myXGCV.foreground = new->clock.Hipixel; myXGCV.font = new->clock.font->fid; myXGCV.line_width = 0; XtReleaseGC (gcurrent, current->clock.HighGC); new->clock.HighGC = XtGetGC((Widget)gcurrent, valuemask, &myXGCV); redisplay = TRUE; } if (new->clock.Hdpixel != current->clock.Hdpixel) { valuemask = GCForeground; myXGCV.foreground = new->clock.Hdpixel; XtReleaseGC (gcurrent, current->clock.HandGC); new->clock.HandGC = XtGetGC((Widget)gcurrent, valuemask, &myXGCV); redisplay = TRUE; } if (new->core.background_pixel != current->core.background_pixel) { valuemask = GCForeground | GCLineWidth | GCGraphicsExposures; myXGCV.foreground = new->core.background_pixel; myXGCV.line_width = 0; myXGCV.graphics_exposures = False; XtReleaseGC (gcurrent, current->clock.EraseGC); new->clock.EraseGC = XtGetGC((Widget)gcurrent, valuemask, &myXGCV); redisplay = TRUE; } #ifdef XRENDER if (new->clock.face != current->clock.face) redisplay = TRUE; if (!sameColor (&new->clock.hour_color, ¤t->clock.fg_color) || !sameColor (&new->clock.hour_color, ¤t->clock.hour_color) || !sameColor (&new->clock.min_color, ¤t->clock.min_color) || !sameColor (&new->clock.sec_color, ¤t->clock.sec_color) || !sameColor (&new->clock.major_color, ¤t->clock.major_color) || !sameColor (&new->clock.minor_color, ¤t->clock.minor_color)) redisplay = True; if (new->clock.sharp != current->clock.sharp) redisplay = True; if (new->clock.render != current->clock.render) redisplay = True; if (new->clock.buffer != current->clock.buffer) { if (new->clock.pixmap) { XFreePixmap (XtDisplay (new), new->clock.pixmap); new->clock.pixmap = 0; } if (new->clock.draw) { XftDrawDestroy (new->clock.draw); new->clock.draw = NULL; } new->clock.picture = 0; } #endif return (redisplay); } #if !defined(NO_I18N) && defined(HAVE_ICONV) static char * clock_to_utf8(const char *str, int in_len) { iconv_t cd; char *buf; size_t buf_size; size_t ileft, oleft; ICONV_CONST char *inptr; char *outptr; size_t ret; const char *code_set = nl_langinfo(CODESET); if (str == NULL ||code_set == NULL || strcasecmp(code_set, "646") == 0) return NULL; if (strcasecmp(code_set, "UTF-8") == 0) return strdup(str); cd = iconv_open("UTF-8", code_set); if (cd == (iconv_t)-1) return NULL; buf_size = MB_LEN_MAX * (in_len + 1); if ((buf = malloc(buf_size)) == NULL) { (void) iconv_close(cd); return NULL; } inptr = str; ileft = in_len; outptr = buf; oleft = buf_size; ret = iconv(cd, &inptr, &ileft, &outptr, &oleft); if (ret == (size_t)(-1) || oleft == 0 ) { free(buf); buf = NULL; } else *outptr = '\0'; (void) iconv_close(cd); return buf; } #endif x11-apps-7.7+5+nmu1ubuntu1/xclock/config.sub0000775000000000000000000010530112167023104015433 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-04-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xclock/clmask.bit0000664000000000000000000000355512213015056015431 0ustar #define clock_mask_width 48 #define clock_mask_height 48 static unsigned char clock_mask_bits[] = { 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x03, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x07, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x01, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x01, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x03, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/xclock/clock.bit0000664000000000000000000000361412213015056015246 0ustar #define clock_width 48 #define clock_height 48 #define clock_x_hot -1 #define clock_y_hot -1 static unsigned char clock_bits[] = { 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x03, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x07, 0x00, 0x00, 0xf8, 0x87, 0xf1, 0x0f, 0x00, 0x00, 0xfc, 0x80, 0x81, 0x1f, 0x00, 0x00, 0x3e, 0x80, 0x01, 0x3e, 0x00, 0x00, 0x9f, 0x01, 0xc0, 0x7c, 0x00, 0x80, 0x8f, 0x01, 0xc0, 0xf8, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xf0, 0x01, 0xe0, 0x03, 0x00, 0x00, 0xe0, 0x03, 0xe0, 0x01, 0x00, 0x00, 0xc0, 0x03, 0xf0, 0x00, 0x00, 0x40, 0x80, 0x07, 0xf0, 0x06, 0x00, 0xe0, 0xb0, 0x07, 0x78, 0x06, 0x00, 0xf0, 0x30, 0x0f, 0x78, 0x00, 0x00, 0x78, 0x00, 0x0f, 0x78, 0x00, 0x00, 0x3c, 0x00, 0x0f, 0x3c, 0x00, 0x00, 0x1e, 0x00, 0x1e, 0x3c, 0x00, 0x00, 0x0f, 0x00, 0x1e, 0x3c, 0x00, 0x80, 0x07, 0x00, 0x1e, 0x3c, 0x00, 0xc0, 0x03, 0x00, 0x7e, 0xfc, 0x01, 0xc0, 0x03, 0xc0, 0x7f, 0xfc, 0x01, 0x80, 0x07, 0xc0, 0x7f, 0x3c, 0x00, 0x00, 0x0f, 0x00, 0x7e, 0x3c, 0x00, 0x00, 0x1e, 0x00, 0x1e, 0x3c, 0x00, 0x00, 0x1c, 0x00, 0x1e, 0x7c, 0x00, 0x00, 0x08, 0x00, 0x0f, 0x78, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x78, 0x06, 0x00, 0x00, 0x30, 0x0f, 0xf0, 0x06, 0x00, 0x00, 0xb0, 0x07, 0xf0, 0x00, 0x00, 0x00, 0x80, 0x07, 0xe0, 0x01, 0x00, 0x00, 0xc0, 0x03, 0xe0, 0x03, 0x00, 0x00, 0xe0, 0x01, 0xc0, 0x07, 0x00, 0x00, 0xf0, 0x01, 0x80, 0x8f, 0x01, 0xc0, 0xf8, 0x00, 0x00, 0x9f, 0x01, 0xc0, 0x7c, 0x00, 0x00, 0x3e, 0x80, 0x01, 0x3e, 0x00, 0x00, 0xfc, 0x80, 0x81, 0x1f, 0x00, 0x00, 0xf8, 0x87, 0xf1, 0x0f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x03, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/xclock/Makefile.am0000664000000000000000000000337612213015056015514 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = xclock AM_CFLAGS = $(CWARNFLAGS) $(XCLOCK_CFLAGS) xclock_LDADD = $(XCLOCK_LIBS) xclock_SOURCES = \ Clock.c \ Clock.h \ ClockP.h \ xclock.c # App default files (*.ad) DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ dist_appdefault_DATA = \ app-defaults/XClock-color \ app-defaults/XClock EXTRA_DIST = \ clmask.bit \ clock.bit CLEANFILES = $(APPDEFAULTFILES) MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xclock/configure.ac0000664000000000000000000000572212213015056015743 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. AC_PREREQ([2.60]) AC_INIT([xclock], [1.0.7], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xclock]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS AC_CONFIG_HEADERS([config.h]) AC_CHECK_FUNCS([strlcpy getpid]) AM_ICONV dnl Required dependencies PKG_CHECK_MODULES(XCLOCK, [xaw7 xmu x11 xproto >= 7.0.17]) XCLOCK_LIBS="$XCLOCK_LIBS $LIBICONV" dnl Optional dependencies AC_ARG_WITH(xft, AS_HELP_STRING([--with-xft],[Use Xft2 and Xrender for rendering (Default is YES)]),use_xft="$withval",use_xft="try") if test x$use_xft != xno ; then PKG_CHECK_MODULES(XFT, [xrender xft]) AC_SEARCH_LIBS(sqrt, [m]) XCLOCK_CFLAGS="$XCLOCK_CFLAGS $XFT_CFLAGS" XCLOCK_LIBS="$XCLOCK_LIBS $XFT_LIBS" AC_DEFINE([XRENDER],1,[Define to use X Render Extension]) AC_DEFINE([XFREE86_FT2],1,[Define to use Xft2 library]) fi AC_ARG_WITH(xkb, AS_HELP_STRING([--with-xkb],[Use XKB to sound bells (Default is YES)]),use_xkb="$withval",use_xkb="try") if test x$use_xkb != xno ; then PKG_CHECK_MODULES(XKB, xkbfile) XCLOCK_CFLAGS="$XCLOCK_CFLAGS $XKB_CFLAGS" XCLOCK_LIBS="$XCLOCK_LIBS $XKB_LIBS" AC_DEFINE([XKB],1,[Define to use XkbStdBell]) fi PKG_CHECK_MODULES(APPDEFS, xt) xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` AC_ARG_WITH(appdefaultdir, AS_HELP_STRING([--with-appdefaultdir=], [specify directory for app-defaults files (default is autodetected)]), [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xclock/README0000664000000000000000000000144312213015056014331 0ustar xclock is the classic X Window System clock utility. It displays the time in analog or digital form, continuously updated at a frequency which may be specified by the user. All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xclock http://cgit.freedesktop.org/xorg/app/xclock For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xclock/COPYING0000664000000000000000000000653612213015056014514 0ustar Copyright 1987, 1988, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ------------------------------------------------------------ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ------------------------------------------------------------ Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. x11-apps-7.7+5+nmu1ubuntu1/xclock/INSTALL0000664000000000000000000002622212213015421014500 0ustar Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 6. Often, you can also type `make uninstall' to remove the installed files again. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *Note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xclock/ClockP.h0000664000000000000000000001224712213015056015001 0ustar /* * $Xorg: ClockP.h,v 1.4 2001/02/09 02:05:39 xorgcvs Exp $ */ /*********************************************************** Copyright 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XFree86: xc/programs/xclock/ClockP.h,v 1.11 2002/10/17 01:00:01 dawes Exp $ */ #ifndef _XawClockP_h #define _XawClockP_h #include /* Needed for struct tm. */ #include "Clock.h" #include #ifdef XRENDER #include #include #endif #define SEG_BUFF_SIZE 128 #ifdef NO_I18N #define ASCII_TIME_BUFLEN 32 /* big enough for 26 plus slop */ #define STRFTIME_BUFF_SIZE 100 /* buffer for "strftime" option */ #else #define STRFTIME_BUFF_SIZE 256 /* should handle any locale */ #endif /* New fields for the clock widget instance record */ typedef struct { #ifndef RENDER Pixel fgpixel; /* color index for text */ #endif Pixel Hipixel; /* color index for Highlighting */ Pixel Hdpixel; /* color index for hands */ XFontStruct *font; /* font for text */ GC myGC; /* pointer to GraphicsContext */ GC EraseGC; /* eraser GC */ GC HandGC; /* Hand GC */ GC HighGC; /* Highlighting GC */ /* start of graph stuff */ int update; /* update period in second */ Dimension radius; /* radius factor */ int backing_store; /* backing store type */ Boolean chime; Boolean beeped; Boolean analog; Boolean brief; Boolean twentyfour; Boolean utime; String strftime; Boolean show_second_hand; Dimension second_hand_length; Dimension minute_hand_length; Dimension hour_hand_length; Dimension hand_width; Dimension second_hand_width; Position centerX; Position centerY; int numseg; int padding; XPoint segbuff[SEG_BUFF_SIZE]; XPoint *segbuffptr; XPoint *hour, *sec; struct tm otm ; XtIntervalId interval_id; char prev_time_string[STRFTIME_BUFF_SIZE]; #ifndef NO_I18N XFontSet fontSet; /* font set for localized text */ Boolean utf8; #endif #ifdef XRENDER XftColor fg_color; XftColor hour_color; XftColor min_color; XftColor sec_color; XftColor major_color; XftColor minor_color; XftFont *face; XRenderPictFormat *mask_format; Boolean render; Boolean sharp; Boolean can_polygon; Boolean buffer; XftDraw *draw; Picture picture; Picture fill_picture; Pixmap pixmap; XRectangle damage; XDouble x_scale; XDouble x_off; XDouble y_scale; XDouble y_off; #endif } ClockPart; #ifdef XRENDER #define ClockFgPixel(c) ((c)->clock.fg_color.pixel) #else #define ClockFgPixel(c) ((c)->clock.fgpixel) #endif /* Full instance record declaration */ typedef struct _ClockRec { CorePart core; SimplePart simple; ClockPart clock; } ClockRec; /* New fields for the Clock widget class record */ typedef struct {int dummy;} ClockClassPart; /* Full class record declaration. */ typedef struct _ClockClassRec { CoreClassPart core_class; SimpleClassPart simple_class; ClockClassPart clock_class; } ClockClassRec; /* Class pointer. */ extern ClockClassRec clockClassRec; #endif /* _XawClockP_h */ x11-apps-7.7+5+nmu1ubuntu1/xclipboard/0000775000000000000000000000000012656635743014341 5ustar x11-apps-7.7+5+nmu1ubuntu1/xclipboard/app-defaults/0000775000000000000000000000000012256610050016702 5ustar x11-apps-7.7+5+nmu1ubuntu1/xclipboard/app-defaults/XClipboard0000664000000000000000000000776612212272254020676 0ustar *Command*Font: -*-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-1 *Label*Font: -*-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-1 *Text*Font: -*-courier-medium-r-normal--*-120-*-*-*-*-iso8859-1 *quit.label: Quit *quit.top: ChainTop *quit.bottom: ChainTop *quit.left: ChainLeft *quit.right: ChainLeft *quit.translations: #override \n\ ,:Quit() unset() *delete.label: Delete *delete.fromHoriz: quit *delete.top: ChainTop *delete.bottom: ChainTop *delete.left: ChainLeft *delete.right: ChainLeft *delete.translations: #override \n\ ,:DeleteClip() unset() *new.label: New *new.fromHoriz: delete *new.top: ChainTop *new.bottom: ChainTop *new.left: ChainLeft *new.right: ChainLeft *new.translations: #override \n\ ,:NewClip() unset() *save.label: Save *save.fromHoriz: new *save.top: ChainTop *save.bottom: ChainTop *save.left: ChainLeft *save.right: ChainLeft *save.translations: #override \n\ ,:Save() unset() *next.label: Next *next.fromHoriz: save *next.top: ChainTop *next.bottom: ChainTop *next.left: ChainLeft *next.right: ChainLeft *next.translations: #override \n\ ,:NextClip() unset() *prev.label: Prev *prev.fromHoriz: next *prev.top: ChainTop *prev.bottom: ChainTop *prev.left: ChainLeft *prev.right: ChainLeft *prev.translations: #override \n\ ,:PrevClip() unset() *index.fromHoriz: prev *index.top: ChainTop *index.bottom: ChainTop *index.left: ChainLeft *index.right: ChainLeft *index.resizable: true *text.scrollVertical: WhenNeeded *text.scrollHorizontal: WhenNeeded *text.autoFill: on *text.fromVert: quit *text.top: ChainTop *text.bottom: ChainBottom *text.left: ChainLeft *text.right: ChainRight *text.resizable: true *text.width: 300 XClipboard.geometry: 300x200 *ShapeStyle: oval XClipboard.baseTranslations: #augment\n\ WM_PROTOCOLS: WMProtocols()\n *TransientShell.baseTranslations: #augment\n\ WM_PROTOCOLS: WMProtocols()\n *fileDialog.label: Save to file: *fileDialog.label.top: ChainTop *fileDialog.label.bottom: ChainTop *fileDialog.label.left: ChainLeft *fileDialog.label.right: ChainLeft *fileDialogShell.allowShellResize: true *fileDialogShell.title: File Save *fileDialog*accept.label: Accept *fileDialog.accept.top: ChainTop *fileDialog.accept.bottom: ChainBottom *fileDialog.accept.left: ChainLeft *fileDialog.accept.right: ChainLeft *fileDialog*accept.translations: #override\ : AcceptSave() unset() *fileDialog.value.top: ChainTop *fileDialog.value.bottom: ChainTop *fileDialog.value.left: ChainLeft *fileDialog.value.right: ChainLeft *fileDialog*value.translations: #override\ Return: AcceptSave() \n\ CtrlS: no-op(ring-bell) \n\ CtrlR: no-op(ring-bell) \n\ CtrlM: no-op(ring-bell) \n\ CtrlJ: no-op(ring-bell) \n\ MetaI: no-op(ring-bell) *fileDialog*value.baseTranslations: #override\ Return: AcceptSave() \n\ CtrlS: no-op(ring-bell) \n\ CtrlR: no-op(ring-bell) \n\ CtrlM: no-op(ring-bell) \n\ CtrlJ: no-op(ring-bell) \n\ MetaI: no-op(ring-bell) *fileDialog*cancel.label: Cancel *fileDialog.cancel.top: ChainTop *fileDialog.cancel.bottom: ChainBottom *fileDialog.cancel.left: ChainLeft *fileDialog.cancel.right: ChainLeft *fileDialog*cancel.translations: #override\ :CancelSave() unset() *failDialog*Label.resizable: true *failDialog.label: Can't write file *failDialogShell.title: Error *failDialogShell.allowShellResize: true *failDialog*continue.label: Continue *failDialog*continue.translations: #override\ :FailContinue() unset() *failDialog*value.translations: #override\ Return: FailContinue() \n\ CtrlS: no-op(ring-bell) \n\ CtrlR: no-op(ring-bell) \n\ CtrlM: no-op(ring-bell) \n\ CtrlJ: no-op(ring-bell) \n\ MetaI: no-op(ring-bell) x11-apps-7.7+5+nmu1ubuntu1/xclipboard/ChangeLog0000664000000000000000000005145112212272272016077 0ustar commit 8cf6dfbbdb10f1ab41deb3d0e87cd0dfb79e3273 Author: Alan Coopersmith Date: Thu Sep 5 23:22:16 2013 -0700 xclipboard 1.1.3 Signed-off-by: Alan Coopersmith commit 25b41a35484ba4db23627e57d105b7156c19816f Author: Alan Coopersmith Date: Thu Jul 18 20:25:53 2013 -0700 Fix some size/sign conversion warnings from clang xclipboard.c:108:27: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] clip->clip = malloc (len + 1); ~~~~~~ ~~~~^~~ xclipboard.c:103:11: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32] len = strlen (data); ~ ^~~~~~~~~~~~~ xclipboard.c:331:15: warning: implicit conversion loses integer precision: 'int' to 'Boolean' (aka 'char') [-Wconversion] success = XawAsciiSaveAsFile (XawTextGetSource (text), filename); ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Alan Coopersmith commit de3301ff61c1f7c5d14265ae9bab9917244568ad Author: Alan Coopersmith Date: Fri May 17 22:01:41 2013 -0700 delete trailing whitespace from source files Signed-off-by: Alan Coopersmith commit dc686289695aa3cef2b0b17d14fae68ac54643de Author: Alan Coopersmith Date: Fri May 17 21:59:47 2013 -0700 Replace malloc(strlen)+strcpy with strdup Signed-off-by: Alan Coopersmith commit f393be55ace1de85445cb1f24fdf235d6644874a Author: Alan Coopersmith Date: Fri May 17 21:56:36 2013 -0700 Convert last sprintf to snprintf Signed-off-by: Alan Coopersmith commit a9f3465dc1d5fcd0c79d5b12bc09fe48e62d7823 Author: Alan Coopersmith Date: Fri May 17 21:47:39 2013 -0700 Rename state argument to SetButton to not shadow global state variable xcutsel.c:196: warning: declaration of 'state' shadows a global declaration xcutsel.c:84: warning: shadowed declaration is here Signed-off-by: Alan Coopersmith commit a5ae058401d073d1af80214133fbe7f9a9cecbdb Author: Alan Coopersmith Date: Fri May 17 21:21:31 2013 -0700 Mark Quit functions as _X_NORETURN, as suggested by -Wmissing-noreturn Signed-off-by: Alan Coopersmith commit f71a9580e229a6e04c89cf901c98aead5b6dd3cd Author: Eric S. Raymond Date: Thu Aug 23 06:16:48 2012 -0400 Don't rely on being able to set tab stops. Signed-off-by: Eric S. Raymond commit a614c2be68ce6cb176901fb14bbd1802d39a5a69 Author: Alan Coopersmith Date: Fri Feb 10 21:37:33 2012 -0800 xclipboard 1.1.2 Signed-off-by: Alan Coopersmith commit 4f1a5dbc00d577cdbd37a824c396b030cb170d65 Author: Kees Cook Date: Sat Jul 9 07:40:23 2011 -0700 xclipboard: avoid overflow crash when building labels This replaces sprintf with XtAsprintf to avoid crashing when creating various potentially large labels. https://bugs.launchpad.net/ubuntu/+source/x11-apps/+bug/792642 Signed-off-by: Kees Cook Reviewed-by: James Cloos [jcristau: added xt >= 1.1 dependency per Alan Coopersmith] Signed-off-by: Julien Cristau commit 35e2f74fbcf172813b7016e58585bb30b39a3de6 Author: Stanislav Maslovski Date: Sun Apr 3 20:10:54 2011 +1000 Change resource to better position Accept/Cancel. #17364 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=17364 The Accept and Cancel buttons on the Save dialog where just visible at the bottom of the dialog. Even if you resized the dialog, the buttons where never fully visible. Signed-off-by: Alistair Leslie-Hughes Acked-by: Dan Nicholson commit 81129a226ae24600642249847cdcc980ec5f9d18 Author: Gaetan Nadon Date: Wed Jan 19 10:06:55 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 936aa5b9bbbe3a2bf08f928fa5f186d2b75e0a71 Author: Gaetan Nadon Date: Thu Jan 13 17:15:36 2011 -0500 man: replace hard coded man page section with substitution strings Signed-off-by: Gaetan Nadon commit 201eb36b403a4408aaac4be8cecd4e5eca38f5e0 Author: Gaetan Nadon Date: Thu Jan 13 11:15:47 2011 -0500 man: remove trailing spaces and tabs Using s/[ \t]*$// Signed-off-by: Gaetan Nadon commit 5b8a938a22059638c33061e47f0028ebc5f53a01 Author: Gaetan Nadon Date: Wed Jan 12 15:29:50 2011 -0500 config: replace deprecated AC_HELP_STRING with AS_HELP_STRING This silences an Automake warning. Signed-off-by: Gaetan Nadon commit 4c5ba0adecd411786b11bd34122cd498ba980c01 Author: Alan Coopersmith Date: Mon Nov 8 22:53:01 2010 -0800 xclipboard 1.1.1 Signed-off-by: Alan Coopersmith commit de80ed3de8490eabcba3618f10c18b2d646e1669 Author: Alan Coopersmith Date: Sun Nov 7 23:55:47 2010 -0800 include "config.h" in *.c files for autoconf definitions Actually enables the #ifdef XKB code that commit f16c6dd23a attempted to enable Signed-off-by: Alan Coopersmith commit 254b55b9a7ec350c3b2f857217ef93ffced3b91d Author: Alan Coopersmith Date: Sun Nov 7 23:50:49 2010 -0800 Purge CVS version tags Signed-off-by: Alan Coopersmith commit 0272c10c35be588a76c27253ba1c94750b89cf61 Author: Alan Coopersmith Date: Sun Nov 7 23:47:47 2010 -0800 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS Regroup AC statements under the Autoconf initialization section. Regroup AM sttaements under the Automake initialization section. Add missing AC_CONFIG_SRCDIR Signed-off-by: Alan Coopersmith commit 163f783b9bef4348d8488b6b927c67406c8a40b6 Author: Alan Coopersmith Date: Sun Nov 7 23:46:00 2010 -0800 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now PKG_CONFIG_MODULES handles AC_SUBST of the CFLAGS & LIBS variables Signed-off-by: Alan Coopersmith commit d043044ab9949b6e15479ede69023f78f00081ee Author: Alan Coopersmith Date: Sun Nov 7 23:45:13 2010 -0800 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS Enables use of platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit 4aa31642993ed592a22214791e06516d3316b226 Author: Gaetan Nadon Date: Sun Nov 7 23:43:21 2010 -0800 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon Signed-off-by: Alan Coopersmith commit 2fa9cd45301c6f56a89845776fb88b5d9922d811 Author: Alan Coopersmith Date: Fri Aug 6 08:37:48 2010 -0700 Fill in COPYING file with copyright notices from source code Signed-off-by: Alan Coopersmith commit 5802b699a985522f2b1e4580b9a6b194b129b62e Author: Gaetan Nadon Date: Sat Dec 19 20:48:47 2009 -0500 configure.ac: use backticks rather than $() for cmd subs Use "$PKG_CONFIG" rather than hard coded "pkg-config" Signed-off-by: Gaetan Nadon commit 7c961835a6ae4aedfe6d340f24f8855f91d9b87d Author: Gaetan Nadon Date: Thu Nov 26 09:19:53 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit b673f5c871ab3cd6366dacfd001636836618a03b Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit 5210e2aa9a83647bdb2d3407963a0a844c25ea4e Author: Gaetan Nadon Date: Tue Oct 27 15:07:24 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit 6734b4d24af6ca98ab41b824a858be5338c541b6 Author: Gaetan Nadon Date: Mon Oct 26 22:08:38 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit ebb429922a8e5d0108f53ccbb34215f554641326 Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit 96d1fe9241f6b68d52c9b3020dd926319d830558 Author: Alan Coopersmith Date: Wed Oct 14 22:37:17 2009 -0700 xclipboard 1.1.0 Signed-off-by: Alan Coopersmith commit f16c6dd23a132d037e513cd378b2a0e0417ebb8c Author: Alan Coopersmith Date: Tue Oct 13 19:58:31 2009 -0700 Enable #ifdef XKB code to call XkbStdBell() if libxkbfile is found Signed-off-by: Alan Coopersmith commit 42432a7776c0cc94c6ec5360c1ab74f484328167 Author: Alan Coopersmith Date: Tue Oct 13 19:51:11 2009 -0700 Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS Signed-off-by: Alan Coopersmith commit 458673cf5192f800621bcd2b371eb55be9b5ba50 Author: Alan Coopersmith Date: Thu Oct 1 14:54:21 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit 7d5f24fd8182ac6650d4080f74237c8f3773acb4 Author: Paulo Cesar Pereira de Andrade Date: Mon Jan 12 20:27:18 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and most gcc 4.3 and sparse warnings. commit e66bb8c9fb0678cb1086320f931d805491b747f7 Author: James Cloos Date: Wed Aug 20 10:32:49 2008 -0400 xaw8 is gone, use xaw7 commit 9f85f47d7cf25fba98207cc8c0a64b2bfc494c14 Author: Stanislav Maslovski Date: Wed Jul 16 14:35:49 2008 -0400 Fix UTF-8 support. * use XA_UTF8_STRING defined in . * add "*international: true" to fallback resources like xedit does. * get rid of a separate InsertClipboardUtf8() and rewrite InsertClipboard() to support proper conversion from UTF-8 with fallbacks to CTEXT or STRING in case of errors. * add COMPOUND_TEXT to the list of supported targets and unify the conversion code for UTF-8, CTEXT and STRING in ConvertSelection(). Use a proper default for target TEXT. Signed-off-by: James Cloos commit f7f9265623762bfa06cec5273de11d2ec55d4917 Author: Stanislav Maslovski Date: Fri Jul 11 09:37:45 2008 -0400 Add UTF-8 support. While reading manuals on X selections, xt and xaw I have added support of UTF-8 to xclipboard. As is seen from the patch I use “UTF8_STRING†atom in the negotiation of the selection type. There are other possibilities and it seems that there is no real standard on this, right? I have checked that UTF8_STRING works with both GTK+ and QT apps. In addition to the patch to enable correct display of international texts in xaw widgets one has to define *international: true in one’s XRM. And enough rich set of bitmap fonts must be also installed. From bug 16671. Signed-off-by: James Cloos commit aecddb8eae77fd36acdca88bb7080b875274d47c Author: Julien Cristau Date: Fri May 16 14:17:52 2008 +0200 $(builddir) is the current directory Apparently automake doesn't always export the builddir variable. This fixes my previous commit. commit 0013b5aa18798da38e7eb64b8bbb96f16268a474 Author: Julien Cristau Date: Sun Apr 20 19:12:08 2008 +0200 Fix build with builddir != srcdir commit 4cd445822a3cc48cde7102cecacc54f6daabe25b Author: Julien Cristau Date: Sun Apr 20 19:05:17 2008 +0200 Use AM_CFLAGS instead of {xclipboard,xcutsel}_CFLAGS and remove AM_PROG_CC_C_O commit 6422151ddd39e50621df2ec4d5c9b52a189b378b Author: Jeremy Huddleston Date: Thu Mar 27 20:25:18 2008 -0700 Added missing AM_PROG_CC_C_O commit 43c7eeef9be867511c2c4ee82aa05ffc925efa65 Author: Jeremy Huddleston Date: Thu Mar 27 20:07:36 2008 -0700 Build fix for file systems that are not case sensitive commit 22d6a8b72a1e52c7554e50fd250519d5a79e2816 Author: James Cloos Date: Thu Dec 6 16:37:10 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit 8587904b2dd914fa0a52f1246cd09b50a252054d Author: James Cloos Date: Mon Sep 3 05:51:16 2007 -0400 Add *~ to .gitignore to skip patch/emacs droppings commit c543ac48d51df1f3fc7a85daf962d632cf5be07d Author: James Cloos Date: Thu Aug 23 19:24:40 2007 -0400 Rename .cvsignore to .gitignore commit 9d2fff958be21935020a443b3fb56bd2d41cd789 Author: Kevin E Martin Date: Wed Dec 21 02:29:48 2005 +0000 Update package version for X11R7 release. commit 63db9d62f56a1429bdc6865337cea064e1c3e55c Author: Adam Jackson Date: Mon Dec 19 16:22:42 2005 +0000 Stub COPYING files commit 3c1e6ab769aaf446951641b560d31f45870c3520 Author: Kevin E Martin Date: Thu Dec 15 00:24:05 2005 +0000 Update package version number for final X11R7 release candidate. commit d1c1ebd46e0931bbffb10f3d8d06b18fc1233910 Author: Kevin E Martin Date: Wed Dec 7 16:17:58 2005 +0000 Change to use the app-defaults default dir configured in libXt. commit 0481b59715f074a1c105afee876cd62960e124a1 Author: Kevin E Martin Date: Tue Dec 6 22:48:19 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit 1a7a14e9b097a3fae172d25fa654af72929b7890 Author: Kevin E Martin Date: Sat Dec 3 05:49:18 2005 +0000 Update package version number for X11R7 RC3 release. commit 21a312bea06be1dda2d64076a87d6ad1324e01d9 Author: Alan Coopersmith Date: Mon Nov 28 22:01:40 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit 0245cfa0e04fd73aae23db52f7c424d5c07644f6 Author: Eric Anholt Date: Mon Nov 21 10:34:58 2005 +0000 Another pass at .cvsignores for apps. commit 75a9ef36c20f318b8da281febf584ce15c10ef35 Author: Eric Anholt Date: Sun Nov 20 22:08:51 2005 +0000 Add/improve .cvsignore files for apps. commit bbb7e9adb403e7896af68944941ca9229b4bfa3e Author: Kevin E Martin Date: Wed Oct 19 02:47:52 2005 +0000 Update package version number for RC1 release. commit 1f5bb8da77add50c72b721d8d63e25d25f99b19e Author: Alan Coopersmith Date: Tue Oct 18 00:32:54 2005 +0000 Change default install dir for app-default files from $(sysconfdir)/X11/app-defaults to $(libdir)/X11/app-defaults to match the monolith & allow localization commit 8b5c18ad03870baac75724ee8e674511548ca25d Author: Alan Coopersmith Date: Mon Oct 17 23:56:21 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 19e2998cd3c424c25aa3780f12da517453428f83 Author: Alan Coopersmith Date: Fri Oct 14 00:25:43 2005 +0000 Use sed to fill in variables in man page commit c440a0452b998073b2dec8bf8278eca8136675be Author: Alan Coopersmith Date: Mon Aug 1 20:25:29 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit 5578b4284a0dcfea32cea8dae3992fe509249f84 Author: Kevin E Martin Date: Fri Jul 29 21:22:31 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit ed3b3927eccbcf03debd34572285176074bec03b Author: Alan Coopersmith Date: Tue Jul 26 15:44:01 2005 +0000 Replace more GNU make-ism's with more portable macros commit 9caece10b7a09796331f5e6c02696bfb212b2e11 Author: Adam Jackson Date: Wed Jul 20 19:31:51 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit fdc0992af4020cb5230a64058281b6e5aed0d3a1 Author: Matthieu Herrb Date: Sun Jul 17 20:11:02 2005 +0000 fix rules to work with non-GNU make and outside of $srcdir commit e0a326f3bd7889da2352a1e534871a64b693545a Author: Søren Sandmann Pedersen Date: Wed Jul 6 17:30:20 2005 +0000 Build system for xclipboard and xcutsel commit 85a4962bf0afd349b3260f68fb29aa06b0117f57 Author: Egbert Eich Date: Fri Apr 23 19:54:39 2004 +0000 Merging XORG-CURRENT into trunk commit 146e4cdd54a23384e879fc814ded63d0d790ba1f Author: Egbert Eich Date: Sun Mar 14 08:35:00 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit 6269527e0703627ca9e0316c82c2159a1c7114f1 Author: Egbert Eich Date: Wed Mar 3 12:12:55 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit 538cb471c6767c367fcd1955cf3eac8a8b043c31 Author: Egbert Eich Date: Thu Feb 26 13:36:16 2004 +0000 readding XFree86's cvs IDs commit 52bd64ce38b07c7609434b72b35127b2324a0f73 Author: Egbert Eich Date: Thu Feb 26 09:23:58 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit 94abf1754b04b1e6382fe0287b1e7eb2ce6ffdf3 Author: Kaleb Keithley Date: Tue Nov 25 19:29:03 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit 63371815b3f48cb8d4793e6a520d2fc4350c5f1f Author: Kaleb Keithley Date: Fri Nov 14 16:48:58 2003 +0000 XFree86 4.3.0.1 commit 729ceb19417c61603e659b2eb82d2e02fa388365 Author: Kaleb Keithley Date: Fri Nov 14 15:54:53 2003 +0000 R6.6 is the Xorg base-line x11-apps-7.7+5+nmu1ubuntu1/xclipboard/config.guess0000775000000000000000000013036112342463275016654 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-06-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xclipboard/xcutsel.c0000664000000000000000000001760212212272254016160 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * * * Author: Ralph Swick, DEC/Project Athena */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #ifdef XKB #include #endif static XrmOptionDescRec optionDesc[] = { {"-selection", "selection", XrmoptionSepArg, NULL}, {"-select", "selection", XrmoptionSepArg, NULL}, {"-sel", "selection", XrmoptionSepArg, NULL}, {"-s", "selection", XrmoptionSepArg, NULL}, {"-cutbuffer", "cutBuffer", XrmoptionSepArg, NULL}, }; typedef struct { String selection_name; int buffer; Atom selection; char* value; int length; } OptionsRec; static OptionsRec options; #define Offset(field) XtOffsetOf(OptionsRec, field) static XtResource resources[] = { {"selection", "Selection", XtRString, sizeof(String), Offset(selection_name), XtRString, "PRIMARY"}, {"cutBuffer", "CutBuffer", XtRInt, sizeof(int), Offset(buffer), XtRImmediate, (XtPointer)0}, }; #undef Offset typedef struct { Widget button; Boolean is_on; } ButtonState; static ButtonState state; static void Syntax(char *call) { fprintf (stderr, "usage: %s [-selection name] [-cutbuffer number]\n", call); exit (1); } static void StoreBuffer(Widget w, XtPointer client_data, Atom *selection, Atom *type, XtPointer value, unsigned long *length, int *format) { if (*type == 0 || *type == XT_CONVERT_FAIL || *length == 0) { #ifdef XKB XkbStdBell( XtDisplay(w), XtWindow(w), 0, XkbBI_MinorError ); #else XBell( XtDisplay(w), 0 ); #endif return; } XStoreBuffer( XtDisplay(w), (char*)value, (int)(*length), options.buffer ); XtFree(value); } static Boolean ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, XtPointer *value, unsigned long *length, int *format) { Display* d = XtDisplay(w); XSelectionRequestEvent* req = XtGetSelectionRequest(w, *selection, (XtRequestId)NULL); if (*target == XA_TARGETS(d)) { Atom* targetP; Atom* std_targets; unsigned long std_length; XmuConvertStandardSelection(w, req->time, selection, target, type, (XPointer*)&std_targets, &std_length, format); *value = XtMalloc(sizeof(Atom)*(std_length + 4)); targetP = *(Atom**)value; *length = std_length + 4; *targetP++ = XA_STRING; *targetP++ = XA_TEXT(d); *targetP++ = XA_LENGTH(d); *targetP++ = XA_LIST_LENGTH(d); /* *targetP++ = XA_CHARACTER_POSITION(d); */ memmove( (char*)targetP, (char*)std_targets, sizeof(Atom)*std_length); XtFree((char*)std_targets); *type = XA_ATOM; *format = 32; return True; } if (*target == XA_STRING || *target == XA_TEXT(d)) { *type = XA_STRING; *value = XtMalloc((Cardinal) options.length); memmove( (char *) *value, options.value, options.length); *length = options.length; *format = 8; return True; } if (*target == XA_LIST_LENGTH(d)) { long *temp = (long *) XtMalloc (sizeof(long)); *temp = 1L; *value = (XtPointer) temp; *type = XA_INTEGER; *length = 1; *format = 32; return True; } if (*target == XA_LENGTH(d)) { long *temp = (long *) XtMalloc (sizeof(long)); *temp = options.length; *value = (XtPointer) temp; *type = XA_INTEGER; *length = 1; *format = 32; return True; } #ifdef notdef if (*target == XA_CHARACTER_POSITION(d)) { long *temp = (long *) XtMalloc (2 * sizeof(long)); temp[0] = ctx->text.s.left + 1; temp[1] = ctx->text.s.right; *value = (XtPointer) temp; *type = XA_SPAN(d); *length = 2; *format = 32; return True; } #endif /* notdef */ if (XmuConvertStandardSelection(w, req->time, selection, target, type, (XPointer *)value, length, format)) return True; /* else */ return False; } static void SetButton(ButtonState *statep, Boolean on) { if (statep->is_on != on) { Arg args[2]; Pixel fg, bg; XtSetArg( args[0], XtNforeground, &fg ); XtSetArg( args[1], XtNbackground, &bg ); XtGetValues( statep->button, args, TWO ); args[0].value = (XtArgVal)bg; args[1].value = (XtArgVal)fg; XtSetValues( statep->button, args, TWO ); statep->is_on = on; } } static void LoseSelection(Widget w, Atom *selection) { if (options.value) { XFree( options.value ); options.value = NULL; } SetButton(&state, False); } /* ARGSUSED */ static void _X_NORETURN Quit(Widget w, XtPointer closure, XtPointer callData) { XtCloseDisplay( XtDisplay(w) ); exit(0); } /* ARGSUSED */ static void GetSelection(Widget w, XtPointer closure, XtPointer callData) { XtGetSelectionValue(w, options.selection, XA_STRING, StoreBuffer, NULL, XtLastTimestampProcessed(XtDisplay(w))); } /* ARGSUSED */ static void GetBuffer(Widget w, XtPointer closure, XtPointer callData) { if (options.value) XFree( options.value ); options.value = XFetchBuffer(XtDisplay(w), &options.length, options.buffer); if (options.value != NULL) { if (XtOwnSelection(w, options.selection, XtLastTimestampProcessed(XtDisplay(w)), ConvertSelection, LoseSelection, NULL)) SetButton((ButtonState*)closure, True); } } int main(int argc, char *argv[]) { char *label; Widget box, button; XtAppContext appcon; Widget shell; XrmDatabase rdb; XtSetLanguageProc(NULL, NULL, NULL); shell = XtAppInitialize( &appcon, "XCutsel", optionDesc, XtNumber(optionDesc), &argc, argv, NULL, NULL, 0 ); rdb = XtDatabase(XtDisplay(shell)); if (argc != 1) Syntax(argv[0]); XtGetApplicationResources( shell, (XtPointer)&options, resources, XtNumber(resources), NULL, ZERO ); options.value = NULL; XmuInternStrings( XtDisplay(shell), &options.selection_name, ONE, &options.selection ); box = XtCreateManagedWidget("box", boxWidgetClass, shell, NULL, ZERO); button = XtCreateManagedWidget("quit", commandWidgetClass, box, NULL, ZERO); XtAddCallback( button, XtNcallback, Quit, NULL ); /* %%% hack alert... */ XtAsprintf(&label, "*label:copy %s to %d", options.selection_name, options.buffer); XrmPutLineResource( &rdb, label ); XtFree(label); button = XtCreateManagedWidget("sel-cut", commandWidgetClass, box, NULL, ZERO); XtAddCallback( button, XtNcallback, GetSelection, NULL ); XtAsprintf(&label, "*label:copy %d to %s", options.buffer, options.selection_name); XrmPutLineResource( &rdb, label ); XtFree(label); button = XtCreateManagedWidget("cut-sel", commandWidgetClass, box, NULL, ZERO); XtAddCallback( button, XtNcallback, GetBuffer, (XtPointer)&state ); state.button = button; state.is_on = False; XtRealizeWidget(shell); XtAppMainLoop(appcon); exit(0); } x11-apps-7.7+5+nmu1ubuntu1/xclipboard/config.h.in0000664000000000000000000000325312656634633016364 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to use libxkbfile calls like XKBStdBell() */ #undef XKB x11-apps-7.7+5+nmu1ubuntu1/xclipboard/man/0000775000000000000000000000000012656635743015114 5ustar x11-apps-7.7+5+nmu1ubuntu1/xclipboard/man/xcutsel.man0000664000000000000000000001050412212272254017256 0ustar .\" Copyright 1994, 1998 The Open Group .\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" .\" .TH XCUTSEL 1 __xorgversion__ .SH NAME xcutsel - interchange between cut buffer and selection .SH SYNOPSIS \fBxcutsel\fP [ \fI-toolkitoption\fP ...] [-selection \fIselection\fP] [-cutbuffer \fInumber\fP] .SH DESCRIPTION The \fIxcutsel\fP program is used to copy the current selection into a cut buffer and to make a selection that contains the current contents of the cut buffer. It acts as a bridge between applications that don't support selections and those that do. .PP By default, \fIxcutsel\fP will use the selection named PRIMARY and the cut buffer CUT_BUFFER0. Either or both of these can be overridden by command line arguments or by resources. .PP An \fIxcutsel\fP window has the following buttons: .TP 8 .I " quit" When this button is pressed, \fIxcutsel\fP exits. Any selections held by \fIxcutsel\fP are automatically released. .TP 8 .I " copy PRIMARY to 0" When this button is pressed, \fIxcutsel\fP copies the current selection into the cut buffer. .TP 8 .I " copy 0 to PRIMARY" When this button is pressed, \fIxcutsel\fP converts the current contents of the cut buffer into the selection. .PP The button labels reflect the selection and cutbuffer selected by command line options or through the resource database. .PP When the ``copy 0 to PRIMARY'' button is activated, the button will remain inverted as long as \fIxcutsel\fP remains the owner of the selection. This serves to remind you which client owns the current selection. Note that the value of the selection remains constant; if the cutbuffer is changed, you must again activate the copy button to retrieve the new value when desired. .SH OPTIONS .I Xcutsel accepts all of the standard X Toolkit command line options as well as the following: .TP 8 .B \-selection \fIname\fP This option specifies the name of the selection to use. The default is PRIMARY. The only supported abbreviations for this option are ``-select'', ``-sel'' and ``-s'', as the standard toolkit option ``-selectionTimeout'' has a similar name. .TP 8 .B \-cutbuffer \fInumber\fP This option specifies the cut buffer to use. The default is cut buffer 0. .SH X DEFAULTS This program accepts all of the standard X Toolkit resource names and classes as well as: .TP 8 .B "selection (\fPclass\fB Selection)" This resource specifies the name of the selection to use. The default is PRIMARY. .TP 8 .B "cutBuffer (\fPclass\fB CutBuffer)" This resource specifies the number of the cut buffer to use. The default is 0. .SH WIDGET NAMES The following instance names may be used when user configuration of the labels in them is desired: .TP 8 .B "sel-cut (\fPclass\fB Command)" This is the ``copy SELECTION to BUFFER'' button. .TP 8 .B "cut-sel (\fPclass\fB Command)" This is the ``copy BUFFER to SELECTION'' button. .TP 8 .B "quit (\fPclass\fB Command)" This is the ``quit'' button. .SH "SEE ALSO" X(__miscmansuffix__), xclipboard(__appmansuffix__), xterm(__appmansuffix__), text widget documentation, individual client documentation for how to make a selection. .SH BUGS There is no way to change the name of the selection or the number of the cut buffer while the program is running. .SH AUTHOR Ralph R. Swick, DEC/MIT Project Athena x11-apps-7.7+5+nmu1ubuntu1/xclipboard/man/xclipboard.man0000664000000000000000000001250012212272254017714 0ustar .\" Copyright 1988, 1994, 1998 The Open Group .\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" .\" .TH XCLIPBOARD 1 __xorgversion__ .SH NAME xclipboard \- X clipboard client .SH SYNOPSIS \fBxclipboard\fP [ \fI\-toolkitoption\fP ... ] [ \fB\-w\fP ] [ \fB\-nw\fP ] .SH DESCRIPTION The \fIxclipboard\fP program is used to collect and display text selections that are sent to the CLIPBOARD by other clients. It is typically used to save CLIPBOARD selections for later use. It stores each CLIPBOARD selection as a separate string, each of which can be selected. Each time CLIPBOARD is asserted by another application, \fIxclipboard\fP transfers the contents of that selection to a new buffer and displays it in the text window. Buffers are never automatically deleted, so you'll want to use the delete button to get rid of useless items. .PP Since \fIxclipboard\fP uses a Text Widget to display the contents of the clipboard, text sent to the CLIPBOARD may be re-selected for use in other applications. \fIxclipboard\fP also responds to requests for the CLIPBOARD selection from other clients by sending the entire contents of the currently displayed buffer. .PP An \fIxclipboard\fP window has the following buttons across the top: .TP 8 .I quit When this button is pressed, \fIxclipboard\fP exits. .TP 8 .I delete When this button is pressed, the current buffer is deleted and the next one displayed. .TP 8 .I new Creates a new buffer with no contents. Useful in constructing a new CLIPBOARD selection by hand. .TP 8 .I save Displays a File Save dialog box. Pressing the Accept button saves the currently displayed buffer to the file specified in the text field. .TP 8 .I next Displays the next buffer in the list. .TP 8 .I previous Displays the previous buffer. .SH OPTIONS The \fIxclipboard\fP program accepts all of the standard X Toolkit command line options as well as the following: .TP 8 .B \-w This option indicates that lines of text that are too long to be displayed on one line in the clipboard should wrap around to the following lines. .TP 8 .B \-nw This option indicates that long lines of text should not wrap around. This is the default behavior. .SH WIDGETS In order to specify resources, it is useful to know the hierarchy of the widgets which compose \fIxclipboard\fR. In the notation below, indentation indicates hierarchical structure. The widget class name is given first, followed by the widget instance name. .sp .nf .ft CW XClipboard xclipboard Form form Command Quit Command delete Command new Command Save Command next Command prev Label index Text text TransientShell fileDialogShell Dialog fileDialog Label label Command accept Command cancel Text value TransientShell failDialogShell Dialog failDialog Label label Command continue .ft .fi .sp .SH SENDING/RETRIEVING CLIPBOARD CONTENTS Text is copied to the clipboard whenever a client asserts ownership of the \fBCLIPBOARD\fP selection. Text is copied from the clipboard whenever a client requests the contents of the \fBCLIPBOARD\fP selection. Examples of event bindings that a user may wish to include in a resource configuration file to use the clipboard are: .sp .nf .ft CW *VT100.Translations: #override \\ : select-end(CLIPBOARD) \\n\\ : insert-selection(PRIMARY,CLIPBOARD) \\n\\ : ignore () .ft .fi .sp .SH "SEE ALSO" X(__miscmansuffix__), xcutsel(__appmansuffix__), xterm(__appmansuffix__), individual client documentation for how to make a selection and send it to the CLIPBOARD. .SH ENVIRONMENT .PP .TP 8 .B DISPLAY to get the default host and display number. .TP 8 .B XENVIRONMENT to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH FILES .TP .I __apploaddir__/XClipboard specifies required resources .SH AUTHOR Ralph R. Swick, DEC/MIT Project Athena .br Chris D. Peterson, MIT X Consortium .br Keith Packard, MIT X Consortium x11-apps-7.7+5+nmu1ubuntu1/xclipboard/man/Makefile.am0000664000000000000000000000054412212272254017131 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = xclipboard.man xcutsel.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/xclipboard/config.sub0000775000000000000000000010530112167023104016277 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-04-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xclipboard/Makefile.am0000664000000000000000000000334612212272254016361 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = xclipboard xcutsel AM_CFLAGS = $(CWARNFLAGS) $(XCLIPBOARD_CFLAGS) # xclipboard xclipboard_LDADD = $(XCLIPBOARD_LIBS) xclipboard_SOURCES = \ xclipboard.c # xcutsel xcutsel_LDADD = $(XCLIPBOARD_LIBS) xcutsel_SOURCES = \ xcutsel.c # App default files (*.ad) DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ dist_appdefault_DATA = \ app-defaults/XClipboard MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xclipboard/xclipboard.c0000664000000000000000000004602512212272254016621 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * * * Author: Ralph Swick, DEC/Project Athena * Updated for R4: Chris D. Peterson, MIT X Consortium. * Reauthored by: Keith Packard, MIT X Consortium. * UTF-8 and CTEXT support: Stanislav Maslovski */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef XKB #include #endif #include #define Command commandWidgetClass #define Label labelWidgetClass #define Text asciiTextWidgetClass #define INFINITY 10000000 /* pretty big, huh? */ typedef struct _Clip { struct _Clip *next, *prev; char *clip; char *filename; size_t avail; } ClipRec, *ClipPtr; static Atom wm_delete_window; static Atom wm_protocols; static void EraseTextWidget ( void ); static void NewCurrentClipContents ( char *data, int len ); static String fallback_resources[] = { "*international: true", NULL }; static long TextLength(Widget w) { return XawTextSourceScan (XawTextGetSource (w), (XawTextPosition) 0, XawstAll, XawsdRight, 1, TRUE); } static void SaveClip(Widget w, ClipPtr clip) { Arg args[1]; char *data; size_t len; Widget source; source = XawTextGetSource (w); XtSetArg (args[0], XtNstring, &data); XtGetValues (source, args, 1); len = strlen (data); if (len >= clip->avail) { if (clip->clip) free (clip->clip); clip->clip = malloc (len + 1); if (!clip->clip) clip->avail = 0; else clip->avail = len + 1; } if (clip->avail) { strcpy (clip->clip, data); } } static void RestoreClip(Widget w, ClipPtr clip) { Arg args[1]; Widget source; source = XawTextGetSource (w); XtSetArg (args[0], XtNstring, clip->clip); XtSetValues (source, args, 1); } /*ARGSUSED*/ static ClipPtr NewClip(Widget w, ClipPtr old) { ClipPtr newClip; newClip = (ClipPtr) malloc (sizeof (ClipRec)); if (!newClip) return newClip; newClip->clip = NULL; newClip->avail = 0; newClip->prev = old; newClip->next = NULL; newClip->filename = NULL; if (old) { newClip->next = old->next; old->next = newClip; } return newClip; } /*ARGSUSED*/ static void DeleteClip(Widget w, ClipPtr clip) { if (clip->prev) clip->prev->next = clip->next; if (clip->next) clip->next->prev = clip->prev; if (clip->clip) free (clip->clip); free ((char *) clip); } static ClipPtr currentClip; static Widget top; static Widget text, nextButton, prevButton, indexLabel; static Widget fileDialog, fileDialogShell; static Widget failDialog, failDialogShell; static int IndexCurrentClip (void) { int i = 0; ClipPtr clip; for (clip = currentClip; clip; clip = clip->prev) i++; return i; } static void set_button_state (void) { Boolean prevvalid, nextvalid; Arg arg; char labelString[10]; prevvalid = currentClip->prev != NULL; nextvalid = currentClip->next != NULL; XtSetArg (arg, XtNsensitive, prevvalid); XtSetValues (prevButton, &arg, ONE); XtSetArg (arg, XtNsensitive, nextvalid); XtSetValues (nextButton, &arg, ONE); snprintf (labelString, sizeof(labelString), "%d", IndexCurrentClip ()); XtSetArg (arg, XtNlabel, labelString); XtSetValues (indexLabel, &arg, ONE); } /* ARGSUSED */ static void NextCurrentClip(Widget w, XEvent *ev, String *parms, Cardinal *np) { if (currentClip->next) { SaveClip (text, currentClip); currentClip = currentClip->next; RestoreClip (text, currentClip); set_button_state (); } } /* ARGSUSED */ static void PrevCurrentClip(Widget w, XEvent *ev, String *parms, Cardinal *np) { if (currentClip->prev) { SaveClip (text, currentClip); currentClip = currentClip->prev; RestoreClip (text, currentClip); set_button_state (); } } /* ARGSUSED */ static void DeleteCurrentClip(Widget w, XEvent *ev, String *parms, Cardinal *np) { ClipPtr newCurrent; if (currentClip->prev) newCurrent = currentClip->prev; else newCurrent = currentClip->next; if (newCurrent) { DeleteClip (text, currentClip); currentClip = newCurrent; RestoreClip (text, currentClip); } else EraseTextWidget (); set_button_state (); } /* ARGSUSED */ static void _X_NORETURN Quit(Widget w, XEvent *ev, String *parms, Cardinal *np) { XtCloseDisplay (XtDisplay (text)); exit (0); } static void CenterWidgetAtPoint(Widget w, int x, int y) { Arg args[2]; Dimension width, height; XtSetArg(args[0], XtNwidth, &width); XtSetArg(args[1], XtNheight, &height); XtGetValues (w, args, 2); x = x - (int) width / 2; y = y - (int) height / 2; if (x < 0) x = 0; else { int scr_width = WidthOfScreen (XtScreen(w)); if (x + (int)width > scr_width) x = scr_width - width; } if (y < 0) y = 0; else { int scr_height = HeightOfScreen (XtScreen(w)); if (y + (int)height > scr_height) y = scr_height - height; } XtSetArg(args[0], XtNx, x); XtSetArg(args[1], XtNy, y); XtSetValues (w, args, 2); } static void CenterWidgetOnEvent(Widget w, XEvent *e) { CenterWidgetAtPoint (w, e->xbutton.x_root, e->xbutton.y_root); } static void CenterWidgetOnWidget(Widget w, Widget wT) { Position rootX, rootY; Dimension width, height; Arg args[2]; XtSetArg (args[0], XtNwidth, &width); XtSetArg (args[1], XtNheight, &height); XtGetValues (wT, args, 2); XtTranslateCoords (wT, (Position) width/2, (Position) height/2, &rootX, &rootY); CenterWidgetAtPoint (w, (int) rootX, (int) rootY); } /*ARGSUSED*/ static void SaveToFile(Widget w, XEvent *e, String *argv, Cardinal *argc) { Arg args[1]; char *filename; filename = "clipboard"; if (currentClip->filename) filename = currentClip->filename; XtSetArg(args[0], XtNvalue, filename); XtSetValues (fileDialog, args, 1); CenterWidgetOnEvent (fileDialogShell, e); XtPopup (fileDialogShell, XtGrabNone); } /*ARGSUSED*/ static void AcceptSaveFile(Widget w, XEvent *e, String *argv, Cardinal *argc) { char *filename; Bool success; Arg args[1]; filename = XawDialogGetValueString (fileDialog); success = XawAsciiSaveAsFile (XawTextGetSource (text), filename); XtPopdown (fileDialogShell); if (!success) { char *failMessage; XtAsprintf (&failMessage, "Can't open file \"%s\"", filename); XtSetArg (args[0], XtNlabel, failMessage); XtSetValues (failDialog, args, 1); CenterWidgetOnEvent (failDialogShell, e); XtPopup (failDialogShell, XtGrabNone); XtFree (failMessage); } else { if (currentClip->filename) free (currentClip->filename); currentClip->filename = strdup (filename); } } /* ARGSUSED */ static void CancelSaveFile(Widget w, XEvent *ev, String *parms, Cardinal *np) { XtPopdown (fileDialogShell); } /* ARGSUSED */ static void FailContinue(Widget w, XEvent *ev, String *parms, Cardinal *np) { XtPopdown (failDialogShell); } /*ARGSUSED*/ static void WMProtocols(Widget w, XEvent *ev, String *params, Cardinal *n) { if (ev->type == ClientMessage && ev->xclient.message_type == wm_protocols && ev->xclient.data.l[0] == (long) wm_delete_window) { while (w && !XtIsShell(w)) w = XtParent(w); if (w == top) Quit(w, ev, params, n); else if (w == fileDialogShell) CancelSaveFile(w, ev, params, n); else if (w == failDialogShell) FailContinue(w, ev, params, n); } } /* ARGUSED */ static void NewCurrentClip(Widget w, XEvent *ev, String *parms, Cardinal *np) { NewCurrentClipContents ("", 0); } static void NewCurrentClipContents(char *data, int len) { XawTextBlock textBlock; SaveClip (text, currentClip); /* append new clips at the end */ while (currentClip && currentClip->next) currentClip = currentClip->next; /* any trailing clips with no text get overwritten */ if (strlen (currentClip->clip) != 0) currentClip = NewClip (text, currentClip); textBlock.ptr = data; textBlock.firstPos = 0; textBlock.length = len; textBlock.format = FMT8BIT; if (XawTextReplace(text, 0, TextLength (text), &textBlock)) { #ifdef XKB XkbStdBell(XtDisplay(text), XtWindow(text), 0, XkbBI_Info); #else XBell( XtDisplay(text), 0); #endif } set_button_state (); } static void EraseTextWidget(void) { XawTextBlock block; block.ptr = ""; block.length = 0; block.firstPos = 0; block.format = FMT8BIT; XawTextReplace(text, 0, INFINITY, &block); /* If this fails, too bad. */ } static XtActionsRec xclipboard_actions[] = { { "NewClip", NewCurrentClip }, { "NextClip", NextCurrentClip }, { "PrevClip", PrevCurrentClip }, { "DeleteClip", DeleteCurrentClip }, { "Save", SaveToFile }, { "AcceptSave", AcceptSaveFile }, { "CancelSave", CancelSaveFile }, { "FailContinue", FailContinue }, { "Quit", Quit }, { "WMProtocols", WMProtocols } }; static XrmOptionDescRec table[] = { {"-w", "wrap", XrmoptionNoArg, "on"}, /* {"-nw", "wrap", XrmoptionNoArg, "False"} */ }; static Boolean ConvertSelection ( Widget w, Atom *selection, Atom *target, Atom *type, XtPointer *value, unsigned long *length, int *format ); static void LoseSelection ( Widget w, Atom *selection ); static Atom ManagerAtom, ClipboardAtom; /*ARGSUSED*/ static void InsertClipboard(Widget w, XtPointer client_data, Atom *selection, Atom *type, XtPointer value, unsigned long *length, int *format) { Display *d = XtDisplay(w); Atom target = (Atom)client_data; Boolean convert_failed = (*type == XT_CONVERT_FAIL); if (!convert_failed) { char **list; int i, ret, count; XTextProperty prop; prop.value = value; prop.nitems = *length; prop.format = *format; prop.encoding = *type; ret = XmbTextPropertyToTextList(d, &prop, &list, &count); if (ret >= Success) { /* manuals say something about multiple strings in a disjoint text selection (?), it should be harmless to get them all */ for (i = 0; i < count; i++) NewCurrentClipContents(list[i], strlen(list[i])); XFreeStringList(list); } else convert_failed = True; XFree(value); } if (convert_failed) { /* if UTF8_STRING failed try COMPOUND_TEXT */ if (target == XA_UTF8_STRING(d)) { XtGetSelectionValue(w, *selection, XA_COMPOUND_TEXT(d), InsertClipboard, (XtPointer)(XA_COMPOUND_TEXT(d)), CurrentTime); return; } /* if COMPOUND_TEXT failed try STRING */ else if (target == XA_COMPOUND_TEXT(d)) { XtGetSelectionValue(w, *selection, XA_STRING, InsertClipboard, NULL, CurrentTime); return; } /* all conversions failed */ else { Arg arg; XtSetArg (arg, XtNlabel, "CLIPBOARD selection conversion failed"); XtSetValues (failDialog, &arg, 1); CenterWidgetOnWidget (failDialogShell, text); XtPopup (failDialogShell, XtGrabNone); #ifdef XKB XkbStdBell (d, XtWindow(w), 0, XkbBI_MinorError); #else XBell (d, 0); #endif } } XtOwnSelection(top, ClipboardAtom, CurrentTime, ConvertSelection, LoseSelection, NULL); } static Boolean ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, XtPointer *value, unsigned long *length, int *format) { Display* d = XtDisplay(w); XSelectionRequestEvent* req = XtGetSelectionRequest(w, *selection, (XtRequestId)NULL); if (*target == XA_TARGETS(d)) { Atom* targetP; Atom* std_targets; unsigned long std_length; XmuConvertStandardSelection(w, req->time, selection, target, type, (XPointer*)&std_targets, &std_length, format); *value = XtMalloc(sizeof(Atom)*(std_length + 7)); targetP = *(Atom**)value; *targetP++ = XA_STRING; *targetP++ = XA_TEXT(d); *targetP++ = XA_UTF8_STRING(d); *targetP++ = XA_COMPOUND_TEXT(d); *targetP++ = XA_LENGTH(d); *targetP++ = XA_LIST_LENGTH(d); *targetP++ = XA_CHARACTER_POSITION(d); *length = std_length + (targetP - (*(Atom **) value)); memmove( (char*)targetP, (char*)std_targets, sizeof(Atom)*std_length); XtFree((char*)std_targets); *type = XA_ATOM; *format = 32; return True; } if (*target == XA_LIST_LENGTH(d) || *target == XA_LENGTH(d)) { long * temp; temp = (long *) XtMalloc(sizeof(long)); if (*target == XA_LIST_LENGTH(d)) *temp = 1L; else /* *target == XA_LENGTH(d) */ *temp = (long) TextLength (text); *value = (XPointer) temp; *type = XA_INTEGER; *length = 1L; *format = 32; return True; } if (*target == XA_CHARACTER_POSITION(d)) { long * temp; temp = (long *) XtMalloc(2 * sizeof(long)); temp[0] = (long) 0; temp[1] = TextLength (text); *value = (XPointer) temp; *type = XA_SPAN(d); *length = 2L; *format = 32; return True; } if (*target == XA_STRING || *target == XA_TEXT(d) || *target == XA_UTF8_STRING(d) || *target == XA_COMPOUND_TEXT(d)) { Arg args[1]; Widget source; XTextProperty prop; int ret, style = XStdICCTextStyle; /* a safe default for TEXT */ char *data; source = XawTextGetSource (text); XtSetArg (args[0], XtNstring, &data); XtGetValues (source, args, 1); if (*target == XA_UTF8_STRING(d)) style = XUTF8StringStyle; else if (*target == XA_COMPOUND_TEXT(d)) style = XCompoundTextStyle; else if (*target == XA_STRING) style = XStringStyle; ret = XmbTextListToTextProperty (d, &data, 1, style, &prop); if (ret >= Success) { *length = prop.nitems; *value = prop.value; *type = prop.encoding; *format = prop.format; return True; } else return False; } if (XmuConvertStandardSelection(w, req->time, selection, target, type, (XPointer *) value, length, format)) return True; return False; } static void LoseSelection(Widget w, Atom *selection) { Display *d = XtDisplay(w); XtGetSelectionValue(w, *selection, XA_UTF8_STRING(d), InsertClipboard, (XtPointer)(XA_UTF8_STRING(d)), CurrentTime); } /*ARGSUSED*/ static Boolean RefuseSelection(Widget w, Atom *selection, Atom *target, Atom *type, XtPointer *value, unsigned long *length, int *format) { return False; } /*ARGSUSED*/ static void LoseManager(Widget w, Atom *selection) { XtError("another clipboard has taken over control\n"); } typedef struct { Boolean wrap; } ResourceData, *ResourceDataPtr; static ResourceData userOptions; #define Offset(field) XtOffsetOf(ResourceData, field) static XtResource resources[] = { {"wrap", "Wrap", XtRBoolean, sizeof(Boolean), Offset(wrap), XtRImmediate, (XtPointer)False} }; #undef Offset int main(int argc, char *argv[]) { Arg args[4]; Cardinal n; XtAppContext xtcontext; Widget parent; XtSetLanguageProc(NULL, NULL, NULL); top = XtAppInitialize( &xtcontext, "XClipboard", table, XtNumber(table), &argc, argv, fallback_resources, NULL, 0); XtGetApplicationResources(top, (XtPointer)&userOptions, resources, XtNumber(resources), NULL, 0); XtAppAddActions (xtcontext, xclipboard_actions, XtNumber (xclipboard_actions)); /* CLIPBOARD_MANAGER is a non-standard mechanism */ ManagerAtom = XInternAtom(XtDisplay(top), "CLIPBOARD_MANAGER", False); ClipboardAtom = XA_CLIPBOARD(XtDisplay(top)); if (XGetSelectionOwner(XtDisplay(top), ManagerAtom)) XtError("another clipboard is already running\n"); parent = XtCreateManagedWidget("form", formWidgetClass, top, NULL, ZERO); (void) XtCreateManagedWidget("quit", Command, parent, NULL, ZERO); (void) XtCreateManagedWidget("delete", Command, parent, NULL, ZERO); (void) XtCreateManagedWidget("new", Command, parent, NULL, ZERO); (void) XtCreateManagedWidget("save", Command, parent, NULL, ZERO); nextButton = XtCreateManagedWidget("next", Command, parent, NULL, ZERO); prevButton = XtCreateManagedWidget("prev", Command, parent, NULL, ZERO); indexLabel = XtCreateManagedWidget("index", Label, parent, NULL, ZERO); n=0; XtSetArg(args[n], XtNtype, XawAsciiString); n++; XtSetArg(args[n], XtNeditType, XawtextEdit); n++; if (userOptions.wrap) { XtSetArg(args[n], XtNwrap, XawtextWrapWord); n++; XtSetArg(args[n], XtNscrollHorizontal, False); n++; } text = XtCreateManagedWidget( "text", Text, parent, args, n); currentClip = NewClip (text, (ClipPtr) 0); set_button_state (); fileDialogShell = XtCreatePopupShell("fileDialogShell", transientShellWidgetClass, top, NULL, ZERO); fileDialog = XtCreateManagedWidget ("fileDialog", dialogWidgetClass, fileDialogShell, NULL, ZERO); XawDialogAddButton(fileDialog, "accept", NULL, NULL); XawDialogAddButton(fileDialog, "cancel", NULL, NULL); failDialogShell = XtCreatePopupShell("failDialogShell", transientShellWidgetClass, top, NULL, ZERO); failDialog = XtCreateManagedWidget ("failDialog", dialogWidgetClass, failDialogShell, NULL, ZERO); XawDialogAddButton (failDialog, "continue", NULL, NULL); XtRealizeWidget(top); XtRealizeWidget(fileDialogShell); XtRealizeWidget(failDialogShell); XtOwnSelection(top, ManagerAtom, CurrentTime, RefuseSelection, LoseManager, NULL); if (XGetSelectionOwner (XtDisplay(top), ClipboardAtom)) { LoseSelection (top, &ClipboardAtom); } else { XtOwnSelection(top, ClipboardAtom, CurrentTime, ConvertSelection, LoseSelection, NULL); } wm_delete_window = XInternAtom(XtDisplay(top), "WM_DELETE_WINDOW", False); wm_protocols = XInternAtom(XtDisplay(top), "WM_PROTOCOLS", False); (void) XSetWMProtocols(XtDisplay(top), XtWindow(top), &wm_delete_window,1); (void) XSetWMProtocols(XtDisplay(top), XtWindow(fileDialogShell), &wm_delete_window,1); (void) XSetWMProtocols(XtDisplay(top), XtWindow(failDialogShell), &wm_delete_window,1); XtAppMainLoop(xtcontext); exit(0); } x11-apps-7.7+5+nmu1ubuntu1/xclipboard/configure.ac0000664000000000000000000000461012212272254016606 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. AC_PREREQ([2.60]) AC_INIT([xclipboard], [1.1.3], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xclipboard]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS # Checks for pkg-config packages PKG_CHECK_EXISTS([xkbfile], [XKBPKG="xkbfile"], [XKBPKG=""]) if test x$XKBPKG = xxkbfile ; then AC_DEFINE([XKB], [1], [Define to use libxkbfile calls like XKBStdBell()]) fi PKG_CHECK_MODULES(XCLIPBOARD, [xaw7 xmu xt >= 1.1 x11 ${XKBPKG} xproto >= 7.0.17]) PKG_CHECK_MODULES(APPDEFS, xt) xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` AC_ARG_WITH(appdefaultdir, AS_HELP_STRING([--with-appdefaultdir=], [specify directory for app-defaults files (default is autodetected)]), [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xclipboard/README0000664000000000000000000000160312212272254015177 0ustar xclipboard is used to collect and display text selections that are sent to the CLIPBOARD by other clients. It is typically used to save CLIPBOARD selections for later use. It stores each CLIPBOARD selection as a separate string, each of which can be selected. All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xclipboard http://cgit.freedesktop.org/xorg/app/xclipboard For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xclipboard/COPYING0000664000000000000000000000216612212272254015357 0ustar Copyright 1989, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. x11-apps-7.7+5+nmu1ubuntu1/xclipboard/INSTALL0000664000000000000000000002622212212272272015354 0ustar Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 6. Often, you can also type `make uninstall' to remove the installed files again. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *Note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xconsole/0000775000000000000000000000000012656635743014044 5ustar x11-apps-7.7+5+nmu1ubuntu1/xconsole/xconsole.c0000664000000000000000000005422112172137553016033 0ustar /* * Copyright 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * * Author: Keith Packard, MIT X Consortium */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern char *_XawTextGetSTRING(TextWidget ctx, XawTextPosition left, XawTextPosition right); #include #include #include #ifndef _POSIX_SOURCE #define _POSIX_SOURCE #include #undef _POSIX_SOURCE #else #include #endif #include #include #include #ifdef HAS_OPENPTY # ifdef HAVE_UTIL_H # include # endif # ifdef HAVE_LIBUTIL_H # include # endif # ifdef HAVE_PTY_H # include # endif #endif static void inputReady(XtPointer w, int *source, XtInputId *id); static long TextLength(Widget w); static void TextReplace(Widget w, int start, int end, XawTextBlock *block); static void TextAppend(Widget w, char *s, int len); static void TextInsert(Widget w, char *s, int len); static Bool ExceededMaxLines(Widget w); static void ScrollLine(Widget w); static Widget top, text; static XtInputId input_id; static FILE *input; static Boolean regularFile = FALSE; static Boolean notified; static Boolean iconified; static Atom wm_delete_window; static Atom mit_console; #define MIT_CONSOLE_LEN 12 #define MIT_CONSOLE "MIT_CONSOLE_" static char mit_console_name[255 + MIT_CONSOLE_LEN + 1] = MIT_CONSOLE; static struct _app_resources { char *file; Boolean stripNonprint; Boolean notify; Boolean daemon; Boolean verbose; Boolean exitOnFail; int saveLines; } app_resources; #define Offset(field) XtOffsetOf(struct _app_resources, field) static XtResource resources[] = { {"file", "File", XtRString, sizeof (char *), Offset (file), XtRString, "console" }, {"notify", "Notify", XtRBoolean, sizeof (Boolean), Offset (notify), XtRImmediate, (XtPointer)True }, {"stripNonprint", "StripNonprint", XtRBoolean, sizeof (Boolean), Offset (stripNonprint), XtRImmediate, (XtPointer)True }, {"daemon", "Daemon", XtRBoolean, sizeof (Boolean), Offset (daemon), XtRImmediate, (XtPointer)False}, {"verbose", "Verbose", XtRBoolean, sizeof (Boolean), Offset (verbose),XtRImmediate, (XtPointer)False}, {"exitOnFail", "ExitOnFail", XtRBoolean, sizeof (Boolean), Offset (exitOnFail),XtRImmediate, (XtPointer)False}, {"saveLines", "SaveLines", XtRInt, sizeof (int), Offset (saveLines), XtRImmediate, (XtPointer) 0 }, }; #undef Offset static XrmOptionDescRec options[] = { {"-file", "*file", XrmoptionSepArg, NULL}, {"-notify", "*notify", XrmoptionNoArg, "TRUE"}, {"-nonotify", "*notify", XrmoptionNoArg, "FALSE"}, {"-daemon", "*daemon", XrmoptionNoArg, "TRUE"}, {"-verbose", "*verbose", XrmoptionNoArg, "TRUE"}, {"-exitOnFail", "*exitOnFail", XrmoptionNoArg, "TRUE"}, {"-saveLines", "*saveLines", XrmoptionSepArg, NULL}, }; #ifdef linux #define USE_FILE #define FILE_NAME "/dev/xconsole" # if defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)) /* * Linux distribution based on glibc 2.1 and higher should use * devpts. This is the fallback if open file FILE_NAME fails. * */ # define USE_PTS # endif #endif #if defined(_AIX) # define USE_PTS #endif #if !defined (USE_FILE) || defined (linux) # include # ifdef hpux # include # endif # if defined (SVR4) || defined (USE_PTS) # include # ifndef HAS_OPENPTY # include /* for I_PUSH */ # endif # ifdef sun # include # endif # endif # if defined(TIOCCONS) || defined(SRIOCSREDIR) # define USE_PTY static int tty_fd, pty_fd; static char ttydev[64], ptydev[64]; # endif #endif #if (defined(SVR4) && !defined(sun)) || (defined(SYSV) && defined(i386)) #define USE_OSM #include #endif #ifdef USE_PTY static int get_pty(int *pty, int *tty, char *ttydev, char *ptydev); #endif #ifdef USE_OSM static FILE *osm_pipe(void); static int child_pid; #endif /* Copied from xterm/ptyx.h */ #ifndef PTYCHAR1 #ifdef __hpux #define PTYCHAR1 "zyxwvutsrqp" #else /* !__hpux */ #define PTYCHAR1 "pqrstuvwxyzPQRSTUVWXYZ" #endif /* !__hpux */ #endif /* !PTYCHAR1 */ #ifndef PTYCHAR2 #ifdef __hpux #define PTYCHAR2 "fedcba9876543210" #else /* !__hpux */ #ifdef __FreeBSD__ #define PTYCHAR2 "0123456789abcdefghijklmnopqrstuv" #else /* !__FreeBSD__ */ #define PTYCHAR2 "0123456789abcdef" #endif /* !__FreeBSD__ */ #endif /* !__hpux */ #endif /* !PTYCHAR2 */ static void OpenConsole(void) { input = 0; if (app_resources.file) { if (!strcmp (app_resources.file, "console")) { /* must be owner and have read/write permission */ #if !defined(__NetBSD__) && !defined(__OpenBSD__) struct stat sbuf; # if !defined (linux) if (!stat("/dev/console", &sbuf) && (sbuf.st_uid == getuid()) && !access("/dev/console", R_OK|W_OK)) # endif #endif { #ifdef USE_FILE # ifdef linux if (!stat(FILE_NAME, &sbuf)) # endif input = fopen (FILE_NAME, "r"); #endif #ifdef USE_PTY if (!input && get_pty (&pty_fd, &tty_fd, ttydev, ptydev) == 0) { # ifdef TIOCCONS int on = 1; if (ioctl (tty_fd, TIOCCONS, (char *) &on) != -1) input = fdopen (pty_fd, "r"); # else int consfd = open("/dev/console", O_RDONLY); if (consfd >= 0) { if (ioctl(consfd, SRIOCSREDIR, tty_fd) != -1) input = fdopen (pty_fd, "r"); close(consfd); } # endif } #endif /* USE_PTY */ } #ifdef USE_OSM /* Don't have to be owner of /dev/console when using /dev/osm. */ if (!input) input = osm_pipe(); #endif if (input && app_resources.verbose) { char *hostname; TextAppend (text, "Console log for ", 16); hostname = mit_console_name + MIT_CONSOLE_LEN; TextAppend (text, hostname, strlen (hostname)); TextAppend (text, "\n", 1); } } else { regularFile = FALSE; if (access(app_resources.file, R_OK) == 0) { int fd = open (app_resources.file, O_RDONLY | O_NONBLOCK | O_NOCTTY); if (fd != -1) { input = fdopen (fd, "r"); if (input) { struct stat sbuf; if ((fstat(fd, &sbuf) == 0) && S_ISREG(sbuf.st_mode)) regularFile = TRUE; } else close(fd); } } } if (!input) { if (app_resources.exitOnFail) exit(0); TextAppend (text, "Couldn't open ", 14); TextAppend (text, app_resources.file, strlen (app_resources.file)); TextAppend (text, "\n", 1); } } else input = stdin; if (input) { input_id = XtAddInput (fileno (input), (XtPointer) XtInputReadMask, inputReady, (XtPointer) text); } } static void CloseConsole (void) { if (input) { XtRemoveInput (input_id); fclose (input); } #ifdef USE_PTY close (tty_fd); #endif } #ifdef USE_OSM static void KillChild(int sig) { if (child_pid > 0) kill(child_pid, SIGTERM); _exit(0); } #endif /*ARGSUSED*/ static void _X_NORETURN Quit(Widget widget, XEvent *event, String *params, Cardinal *num_params) { #ifdef USE_OSM if (child_pid > 0) kill(child_pid, SIGTERM); #endif exit (0); } #ifdef USE_OSM static int (*ioerror)(Display *); static int IOError(Display *dpy) { if (child_pid > 0) kill(child_pid, SIGTERM); return (*ioerror)(dpy); } #endif static void Notify(void) { Arg arglist[1]; char *oldName; char *newName; if (!iconified || !app_resources.notify || notified) return; XtSetArg (arglist[0], XtNiconName, &oldName); XtGetValues (top, arglist, 1); newName = malloc (strlen (oldName) + 3); if (!newName) return; sprintf (newName, "%s *", oldName); XtSetArg (arglist[0], XtNiconName, newName); XtSetValues (top, arglist, 1); free (newName); notified = True; } /*ARGSUSED*/ static void Deiconified(Widget widget, XEvent *event, String *params, Cardinal *num_params) { Arg arglist[1]; char *oldName; char *newName; size_t oldlen; iconified = False; if (!app_resources.notify || !notified) return; XtSetArg (arglist[0], XtNiconName, &oldName); XtGetValues (top, arglist, 1); oldlen = strlen (oldName); if (oldlen >= 2) { newName = malloc (oldlen - 1); if (!newName) return; strncpy (newName, oldName, oldlen - 2); newName[oldlen - 2] = '\0'; XtSetArg (arglist[0], XtNiconName, newName); XtSetValues (top, arglist, 1); free (newName); } notified = False; } /*ARGSUSED*/ static void Iconified(Widget widget, XEvent *event, String *params, Cardinal *num_params) { iconified = True; } /*ARGSUSED*/ static void Clear(Widget widget, XEvent *event, String *params, Cardinal *num_params) { long last; XawTextBlock block; last = TextLength (text); block.ptr = ""; block.firstPos = 0; block.length = 0; block.format = FMT8BIT; TextReplace (text, 0, last, &block); } static XtActionsRec actions[] = { { "Quit", Quit }, { "Iconified", Iconified }, { "Deiconified", Deiconified }, { "Clear", Clear }, }; static void stripNonprint(char *b) { char *c; c = b; while (*b) { if (isprint (*b) || (isspace (*b) && *b != '\r')) { if (c != b) *c = *b; ++c; } ++b; } *c = '\0'; } static void inputReady(XtPointer w, int *source, XtInputId *id) { char buffer[1025]; int n; n = read (*source, buffer, sizeof (buffer) - 1); if (n <= 0) { if (app_resources.file && regularFile && n == 0) { if (XPending(XtDisplay(w))) return; sleep(1); return; } fclose (input); XtRemoveInput (*id); /* try to reopen if pipe; this can be caused by syslog restart */ if (app_resources.file && !regularFile && n == 0) { OpenConsole(); } } else { Notify(); buffer[n] = '\0'; if (app_resources.stripNonprint) { stripNonprint (buffer); n = strlen (buffer); } TextAppend ((Widget) text, buffer, n); } } static Boolean ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, XtPointer *value, unsigned long *length, int *format) { Display* d = XtDisplay(w); XSelectionRequestEvent* req = XtGetSelectionRequest(w, *selection, (XtRequestId)NULL); if (*target == XA_TARGETS(d)) { Atom* targetP; Atom* std_targets; unsigned long std_length; XmuConvertStandardSelection(w, req->time, selection, target, type, (XPointer *)&std_targets, &std_length, format); *value = (XtPointer)XtMalloc(sizeof(Atom)*(std_length + 5)); targetP = *(Atom**)value; *targetP++ = XA_STRING; *targetP++ = XA_TEXT(d); *targetP++ = XA_LENGTH(d); *targetP++ = XA_LIST_LENGTH(d); *targetP++ = XA_CHARACTER_POSITION(d); *length = std_length + (targetP - (*(Atom **) value)); memmove( (char*)targetP, (char*)std_targets, sizeof(Atom)*std_length); XtFree((char*)std_targets); *type = XA_ATOM; *format = 32; return True; } if (*target == XA_LIST_LENGTH(d) || *target == XA_LENGTH(d)) { long * temp; temp = (long *) XtMalloc(sizeof(long)); if (*target == XA_LIST_LENGTH(d)) *temp = 1L; else /* *target == XA_LENGTH(d) */ *temp = (long) TextLength (text); *value = (XtPointer) temp; *type = XA_INTEGER; *length = 1L; *format = 32; return True; } if (*target == XA_CHARACTER_POSITION(d)) { long * temp; temp = (long *) XtMalloc(2 * sizeof(long)); temp[0] = (long) 0; temp[1] = TextLength (text); *value = (XtPointer) temp; *type = XA_SPAN(d); *length = 2L; *format = 32; return True; } if (*target == XA_STRING || *target == XA_TEXT(d) || *target == XA_COMPOUND_TEXT(d)) { if (*target == XA_COMPOUND_TEXT(d)) *type = *target; else *type = XA_STRING; *length = TextLength (text); *value = (XtPointer)_XawTextGetSTRING((TextWidget) text, 0, *length); *format = 8; /* * Drop our connection to the file; the new console program * will open as soon as it receives the selection contents; there * is a small window where console output will not be redirected, * but I see no way of avoiding that without having two programs * attempt to redirect console output at the same time, which seems * worse */ CloseConsole (); return True; } if (XmuConvertStandardSelection(w, req->time, selection, target, type, (XPointer *)value, length, format)) return True; return False; } static void _X_NORETURN LoseSelection(Widget w, Atom *selection) { Quit (w, (XEvent*)NULL, (String*)NULL, (Cardinal*)NULL); } /*ARGSUSED*/ static void InsertSelection(Widget w, XtPointer client_data, Atom *selection, Atom *type, XtPointer value, unsigned long *length, int *format) { if (*type != XT_CONVERT_FAIL) TextInsert (text, (char *) value, *length); XtOwnSelection(top, mit_console, CurrentTime, ConvertSelection, LoseSelection, NULL); OpenConsole (); } int main(int argc, char *argv[]) { Arg arglist[10]; Cardinal num_args; XtSetLanguageProc(NULL,NULL,NULL); top = XtInitialize ("xconsole", "XConsole", options, XtNumber (options), &argc, argv); XtGetApplicationResources (top, (XtPointer)&app_resources, resources, XtNumber (resources), NULL, 0); if (app_resources.daemon) if (fork ()) exit (0); XtAddActions (actions, XtNumber (actions)); text = XtCreateManagedWidget ("text", asciiTextWidgetClass, top, NULL, 0); XtRealizeWidget (top); num_args = 0; XtSetArg(arglist[num_args], XtNiconic, &iconified); num_args++; XtGetValues(top, arglist, num_args); if (iconified) Iconified((Widget)NULL, (XEvent*)NULL, (String*)NULL, (Cardinal*)NULL); else Deiconified((Widget)NULL,(XEvent*)NULL,(String*)NULL,(Cardinal*)NULL); wm_delete_window = XInternAtom(XtDisplay(top), "WM_DELETE_WINDOW", False); (void) XSetWMProtocols (XtDisplay(top), XtWindow(top), &wm_delete_window, 1); XmuGetHostname (mit_console_name + MIT_CONSOLE_LEN, 255); mit_console = XInternAtom(XtDisplay(top), mit_console_name, False); if (XGetSelectionOwner (XtDisplay (top), mit_console)) { XtGetSelectionValue(top, mit_console, XA_STRING, InsertSelection, NULL, CurrentTime); } else { XtOwnSelection(top, mit_console, CurrentTime, ConvertSelection, LoseSelection, NULL); OpenConsole (); } #ifdef USE_OSM ioerror = XSetIOErrorHandler(IOError); #endif XtMainLoop (); return 0; } static long TextLength(Widget w) { return XawTextSourceScan (XawTextGetSource (w), (XawTextPosition) 0, XawstAll, XawsdRight, 1, TRUE); } static void TextReplace(Widget w, int start, int end, XawTextBlock *block) { Arg arg; Widget source; XawTextEditType edit_mode; source = XawTextGetSource (w); XtSetArg (arg, XtNeditType, &edit_mode); XtGetValues (source, &arg, ONE); XtSetArg (arg, XtNeditType, XawtextEdit); XtSetValues (source, &arg, ONE); XawTextReplace (w, start, end, block); XtSetArg (arg, XtNeditType, edit_mode); XtSetValues (source, &arg, ONE); } static void TextAppend(Widget w, char *s, int len) { long last, current; XawTextBlock block; current = XawTextGetInsertionPoint (w); last = TextLength (w); block.ptr = s; block.firstPos = 0; block.length = len; block.format = FMT8BIT; /* * If saveLines is 1, just replace the entire contents of the widget * each time, so the test in ExceededMaxLines() isn't fooled. */ if (app_resources.saveLines == 1) TextReplace (w, 0, last, &block); else TextReplace (w, last, last, &block); if (current == last) XawTextSetInsertionPoint (w, last + block.length); if (ExceededMaxLines(w)) ScrollLine(w); } static void TextInsert(Widget w, char *s, int len) { XawTextBlock block; long current; current = XawTextGetInsertionPoint (w); block.ptr = s; block.firstPos = 0; block.length = len; block.format = FMT8BIT; TextReplace (w, 0, 0, &block); if (current == 0) XawTextSetInsertionPoint (w, len); if (ExceededMaxLines(w)) ScrollLine(w); } static Bool ExceededMaxLines(Widget w) { XawTextPosition end_of_last_line; Bool retval = False; if (app_resources.saveLines > 0) { /* * XawTextSourceScan() will return the end of the widget if it cannot * find what it is searching for. */ end_of_last_line = XawTextSourceScan (XawTextGetSource (w), (XawTextPosition) 0, XawstEOL, XawsdRight, app_resources.saveLines, TRUE); if (TextLength(w) > end_of_last_line) retval = True; else retval = False; } else retval = False; return retval; } static void ScrollLine(Widget w) { XawTextPosition firstnewline; XawTextBlock block; /* * This is pretty inefficient but should work well enough unless the * console device is getting totally spammed. Generally, new lines * only come in one at a time anyway. */ firstnewline = XawTextSourceScan (XawTextGetSource (w), (XawTextPosition) 0, XawstEOL, XawsdRight, 1, TRUE); block.ptr = ""; block.firstPos = 0; block.length = 0; block.format = FMT8BIT; TextReplace (w, 0, firstnewline, &block); } #ifdef USE_PTY /* * This function opens up a pty master and stuffs its value into pty. * If it finds one, it returns a value of 0. If it does not find one, * it returns a value of !0. This routine is designed to be re-entrant, * so that if a pty master is found and later, we find that the slave * has problems, we can re-enter this function and get another one. */ static int get_pty(int *pty, int *tty, char *ttydev, char *ptydev) { #ifdef HAS_OPENPTY if (openpty(pty, tty, NULL, NULL, NULL) == -1) { return 1; } return 0; #elif defined (SVR4) || defined (USE_PTS) #if defined (_AIX) if ((*pty = open ("/dev/ptc", O_RDWR)) < 0) #else if ((*pty = open ("/dev/ptmx", O_RDWR)) < 0) #endif return 1; grantpt(*pty); unlockpt(*pty); strcpy(ttydev, (char *)ptsname(*pty)); if ((*tty = open(ttydev, O_RDWR)) >= 0) { (void)ioctl(*tty, I_PUSH, "ttcompat"); return 0; } if (*pty >= 0) close (*pty); #else /* !SVR4, need lots of code */ #ifdef USE_GET_PSEUDOTTY if ((*pty = getpseudotty (&ttydev, &ptydev)) >= 0 && (*tty = open (ttydev, O_RDWR)) >= 0) return 0; if (*pty >= 0) close (*pty); #else static int devindex, letter = 0; #ifdef sgi { char *slave; slave = _getpty (pty, O_RDWR, 0622, 0); if ((*tty = open (slave, O_RDWR)) != -1) return 0; } #else strcpy (ttydev, "/dev/ttyxx"); strcpy (ptydev, "/dev/ptyxx"); while (PTYCHAR1[letter]) { ttydev [strlen(ttydev) - 2] = ptydev [strlen(ptydev) - 2] = PTYCHAR1 [letter]; while (PTYCHAR2[devindex]) { ttydev [strlen(ttydev) - 1] = ptydev [strlen(ptydev) - 1] = PTYCHAR2 [devindex]; if ((*pty = open (ptydev, O_RDWR)) >= 0 && (*tty = open (ttydev, O_RDWR)) >= 0) { /* * We need to set things up for our next entry * into this function! */ (void) devindex++; return(0); } if (*pty >= 0) close (*pty); devindex++; } devindex = 0; (void) letter++; } #endif /* sgi else not sgi */ #endif /* USE_GET_PSEUDOTTY */ #endif /* SVR4 */ /* * We were unable to allocate a pty master! Return an error * condition and let our caller terminate cleanly. */ return(1); } #endif #ifdef USE_OSM /* * On SYSV386 there is a special device, /dev/osm, where system messages * are sent. Problem is that we can't perform a select(2) on this device. * So this routine creates a streams-pty where one end reads the device and * sends the output to xconsole. */ #ifdef SCO325 #define OSM_DEVICE "/dev/error" #else #ifdef __UNIXWARE__ #define OSM_DEVICE "/dev/osm2" #define NO_READAHEAD #else #define OSM_DEVICE "/dev/osm" #endif #endif static FILE * osm_pipe(void) { int tty; char ttydev[64]; if (access(OSM_DEVICE, R_OK) < 0) return NULL; #if defined (_AIX) if ((tty = open("/dev/ptc", O_RDWR)) < 0) #else if ((tty = open("/dev/ptmx", O_RDWR)) < 0) #endif return NULL; grantpt(tty); unlockpt(tty); strcpy(ttydev, (char *)ptsname(tty)); if ((child_pid = fork()) == 0) { int pty, osm, nbytes, skip; char cbuf[128]; skip = 0; #ifndef NO_READAHEAD osm = open(OSM_DEVICE, O_RDONLY); if (osm >= 0) { while ((nbytes = read(osm, cbuf, sizeof(cbuf))) > 0) skip += nbytes; close(osm); } #endif pty = open(ttydev, O_RDWR); if (pty < 0) exit(1); osm = open(OSM_DEVICE, O_RDONLY); if (osm < 0) exit(1); for (nbytes = 0; skip > 0 && nbytes >= 0; skip -= nbytes) { nbytes = skip; if (nbytes > sizeof(cbuf)) nbytes = sizeof(cbuf); nbytes = read(osm, cbuf, nbytes); } while ((nbytes = read(osm, cbuf, sizeof(cbuf))) >= 0) write(pty, cbuf, nbytes); exit(0); } signal(SIGHUP, KillChild); signal(SIGINT, KillChild); signal(SIGTERM, KillChild); return fdopen(tty, "r"); } #endif /* USE_OSM */ x11-apps-7.7+5+nmu1ubuntu1/xconsole/app-defaults/0000775000000000000000000000000012202404165016404 5ustar x11-apps-7.7+5+nmu1ubuntu1/xconsole/app-defaults/XConsole0000664000000000000000000000114712172137553020076 0ustar *allowShellResize: true XConsole.translations: #override\ : Deiconified() \n\ : Iconified() \n\ WM_PROTOCOLS: Quit() XConsole.baseTranslations: #override\ : Deiconified() \n\ : Iconified() \n\ WM_PROTOCOLS: Quit() *text.translations: #override\ CtrlC: Clear() \n\ Clear: Clear() *text.baseTranslations: #override\ CtrlC: Clear() \n\ Clear: Clear() *text.scrollVertical: Always *text.scrollHorizontal: Never *text.width: 400 *text.height: 70 *text.allowResize: true *editType: read x11-apps-7.7+5+nmu1ubuntu1/xconsole/ChangeLog0000664000000000000000000006103112172140277015601 0ustar commit f4ba22c10b9b1bd175fa39d25118bf904ba82eec Author: Alan Coopersmith Date: Thu Jul 18 21:24:07 2013 -0700 xconsole 1.0.6 Signed-off-by: Alan Coopersmith commit ba74b1a1dfa5d3411817e0c436b378945c410ec7 Author: Alan Coopersmith Date: Sun Apr 21 14:01:12 2013 -0700 Use fstat() on the fd from open(), instead of stat() on the same pathname Signed-off-by: Alan Coopersmith commit 73be08929d1d418370ae235e5261e64f72054cbf Author: Alan Coopersmith Date: Sun Apr 21 13:56:23 2013 -0700 Fix file leak if fdopen() fails Reported by parfait 1.1: File Descriptor Leak: Leaked File Descriptor fd at line 313 of xconsole.c in function 'OpenConsole'. fd initialized at line 285 with open fd leaks when fd != -1 at line 287. Signed-off-by: Alan Coopersmith commit 22a09b77093970423e721ebd8004a593d5f88a21 Author: Alan Coopersmith Date: Sun Feb 24 08:14:32 2013 -0800 unifdef -ULynx Signed-off-by: Alan Coopersmith commit 676edb80c54ac5ace45e641a3dde17751a3ab224 Author: Alan Coopersmith Date: Sun Feb 24 08:13:14 2013 -0800 unifdef -UISC Signed-off-by: Alan Coopersmith commit 9567b4e2b70552963189ac90a3ff91c351cd482a Author: Alan Coopersmith Date: Sun Feb 24 08:12:31 2013 -0800 unifdef -Uultrix Signed-off-by: Alan Coopersmith commit 78492fd74051af9d717ec07503a7173858793528 Author: Alan Coopersmith Date: Sun Feb 24 08:07:47 2013 -0800 config: Add missing AC_CONFIG_SRCDIR Regroup AC statements under the Autoconf initialization section. Regroup AM statements under the Automake initialization section. Signed-off-by: Alan Coopersmith commit 2831823f608c1906211d5c55a098f48c8fad1a37 Author: Niclas Zeising Date: Wed Jan 16 01:30:20 2013 +0100 Fix build on FreeBSD libutil.h is needed on FreeBSD to get the definition of openpty(), add a configure check for this include, and include it in xconsole.c if it exists. Signed-off-by: Alan Coopersmith commit cc0cf84461cfe2c31ddce34863c6433183e8a55d Author: Alan Coopersmith Date: Sat Jan 12 16:24:44 2013 -0800 xconsole 1.0.5 Signed-off-by: Alan Coopersmith commit 98f941d218108a314f979332b19c612f51ace08d Author: Alan Coopersmith Date: Fri Jan 4 18:21:23 2013 -0800 Fix implicit conversion from size_t to int warnings in Deiconified() xconsole.c:423:14: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32] oldlen = strlen (oldName); ~ ^~~~~~~~~~~~~~~~ xconsole.c:426:27: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] newName = malloc (oldlen - 1); ~~~~~~ ~~~~~~~^~~ xconsole.c:429:36: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] strncpy (newName, oldName, oldlen - 2); ~~~~~~~ ~~~~~~~^~~ Signed-off-by: Alan Coopersmith commit 60d4a9dc01c9a1bf7a29c4a64ad52a6e27307682 Author: Alan Coopersmith Date: Fri Jan 4 18:17:18 2013 -0800 unifdef -U__UNIXOS2__ Signed-off-by: Alan Coopersmith commit a7a54829dc89b38bbad7fcd6e70cf001d2274c26 Author: Arvind Umrao Date: Fri Aug 24 09:44:23 2012 +0530 Open /dev/console with NOCTTY and O_NONBLOCK flags In some cases, for SPARC servers, special files like fifo need to open in nonblocking mode otherwise whole xconsole GUI freezes. Also /dev/console is often a terminal device. So I am opening /dev/console with NOCTTY and O_NONBLOCK flags. Signed-off-by: Arvind Umrao Reviewed-by: Alan Coopersmith Signed-off-by: Alan Coopersmith commit 2e2ccc86fd4e778268ee44897a56535ce37b25e3 Author: Eric S. Raymond Date: Thu Aug 23 06:19:16 2012 -0400 Don't rely on being able to set tab stops. Signed-off-by: Eric S. Raymond commit 1dad4492bf1a6668de2b6ef56fd16ef4fc0e380d Author: Alan Coopersmith Date: Tue Jun 5 18:25:30 2012 -0700 unifdef CRAY Signed-off-by: Alan Coopersmith commit ada6e8761138d3e7af42726de15e88204bed1686 Author: Alan Coopersmith Date: Tue Jun 5 18:22:40 2012 -0700 unifdef umips Signed-off-by: Alan Coopersmith commit f9b34c2eae4c3abe40904e4274c5d82cd16fc7af Author: Alan Coopersmith Date: Tue Jun 5 18:20:49 2012 -0700 Mark functions _X_NORETURN that gcc warnings suggest Signed-off-by: Alan Coopersmith commit a12b6b391ab96241aa14f918e36a2fbd92734c7d Author: Alan Coopersmith Date: Tue Jun 5 18:16:59 2012 -0700 Remove old Xorg & XFree86 CVS version tags Signed-off-by: Alan Coopersmith commit f7bcc00522e06e33ddb1ff4974c3b15a44d1005f Author: Alan Coopersmith Date: Wed Sep 28 20:30:46 2011 -0700 Strip trailing whitespace Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' git diff -w & git diff -b show no diffs from this change Signed-off-by: Alan Coopersmith commit a03d98d49cd2f2ef6aa6d2ecaf611cccfad7a919 Author: Jeremy Huddleston Date: Sun Sep 25 00:55:20 2011 -0700 Require xt >= 1.0 for appdefaultdir https://bugs.freedesktop.org/show_bug.cgi?id=7237 Signed-off-by: Jeremy Huddleston commit 2f34a30d5b4fed4936fa41bb25bc0953d6882ece Author: Gaetan Nadon Date: Wed Jan 19 10:06:55 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 037e30485b3d6e22216a8c44e78fdb6fb57b238b Author: Gaetan Nadon Date: Thu Jan 13 17:15:36 2011 -0500 man: replace hard coded man page section with substitution strings Signed-off-by: Gaetan Nadon commit e076a7cc5441e51b1083aba11f5b743156514fc1 Author: Gaetan Nadon Date: Wed Jan 12 16:28:02 2011 -0500 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS This silences an Autoconf warning commit 2f6ff82050e8a535d633f9b59bb2ec94528d3634 Author: Gaetan Nadon Date: Wed Jan 12 15:29:50 2011 -0500 config: replace deprecated AC_HELP_STRING with AS_HELP_STRING This silences an Automake warning. Signed-off-by: Gaetan Nadon commit d71b95d96588e1ca020fa15db6ceb3050d41bbdc Author: Alan Coopersmith Date: Thu Sep 23 19:31:52 2010 -0700 xconsole 1.0.4 Signed-off-by: Alan Coopersmith commit 7507dea14fdc259d50dd1e2693d4f3cd5235eeb4 Author: Alan Coopersmith Date: Thu Sep 23 19:28:30 2010 -0700 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now Signed-off-by: Alan Coopersmith commit 49bc4d3002ede196319bfc2829dda169c706e300 Author: Gaetan Nadon Date: Tue Jul 20 18:45:18 2010 -0400 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon commit 53fdc18e1723eb42596ad72ccd0e84ebfbd0a0e4 Author: Alan Coopersmith Date: Fri Aug 6 08:47:48 2010 -0700 Fill in COPYING file with copyright notices from source code Signed-off-by: Alan Coopersmith commit 3105c7119df08bab8d1668997c6b332ba5ff732c Author: Alan Coopersmith Date: Thu Jul 1 17:05:25 2010 -0700 Xmu functions are called directly, so include it in PKG_CHECK_MODULES Signed-off-by: Alan Coopersmith commit ee142aaa65ef5a96b205110b8fa7dc5f9fe4fc20 Author: Alan Coopersmith Date: Wed Jun 30 23:25:03 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS The existing statement can now be removed from the configuration file. Use automake provided $(AM_V_GEN) and XORG_DEFAULT_OPTIONS provided $(SED) Enables silent rule and use platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit fee6d15b7cc5f1fad77fed4988bd856399e5750a Author: Gaetan Nadon Date: Thu Feb 11 10:08:06 2010 -0500 config: move CWARNFLAGS from configure.ac to Makefile.am Compiler warning flags should be explicitly set in the makefile rather than being merged with other packages compiler flags. Signed-off-by: Gaetan Nadon commit 45fd4b1fa6f81acd33d183b00b060a69087da194 Author: Gaetan Nadon Date: Sat Dec 19 20:48:47 2009 -0500 configure.ac: use backticks rather than $() for cmd subs Use "$PKG_CONFIG" rather than hard coded "pkg-config" Signed-off-by: Gaetan Nadon commit 89dbe10377a39ee7001d1c34ce8f01aa209bb376 Author: Gaetan Nadon Date: Thu Nov 26 09:19:53 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit 11cd7489b6f96f194171be418bf9112b5f1cbc1d Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit fe30cb2c210cf51b239505deaac63593a0ab53f9 Author: Gaetan Nadon Date: Tue Oct 27 15:07:24 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit 41d1f93ec0cfd8754d3c6f81bb4cb113328291cd Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit 099fc3d0dd7b769693bf1bce70112e1e13fe5336 Author: Alan Coopersmith Date: Thu Oct 1 14:54:21 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit 3254ca74de650838e46a551e7c567a79fd971503 Author: Alan Coopersmith Date: Mon Aug 3 16:26:13 2009 -0700 Remove errant #error I_PUSH from SVR4 code path Signed-off-by: Alan Coopersmith commit 58c8fc6828c07867955882f9126b116edc2036d2 Author: Matthieu Herrb Date: Sat Jul 25 14:08:41 2009 +1000 Prevent inclusion of stropts.h on Linux. Systems like Linux/glibc that have openpty() will not mess around with SVR4 like stream modules, so no need to include streams related headers. Signed-off-by: Peter Hutterer commit acc7c587322e2f1952900ad554061c5a8d08f7c3 Author: Paulo Cesar Pereira de Andrade Date: Mon Jan 19 20:16:40 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings. commit 5b3da5679d78ac025358ba0e4beb35e8a9cacd5c Author: Julien Cristau Date: Sun Nov 16 21:25:33 2008 +0100 Fix header inclusion for openpty() AC_CHECK_HEADERS(foo.h) defines HAVE_FOO_H, not HAS_FOO_H. This fixes a compiler warning: xconsole.c:839: warning: implicit declaration of function 'openpty' commit 9f690af8ed736ffcae0f0e3771bbc4ab851f8202 Author: James Cloos Date: Wed Aug 20 10:32:50 2008 -0400 xaw8 is gone, use xaw7 commit 0ac48669dfcfd2760eaab31c934ff0b83ff2dd2c Author: Julien Cristau Date: Fri May 16 14:24:55 2008 +0200 $(builddir) is the current directory Apparently automake doesn't always export the builddir variable. This fixes my previous commit. commit 6e305f9cdfaffd87f1852a1c24271b10b0bd5079 Author: Julien Cristau Date: Sun Apr 20 19:48:09 2008 +0200 Fix build with builddir != srcdir commit e321bfbe9970a89d486437ed5eedcd83a10a749e Author: Jeremy Huddleston Date: Thu Mar 27 20:07:41 2008 -0700 Build fix for file systems that are not case sensitive commit 2f9d3842be3d5d58270e54821552735cdb098075 Merge: d5ffc49 cda9968 Author: James Cloos Date: Mon Sep 3 05:59:57 2007 -0400 Merge branch 'master' of ssh://git.freedesktop.org/git/xorg/app/xconsole commit d5ffc49536871784f269ba938566fa77733b16e3 Author: James Cloos Date: Mon Sep 3 05:51:18 2007 -0400 Add *~ to .gitignore to skip patch/emacs droppings commit cda9968cea772dbc94b50d791a5be62203ae9ddf Author: Alan Coopersmith Date: Mon Aug 20 18:58:33 2007 -0700 Version bump: 1.0.3 commit 9eee6c49bd6f57d51c517a6703cac2f29732231a Author: Alan Coopersmith Date: Mon Aug 20 18:54:22 2007 -0700 Add *~ to .gitignore to skip patch/emacs droppings commit d1e90da451da71d7d362236c5709d9931ab7b9d1 Author: Alan Coopersmith Date: Mon Aug 20 18:53:41 2007 -0700 Replace xconsole_CFLAGS with AM_CFLAGS to make automake-1.10 happier commit 3d4f2f96fc661095ce615928e6b586784f5d35e5 Author: Matthieu Herrb Date: Sun Jul 30 18:42:08 2006 +0200 Check if openpty() is available and use it if it is. commit 5bdbbecf51e3a73c6660498f8598f0731b43a703 Author: Matthieu Herrb Date: Sun Jul 30 16:31:03 2006 +0200 Remove ChangeLog, replace with a rule that generates it using git-log commit c8a026e7c8457cd726f8f6fbd74ade325a9f486e Author: Matthieu Herrb Date: Sun Jul 30 16:29:10 2006 +0200 rename .cvsignore -> .gitignore commit 86e5d9ca5836d4ad02faa1a5f9c0db239464bde1 Author: Adam Jackson Date: Wed Apr 26 23:38:08 2006 +0000 Bump to 1.0.2 commit 219ef4e86f05e7a473e399c5188efdb7f16f31f1 Author: Matthieu Herrb Date: Sat Mar 18 18:31:08 2006 +0000 Avoid potential underflow if read() returns -1. Coverity CID 414 commit 950d308b3230e7e89d307fd95abb983e44987665 Author: Kevin E Martin Date: Wed Dec 21 02:29:49 2005 +0000 Update package version for X11R7 release. commit f3755877004e49e96f26b120e0716f6673dc738b Author: Adam Jackson Date: Mon Dec 19 16:22:42 2005 +0000 Stub COPYING files commit a87b4d1f07448fde9b4f7ecad965210a339caaa5 Author: Kevin E Martin Date: Thu Dec 15 00:24:05 2005 +0000 Update package version number for final X11R7 release candidate. commit d82f94100bd454d3298c6548173827a67cb4d7ad Author: Kevin E Martin Date: Wed Dec 7 16:17:59 2005 +0000 Change to use the app-defaults default dir configured in libXt. commit c681eac9a17d8d3f16efa2a992b02972cfa71926 Author: Kevin E Martin Date: Tue Dec 6 22:48:20 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit 406fdcbe2e0b7f6af37c6d6965f85adfa8bb3aa6 Author: Kevin E Martin Date: Sat Dec 3 05:49:18 2005 +0000 Update package version number for X11R7 RC3 release. commit 81d992f635798580d71fc79abf9df2a825f125e0 Author: Alan Coopersmith Date: Mon Nov 28 22:01:40 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit 61eac81e62e1b9b141ce7aaf3fd778ad1f9d7924 Author: Eric Anholt Date: Mon Nov 21 10:34:59 2005 +0000 Another pass at .cvsignores for apps. commit 68ea4cb352cc528736914c7d328df024164e0e60 Author: Eric Anholt Date: Sun Nov 20 22:08:51 2005 +0000 Add/improve .cvsignore files for apps. commit 630bdf36e17b8f125f8aa0cabf41c75e650ac973 Author: Kevin E Martin Date: Wed Nov 9 21:09:20 2005 +0000 Update package version number for X11R7 RC2 release. commit 31dbed9163fd4384dc5dc81f426ce82176587dd2 Author: Kean Johnson Date: Tue Nov 8 06:33:31 2005 +0000 See ChangeLog entry 2005-11-07 for details. commit 0710398b397c5f8b09b6216bd18e84337fb4efdb Author: Kevin E Martin Date: Wed Oct 19 02:47:52 2005 +0000 Update package version number for RC1 release. commit 34924fc44be47d2d58c701485b4e1b6fad28c21d Author: Alan Coopersmith Date: Tue Oct 18 00:32:55 2005 +0000 Change default install dir for app-default files from $(sysconfdir)/X11/app-defaults to $(libdir)/X11/app-defaults to match the monolith & allow localization commit 324e3c08212f7dbe8b08f7d9028f2e775cbc73c1 Author: Alan Coopersmith Date: Mon Oct 17 23:56:21 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit ad9813ed3ad1d8adb562ac9b279c18753249786f Author: Alan Coopersmith Date: Fri Oct 14 00:25:43 2005 +0000 Use sed to fill in variables in man page commit f8ca981b964aaa3c59eab661ce35efb7d7085020 Author: Alan Coopersmith Date: Wed Aug 17 21:03:23 2005 +0000 Bugzilla #4130 xconsole: non-ascii characters don't show up (Samuel Thibault) commit 05a718f11fc97f1e34cf927fd8762f8251356dcb Author: Alan Coopersmith Date: Mon Aug 1 20:25:29 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit c0ecb99582a714c95282f1187c0f39acee640779 Author: Kevin E Martin Date: Fri Jul 29 21:22:31 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit b23b1f35930ed0d10fef42a23f88a2dacd29d91c Author: Daniel Stone Date: Wed Jul 27 00:15:46 2005 +0000 Fix xconsole build break on AIX caused by removal of ptyx defines. commit b471e2609662c2ec83d26ee32a7900e528f67f75 Author: Alan Coopersmith Date: Tue Jul 26 15:44:02 2005 +0000 Replace more GNU make-ism's with more portable macros commit e656ddba66cda7432279cd10ac5a450e8b2c342c Author: Adam Jackson Date: Wed Jul 20 19:31:52 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit 171e31464fc9d4f39403931b1126c3e2cf52b84e Author: Matthieu Herrb Date: Sun Jul 17 21:11:32 2005 +0000 fix rules to work with non-GNU make. commit 6fa7b824f077a0c04eb678c8736cda077232a084 Author: Søren Sandmann Pedersen Date: Thu Jul 7 23:08:22 2005 +0000 - Build system for xconsole - Remove include of "../xterm/ptyx" from xc/programs/xconsole/xconsole.c commit b38b9a7731430359f10ba74706fc6d4c786d2d36 Author: Egbert Eich Date: Mon Oct 18 14:21:46 2004 +0000 Made handling of DevelDrivers for x86-64 more conformant to other platforms. Compress all font encodings (Stefan Dirsch). Fixed warnings. Turn on forwarding XNSpotLocation event to XIM server in OffTheSpot and Root mode (bugzilla #1580, James Su). Added another compose key combination for the Euro symbol (Stefan Dirsch). Added support for UTF-8 in ja_JP, ko_KR and zh_TW locales (Mike Fabian). Changed default encoding for ru from KOI8-R to ISO8859-5 (Mike Fabian). This is the encoding that is also used by glibc. We may break other libcs - lets see who complains. Added explanation for DESTDIR to install to a different directory than /. Added some early bailouts to atiprobe if PCI structure pointer is NULL to prevent sig11. XV support doesn't depend on 2D acceleration any more. This patch removes this limitation from the NSC driver. This is a patch that I have committed to XFree86 a while ago but never ported over to X.Org. Matthieu Herrb contributed some build fixes. Fixing SetDPMSTimers() so that DPMS*Time == 0 disables the appropriate timer. This takes advantage of the fact that TimerSet() with a timeout argument 0 behaves like TimerCanel(). Use /dev/xconsole (named pipe) or devpts for system logger (Werner Fink). Create missing links for backward compatibility to XFree86 (Stefan Dirsch). Changed comment to mention xorg. Changed cursor for the 'kill' action from XC_draped_box to XC_Pirate. If you don't like it we can change it back (original author unkown). Added 'pic' to the man page rendering command pipeline (Werner Fink). Added missing return value (Stefan Dirsch, Roland Mainz) commit 7da0d180d6852916e5dca44842ee88e7d8429e6e Author: Egbert Eich Date: Fri Apr 23 19:54:41 2004 +0000 Merging XORG-CURRENT into trunk commit 0b03eedd1839ec360b2bb7c0b4b9592cd53cfda5 Author: Egbert Eich Date: Sun Mar 14 08:35:01 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit 2ec4fa572aba38d9e01205a2b440f6fcf29b796e Author: Egbert Eich Date: Wed Mar 3 12:12:55 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit 798ad4a31ca485e2b04a2a623b1fc96f3860d11f Author: Egbert Eich Date: Thu Feb 26 13:36:16 2004 +0000 readding XFree86's cvs IDs commit 297a4fba84512347e1f65d5c9eca649c24271067 Author: Egbert Eich Date: Thu Feb 26 09:23:58 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit b53d3aeeedd692ef010a3ec5961079aee7d47fb3 Author: Kaleb Keithley Date: Tue Nov 25 19:29:03 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit 2b2c62b3be8dd36d3231a2ad18d8b212e81695d1 Author: Kaleb Keithley Date: Fri Nov 14 16:48:58 2003 +0000 XFree86 4.3.0.1 commit 593922e4e9e9bdcb9bd2b66493b91023d8f0984b Author: Kaleb Keithley Date: Fri Nov 14 15:54:53 2003 +0000 R6.6 is the Xorg base-line x11-apps-7.7+5+nmu1ubuntu1/xconsole/config.guess0000775000000000000000000013036112342463275016357 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-06-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xconsole/config.h.in0000664000000000000000000000363212656634643016071 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the 'openpty' function. */ #undef HAS_OPENPTY /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBUTIL_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_PTY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_UTIL_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION x11-apps-7.7+5+nmu1ubuntu1/xconsole/man/0000775000000000000000000000000012656635743014617 5ustar x11-apps-7.7+5+nmu1ubuntu1/xconsole/man/xconsole.man0000664000000000000000000000732212172137553017137 0ustar .\" Copyright 1994, 1998 The Open Group .\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. .\" .\" The above copyright notice and this permission notice shall be included in .\" all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR .\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, .\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL .\" THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, .\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF .\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE .\" SOFTWARE. .\" .\" Except as contained in this notice, the name of The Open Group shall not .\" be used in advertising or otherwise to promote the sale, use or other .\" dealing in this Software without prior written authorization from the .\" The Open Group. .\" .\" .TH XCONSOLE 1 __xorgversion__ .SH NAME xconsole \- monitor system console messages with X .SH SYNOPSIS .ta 8n \fBxconsole\fP [-\fItoolkitoption\fP ...] [-file \fIfile-name\fP] [-notify] [-stripNonprint] [-daemon] [-verbose] [-exitOnFail] .SH DESCRIPTION The .I xconsole program displays messages which are usually sent to /dev/console. .SH OPTIONS .I Xconsole accepts all of the standard X Toolkit command line options along with the additional options listed below: .TP 8 .B \-file \fIfile-name\fP To monitor some other device, use this option to specify the device name. This does not work on regular files as they are always ready to be read from. .TP 8 .B \-notify \-nonotify When new data are received from the console and the notify option is set, the icon name of the application has " *" appended, so that it is evident even when the application is iconified. \-notify is the default. .TP 8 .B \-daemon This option causes .I xconsole to place itself in the background, using fork/exit. .TP 8 .B \-verbose When set, this option directs .I xconsole to display an informative message in the first line of the text buffer. .TP 8 .B \-exitOnFail When set, this option directs .I xconsole to exit when it is unable to redirect the console output. .TP 8 .B \-saveLines \fIcount\fP When set, .I xconsole only preserves .I count lines of message history instead of growing the text buffer without bound (a .I count of zero \- the default \- is treated as placing no limit on the history). .SH X DEFAULTS This program uses the .I Athena Text widget, look in the .I Athena Widget Set documentation for controlling it. .PP .I Xconsole otherwise accepts resources of the same names as the command-line options (without the leading dash). "file" is a string type, "saveLines" an integer, and the remaining options are booleans. .SH WIDGETS In order to specify resources, it is useful to know the hierarchy of the widgets which compose \fIxconsole\fR. In the notation below, indentation indicates hierarchical structure. The widget class name is given first, followed by the widget instance name. .sp .nf XConsole xconsole XConsole text .fi .sp .SH ENVIRONMENT .PP .TP 8 .B DISPLAY to get the default host and display number. .TP 8 .B XENVIRONMENT to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH FILES .TP .I __apploaddir__/XConsole specifies required resources .SH "SEE ALSO" X(__miscmansuffix__), xrdb(__appmansuffix__), Athena Text widget .SH AUTHOR Keith Packard (MIT X Consortium) x11-apps-7.7+5+nmu1ubuntu1/xconsole/man/Makefile.am0000664000000000000000000000052612172137553016643 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = xconsole.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/xconsole/config.sub0000775000000000000000000010530112167023104016002 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-04-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xconsole/Makefile.am0000664000000000000000000000313712172137553016071 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = xconsole AM_CFLAGS = $(XCONSOLE_CFLAGS) $(CWARNFLAGS) xconsole_LDADD = $(XCONSOLE_LIBS) xconsole_SOURCES = \ xconsole.c # App default files DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ dist_appdefault_DATA = \ app-defaults/XConsole MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xconsole/configure.ac0000664000000000000000000000472312172137553016325 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xconsole], [1.0.6], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xconsole]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS # Checks for pkg-config packages PKG_CHECK_MODULES(XCONSOLE, xaw7 xmu xt >= 1.0 x11 xproto >= 7.0.17) PKG_CHECK_MODULES(APPDEFS, xt) xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` AC_ARG_WITH(appdefaultdir, AS_HELP_STRING([--with-appdefaultdir=], [specify directory for app-defaults files (default is autodetected)]), [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) AC_SEARCH_LIBS(openpty, [util]) AC_CHECK_FUNC(openpty, [HAS_OPENPTY="yes"]) if test "x$HAS_OPENPTY" = "xyes" ; then AC_DEFINE([HAS_OPENPTY], 1, [Define to 1 if you have the 'openpty' function.]) AC_CHECK_HEADERS([util.h libutil.h pty.h], [break]) fi AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xconsole/README0000664000000000000000000000131712172137553014713 0ustar xconsole displays in a X11 window the messages which are usually sent to /dev/console All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xconsole http://cgit.freedesktop.org/xorg/app/xconsole For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xconsole/COPYING0000664000000000000000000000216612172137553015071 0ustar Copyright 1990, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. x11-apps-7.7+5+nmu1ubuntu1/xconsole/INSTALL0000664000000000000000000002622212172140277015063 0ustar Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 6. Often, you can also type `make uninstall' to remove the installed files again. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *Note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xbiff/0000775000000000000000000000000012656635743013310 5ustar x11-apps-7.7+5+nmu1ubuntu1/xbiff/MailboxP.h0000664000000000000000000000663712167023104015163 0ustar /* $XConsortium: MailboxP.h,v 1.22 94/04/17 20:43:27 rws Exp $ */ /* Copyright (c) 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XFree86: xc/programs/xbiff/MailboxP.h,v 1.1 2000/02/13 03:56:12 dawes Exp $ */ #ifndef _XawMailboxP_h #define _XawMailboxP_h #include "config.h" #include "Mailbox.h" #include #ifdef HAVE_PATHS_H # include #endif #ifndef MAILBOX_DIRECTORY # ifdef _PATH_MAILDIR # define MAILBOX_DIRECTORY _PATH_MAILDIR # elif defined(SYSV) # define MAILBOX_DIRECTORY "/usr/mail" # elif defined(SVR4) # define MAILBOX_DIRECTORY "/var/mail" # elif defined(__linux__) # define MAILBOX_DIRECTORY "/var/spool/mail" # else # define MAILBOX_DIRECTORY "/usr/spool/mail" # endif #endif typedef struct { /* new fields for mailbox widget */ /* resources */ int update; /* seconds between updates */ Pixel foreground_pixel; /* color index of normal state fg */ String filename; /* filename to watch */ String check_command; /* command to exec for mail check */ Boolean flipit; /* do flip of full pixmap */ int volume; /* bell volume */ Boolean once_only; /* ring bell only once on new mail */ /* local state */ GC gc; /* normal GC to use */ long last_size; /* size in bytes of mailboxname */ XtIntervalId interval_id; /* time between checks */ Boolean flag_up; /* is the flag up? */ struct _mbimage { Pixmap bitmap, mask; /* depth 1, describing shape */ Pixmap pixmap; /* full depth pixmap */ int width, height; /* geometry of pixmaps */ } full, empty; Boolean shapeit; /* do shape extension */ struct { Pixmap mask; int x, y; } shape_cache; /* last set of info */ } MailboxPart; typedef struct _MailboxRec { /* full instance record */ CorePart core; SimplePart simple; MailboxPart mailbox; } MailboxRec; typedef struct { /* new fields for mailbox class */ int dummy; /* stupid C compiler */ } MailboxClassPart; typedef struct _MailboxClassRec { /* full class record declaration */ CoreClassPart core_class; SimpleClassPart simple_class; MailboxClassPart mailbox_class; } MailboxClassRec; extern MailboxClassRec mailboxClassRec; /* class pointer */ #endif /* _XawMailboxP_h */ x11-apps-7.7+5+nmu1ubuntu1/xbiff/ChangeLog0000664000000000000000000003302112167023104015034 0ustar commit 3d9d486dfbd40dedc328943fc39041874bb15a25 Author: Alan Coopersmith Date: Tue Jan 25 12:43:26 2011 -0800 xbiff 1.0.3 Signed-off-by: Alan Coopersmith commit 2493d94686bfb758428c4479114f47b99db04456 Author: Gaetan Nadon Date: Wed Jan 19 10:06:55 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 9bf1cbbd49fbb11707e3bc30429e1fbedd5abec8 Author: Alan Coopersmith Date: Fri Jan 7 17:13:49 2011 -0800 Add --with-mailbox-directory=PATH option to configure Lets builders set a specific path for mailboxes when the defaults don't match the system setup Signed-off-by: Alan Coopersmith Reviewed-by: Dan Nicholson commit dc963f6d676d1735144ff3997c0ab5bf7cc3889f Author: Alan Coopersmith Date: Fri Jan 7 16:06:40 2011 -0800 Use and _PATH_MAILDIR to find mailboxes if present Use autoconf to check for paths.h on all systems, instead of only including it #ifdef CSRG_BASED Makes _PATH_MAILDIR the preferred mail directory path on all systems if it's defined, falls back to old per-system hardcoded paths if not. Signed-off-by: Alan Coopersmith Reviewed-by: Mark Kettenis Reviewed-by: Dan Nicholson commit 6cabab62873999d56a6cca6452c0cbe84dbacd9a Author: Gaetan Nadon Date: Thu Jan 13 17:15:36 2011 -0500 man: replace hard coded man page section with substitution strings Signed-off-by: Gaetan Nadon commit ef54b28477afbe2e059f5d399513716a86d6e1d0 Author: Gaetan Nadon Date: Thu Jan 13 11:15:47 2011 -0500 man: remove trailing spaces and tabs Using s/[ \t]*$// Signed-off-by: Gaetan Nadon commit 478f979bce3426af3efdb97f8cf40610ed8f9076 Author: Alan Coopersmith Date: Sun Oct 31 12:17:10 2010 -0700 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS Regroup AC statements under the Autoconf initialization section. Regroup AM sttaements under the Automake initialization section. Add missing AC_CONFIG_SRCDIR Signed-off-by: Alan Coopersmith commit b4bc572dede7e2433bc368faf572b49ad852dd8c Author: Gaetan Nadon Date: Sun Oct 31 12:06:15 2010 -0700 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon Signed-off-by: Alan Coopersmith commit 5f5d8495455e806ea66f021f49efb1fa3d3f5221 Author: Alan Coopersmith Date: Sun Oct 31 12:05:38 2010 -0700 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now Signed-off-by: Alan Coopersmith commit 070c9d45cc0678708d5766804d0c529bc6f8bee3 Author: Alan Coopersmith Date: Thu Jul 1 16:38:53 2010 -0700 Xmu functions are called directly, so include it in PKG_CHECK_MODULES Signed-off-by: Alan Coopersmith commit 3fb1f51edec3e4b599d8e8b42e8220bf526bc3b4 Author: Alan Coopersmith Date: Wed Jun 30 23:25:03 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS The existing statement can now be removed from the configuration file. Use XORG_DEFAULT_OPTIONS provided $(SED) Use platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit 6b546577aadec95c09da148936dbfd55b9cd0216 Author: Alan Coopersmith Date: Thu Dec 17 08:32:12 2009 -0800 xbiff 1.0.2 Signed-off-by: Alan Coopersmith commit 82e802ad978b110dd093b620e91589ca689dcff6 Author: Alan Coopersmith Date: Thu Dec 17 08:25:19 2009 -0800 Fill in COPYING with notices from source code Signed-off-by: Alan Coopersmith commit d8c551691ff2c28b2d90af47ada68bc3ee78bdc8 Author: Gaetan Nadon Date: Thu Nov 26 09:19:52 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit c7475f38f7aec802914af26043bb0d950880a77e Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit be7954a66400b0efacf01d159752f5ea2886564f Author: Gaetan Nadon Date: Mon Oct 26 22:08:38 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit 4511a4a0030b9a33a6056f76a5e126d76611c463 Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit 111206b3ad0b0536bdc8c39425f79f50665c3000 Author: Alan Coopersmith Date: Mon Oct 12 18:34:18 2009 -0700 Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS Signed-off-by: Alan Coopersmith commit 492785cb489963cff20e7d20b87d33ffa5508247 Author: Alan Coopersmith Date: Thu Oct 1 14:54:20 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit b88273dcdd403e058888fbcdf4a0470854045179 Author: Paulo Cesar Pereira de Andrade Date: Tue Jan 13 20:54:08 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings. commit 4882f2fc26a5976fe7744286932263c83f1c61dc Author: James Cloos Date: Wed Aug 20 10:32:49 2008 -0400 xaw8 is gone, use xaw7 commit bdd747628f08de80eb311d6e7ef2cd1dd9b34943 Author: James Cloos Date: Thu Dec 6 16:37:09 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit e00caacfa0a86692928f81039ece9341745bc3d0 Author: James Cloos Date: Mon Sep 3 05:51:15 2007 -0400 Add *~ to .gitignore to skip patch/emacs droppings commit e3abf6683d15c67e796a395b30437fd01ff3b538 Author: James Cloos Date: Thu Aug 23 19:24:40 2007 -0400 Rename .cvsignore to .gitignore commit 0365e1a08ddb0c5961a0c52f9cf4a8368cf312e5 Author: Kevin E Martin Date: Wed Dec 21 02:29:48 2005 +0000 Update package version for X11R7 release. commit 7ad243529fe6d78e52dea5a22a24f7f83a22ba62 Author: Adam Jackson Date: Mon Dec 19 16:22:42 2005 +0000 Stub COPYING files commit efd4fed0e413ddf6d93c366041f6cb9a6e622375 Author: Kevin E Martin Date: Thu Dec 15 00:24:04 2005 +0000 Update package version number for final X11R7 release candidate. commit d54d4ef448b3e16ec9151c6dd4143ca32eaf32a5 Author: Kevin E Martin Date: Tue Dec 6 22:48:19 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit a2cf84dad681150f17186bc929e4958017d19d8c Author: Kevin E Martin Date: Sat Dec 3 05:49:18 2005 +0000 Update package version number for X11R7 RC3 release. commit 96700fc277e1a211aca0fe1b2e87d87d7f359fcc Author: Alan Coopersmith Date: Mon Nov 28 22:01:39 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit ca0fb29b3fe6e8b574dfe2e692734127ab7a3d43 Author: Eric Anholt Date: Mon Nov 21 10:34:58 2005 +0000 Another pass at .cvsignores for apps. commit acded00af405734d1611db4fe6d0e9940b8bd326 Author: Eric Anholt Date: Sun Nov 20 22:08:50 2005 +0000 Add/improve .cvsignore files for apps. commit 8114be741f5386cebfa24de82474b49c438dc78d Author: Kevin E Martin Date: Sat Nov 19 07:15:36 2005 +0000 Update pkgconfig files to separate library build-time dependencies from application build-time dependencies, and update package deps to work with separate build roots. commit 3097fcab22bf84f0bb6faee69c99c950a79bb1c4 Author: Kevin E Martin Date: Wed Oct 19 02:47:52 2005 +0000 Update package version number for RC1 release. commit 7aeb50852f7111ba9a4ad3404bea0d20e1602502 Author: Alan Coopersmith Date: Mon Oct 17 23:56:21 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit c080a49a36c2f90fae774550553791da721e9240 Author: Alan Coopersmith Date: Fri Oct 14 00:25:43 2005 +0000 Use sed to fill in variables in man page commit ae73bd0c0087ebde446d6e4956242088a315ab6c Author: Kristian Høgsberg Date: Tue Sep 27 18:35:34 2005 +0000 Fix configure.ac to not require xaw8 unconditionally. commit 25b5d282c0264508adbd695010632cde93f55a2f Author: Alan Coopersmith Date: Mon Aug 1 20:25:29 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit b89877374f51e8b9c83ca1aa55e246391038ffba Author: Kevin E Martin Date: Fri Jul 29 21:22:31 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit a8d1903bfd5ee45e6736427be85adef5624d661a Author: Matthieu Herrb Date: Sat Jul 23 15:46:06 2005 +0000 xbiff depends on Xaw commit d9ea3ae597b97c173faa6dd29077ddf3a4bbc5ac Author: Adam Jackson Date: Wed Jul 20 19:31:51 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit df4faebea1a9a32c5c4b78a2585cbf6a443181a7 Author: Søren Sandmann Pedersen Date: Sat Jul 16 21:40:42 2005 +0000 Add _BSD_SOURCE - patch from Stefan Dirsch commit b3b0fffccaec04ca4bf47409dc39fba17819ee06 Author: Søren Sandmann Pedersen Date: Fri Jul 15 16:53:50 2005 +0000 Add dependency on xbitmaps commit ee0c19e43392bb8bc343a617d92e3784845511b6 Author: Søren Sandmann Pedersen Date: Wed Jul 6 15:21:38 2005 +0000 Build system for xbiff commit dbaae0652239411598a00da1ee5af65a5b101a98 Author: Egbert Eich Date: Fri Apr 23 19:54:38 2004 +0000 Merging XORG-CURRENT into trunk commit fd6ce9234674249a5ef7cc6fb3a13d3ff604a24a Author: Egbert Eich Date: Sun Mar 14 08:35:00 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit d0ae3505f328fbc52752a17b7d3033021ce2b0c3 Author: Egbert Eich Date: Wed Mar 3 12:12:55 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit c946d9c9cf9222327544ca677e26de0fe796ba95 Author: Egbert Eich Date: Thu Feb 26 13:36:16 2004 +0000 readding XFree86's cvs IDs commit 1fb603e5ba366ab79a17f6d79f7fc6dd6988cda6 Author: Egbert Eich Date: Thu Feb 26 09:23:58 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit 8dcf7ae639f46e982131632b7cc0c37a8fd4ee97 Author: Kaleb Keithley Date: Tue Nov 25 19:29:03 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit f2fc3bc2312c7af4f0cd5fee2e08be7c0ca115b3 Author: Kaleb Keithley Date: Fri Nov 14 16:48:58 2003 +0000 XFree86 4.3.0.1 commit 248f03b4a519c635bdfa16ae1c7aa708a006c580 Author: Kaleb Keithley Date: Fri Nov 14 16:48:58 2003 +0000 Initial revision x11-apps-7.7+5+nmu1ubuntu1/xbiff/config.guess0000664000000000000000000012776412167023104015621 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. timestamp='2010-08-21' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' HUP INT TERM # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-tilera-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xbiff/bitmaps/0000775000000000000000000000000012167023104014722 5ustar x11-apps-7.7+5+nmu1ubuntu1/xbiff/bitmaps/mail-up-mask0000664000000000000000000000364612167023104017153 0ustar #define mail_up_mask_width 48 #define mail_up_mask_height 48 #define mail_up_mask_x_hot -1 #define mail_up_mask_y_hot -1 static char mail_up_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/xbiff/bitmaps/mail-up0000664000000000000000000000353312167023104016215 0ustar #define mail_up_width 48 #define mail_up_height 48 static char mail_up_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0xfa, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2e, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x21, 0x20, 0x00, 0x00, 0x00, 0x00, 0x21, 0xa0, 0x03, 0x00, 0x00, 0x70, 0x21, 0x20, 0x00, 0x00, 0x00, 0x50, 0x21, 0xa0, 0x1f, 0x00, 0x00, 0x50, 0x21, 0x20, 0x00, 0x00, 0x00, 0x70, 0x21, 0xfe, 0xff, 0xff, 0xff, 0x0f, 0x21, 0x02, 0x00, 0x00, 0x00, 0x08, 0x21, 0xfa, 0x01, 0x00, 0x80, 0x0b, 0x21, 0x02, 0x00, 0x00, 0x80, 0x0a, 0x21, 0xba, 0x01, 0x00, 0x80, 0x0a, 0x21, 0x02, 0x00, 0x00, 0x80, 0x0b, 0x21, 0x3a, 0x00, 0x00, 0x00, 0x08, 0x21, 0x02, 0x00, 0x00, 0x00, 0x08, 0x21, 0x02, 0xc0, 0xfb, 0x03, 0x08, 0x21, 0x02, 0x00, 0x00, 0x00, 0x08, 0x3f, 0x02, 0xc0, 0xbd, 0x0f, 0x08, 0x01, 0x02, 0x00, 0x00, 0x00, 0x08, 0x01, 0x02, 0xc0, 0x7f, 0x7b, 0x08, 0x01, 0x02, 0x00, 0x00, 0x00, 0x08, 0x01, 0x02, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/xbiff/bitmaps/mail-down0000664000000000000000000000354112167023104016537 0ustar #define mail_down_width 48 #define mail_down_height 48 static char mail_down_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/xbiff/bitmaps/mail-down-mask0000664000000000000000000000366012167023104017472 0ustar #define mail_down_mask_width 48 #define mail_down_mask_height 48 #define mail_down_mask_x_hot -1 #define mail_down_mask_y_hot -1 static char mail_down_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; x11-apps-7.7+5+nmu1ubuntu1/xbiff/Mailbox.h0000664000000000000000000000454412167023104015036 0ustar /* $XConsortium: Mailbox.h,v 1.21 94/04/17 20:43:27 rws Exp $ */ /* Copyright (c) 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _XawMailbox_h #define _XawMailbox_h /* * Mailbox widget; looks a lot like the clock widget, don't it... */ /* resource names used by mailbox widget that aren't defined in StringDefs.h */ #ifndef _XtStringDefs_h_ #define XtNupdate "update" #endif /* command to exec */ #define XtNcheckCommand "checkCommand" #define XtNonceOnly "onceOnly" /* Int: volume for bell */ #define XtNvolume "volume" #define XtNfullPixmap "fullPixmap" #define XtNfullPixmapMask "fullPixmapMask" #define XtNemptyPixmap "emptyPixmap" #define XtNemptyPixmapMask "emptyPixmapMask" #define XtNflip "flip" #define XtNshapeWindow "shapeWindow" #define XtCCheckCommand "CheckCommand" #define XtCVolume "Volume" #define XtCPixmapMask "PixmapMask" #define XtCFlip "Flip" #define XtCShapeWindow "ShapeWindow" /* structures */ typedef struct _MailboxRec *MailboxWidget; /* see MailboxP.h */ typedef struct _MailboxClassRec *MailboxWidgetClass; /* see MailboxP.h */ extern WidgetClass mailboxWidgetClass; #endif /* _XawMailbox_h */ /* DON'T ADD STUFF AFTER THIS #endif */ x11-apps-7.7+5+nmu1ubuntu1/xbiff/xbiff.c0000664000000000000000000001007012167023104014523 0ustar /* $XConsortium: xbiff.c,v 1.19 94/04/17 20:43:28 rws Exp $ */ /* Copyright (c) 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XFree86: xc/programs/xbiff/xbiff.c,v 1.3tsi Exp $ */ #include #include #include #include #include #include "Mailbox.h" #include static const char *ProgramName; static XrmOptionDescRec options[] = { { "-update", "*mailbox.update", XrmoptionSepArg, (caddr_t) NULL }, { "-file", "*mailbox.file", XrmoptionSepArg, (caddr_t) NULL }, { "-volume", "*mailbox.volume", XrmoptionSepArg, (caddr_t) NULL }, { "-shape", "*mailbox.shapeWindow", XrmoptionNoArg, (caddr_t) "on" }, }; static Atom wm_delete_window; static void quit (Widget w, XEvent *event, String *params, Cardinal *num_params) { if (event->type == ClientMessage && event->xclient.data.l[0] != wm_delete_window) { XBell (XtDisplay(w), 0); return; } XCloseDisplay (XtDisplay(w)); exit (0); } static XtActionsRec xbiff_actions[] = { { "quit", quit }, }; static void Usage (void) { static const char *help_message[] = { "where options include:", " -display host:dpy X server to contact", " -geometry geom size of mailbox", " -file file file to watch", " -update seconds how often to check for mail", " -volume percentage how loud to ring the bell", " -bg color background color", " -fg color foreground color", " -rv reverse video", " -shape shape the window", NULL}; const char **cpp; fprintf (stderr, "usage: %s [-options ...]\n", ProgramName); for (cpp = help_message; *cpp; cpp++) fprintf (stderr, "%s\n", *cpp); fprintf (stderr, "\n"); exit (1); } int main (int argc, char **argv) { XtAppContext xtcontext; Widget toplevel; ProgramName = argv[0]; XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); toplevel = XtAppInitialize(&xtcontext, "XBiff", options, XtNumber (options), &argc, argv, NULL, NULL, 0); if (argc != 1) Usage (); /* * This is a hack so that f.delete will do something useful in this * single-window application. */ wm_delete_window = XInternAtom (XtDisplay(toplevel), "WM_DELETE_WINDOW", False); XtAppAddActions (xtcontext, xbiff_actions, XtNumber(xbiff_actions)); XtOverrideTranslations(toplevel, XtParseTranslationTable ("WM_PROTOCOLS: quit()")); (void) XtCreateManagedWidget ("mailbox", mailboxWidgetClass, toplevel, NULL, 0); XtRealizeWidget (toplevel); (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel), &wm_delete_window, 1); XtAppMainLoop (xtcontext); return 0; } x11-apps-7.7+5+nmu1ubuntu1/xbiff/config.h.in0000664000000000000000000000337212656634623015334 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_PATHS_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Directory containing user mailboxes */ #undef MAILBOX_DIRECTORY /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION x11-apps-7.7+5+nmu1ubuntu1/xbiff/man/0000775000000000000000000000000012656635743014063 5ustar x11-apps-7.7+5+nmu1ubuntu1/xbiff/man/xbiff.man0000664000000000000000000001700512167023104015634 0ustar .\" $XConsortium: xbiff.man,v 1.22 94/04/17 20:43:28 gildea Exp $ .\" Copyright (c) 1988 X Consortium .\" .\" Permission is hereby granted, free of charge, to any person obtaining .\" a copy of this software and associated documentation files (the .\" "Software"), to deal in the Software without restriction, including .\" without limitation the rights to use, copy, modify, merge, publish, .\" distribute, sublicense, and/or sell copies of the Software, and to .\" permit persons to whom the Software is furnished to do so, subject to .\" the following conditions: .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of the X Consortium shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from the X Consortium. .\" .\" $XFree86: xc/programs/xbiff/xbiff.man,v 1.3 2001/01/27 18:21:08 dawes Exp $ .\" .TH XBIFF 1 __xorgversion__ .SH NAME xbiff \- mailbox flag for X .SH SYNOPSIS .B xbiff [ \-\fItoolkitoption\fP ... ] [ \fI\-option\fP ... ] .SH DESCRIPTION The .I xbiff program displays a little image of a mailbox. When there is no mail, the flag on the mailbox is down. When mail arrives, the flag goes up and the mailbox beeps. By default, pressing any mouse button in the image forces \fIxbiff\fP to remember the current size of the mail file as being the ``empty'' size and to lower the flag. .SH OPTIONS .I Xbiff accepts all of the standard X Toolkit command line options along with the additional options listed below: .TP 8 .B \-help This option indicates that a brief summary of the allowed options should be printed on the standard error. .TP 8 .B \-update \fIseconds\fP This option specifies the frequency in seconds at which \fIxbiff\fP should update its display. If the mailbox is obscured and then exposed, it will be updated immediately. The default is 30 seconds. .TP 8 .B \-file \fIfilename\fP This option specifies the name of the file which should be monitored. By default it watches your inbox in the default location for your system (some examples are .RI /var/mail/ username , .RI /usr/spool/mail/ username , .RI /var/spool/mail/ username (where .I username is your login name). If the MAIL environment variable is set, the file specified by it will be monitored. .TP 8 .B \-volume \fIpercentage\fP This option specifies how loud the bell should be rung when new mail comes in. .TP 8 .B \-shape This option indicates that the mailbox window should be shaped if masks for the empty or full images are given. .PP The following standard X Toolkit command line arguments are commonly used with .I xbiff: .TP 8 .B \-display \fIdisplay\fP This option specifies the X server to contact. .TP 8 .B \-geometry \fIgeometry\fP This option specifies the preferred size and position of the mailbox window. The mailbox is 48 pixels wide and 48 pixels high and will be centered in the window. .TP 8 .B \-bg \fIcolor\fP This option specifies the color to use for the background of the window. .TP 8 .B \-bd \fIcolor\fP This option specifies the color to use for the border of the window. .TP 8 .B \-bw \fInumber\fP This option specifies the width in pixels of the border surrounding the window. .TP 8 .B \-fg \fIcolor\fP This option specifies the color to use for the foreground of the window. .TP 8 .B \-rv This option indicates that reverse video should be simulated by swapping the foreground and background colors. .TP 8 .B \-xrm \fIresourcestring\fP This option specifies a resource string to be used. This is especially useful for setting resources that do not have separate command line options. .SH X DEFAULTS The application class name is XBiff. This program uses the .I Mailbox widget. It understands all of the core resource names and classes as well as: .PP .TP 8 .B checkCommand (\fPclass\fB CheckCommand) Specifies a shell command to be executed to check for new mail rather than examining the size of \fBfile\fP. The specified string value is used as the argument to a \fIsystem\fP(__libmansuffix__) call and may therefore contain i/o redirection. An exit status of 0 indicates that new mail is waiting, 1 indicates that there has been no change in size, and 2 indicates that the mail has been cleared. By default, no shell command is provided. .TP 8 .B file (\fPclass\fB File) Specifies the name of the file to monitor. The default is as described above for the .B \-file command line option. .TP 8 .B onceOnly (\fPclass\fB Boolean) Specifies that the bell is only rung the first time new mail is found and is not rung again until at least one interval has passed with no mail waiting. The window will continue to indicate the presence of new mail until it has been retrieved. The default is false. .TP 8 .B width (\fPclass\fB Width) Specifies the width of the mailbox. .TP 8 .B height (\fPclass\fB Height) Specifies the height of the mailbox. .TP 8 .B update (\fPclass\fB Interval) Specifies the frequency in seconds at which the mail should be checked. The default is 30. .TP 8 .B volume (\fPclass\fB Volume) Specifies how loud the bell should be rung. The default is 33 percent. .TP 8 .B foreground (\fPclass\fB Foreground) Specifies the color for the foreground. .TP 8 .B reverseVideo (\fPclass\fB ReverseVideo) Specifies that the foreground and background should be reversed. .TP 8 .B flip (\fPclass\fB Flip) Specifies whether or not the image that is shown when mail has arrived should be inverted. The default is ``true.'' .TP 8 .B fullPixmap (\fPclass\fB Pixmap) Specifies a bitmap to be shown when new mail has arrived. The default is flagup. .TP 8 .B emptyPixmap (\fPclass\fB Pixmap) Specifies a bitmap to be shown when no new mail is present. The default is flagdown. .TP 8 .B shapeWindow (\fPclass\fB ShapeWindow) Specifies whether or not the mailbox window should be shaped to the given fullPixmapMask and emptyPixmapMask. The default is false. .TP 8 .B fullPixmapMask (\fPclass\fB PixmapMask) Specifies a mask for the bitmap to be shown when new mail has arrived. The default is none. .TP 8 .B emptyPixmapMask (\fPclass\fB PixmapMask) Specifies a mask for the bitmap to be shown when no new mail is present. The default is none. .SH ACTIONS The \fIMailbox\fP widget provides the following actions for use in event translations: .TP 8 .B check() This action causes the widget to check for new mail and display the flag appropriately. .TP 8 .B unset() This action causes the widget to lower the flag until new mail comes in. .TP 8 .B set() This action causes the widget to raise the flag until the user resets it. .PP The default translation is .sp .nf : unset() .fi .sp .SH ENVIRONMENT .PP .TP 8 .B DISPLAY to get the default host and display number. .TP 8 .B XENVIRONMENT to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH "SEE ALSO" X(__miscmansuffix__), xrdb(__appmansuffix__), stat(2) .SH BUGS The mailbox bitmaps are ugly. .SH AUTHOR Jim Fulton, MIT X Consortium .br Additional hacks by Ralph Swick, DEC/MIT Project Athena x11-apps-7.7+5+nmu1ubuntu1/xbiff/man/Makefile.am0000664000000000000000000000052312167023104016072 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = xbiff.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/xbiff/config.sub0000664000000000000000000010437612167023104015256 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. timestamp='2010-09-11' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile-* | tilegx-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; # This must be matched before tile*. tilegx*) basic_machine=tilegx-unknown os=-linux-gnu ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xbiff/Makefile.am0000664000000000000000000000307212167023104015321 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = xbiff AM_CFLAGS = $(CWARNFLAGS) $(XBIFF_CFLAGS) -D_BSD_SOURCE xbiff_LDADD = $(XBIFF_LIBS) xbiff_SOURCES = \ Mailbox.c \ Mailbox.h \ MailboxP.h \ xbiff.c EXTRA_DIST = bitmaps/mail-down bitmaps/mail-up bitmaps/mail-down-mask bitmaps/mail-up-mask MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xbiff/configure.ac0000664000000000000000000000472412167023104015560 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xbiff], [1.0.3], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xbiff]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS # Checks for pkg-config packages PKG_CHECK_MODULES(XBIFF, xaw7 xmu xbitmaps xext x11) # Checks for headers AC_CHECK_HEADERS([paths.h]) # Allow builder to set path to look for mailboxes AC_MSG_CHECKING([for mailbox directory]) AC_ARG_WITH([mailbox-directory], [AS_HELP_STRING([--with-mailbox-directory=PATH], [specify directory to check for system mailboxes])], [mailbox_directory=$with_mailbox_directory]) if test "x$mailbox_directory" != "x"; then AC_DEFINE_UNQUOTED([MAILBOX_DIRECTORY], ["$mailbox_directory"], [Directory containing user mailboxes]) AC_MSG_RESULT([$mailbox_directory]) else AC_MSG_RESULT([not set]) fi AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xbiff/README0000664000000000000000000000143112167023104014142 0ustar xbiff provides graphical notification of new e-mail. It only handles mail stored in a filesystem accessible file, not via IMAP, POP or other remote access protocols. All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xbiff http://cgit.freedesktop.org/xorg/app/xbiff For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xbiff/COPYING0000664000000000000000000000237012167023104014320 0ustar Copyright (c) 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. x11-apps-7.7+5+nmu1ubuntu1/xbiff/INSTALL0000664000000000000000000002622212167023104014320 0ustar Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 6. Often, you can also type `make uninstall' to remove the installed files again. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *Note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xbiff/Mailbox.c0000664000000000000000000004652312167023104015034 0ustar /* $XConsortium: Mailbox.c,v 1.64 94/04/17 20:43:26 rws Exp $ */ /* Copyright (c) 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XFree86: xc/programs/xbiff/Mailbox.c,v 1.4 2001/08/01 00:45:02 tsi Exp $ */ /* * Author: Jim Fulton, MIT X Consortium * * I recommend that you use the new mailfull and mailempty bitmaps instead of * the ugly mailboxes: * * XBiff*fullPixmap: mailfull * XBiff*emptyPixmap: mailempty */ #include /* for toolkit stuff */ #include /* for useful atom names */ #include /* for cursor constants */ #include /* for X_NOT_POSIX def */ #include #ifdef WIN32 #include #else #include /* for getting username */ #endif #include /* for stat() ** needs types.h ***/ #include /* for printing error messages */ #include #ifndef X_NOT_POSIX #ifdef _POSIX_SOURCE # include #else #define _POSIX_SOURCE # include #undef _POSIX_SOURCE #endif # define waitCode(w) WEXITSTATUS(w) # define waitSig(w) WIFSIGNALED(w) typedef int waitType; # define INTWAITTYPE #else /* ! X_NOT_POSIX */ #ifdef SYSV # define waitCode(w) (((w) >> 8) & 0x7f) # define waitSig(w) ((w) & 0xff) typedef int waitType; # define INTWAITTYPE #else #ifdef WIN32 #include # define INTWAITTYPE typedef int waitType; # define waitCode(w) (w) # define waitSig(w) (0) #else # include # define waitCode(w) ((w).w_T.w_Retcode) # define waitSig(w) ((w).w_T.w_Termsig) typedef union wait waitType; #endif /* WIN32 else */ #endif /* SYSV else */ #endif /* ! X_NOT_POSIX else */ #include /* for flag up (mail present) bits */ #include /* for flag down (mail not here) */ #include #include "MailboxP.h" /* for implementation mailbox stuff */ #include #include /* * The default user interface is to have the mailbox turn itself off whenever * the user presses a button in it. Expert users might want to make this * happen on EnterWindow. It might be nice to provide support for some sort of * exit callback so that you can do things like press q to quit. */ static char defaultTranslations[] = ": unset()"; static void Set (Widget gw, XEvent *event, String *params, Cardinal *nparams); static void Check(Widget gw, XEvent *event, String *params, Cardinal *nparams); static void Unset(Widget gw, XEvent *event, String *params, Cardinal *nparams); static XtActionsRec actionsList[] = { { "check", Check }, { "unset", Unset }, { "set", Set }, }; /* Initialization of defaults */ #define offset(field) XtOffsetOf(MailboxRec, mailbox.field) #define goffset(field) XtOffsetOf(WidgetRec, core.field) static Dimension defDim = 48; static Pixmap nopix = None; static XtResource resources[] = { { XtNwidth, XtCWidth, XtRDimension, sizeof (Dimension), goffset (width), XtRDimension, (XtPointer)&defDim }, { XtNheight, XtCHeight, XtRDimension, sizeof (Dimension), goffset (height), XtRDimension, (XtPointer)&defDim }, { XtNupdate, XtCInterval, XtRInt, sizeof (int), offset (update), XtRString, "30" }, { XtNforeground, XtCForeground, XtRPixel, sizeof (Pixel), offset (foreground_pixel), XtRString, XtDefaultForeground }, { XtNfile, XtCFile, XtRString, sizeof (String), offset (filename), XtRString, NULL }, { XtNcheckCommand, XtCCheckCommand, XtRString, sizeof(char*), offset (check_command), XtRString, NULL}, { XtNvolume, XtCVolume, XtRInt, sizeof(int), offset (volume), XtRString, "33"}, { XtNonceOnly, XtCBoolean, XtRBoolean, sizeof(Boolean), offset (once_only), XtRImmediate, (XtPointer)False }, { XtNfullPixmap, XtCPixmap, XtRBitmap, sizeof(Pixmap), offset (full.bitmap), XtRString, "flagup" }, { XtNfullPixmapMask, XtCPixmapMask, XtRBitmap, sizeof(Pixmap), offset (full.mask), XtRBitmap, (XtPointer) &nopix }, { XtNemptyPixmap, XtCPixmap, XtRBitmap, sizeof(Pixmap), offset (empty.bitmap), XtRString, "flagdown" }, { XtNemptyPixmapMask, XtCPixmapMask, XtRBitmap, sizeof(Pixmap), offset (empty.mask), XtRBitmap, (XtPointer) &nopix }, { XtNflip, XtCFlip, XtRBoolean, sizeof(Boolean), offset (flipit), XtRString, "true" }, { XtNshapeWindow, XtCShapeWindow, XtRBoolean, sizeof(Boolean), offset (shapeit), XtRString, "false" }, }; #undef offset #undef goffset static void GetMailFile(MailboxWidget w); static void CloseDown (MailboxWidget w, int status); static void check_mailbox(MailboxWidget w, Boolean force_redraw, Boolean reset); static void redraw_mailbox (MailboxWidget w); static void beep (MailboxWidget w); static void Initialize (Widget request, Widget new, ArgList args, Cardinal *num_args); static void Realize (Widget gw, XtValueMask *valuemaskp, XSetWindowAttributes *attr); static void Destroy (Widget gw); static void Redisplay (Widget gw, XEvent *event, Region region); static Boolean SetValues (Widget gcurrent, Widget grequest, Widget gnew, ArgList args, Cardinal *num_args); MailboxClassRec mailboxClassRec = { { /* core fields */ /* superclass */ (WidgetClass) &simpleClassRec, /* class_name */ "Mailbox", /* widget_size */ sizeof(MailboxRec), /* class_initialize */ XawInitializeWidgetSet, /* class_part_initialize */ NULL, /* class_inited */ FALSE, /* initialize */ Initialize, /* initialize_hook */ NULL, /* realize */ Realize, /* actions */ actionsList, /* num_actions */ XtNumber(actionsList), /* resources */ resources, /* resource_count */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, /* compress_exposure */ TRUE, /* compress_enterleave */ TRUE, /* visible_interest */ FALSE, /* destroy */ Destroy, /* resize */ NULL, /* expose */ Redisplay, /* set_values */ SetValues, /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ defaultTranslations, /* query_geometry */ XtInheritQueryGeometry, /* display_accelerator */ XtInheritDisplayAccelerator, /* extension */ NULL }, { /* simple fields */ /* change_sensitive */ XtInheritChangeSensitive }, { /* mailbox fields */ /* ignore */ 0 } }; WidgetClass mailboxWidgetClass = (WidgetClass) &mailboxClassRec; /* * widget initialization */ static GC get_mailbox_gc (MailboxWidget w) { XtGCMask valuemask; XGCValues xgcv; valuemask = GCForeground | GCBackground | GCFunction | GCGraphicsExposures; xgcv.foreground = w->mailbox.foreground_pixel; xgcv.background = w->core.background_pixel; xgcv.function = GXcopy; xgcv.graphics_exposures = False; /* this is Bool, not Boolean */ return (XtGetGC ((Widget) w, valuemask, &xgcv)); } /* ARGSUSED */ static void Initialize (Widget request, Widget new, ArgList args, Cardinal *num_args) { MailboxWidget w = (MailboxWidget) new; int shape_event_base, shape_error_base; if (w->core.width <= 0) w->core.width = 1; if (w->core.height <= 0) w->core.height = 1; if (w->mailbox.shapeit && !XShapeQueryExtension (XtDisplay (w), &shape_event_base, &shape_error_base)) w->mailbox.shapeit = False; w->mailbox.shape_cache.mask = None; w->mailbox.gc = get_mailbox_gc (w); w->mailbox.interval_id = (XtIntervalId) 0; w->mailbox.full.pixmap = None; w->mailbox.empty.pixmap = None; w->mailbox.flag_up = FALSE; w->mailbox.last_size = 0; if (!w->mailbox.filename) GetMailFile (w); return; } /* * action procedures */ /* * pretend there is new mail; put widget in flagup state */ /* ARGSUSED */ static void Set (Widget gw, XEvent *event, String *params, Cardinal *nparams) { MailboxWidget w = (MailboxWidget) gw; w->mailbox.last_size = -1; check_mailbox (w, TRUE, FALSE); /* redraw, no reset */ } /* * ack the existing mail; put widget in flagdown state */ /* ARGSUSED */ static void Unset (Widget gw, XEvent *event, String *params, Cardinal *nparams) { MailboxWidget w = (MailboxWidget) gw; check_mailbox (w, TRUE, TRUE); /* redraw, reset */ } /* * look to see if there is new mail; if so, Set, else Unset */ /* ARGSUSED */ static void Check (Widget gw, XEvent *event, String *params, Cardinal *nparams) { MailboxWidget w = (MailboxWidget) gw; check_mailbox (w, TRUE, FALSE); /* redraw, no reset */ } /* ARGSUSED */ static void clock_tic (XtPointer client_data, XtIntervalId *id) { MailboxWidget w = (MailboxWidget) client_data; check_mailbox (w, FALSE, FALSE); /* no redraw, no reset */ /* * and reset the timer */ w->mailbox.interval_id = XtAppAddTimeOut (XtWidgetToApplicationContext((Widget) w), w->mailbox.update * 1000, clock_tic, client_data); return; } static Pixmap make_pixmap (Display *dpy, MailboxWidget w, Pixmap bitmap, int depth, Boolean flip, int *widthp, int *heightp) { Window root; int x, y; unsigned int width, height, bw, dep; unsigned long fore, back; if (!XGetGeometry (dpy, bitmap, &root, &x, &y, &width, &height, &bw, &dep)) return None; *widthp = (int) width; *heightp = (int) height; if (flip) { fore = w->core.background_pixel; back = w->mailbox.foreground_pixel; } else { fore = w->mailbox.foreground_pixel; back = w->core.background_pixel; } return XmuCreatePixmapFromBitmap (dpy, w->core.window, bitmap, width, height, depth, fore, back); } static void Realize (Widget gw, XtValueMask *valuemaskp, XSetWindowAttributes *attr) { MailboxWidget w = (MailboxWidget) gw; register Display *dpy = XtDisplay (w); int depth = w->core.depth; *valuemaskp |= (CWBitGravity | CWCursor); attr->bit_gravity = ForgetGravity; attr->cursor = XCreateFontCursor (dpy, XC_top_left_arrow); (*mailboxWidgetClass->core_class.superclass->core_class.realize) (gw, valuemaskp, attr); /* * build up the pixmaps that we'll put into the image */ if (w->mailbox.full.bitmap == None) { w->mailbox.full.bitmap = XCreateBitmapFromData (dpy, w->core.window, (char *) mailfull_bits, mailfull_width, mailfull_height); } if (w->mailbox.empty.bitmap == None) { w->mailbox.empty.bitmap = XCreateBitmapFromData (dpy, w->core.window, (char *) mailempty_bits, mailempty_width, mailempty_height); } w->mailbox.empty.pixmap = make_pixmap (dpy, w, w->mailbox.empty.bitmap, depth, False, &w->mailbox.empty.width, &w->mailbox.empty.height); w->mailbox.full.pixmap = make_pixmap (dpy, w, w->mailbox.full.bitmap, depth, w->mailbox.flipit, &w->mailbox.full.width, &w->mailbox.full.height); if (w->mailbox.empty.mask == None && w->mailbox.full.mask == None) w->mailbox.shapeit = False; w->mailbox.interval_id = XtAppAddTimeOut (XtWidgetToApplicationContext((Widget) w), w->mailbox.update * 1000, clock_tic, (XtPointer) w); w->mailbox.shape_cache.mask = None; check_mailbox (w, TRUE, FALSE); return; } static void Destroy (Widget gw) { MailboxWidget w = (MailboxWidget) gw; Display *dpy = XtDisplay (gw); XtFree (w->mailbox.filename); if (w->mailbox.interval_id) XtRemoveTimeOut (w->mailbox.interval_id); XtReleaseGC(gw, w->mailbox.gc); #define freepix(p) if (p) XFreePixmap (dpy, p) freepix (w->mailbox.full.bitmap); /* until cvter does ref cnt */ freepix (w->mailbox.full.mask); /* until cvter does ref cnt */ freepix (w->mailbox.full.pixmap); freepix (w->mailbox.empty.bitmap); /* until cvter does ref cnt */ freepix (w->mailbox.empty.mask); /* until cvter does ref cnt */ freepix (w->mailbox.empty.pixmap); freepix (w->mailbox.shape_cache.mask); #undef freepix } static void Redisplay (Widget gw, XEvent *event, Region region) { MailboxWidget w = (MailboxWidget) gw; check_mailbox (w, TRUE, FALSE); } static void check_mailbox (MailboxWidget w, Boolean force_redraw, Boolean reset) { long mailboxsize = 0; Boolean readSinceLastWrite = FALSE; if (w->mailbox.check_command != NULL) { waitType wait_status; int check_status; #ifdef INTWAITTYPE wait_status = system(w->mailbox.check_command); #else wait_status.w_status = system(w->mailbox.check_command); #endif check_status = waitCode(wait_status); /* error in sh checkCommand execution */ if (waitSig(wait_status)) check_status = 2; /* act as if there is no mail */ switch (check_status) { case 0: mailboxsize = w->mailbox.last_size + 1; break; case 2: mailboxsize = 0; break; default: /* treat everything else as no change */ /* case 1 is no change */ mailboxsize = w->mailbox.last_size; } } else { struct stat st; if (stat (w->mailbox.filename, &st) == 0) { mailboxsize = st.st_size; readSinceLastWrite = (st.st_atime > st.st_mtime); } } /* * Now check for changes. If reset is set then we want to pretent that * there is no mail. If the mailbox is empty then we want to turn off * the flag. Otherwise if the mailbox has changed size then we want to * put the flag up, unless the mailbox has been read since the last * write. * * The cases are: * o forced reset by user DOWN * o no mailbox or empty (zero-sized) mailbox DOWN * o if read after most recent write DOWN * o same size as last time no change * o bigger than last time UP * o smaller than last time but non-zero UP * * The last two cases can be expressed as different from last * time and non-zero. */ if (reset) { /* forced reset */ w->mailbox.flag_up = FALSE; force_redraw = TRUE; } else if (mailboxsize == 0) { /* no mailbox or empty */ w->mailbox.flag_up = FALSE; if (w->mailbox.last_size > 0) force_redraw = TRUE; /* if change */ } else if (readSinceLastWrite) { /* only when checkCommand is NULL */ /* mailbox has been read after most recent write */ if (w->mailbox.flag_up) { w->mailbox.flag_up = FALSE; force_redraw = TRUE; } } else if (mailboxsize != w->mailbox.last_size) { /* different size */ if (!w->mailbox.once_only || !w->mailbox.flag_up) beep(w); if (!w->mailbox.flag_up) force_redraw = w->mailbox.flag_up = TRUE; } w->mailbox.last_size = mailboxsize; if (force_redraw) redraw_mailbox (w); return; } /* * get user name for building mailbox */ static void GetMailFile (MailboxWidget w) { char *username; char *mailpath; #ifdef WIN32 if (!(username = getenv("USERNAME"))) { fprintf (stderr, "%s: unable to find a username for you.\n", "Mailbox widget"); CloseDown (w, 1); } #else username = getlogin (); if (!username) { struct passwd *pw = getpwuid (getuid ()); if (!pw) { fprintf (stderr, "%s: unable to find a username for you.\n", "Mailbox widget"); CloseDown (w, 1); } username = pw->pw_name; } #endif if ((mailpath = getenv("MAIL"))) { w->mailbox.filename = (String) XtMalloc (strlen (mailpath) + 1); strcpy (w->mailbox.filename, mailpath); } else { w->mailbox.filename = (String) XtMalloc (strlen (MAILBOX_DIRECTORY) + 1 + strlen (username) + 1); strcpy (w->mailbox.filename, MAILBOX_DIRECTORY); strcat (w->mailbox.filename, "/"); strcat (w->mailbox.filename, username); } return; } static void CloseDown (MailboxWidget w, int status) { Display *dpy = XtDisplay (w); XtDestroyWidget ((Widget)w); XCloseDisplay (dpy); exit (status); } /* ARGSUSED */ static Boolean SetValues (Widget gcurrent, Widget grequest, Widget gnew, ArgList args, Cardinal *num_args) { MailboxWidget current = (MailboxWidget) gcurrent; MailboxWidget new = (MailboxWidget) gnew; Boolean redisplay = FALSE; if (current->mailbox.update != new->mailbox.update) { if (current->mailbox.interval_id) XtRemoveTimeOut (current->mailbox.interval_id); new->mailbox.interval_id = XtAppAddTimeOut (XtWidgetToApplicationContext(gnew), new->mailbox.update * 1000, clock_tic, (XtPointer) gnew); } if (current->mailbox.foreground_pixel != new->mailbox.foreground_pixel || current->core.background_pixel != new->core.background_pixel) { XtReleaseGC (gcurrent, current->mailbox.gc); new->mailbox.gc = get_mailbox_gc (new); redisplay = TRUE; } return (redisplay); } /* * drawing code */ static void redraw_mailbox (MailboxWidget w) { register Display *dpy = XtDisplay (w); register Window win = XtWindow (w); register int x, y; GC gc = w->mailbox.gc; Pixel back = w->core.background_pixel; struct _mbimage *im; /* center the picture in the window */ if (w->mailbox.flag_up) { /* paint the "up" position */ im = &w->mailbox.full; if (w->mailbox.flipit) back = w->mailbox.foreground_pixel; } else { /* paint the "down" position */ im = &w->mailbox.empty; } x = (((int)w->core.width) - im->width) / 2; y = (((int)w->core.height) - im->height) / 2; XSetWindowBackground (dpy, win, back); XClearWindow (dpy, win); XCopyArea (dpy, im->pixmap, win, gc, 0, 0, im->width, im->height, x, y); /* * XXX - temporary hack; walk up widget tree to find top most parent (which * will be a shell) and mash it to have our shape. This will be replaced * by a special shell widget. */ if (w->mailbox.shapeit) { Widget parent; for (parent = (Widget) w; XtParent(parent); parent = XtParent(parent)) { x += parent->core.x + parent->core.border_width; y += parent->core.y + parent->core.border_width; } if (im->mask != w->mailbox.shape_cache.mask || x != w->mailbox.shape_cache.x || y != w->mailbox.shape_cache.y) { XShapeCombineMask (XtDisplay(parent), XtWindow(parent), ShapeBounding, x, y, im->mask, ShapeSet); w->mailbox.shape_cache.mask = im->mask; w->mailbox.shape_cache.x = x; w->mailbox.shape_cache.y = y; } } return; } static void beep (MailboxWidget w) { XBell (XtDisplay (w), w->mailbox.volume); return; } x11-apps-7.7+5+nmu1ubuntu1/xman/0000775000000000000000000000000012656635743013155 5ustar x11-apps-7.7+5+nmu1ubuntu1/xman/vendor.c0000664000000000000000000002670112476465600014615 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* Vendor-specific data structures and operations */ #include "globals.h" #include "vendor.h" typedef struct sectionName { const char *name; const char *suffix; } SectionNameRec; #if (defined(__osf__) || defined(SVR4)) && !defined(sun) static SectionNameRec SectionNames[] = { {"(1) User Commands", "1"}, {"(1m) Sys, Administration", "1m"}, {"(2) System Calls", "2"}, {"(3) Subroutines", "3"}, {"(4) File Formats", "4"}, {"(5) Miscellaneous", "5"}, {"(6) Games", "6"}, {"(7) Devices", "7"}, {"(8) Sys. Administration", "8"}, {"(l) Local", "l"}, {"(n) New", "n"}, {"(o) Old", "o"} #ifdef __SCO__ , {"(ADM) System Administration", "ADM"}, {"(ADMN) Network Administration", "ADMN"}, {"(ADMP) Protocol Administration", "ADMP"}, {"(C) Commands", "C"}, {"(CMD) DOS Commands", "CMD"}, {"(CP) Programming Commands", "CP"}, {"(DOS) DOS Subroutines and Libraries", "DOS"}, {"(F) File Formats", "F"}, {"(HW) Hardware Dependant", "HW"}, {"(K) Kernel Subroutines", "K"}, {"(LOCAL) Local utilities for your system", "LOCAL"}, {"(M) Miscellaneous", "M"}, {"(NADM) NFS Administration", "NADM"}, {"(NC) Network Commands", "NC"}, {"(NF) Network File Formats", "NF"}, {"(NS) Network Subroutines", "NS"}, {"(NSL) Network Services", "NSL"}, {"(S) Subroutines and Libraries", "S"}, {"(SCO) Product Engineering Toolkit", "SCO"}, {"(SFF) Socket File Formats", "SFF"}, {"(STR) Streams", "STR"}, {"(TC) Transport Layer Commands", "TC"}, {"(X) X Man pages", "X"}, {"(XNX) Xenix Subroutines, Commands and Libs", "XNX"}, {"(XS) X11 Subroutines and Libraries", "XS"}, {"(Xm) Motif Commands and Subroutines", "Xm"}, {"(Xt) X Intrinsics", "Xt"} #endif }; #else #if defined(sun) && defined(SVR4) /* losing man.cf is useless because it has no section names */ static SectionNameRec SectionNames[] = { {"(1) User Commands", "1"}, {"(1b) SunOS/BSD Compatibility Commands", "1b"}, {"(1c) Communication Commands", "1c"}, {"(1f) FMLI Commands", "1f"}, {"(1m) Maintenance Commands", "1m"}, {"(1s) SunOS Specific Commands", "1s"}, {"(2) System Calls", "2"}, {"(3) Introduction to Library Functions", "3"}, {"(3adm) General Administrative Library Functions", "3adm"}, {"(3aio) Asynchronous I/O Library Functions", "3aio"}, {"(3b) SunOS/BSD Compatibility Functions", "3b"}, {"(3bsm) Security and Auditing Library Functions", "3bsm"}, {"(3c) C Library Functions", "3c"}, {"(3cfgadm) Configuration Administration Library Functions", "3cfgadm"}, {"(3crypt) Encryption and Decryption Library", "3crypt"}, {"(3curses) Curses Library Functions", "3curses"}, {"(3devid) Device ID Library Functions", "3devid"}, {"(3devinfo) Device Information Library Functions", "3devinfo"}, {"(3dl) Dynamic Linking Library Functions", "3dl"}, {"(3dmi) DMI Library Functions", "3dmi"}, {"(3door) Door Library Functions", "3door"}, {"(3e) ELF Library Functions", "3e"}, {"(3elf) ELF Library Functions", "3elf"}, {"(3ext) Extended Library Functions", "3ext"}, {"(3g) C Library Functions", "3g"}, {"(3gen) String Pattern-Matching Library Functions", "3gen"}, {"(3head) Headers", "3head"}, {"(3i) Wide Character Functions", "3i"}, {"(3k) Kernel VM Library Functions", "3k"}, {"(3krb) Kerberos Library Functions", "3krb"}, {"(3kstat) Kernel Statistics Library Functions", "3kstat"}, {"(3kvm) Kernel VM Library Functions", "3kvm"}, {"(3layout) Layout Services Library Functions", "3layout"}, {"(3ldap) LDAP Library Functions", "3ldap"}, {"(3lib) Interface Libraries", "3lib"}, {"(3libucb) SunOS/BSD Compatibility Interface Libraries", "3libucb"}, {"(3m) Mathematical Library Functions", "3m"}, {"(3mail) User Mailbox Library Functions", "3mail"}, {"(3malloc) Memory Allocation Library Functions", "3malloc"}, {"(3mp) Integer Mathematical Library Functions", "3mp"}, {"(3n) Network Functions", "3n"}, {"(3nsl) Networking Services Library Functions", "3nsl"}, {"(3pam) PAM Library Functions", "3pam"}, {"(3plot) Graphics Interface Library Functions", "3plot"}, {"(3proc) Process Control Library Functions", "3proc"}, {"(3r) Realtime Library", "3r"}, {"(3rac) Remote Asynchronous Calls Library Functions", "3rac"}, {"(3resolv) Resolver Library Functions", "3resolv"}, {"(3rpc) RPC Library Functions", "3rpc"}, {"(3rt) Realtime Library Functions", "3rt"}, {"(3s) Standard I/O Functions", "3s"}, {"(3sched) LWP Scheduling Library Functions", "3sched"}, {"(3sec) File Access Control Library Functions", "3sec"}, {"(3secdb) Security Attributes Database Library Functions", "3secdb"}, {"(3snmp) SNMP Library Functions", "3snmp"}, {"(3socket) Sockets Library Functions", "3socket"}, {"(3t) Threads Library Functions", "3t"}, {"(3thr) Threads Library Functions", "3thr"}, {"(3tnf) TNF Library Functions", "3tnf"}, {"(3ucb) SunOS/BSD Compatibility Library Functions", "3ucb"}, {"(3volmgt) Volume Management Library Functions", "3volmgt"}, {"(3x) Miscellaneous Library Functions", "3x"}, {"(3xc) X/Open Curses Library Functions", "3xc"}, {"(3xcurses) X/Open Curses Library Functions", "3xcurses"}, {"(3xfn) XFN Interface Library Functions", "3xfn"}, {"(3xn) X/Open Networking Services Library Functions", "3xn"}, {"(3xnet) X/Open Networking Services Library Functions", "3xnet"}, {"(3x11) X Window System: Xlib Functions", "3x11"}, {"(3xcb) X Window System: X C Binding Functions", "3xcb"}, {"(3xext) X Window System: Protocol Extension Functions", "3xext"}, {"(3xi) X Window System: Input Extension Functions", "3xi"}, {"(3xmu) X Window System: Miscellaneous Utility Functions","3xmu"}, {"(3xp) X Window System: Print Extension Functions", "3xp"}, {"(3xt) X Window System: Toolkit Intrinsics Functions", "3xt"}, {"(4) File Formats", "4"}, {"(4b) Misc. Reference Manual Pages", "4b"}, {"(5) Environments, Tables, and TROFF Macros", "5"}, {"(6) Games and Demos", "6"}, {"(7) Special Files", "7"}, {"(7d) Devices", "7d"}, {"(7fs) File Systems", "7fs"}, {"(7i) Ioctl Requests", "7i"}, {"(7m) STREAMS Modules", "7m"}, {"(7p) Protocols", "7p"}, {"(9) Device Driver Information", "9"}, {"(9e) DDI and DKI Driver Entry Points", "9e"}, {"(9f) DDI and DKI Kernel Functions", "9f"}, {"(9s) DDI and DKI Data Structures", "9s"}, {"(l) Local", "l"}, {"(n) New", "n"}, {"(o) Old", "o"} }; #else static SectionNameRec SectionNames[] = { {"(1) User Commands", "1"}, {"(2) System Calls", "2"}, {"(3) Subroutines", "3"}, {"(4) Devices", "4"}, {"(5) File Formats", "5"}, {"(6) Games", "6"}, {"(7) Miscellaneous", "7"}, {"(8) Sys. Administration", "8"}, #if defined(__OpenBSD__) || defined(__NetBSD__) {"(9) Kernel Manual", "9"}, #endif #if defined(__FreeBSD__) {"(9) Kernel Interfaces", "9"}, #endif {"(l) Local", "l"}, {"(n) New", "n"}, {"(o) Old", "o"}, #ifdef sony {"(p) Public Domain", "p"}, {"(s) Sony Specific", "s"}, #endif }; #endif #endif /* Function Name: AddStandardSections * Description: Adds all the standard sections to the list for this path. * Arguments: list - a pointer to the section list. * path - the path to these standard sections. * Returns: none. */ void AddStandardSections(SectionList ** list, const char *path) { register int i; char file[BUFSIZ]; int numSections = sizeof(SectionNames) / sizeof(SectionNames[0]); for (i = 0; i < numSections; i++) { snprintf(file, sizeof(file), "%s%s", SEARCHDIR, SectionNames[i].suffix); AddNewSection(list, path, file, SectionNames[i].name, TRUE); #ifdef SEARCHOTHER snprintf(file, sizeof(file), "%s%s", SEARCHOTHER, SectionNames[i].suffix); AddNewSection(list, path, file, SectionNames[i].name, TRUE); #endif } } /* Function Name: CreateManpageName * Description: Creates the manual page name for a given item. * Arguments: entry - the entry to convert. * Returns: the manual page properly allocated. */ /* * If the filename is foo.3 - Create an entry of the form: foo * If the filename is foo.3X11 - Create an entry of the form: foo(X11) * IF the filename is a.out.1 - Create an entry of the form: a.out */ char * CreateManpageName(const char *entry, int section, /* FIXME: unused */ int flags) { char *cp; char page[BUFSIZ]; char sect[BUFSIZ]; ParseEntry(entry, NULL, sect, page); if ((cp = strrchr(page, '.')) != NULL) { if ((int) strlen(cp) > 2) { *cp++ = '('; while ((cp[1] != '\0')) { *cp = *(cp + 1); cp++; } *cp++ = ')'; *cp = '\0'; } else *cp = '\0'; } return (XtNewString(page)); } x11-apps-7.7+5+nmu1ubuntu1/xman/globals.c0000664000000000000000000000416012476465600014736 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include "man.h" Xman_Resources resources; /* Resource manager sets these. */ /* bookkeeping global variables. */ Widget help_widget; /* The help widget. */ int default_height, default_width; /* Approximately the default width and height, of the manpage when shown, the the top level manual page window */ Manual *manual; /* The manual structure. */ int sections; /* The number of manual sections. */ int man_pages_shown; /* The current number of manual pages being shown, if 0 we exit. */ Widget initial_widget; /* The initial widget, never realized. */ XContext manglobals_context; /* The context for man_globals. */ x11-apps-7.7+5+nmu1ubuntu1/xman/buttons.c0000664000000000000000000006214012476465600015013 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * xman - X window system manual page display program. * Author: Chris D. Peterson, MIT Project Athena * Created: October 27, 1987 */ #include "globals.h" #include "vendor.h" /* The files with the icon bits in them. */ #include "icon_open.h" #include "icon_help.h" #include "iconclosed.h" static void CreateOptionMenu(ManpageGlobals * man_globals, Widget parent); static void CreateSectionMenu(ManpageGlobals * man_globals, Widget parent); static void StartManpage(ManpageGlobals * man_globals, Boolean help, Boolean page); static Widget *ConvertNamesToWidgets(Widget parent, const char **names); /* Function Name: MakeTopBox * Description: This function creates the top menu, in a shell widget. * Arguments: none. * Returns: the top level widget */ #define TOPARGS 5 Widget top; /* needed in PopupWarning, misc.c */ void MakeTopBox(void) { Widget form, command, label; /* widgets. */ Arg arglist[TOPARGS]; /* An argument list */ Cardinal num_args = 0; /* The number of arguments. */ ManpageGlobals *man_globals; static const char *full_size[] = { "topLabel", MANPAGE_BUTTON, NULL }; static const char *half_size[] = { HELP_BUTTON, QUIT_BUTTON, NULL }; /* create the top icon. */ num_args = 0; XtSetArg(arglist[num_args], XtNiconPixmap, XCreateBitmapFromData(XtDisplay(initial_widget), XtScreen(initial_widget)->root, (const char *) iconclosed_bits, iconclosed_width, iconclosed_height)); num_args++; XtSetArg(arglist[num_args], XtNtitle, resources.title); num_args++; XtSetArg(arglist[num_args], XtNiconic, resources.iconic); num_args++; top = XtCreatePopupShell(TOPBOXNAME, topLevelShellWidgetClass, initial_widget, arglist, num_args); form = XtCreateManagedWidget("form", formWidgetClass, top, NULL, (Cardinal) 0); label = XtCreateManagedWidget("topLabel", labelWidgetClass, form, NULL, (Cardinal) 0); num_args = 0; XtSetArg(arglist[num_args], XtNfromVert, label); num_args++; command = XtCreateManagedWidget(HELP_BUTTON, commandWidgetClass, form, arglist, num_args); /* use same vertical as help widget. */ XtSetArg(arglist[num_args], XtNfromHoriz, command); num_args++; command = XtCreateManagedWidget(QUIT_BUTTON, commandWidgetClass, form, arglist, num_args); num_args = 0; XtSetArg(arglist[num_args], XtNfromVert, command); num_args++; command = XtCreateManagedWidget(MANPAGE_BUTTON, commandWidgetClass, form, arglist, num_args); help_widget = NULL; /* We have not seen the help yet. */ FormUpWidgets(form, full_size, half_size); XtRealizeWidget(top); /* add WM_COMMAND property */ XSetCommand(XtDisplay(top), XtWindow(top), saved_argv, saved_argc); man_globals = (ManpageGlobals *) XtCalloc(ONE, (Cardinal) sizeof(ManpageGlobals)); MakeSearchWidget(man_globals, top); MakeSaveWidgets(man_globals, top); SaveGlobals((man_globals->This_Manpage = top), man_globals); XtMapWidget(top); AddCursor(top, resources.cursors.top); /* * Set up ICCCM delete window. */ XtOverrideTranslations (top, XtParseTranslationTable("WM_PROTOCOLS: Quit()")); (void) XSetWMProtocols(XtDisplay(top), XtWindow(top), &wm_delete_window, 1); } /* Function Name: CreateManpage * Description: Creates a new manpage. * Arguments: none. * Returns: none. */ Widget CreateManpage(FILE * file) { ManpageGlobals *man_globals; /* The pseudo global structure. */ man_globals = InitPsuedoGlobals(); if (man_globals == NULL) return NULL; CreateManpageWidget(man_globals, MANNAME, TRUE); if (file == NULL) StartManpage(man_globals, OpenHelpfile(man_globals), FALSE); else { OpenFile(man_globals, file); StartManpage(man_globals, FALSE, TRUE); } return (man_globals->This_Manpage); } /* Function Name: InitPsuedoGlobals * Description: Initializes the pseudo global variables. * Arguments: none. * Returns: a pointer to a new pseudo globals structure. */ ManpageGlobals * InitPsuedoGlobals(void) { ManpageGlobals *man_globals; /* * Allocate necessary memory. */ man_globals = (ManpageGlobals *) XtCalloc(ONE, (Cardinal) sizeof(ManpageGlobals)); if (!man_globals) return NULL; man_globals->search_widget = NULL; man_globals->section_name = (char **) XtMalloc((Cardinal) (sections * sizeof(char *))); man_globals->manpagewidgets.box = (Widget *) XtCalloc((Cardinal) sections, (Cardinal) sizeof(Widget)); /* Initialize the number of screens that will be shown */ man_globals->both_shown = resources.both_shown_initial; return (man_globals); } /* Function Name: CreateManpageWidget * Description: Creates a new manual page widget. * Arguments: man_globals - a new man_globals structure. * name - name of this shell widget instance. * full_instance - if true then create a full manpage, * otherwise create stripped down version * used for help. * Returns: none */ #define MANPAGEARGS 10 void CreateManpageWidget(ManpageGlobals * man_globals, char *name, Boolean full_instance) { Arg arglist[MANPAGEARGS]; /* An argument list for widget creation */ Cardinal num_args; /* The number of arguments in the list. */ Widget mytop, pane, hpane, mysections; /* Widgets */ ManPageWidgets *mpw = &(man_globals->manpagewidgets); num_args = (Cardinal) 0; XtSetArg(arglist[num_args], XtNwidth, default_width); num_args++; XtSetArg(arglist[num_args], XtNheight, default_height); num_args++; mytop = XtCreatePopupShell(name, topLevelShellWidgetClass, initial_widget, arglist, num_args); man_globals->This_Manpage = mytop; /* pointer to root widget of Manualpage. */ num_args = 0; if (full_instance) XtSetArg(arglist[num_args], XtNiconPixmap, XCreateBitmapFromData(XtDisplay(mytop), XtScreen(mytop)->root, (const char *) icon_open_bits, icon_open_width, icon_open_height)); else XtSetArg(arglist[num_args], XtNiconPixmap, XCreateBitmapFromData(XtDisplay(mytop), XtScreen(mytop)->root, (const char *) icon_help_bits, icon_help_width, icon_help_height)); num_args++; XtSetValues(mytop, arglist, num_args); pane = XtCreateManagedWidget("vertPane", panedWidgetClass, mytop, NULL, (Cardinal) 0); /* Create menu bar. */ hpane = XtCreateManagedWidget("horizPane", panedWidgetClass, pane, NULL, (Cardinal) 0); num_args = 0; XtSetArg(arglist[num_args], XtNmenuName, OPTION_MENU); num_args++; (void) XtCreateManagedWidget("options", menuButtonWidgetClass, hpane, arglist, num_args); CreateOptionMenu(man_globals, mytop); num_args = 0; XtSetArg(arglist[num_args], XtNmenuName, SECTION_MENU); num_args++; mysections = XtCreateManagedWidget("sections", menuButtonWidgetClass, hpane, arglist, num_args); XtSetArg(arglist[0], XtNlabel, SHOW_BOTH); XtSetValues(man_globals->both_screens_entry, arglist, (Cardinal) 1); if (full_instance) { MakeSearchWidget(man_globals, mytop); CreateSectionMenu(man_globals, mytop); MakeSaveWidgets(man_globals, mytop); } else { XtSetSensitive(mysections, FALSE); XtSetArg(arglist[0], XtNsensitive, FALSE); XtSetValues(man_globals->dir_entry, arglist, ONE); XtSetValues(man_globals->manpage_entry, arglist, ONE); XtSetValues(man_globals->help_entry, arglist, ONE); XtSetValues(man_globals->search_entry, arglist, ONE); XtSetValues(man_globals->both_screens_entry, arglist, ONE); } #ifdef INCLUDE_XPRINT_SUPPORT XtSetArg(arglist[0], XtNsensitive, True); XtSetValues(man_globals->print_entry, arglist, ONE); #endif /* INCLUDE_XPRINT_SUPPORT */ man_globals->label = XtCreateManagedWidget("manualTitle", labelWidgetClass, hpane, NULL, (Cardinal) 0); /* Create Directory */ if (full_instance) { num_args = 0; XtSetArg(arglist[num_args], XtNallowVert, TRUE); num_args++; mpw->directory = XtCreateWidget(DIRECTORY_NAME, viewportWidgetClass, pane, arglist, num_args); man_globals->current_directory = INITIAL_DIR; MakeDirectoryBox(man_globals, mpw->directory, mpw->box + man_globals->current_directory, man_globals->current_directory); XtManageChild(mpw->box[man_globals->current_directory]); } /* Create Manpage */ mpw->manpage = XtCreateWidget(MANUALPAGE, scrollByLineWidgetClass, pane, NULL, (Cardinal) 0); } /* Function Name: StartManpage * Description: Starts up a new manpage. * Arguments: man_globals - the pseudo globals variable. * help - is this a help file? * page - Is there a page to display? * Returns: none. */ static void StartManpage(ManpageGlobals * man_globals, Boolean help, Boolean page) { Widget dir = man_globals->manpagewidgets.directory; Widget manpage = man_globals->manpagewidgets.manpage; Widget label = man_globals->label; Arg arglist[1]; /* * If there is a helpfile then put up both screens if both_show is set. */ if (page || help) { if (help) strcpy(man_globals->manpage_title, "Xman Help"); if (man_globals->both_shown) { XtManageChild(dir); man_globals->dir_shown = TRUE; XtSetArg(arglist[0], XtNpreferredPaneSize, resources.directory_height); XtSetValues(dir, arglist, (Cardinal) 1); XtSetArg(arglist[0], XtNsensitive, FALSE); XtSetValues(man_globals->manpage_entry, arglist, ONE); XtSetValues(man_globals->dir_entry, arglist, ONE); XtSetArg(arglist[0], XtNlabel, SHOW_ONE); XtSetValues(man_globals->both_screens_entry, arglist, ONE); ChangeLabel(label, man_globals->section_name[man_globals-> current_directory]); } else { ChangeLabel(label, man_globals->manpage_title); } XtManageChild(manpage); man_globals->dir_shown = FALSE; } /* * Since There is file to display, put up directory and do not allow change * to manpage, show both, or help. */ else { XtManageChild(dir); man_globals->dir_shown = TRUE; XtSetArg(arglist[0], XtNsensitive, FALSE); XtSetValues(man_globals->manpage_entry, arglist, ONE); XtSetValues(man_globals->help_entry, arglist, ONE); XtSetValues(man_globals->both_screens_entry, arglist, ONE); man_globals->both_shown = FALSE; ChangeLabel(label, man_globals->section_name[man_globals->current_directory]); } /* * Start 'er up, and change the cursor. */ XtRealizeWidget(man_globals->This_Manpage); SaveGlobals(man_globals->This_Manpage, man_globals); XtMapWidget(man_globals->This_Manpage); AddCursor(man_globals->This_Manpage, resources.cursors.manpage); XtSetArg(arglist[0], XtNtransientFor, man_globals->This_Manpage); XtSetValues(XtParent(man_globals->standby), arglist, (Cardinal) 1); XtSetValues(XtParent(man_globals->save), arglist, (Cardinal) 1); XtRealizeWidget(XtParent(man_globals->standby)); XtRealizeWidget(XtParent(man_globals->save)); AddCursor(XtParent(man_globals->standby), resources.cursors.top); AddCursor(XtParent(man_globals->save), resources.cursors.top); /* * Set up ICCCM delete window. */ XtOverrideTranslations (man_globals->This_Manpage, XtParseTranslationTable("WM_PROTOCOLS: RemoveThisManpage()")); (void) XSetWMProtocols(XtDisplay(man_globals->This_Manpage), XtWindow(man_globals->This_Manpage), &wm_delete_window, 1); } /* Function Name: MenuDestroy * Description: free's data associated with menu when it is destroyed. * Arguments: w - menu widget. * free_me - data to free. * junk - not used. * Returns: none. */ /* ARGSUSED */ static void MenuDestroy(Widget w, XtPointer free_me, XtPointer junk) { XtFree((char *) free_me); } /* Function Name: CreateOptionMenu * Description: Create the option menu. * Arguments: man_globals - the manual page globals. * parent - the button that activates the menu. * Returns: none. */ static void CreateOptionMenu(ManpageGlobals * man_globals, Widget parent) { Widget menu, entry; int i; static const char *option_names[] = { /* Names of the buttons. */ DIRECTORY, MANPAGE, HELP, SEARCH, BOTH_SCREENS, REMOVE_MANPAGE, OPEN_MANPAGE, #ifdef INCLUDE_XPRINT_SUPPORT PRINT_MANPAGE, #endif /* INCLUDE_XPRINT_SUPPORT */ SHOW_VERSION, QUIT }; menu = XtCreatePopupShell(OPTION_MENU, simpleMenuWidgetClass, parent, NULL, (Cardinal) 0); man_globals->option_menu = menu; for (i = 0; i < NUM_OPTIONS; i++) { entry = XtCreateManagedWidget(option_names[i], smeBSBObjectClass, menu, NULL, ZERO); XtAddCallback(entry, XtNcallback, OptionCallback, (caddr_t) man_globals); switch (i) { case 0: man_globals->dir_entry = entry; break; case 1: man_globals->manpage_entry = entry; break; case 2: man_globals->help_entry = entry; break; case 3: man_globals->search_entry = entry; break; case 4: man_globals->both_screens_entry = entry; break; case 5: man_globals->remove_entry = entry; break; case 6: man_globals->open_entry = entry; break; #ifdef INCLUDE_XPRINT_SUPPORT case 7: man_globals->print_entry = entry; break; case 8: man_globals->version_entry = entry; break; case 9: man_globals->quit_entry = entry; break; #else /* !INCLUDE_XPRINT_SUPPORT */ case 7: man_globals->version_entry = entry; break; case 8: man_globals->quit_entry = entry; break; #endif /* !INCLUDE_XPRINT_SUPPORT */ default: Error(("CreateOptionMenu: Unknown id=%d\n", i)); break; } } #ifdef INCLUDE_XPRINT_SUPPORT XtVaSetValues(man_globals->print_entry, XtNsensitive, FALSE, NULL); #endif /* INCLUDE_XPRINT_SUPPORT */ } /* Function Name: CreateSectionMenu * Description: Create the Section menu. * Arguments: man_globals - the manual page globals. * parent - the button that activates the menu. * Returns: none. */ static void CreateSectionMenu(ManpageGlobals * man_globals, Widget parent) { Widget menu, entry; int i; MenuStruct *menu_struct; Arg args[1]; Cardinal num_args; char entry_name[BUFSIZ]; menu = XtCreatePopupShell(SECTION_MENU, simpleMenuWidgetClass, parent, NULL, (Cardinal) 0); for (i = 0; i < sections; i++) { num_args = 0; XtSetArg(args[num_args], XtNlabel, manual[i].blabel); num_args++; snprintf(entry_name, sizeof(entry_name), "section%d", i); entry = XtCreateManagedWidget(entry_name, smeBSBObjectClass, menu, args, num_args); menu_struct = (MenuStruct *) XtMalloc(sizeof(MenuStruct)); menu_struct->data = (caddr_t) man_globals; menu_struct->number = i; XtAddCallback(entry, XtNcallback, DirPopupCallback, (caddr_t) menu_struct); XtAddCallback(entry, XtNdestroyCallback, MenuDestroy, (caddr_t) menu_struct); } } /* Function Name: CreateList * Description: this function prints a label in the directory list * Arguments: section - the manual section. * Returns: none */ static char ** CreateList(int section) { char **ret_list, **current; int count; ret_list = (char **) XtMalloc((manual[section].nentries + 1) * sizeof(char *)); for (current = ret_list, count = 0; count < manual[section].nentries; count++, current++) *current = CreateManpageName(manual[section].entries[count], section, manual[section].flags); *current = NULL; /* NULL terminate the list. */ return (ret_list); } /* Function Name: MakeDirectoryBox * Description: make a directory box. * Arguments: man_globals - the pseudo global structure for each manpage. * parent - this guys parent widget. * dir_disp - the directory display widget. * section - the section number. * Returns: none. */ void MakeDirectoryBox(ManpageGlobals * man_globals, Widget parent, Widget * dir_disp, int section) { Arg arglist[10]; Cardinal num_args; char *name, label_name[BUFSIZ]; if (*dir_disp != NULL) /* If we have one, don't make another. */ return; name = manual[section].blabel; /* Set the section name */ snprintf(label_name, sizeof(label_name), "Directory of: %s", name); man_globals->section_name[section] = XtNewString(label_name); num_args = 0; XtSetArg(arglist[num_args], XtNlist, CreateList(section)); num_args++; XtSetArg(arglist[num_args], XtNfont, resources.fonts.directory); num_args++; *dir_disp = XtCreateWidget(DIRECTORY_NAME, listWidgetClass, parent, arglist, num_args); XtAddCallback(*dir_disp, XtNcallback, DirectoryHandler, (caddr_t) man_globals); } /* Function Name: MakeSaveWidgets. * Description: This functions creates two popup widgets, the please * standby widget and the would you like to save widget. * Arguments: man_globals - the pseudo globals structure for each man page * parent - the realized parent for both popups. * Returns: none. */ void MakeSaveWidgets(ManpageGlobals * man_globals, Widget parent) { Widget shell, dialog; /* misc. widgets. */ Arg warg[1]; Cardinal n = 0; /* make the please stand by popup widget. */ if (XtIsRealized(parent)) { XtSetArg(warg[0], XtNtransientFor, parent); n++; } shell = XtCreatePopupShell("pleaseStandBy", transientShellWidgetClass, parent, warg, (Cardinal) n); man_globals->standby = XtCreateManagedWidget("label", labelWidgetClass, shell, NULL, (Cardinal) 0); man_globals->save = XtCreatePopupShell("likeToSave", transientShellWidgetClass, parent, warg, n); dialog = XtCreateManagedWidget("dialog", dialogWidgetClass, man_globals->save, NULL, (Cardinal) 0); XawDialogAddButton(dialog, FILE_SAVE, NULL, NULL); XawDialogAddButton(dialog, CANCEL_FILE_SAVE, NULL, NULL); if (XtIsRealized(parent)) { XtRealizeWidget(shell); AddCursor(shell, resources.cursors.top); XtRealizeWidget(man_globals->save); AddCursor(man_globals->save, resources.cursors.top); } } /* Function Name: FormUpWidgets * Description: Sizes widgets to look nice. * Arguments: parent - the common parent of all the widgets. * full_size - array of widget names that will be full size. * half_size - array of widget names that will be half size. * Returns: none */ void FormUpWidgets(Widget parent, const char **full_size, const char **half_size) { Widget *full_widgets, *half_widgets, *temp, long_widget; Dimension longest, length, b_width; int interior_dist; Arg arglist[2]; full_widgets = ConvertNamesToWidgets(parent, full_size); half_widgets = ConvertNamesToWidgets(parent, half_size); long_widget = NULL; longest = 0; XtSetArg(arglist[0], XtNwidth, &length); XtSetArg(arglist[1], XtNborderWidth, &b_width); /* * Find Longest widget. */ for (temp = full_widgets; *temp != (Widget) NULL; temp++) { XtGetValues(*temp, arglist, (Cardinal) 2); length += 2 * b_width; if (length > longest) { longest = length; long_widget = *temp; } } if (long_widget == (Widget) NULL) { /* Make sure we found one. */ PopupWarning(GetGlobals(parent), "Could not find longest widget, aborting..."); XtFree((char *) full_widgets); XtFree((char *) half_widgets); return; } /* * Set all other full_widgets to this length. */ for (temp = full_widgets; *temp != (Widget) NULL; temp++) if (long_widget != *temp) { Dimension width, border_width; XtSetArg(arglist[0], XtNborderWidth, &border_width); XtGetValues(*temp, arglist, (Cardinal) 1); width = longest - 2 * border_width; XtSetArg(arglist[0], XtNwidth, width); XtSetValues(*temp, arglist, (Cardinal) 1); } /* * Set all the half widgets to the right length. */ XtSetArg(arglist[0], XtNdefaultDistance, &interior_dist); XtGetValues(parent, arglist, (Cardinal) 1); for (temp = half_widgets; *temp != (Widget) NULL; temp++) { Dimension width, border_width; XtSetArg(arglist[0], XtNborderWidth, &border_width); XtGetValues(*temp, arglist, (Cardinal) 1); width = (int) (longest - interior_dist) / 2 - 2 * border_width; XtSetArg(arglist[0], XtNwidth, width); XtSetValues(*temp, arglist, (Cardinal) 1); } XtFree((char *) full_widgets); XtFree((char *) half_widgets); } /* Function Name: ConvertNamesToWidgets * Description: Converts a list of names into a list of widgets. * Arguments: parent - the common parent of these widgets. * names - an array of widget names. * Returns: an array of widget id's. */ static Widget * ConvertNamesToWidgets(Widget parent, const char **names) { const char **temp; Widget *ids, *temp_ids; int count; for (count = 0, temp = names; *temp != NULL; count++, temp++); ids = (Widget *) XtMalloc((count + 1) * sizeof(Widget)); for (temp_ids = ids; *names != NULL; names++, temp_ids++) { *temp_ids = XtNameToWidget(parent, *names); if (*temp_ids == NULL) { char error_buf[BUFSIZ]; snprintf(error_buf, sizeof(error_buf), "Could not find widget named '%s'", *names); PrintError(error_buf); XtFree((char *) ids); return (NULL); } } *temp_ids = (Widget) NULL; return (ids); } x11-apps-7.7+5+nmu1ubuntu1/xman/misc.c0000664000000000000000000011723512656635743014265 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * xman - X window system manual page display program. * Author: Chris D. Peterson, MIT Project Athena * Created: October 27, 1987 */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "globals.h" #include "vendor.h" #include /* sys/types.h and unistd.h included in here */ #include #include #include #include static FILE *Uncompress(ManpageGlobals * man_globals, const char *filename); static Boolean UncompressNamed(ManpageGlobals * man_globals, const char *filename, char *output, FILE ** output_file); static Boolean UncompressUnformatted(ManpageGlobals * man_globals, const char *entry, char *filename, FILE ** file); #ifdef HANDLE_ROFFSEQ static Boolean ConstructCommand(char *cmdbuf, const char *path, const char *filename, const char *tempfile); #endif #if defined(ISC) || defined(__SCO__) || defined(__UNIXWARE__) static char *uncompress_format = NULL; static char *uncompress_formats[] = { UNCOMPRESS_FORMAT_1, UNCOMPRESS_FORMAT_2, UNCOMPRESS_FORMAT_3 }; #endif /* Function Name: PopupWarning * Description: This function pops up a warning message. * Arguments: string - the specific warning string. * Returns: none */ static Widget warnShell, warnDialog; static void PopdownWarning(Widget w, XtPointer client, XtPointer call) { XtPopdown((Widget) client); } void PopupWarning(ManpageGlobals * man_globals, const char *string) { int n; Arg wargs[3]; Dimension topX, topY; char buffer[BUFSIZ]; Boolean hasPosition; snprintf(buffer, sizeof(buffer), "Xman Warning: %s", string); hasPosition = FALSE; if (top) { n = 0; XtSetArg(wargs[n], XtNx, &topX); n++; XtSetArg(wargs[n], XtNy, &topY); n++; XtGetValues(top, wargs, n); hasPosition = TRUE; } if (man_globals != NULL) ChangeLabel(man_globals->label, buffer); if (man_globals->label == NULL) { n = 0; if (hasPosition) { XtSetArg(wargs[n], XtNx, topX); n++; XtSetArg(wargs[n], XtNy, topY); n++; } XtSetArg(wargs[n], XtNtransientFor, top); n++; warnShell = XtCreatePopupShell("warnShell", transientShellWidgetClass, initial_widget, wargs, n); XtSetArg(wargs[0], XtNlabel, buffer); warnDialog = XtCreateManagedWidget("warnDialog", dialogWidgetClass, warnShell, wargs, 1); XawDialogAddButton(warnDialog, "dismiss", PopdownWarning, (XtPointer) warnShell); XtRealizeWidget(warnShell); Popup(warnShell, XtGrabNone); } } /* Function Name: PrintError * Description: This Function prints an error message and exits. * Arguments: string - the specific message. * Returns: none. - exits though. */ void PrintError(const char *string) { fprintf(stderr, "Xman Error: %s\n", string); exit(EXIT_FAILURE); } /* Function Name: OpenFile * Description: Assigns a file to the manpage. * Arguments: man_globals - global structure. * file - the file pointer. * Returns: none */ void OpenFile(ManpageGlobals * man_globals, FILE * file) { Arg arglist[1]; Cardinal num_args = 0; if (man_globals->curr_file) { #if 0 /* Ownership rules need to be fixed first */ fclose(man_globals->curr_file); #endif } man_globals->curr_file = file; XtSetArg(arglist[num_args], XtNfile, man_globals->curr_file); num_args++; XtSetValues(man_globals->manpagewidgets.manpage, arglist, num_args); } /* Function Name: FindManualFile * Description: Opens the manual page file given the entry information. * Arguments: man_globals - the globals info for this manpage. * section_num - section number of the man page. * entry_num - entry number of the man page. * Returns: fp - the file pointer * * NOTES: * * If there is a uncompressed section it will look there for uncompressed * manual pages first and then for individually compressed file in the * uncompressed section. * * If there is a compressed directory then it will also look there for * the manual pages. * * If both of these fail then it will attempt to format the manual page. */ FILE * FindManualFile(ManpageGlobals * man_globals, int section_num, int entry_num) { FILE *file; char path[BUFSIZ], page[BUFSIZ], section[BUFSIZ], *temp; char filename[BUFSIZ]; const char *entry = manual[section_num].entries[entry_num]; int len_cat = strlen(CAT); #if defined(ISC) || defined(__SCO__) || defined(__UNIXWARE__) int i; #endif temp = CreateManpageName(entry, 0, 0); snprintf(man_globals->manpage_title, sizeof(man_globals->manpage_title), "The current manual page is: %s.", temp); XtFree(temp); ParseEntry(entry, path, section, page); /* * Look for uncompressed files first. */ #if defined(__OpenBSD__) || defined(__NetBSD__) /* look in machine subdir first */ snprintf(filename, sizeof(filename), "%s/%s%s/%s/%s", path, CAT, section + len_cat, MACHINE, page); if ((file = fopen(filename, "r")) != NULL) return (file); #endif snprintf(filename, sizeof(filename), "%s/%s%s/%s", path, CAT, section + len_cat, page); if ((file = fopen(filename, "r")) != NULL) return (file); /* * Then for compressed files in an uncompressed directory. */ #if !defined(ISC) && !defined(__UNIXWARE__) #if defined(__OpenBSD__) || defined(__NetBSD__) /* look in machine subdir first */ snprintf(filename, sizeof(filename), "%s/%s%s/%s/%s.%s", path, CAT, section + len_cat, MACHINE, page, COMPRESSION_EXTENSION); if ((file = Uncompress(man_globals, filename)) != NULL) return (file); #endif snprintf(filename, sizeof(filename), "%s/%s%s/%s.%s", path, CAT, section + len_cat, page, COMPRESSION_EXTENSION); if ((file = Uncompress(man_globals, filename)) != NULL) return (file); #ifdef GZIP_EXTENSION else { #if defined(__OpenBSD__) || defined(__NetBSD__) /* look in machine subdir first */ snprintf(filename, sizeof(filename), "%s/%s%s/%s/%s.%s", path, CAT, section + len_cat, MACHINE, page, GZIP_EXTENSION); if ((file = Uncompress(man_globals, filename)) != NULL) return (file); #endif snprintf(filename, sizeof(filename), "%s/%s%s/%s.%s", path, CAT, section + len_cat, page, GZIP_EXTENSION); if ((file = Uncompress(man_globals, filename)) != NULL) return (file); } #endif #ifdef BZIP2_EXTENSION #if defined(__OpenBSD__) || defined(__NetBSD__) /* look in machine subdir first */ snprintf(filename, sizeof(filename), "%s/%s%s/%s/%s.%s", path, CAT, section + len_cat, MACHINE, page, BZIP2_EXTENSION); if ((file = Uncompress(man_globals, filename)) != NULL) return (file); #endif { snprintf(filename, sizeof(filename), "%s/%s%s/%s.%s", path, CAT, section + len_cat, page, BZIP2_EXTENSION); if ((file = Uncompress(man_globals, filename)) != NULL) return (file); } #endif #ifdef LZMA_EXTENSION { snprintf(filename, sizeof(filename), "%s/%s%s/%s.%s", path, CAT, section + len_cat, page, LZMA_EXTENSION); if ((file = Uncompress(man_globals, filename)) != NULL) return (file); } #endif #else for (i = 0; i < strlen(COMPRESSION_EXTENSIONS); i++) { snprintf(filename, sizeof(filename), "%s/%s%s/%s.%c", path, CAT, section + len_cat, page, COMPRESSION_EXTENSIONS[i]); uncompress_format = uncompress_formats[i]; #ifdef DEBUG printf("Trying .%c ...\n", COMPRESSION_EXTENSIONS[i]); #endif if ((file = Uncompress(man_globals, filename)) != NULL) return (file); } #endif /* * And lastly files in a compressed directory. * * The directory is not actually compressed it is just named man#.Z * and all files in it are compressed without the .Z extension. * HP does it this way (really :-). */ snprintf(filename, sizeof(filename), "%s/%s%s.%s/%s", path, CAT, section + len_cat, COMPRESSION_EXTENSION, page); if ((file = Uncompress(man_globals, filename)) != NULL) return (file); /* * We did not find any preformatted manual pages, try to format it. */ return (Format(man_globals, entry)); } #ifndef HAVE_MKSTEMP /* Emulate mkstemp to allow use of a common API in the many calls below */ _X_HIDDEN int Xmkstemp (char *template) { int fd = 0; char tmp[PATH_MAX]; if (strlen(template) >= sizeof(tmp)) return -1; /* save copy of unmodified template in case we have to try again */ strcpy(tmp, template); do { if (fd == -1) strcpy(template, tmp); if ((mktemp(template) == NULL) || (template[0] == '\0')) return -1; fd = open(template, O_RDWR | O_CREAT | O_EXCL, 0600); } while ((fd == -1) && (errno == EEXIST || errno == EINTR)); return fd; } #endif /* Function Namecompress * Description: This function will attempt to find a compressed man * page and uncompress it. * Arguments: man_globals - the pseudo global info. * filename - name of file to uncompress. * Returns:; a pointer to the file or NULL. */ static FILE * Uncompress(ManpageGlobals * man_globals, const char *filename) { char tmp_file[BUFSIZ]; FILE *file; if (!UncompressNamed(man_globals, filename, tmp_file, &file)) { PopupWarning(man_globals, "Something went wrong in retrieving the " "uncompressed manual page try cleaning up /tmp."); return (NULL); } remove(tmp_file); /* remove name in tree, it will remain until we close the fd, however. */ return (file); } /* Function Name: UncompressNamed * Description: This function will attempt to find a compressed man * page and uncompress it. * Arguments: man_globals - the pseudo global info. * filename - name of file to uncompress. * RETURNED output - the file name output (must be an allocated string). * Returns:; TRUE if the file was found. */ static Boolean UncompressNamed(ManpageGlobals * man_globals, const char *filename, char *output, FILE ** output_file) { char tmp[BUFSIZ], cmdbuf[BUFSIZ], error_buf[BUFSIZ]; struct stat junk; int fd; if (stat(filename, &junk) != 0) { /* Check for existence of the file. */ if (errno != ENOENT) { snprintf(error_buf, sizeof(error_buf), "Error while stating file %s, errno = %d", filename, errno); PopupWarning(man_globals, error_buf); } return (FALSE); } /* * Using stdin is necessary to fool zcat since we cannot guarantee * the .Z extension. */ strcpy(tmp, MANTEMP); /* get a temp file. */ fd = mkstemp(tmp); if (fd < 0) { PopupWarning(man_globals, "Error creating a temp file"); return FALSE; } *output_file = fdopen(fd, "r"); if (*output_file == NULL) { remove(tmp); close(fd); PopupWarning(man_globals, "Error opening temp file"); return FALSE; } strcpy(output, tmp); #ifdef GZIP_EXTENSION if (streq(filename + strlen(filename) - strlen(GZIP_EXTENSION), GZIP_EXTENSION)) snprintf(cmdbuf, sizeof(cmdbuf), GUNZIP_FORMAT, filename, output); else #endif #ifdef BZIP2_EXTENSION if (streq(filename + strlen(filename) - strlen(BZIP2_EXTENSION), BZIP2_EXTENSION)) snprintf(cmdbuf, sizeof(cmdbuf), BUNZIP2_FORMAT, filename, output); else #endif #ifdef LZMA_EXTENSION if (streq(filename + strlen(filename) - strlen(LZMA_EXTENSION), LZMA_EXTENSION)) snprintf(cmdbuf, sizeof(cmdbuf), UNLZMA_FORMAT, filename, output); else #endif snprintf(cmdbuf, sizeof(cmdbuf), UNCOMPRESS_FORMAT, filename, output); if (system(cmdbuf) == 0) /* execute search. */ return (TRUE); snprintf(error_buf, sizeof(error_buf), "Error while uncompressing, command was: %s", cmdbuf); PopupWarning(man_globals, error_buf); return (FALSE); } #if defined(SMAN) && defined(SFORMAT) /* Function Name: SgmlToRoffNamed * Description: This function will attempt to find an SGML man * page and convert it to roff format. * Arguments: man_globals - the pseudo global info. * filename - name of file to uncompress. * RETURNED output - the file name output (must be an allocated string). * Returns:; TRUE if the file was found. */ static Boolean SgmlToRoffNamed(ManpageGlobals * man_globals, char *filename, char *output, FILE ** output_file) { char tmp[BUFSIZ], cmdbuf[BUFSIZ], error_buf[BUFSIZ]; struct stat junk; int fd; if (stat(filename, &junk) != 0) { /* Check for existence of the file. */ if (errno != ENOENT) { snprintf(error_buf, sizeof(error_buf), "Error while stating file %s, errno = %d", filename, errno); PopupWarning(man_globals, error_buf); } return (FALSE); } strcpy(tmp, MANTEMP); /* get a temp file. */ fd = mkstemp(tmp); if (fd < 0) { PopupWarning(man_globals, "Error creating a temp file"); return FALSE; } *output_file = fdopen(fd, "r"); if (*output_file == NULL) { remove(tmp); close(fd); PopupWarning(man_globals, "Error opening temp file"); return FALSE; } strcpy(output, tmp); snprintf(cmdbuf, sizeof(cmdbuf), "%s %s >> %s", SFORMAT, filename, output); if (system(cmdbuf) == 0) /* execute search. */ return (TRUE); snprintf(error_buf, sizeof(error_buf), "Error while converting from sgml, command was: %s", cmdbuf); PopupWarning(man_globals, error_buf); return (FALSE); } #endif /* defined (SMAN) && defined(SFORMAT) */ /* Function Name: Format * Description: This function formats the manual pages and interfaces * with the user. * Arguments: man_globals - the pseudo globals * file - the file pointer to use and return * entry - the current entry struct. * current_box - The current directory being displayed. * Returns: none. */ /* ARGSUSED */ FILE * Format(ManpageGlobals * man_globals, const char *entry) { FILE *file = NULL; int fd; Widget manpage = man_globals->manpagewidgets.manpage; char cmdbuf[BUFSIZ], tmp[BUFSIZ], filename[BUFSIZ], error_buf[BUFSIZ]; char path[BUFSIZ], sect[BUFSIZ]; XEvent event; Position x, y; /* location to pop up the "would you like to save" widget. */ if (!UncompressUnformatted(man_globals, entry, filename, &file)) { /* We Really could not find it, this should never happen, yea right. */ snprintf(error_buf, sizeof(error_buf), "Could not open manual page, %s", entry); PopupWarning(man_globals, error_buf); XtPopdown(XtParent(man_globals->standby)); return (NULL); } if (file != NULL) { char line[BUFSIZ]; if (fgets(line, sizeof(line), file) != NULL) { if (strncmp(line, ".so ", 4) == 0) { size_t len = strlen(line); /* must be >= 4 to pass strncmp */ if (line[len - 1] == '\n') line[len - 1] = '\0'; fclose(file); remove(filename); if (line[4] != '/') { char *ptr = NULL; strcpy(tmp, entry); if ((ptr = strrchr(tmp, '/')) != NULL) { *ptr = '\0'; if ((ptr = strrchr(tmp, '/')) != NULL) ptr[1] = '\0'; } } else *tmp = '\0'; snprintf(filename, sizeof(filename), "%s%s", tmp, line + 4); return (Format(man_globals, filename)); } } fclose(file); } Popup(XtParent(man_globals->standby), XtGrabExclusive); while (!XCheckTypedWindowEvent(XtDisplay(man_globals->standby), XtWindow(man_globals->standby), Expose, &event)); XtDispatchEvent(&event); XFlush(XtDisplay(man_globals->standby)); strcpy(tmp, MANTEMP); /* Get a temp file. */ fd = mkstemp(tmp); if (fd >= 0) { file = fdopen(fd, "r"); if (file == NULL) { remove(tmp); close(fd); } } else file = NULL; if (file == NULL) { PopupWarning(man_globals, "Something went wrong in opening the " "temp file, try cleaning up /tmp"); return NULL; } strcpy(man_globals->tempfile, tmp); ParseEntry(entry, path, sect, NULL); #ifndef HANDLE_ROFFSEQ snprintf(cmdbuf, sizeof(cmdbuf), "cd %s ; %s %s %s >> %s %s", path, TBL, filename, FORMAT, man_globals->tempfile, "2> /dev/null"); #else /* Handle more flexible way of specifying the formatting pipeline */ if (!ConstructCommand(cmdbuf, path, filename, man_globals->tempfile)) { PopupWarning(man_globals, "Constructed command was too long!"); fclose(file); file = NULL; } else #endif /* HANDLE_ROFFSEQ */ if (system(cmdbuf) != 0) { /* execute search. */ snprintf(error_buf, sizeof(error_buf), "Something went wrong trying to run the command: %s", cmdbuf); PopupWarning(man_globals, error_buf); fclose(file); file = NULL; } else { if (file != NULL) { XtPopdown(XtParent(man_globals->standby)); if ((man_globals->save == NULL) || (man_globals->manpagewidgets.manpage == NULL)) remove(man_globals->tempfile); else { char *ptr, catdir[BUFSIZ]; /* * If the catdir is writable then ask the user if he/she wants to * write the man page to it. */ strcpy(catdir, man_globals->save_file); if ((ptr = strrchr(catdir, '/')) != NULL) { *ptr = '\0'; if (access(catdir, W_OK) != 0) remove(man_globals->tempfile); else { x = (Position) Width(man_globals->manpagewidgets. manpage) / 2; y = (Position) Height(man_globals->manpagewidgets. manpage) / 2; XtTranslateCoords(manpage, x, y, &x, &y); PositionCenter(man_globals->save, (int) x, (int) y, 0, 0, 0, 0); XtPopup(man_globals->save, XtGrabExclusive); } } else remove(man_globals->tempfile); } } } /* * If the original was compressed or in another format, delete temporary file. */ if (man_globals->deletetempfile) remove(filename); return (file); } #ifdef HANDLE_ROFFSEQ /* Function Name: ConstructCommand * Description: Constructs the pipeline of commands necessary to format * a manual page. * Arguments: cmdbuf - the buffer into which to write the command * path - the directory in which the original man page resides * filename - the (uncompressed) manpage source file * tempfile - the name of a temporary file to direct the final * output of the pipeline into * Returns: TRUE if the command fit into the buffer, FALSE if it would * be too long (more than BUFSIZ characters) */ static Boolean ConstructCommand(char *cmdbuf, const char *path, const char *filename, const char *tempfile) { /* The original code did the following to produce a command line: * sprintf(cmdbuf,"cd %s ; %s %s %s > %s %s", path, TBL, * filename, FORMAT, man_globals->tempfile, "2> /dev/null"); * We are more flexible and follow more or less the algorithm used * by the Linux man command: * + Obtain a string of letters from the following sources in order * of preference: * + a command line option (not implemented in xman; it's probably not * useful) * + the first line of the manpage source, if it is of the form: * '\" * + the MANROFFSEQ environment variable * + a default string; this is "". * + Interpret the string as a pipeline of filters: * + e = eqn g = grap p = pic t = tbl v = vgrind r = refer * + zsoelim is always run as the first preprocessor in any case. * * Strictly speaking we should save a catpage iff the string comes * from the file or is the default. * * You'll notice that we format a man page into ASCII text output and then * attempt to interpret things like L^HL as bold and so forth. This * is so obviously the Wrong Thing it's untrue. */ char *c = cmdbuf; /* current posn in buffer */ int left = BUFSIZ; /* space left in buffer */ int used; const char *fmt; char fmtbuf[128]; fmt = NULL; /* If you have a command line option that gives a setting for fmt, set it here. */ if (!fmt) { /* This is the tricky bit: extract a format string from the source file * Annoyingly, filename might be relative or absolute. We cheat and * use system to get the thing to a known absolute filename. */ FILE *file; int gotfmt = 0; /* set to 1 if we got a directive from source */ char fname[PATH_MAX]; if (filename[0] == '/') { snprintf(fname, sizeof(fname), "%s", filename); } else { snprintf(fname, sizeof(fname), "%s/%s", path, filename); } if ((file = fopen(fname, "r")) != NULL) { if ((fgets(fmtbuf, sizeof(fmtbuf), file)) && (!memcmp(fmtbuf, "'\\\" ", 4))) { /* that's squote-backslash-dquote-space */ int len = strlen(fmtbuf); if (len && (fmtbuf[len - 1] == '\n')) { fmtbuf[len - 1] = 0; fmt = fmtbuf + 3; gotfmt++; } } fclose(file); } if (!gotfmt) { /* not there or some error */ fmt = getenv("MANROFFSEQ"); } } if (!fmt) { fmt = DEFAULT_MANROFFSEQ; } /* Start with the first fixed part of the command line */ used = snprintf(c, left, "cd %s; %s %s ", path, ZSOELIM, filename); left -= used; c += used; if (left <= 1) return (FALSE); /* Now add preprocessors of the form '| processor' */ for (; *fmt; fmt++) { const char *filter; switch (*fmt) { case 'e': filter = EQN; break; case 'g': filter = GRAP; break; case 'p': filter = ROFF_PIC; break; case 't': filter = TBL; break; case 'v': filter = VGRIND; break; case 'r': filter = REFER; break; default: filter = NULL; break; } if (filter) { used = snprintf(c, left, " | %s ", filter); left -= used; c += used; if (left <= 1) return (FALSE); } } /* Now add the fixed trailing part 'formatprog > tempfile 2> /dev/null' */ used = snprintf(c, left, " | %s >> %s 2>/dev/null", FORMAT, tempfile); left -= used; if (left <= 1) return (FALSE); return (TRUE); } #endif /* HANDLE_ROFFSEQ */ /* Function Name: UncompressUnformatted * Description: Finds an uncompressed unformatted manual page. * Arguments: man_globals - the pseudo global structure. * entry - the manual page entry. * RETURNED filename - location to put the name of the file. * Returns: TRUE if the file was found. */ static Boolean UncompressUnformatted(ManpageGlobals * man_globals, const char *entry, char *filename, FILE ** file) { char path[BUFSIZ], page[BUFSIZ], section[BUFSIZ], input[BUFSIZ]; int len_cat = strlen(CAT), len_man = strlen(MAN); #if defined(SMAN) && defined(SFORMAT) int len_sman = strlen(SMAN); #endif ParseEntry(entry, path, section, page); man_globals->bzip2 = FALSE; man_globals->lzma = FALSE; #if defined(__OpenBSD__) || defined(__NetBSD__) /* * look for uncompressed file in machine subdir first */ snprintf(filename, BUFSIZ, "%s/%s%s/%s/%s", path, MAN, section + len_cat, MACHINE, page); if (access(filename, R_OK) == 0) { man_globals->compress = FALSE; man_globals->gzip = FALSE; man_globals->deletetempfile = FALSE; snprintf(man_globals->save_file, sizeof(man_globals->save_file), "%s/%s%s/%s/%s", path, CAT, section + len_cat, MACHINE, page); return (TRUE); } /* * Then for compressed files in an uncompressed directory. */ snprintf(input, sizeof(input), "%s.%s", filename, COMPRESSION_EXTENSION); if (UncompressNamed(man_globals, input, filename, file)) { man_globals->compress = TRUE; man_globals->deletetempfile = TRUE; snprintf(man_globals->save_file, sizeof(man_globals->save_file), "%s/%s%s/%s.%s", path, CAT, section + len_cat, page, COMPRESSION_EXTENSION); return (TRUE); } #ifdef GZIP_EXTENSION else { snprintf(input, sizeof(input), "%s.%s", filename, GZIP_EXTENSION); if (UncompressNamed(man_globals, input, filename, file)) { man_globals->compress = TRUE; man_globals->gzip = TRUE; man_globals->deletetempfile = TRUE; snprintf(man_globals->save_file, sizeof(man_globals->save_file), "%s/%s%s/%s.%s", path, CAT, section + len_cat, page, GZIP_EXTENSION); return (TRUE); } } #endif /* GZIP_EXTENSION */ #endif /* __OpenBSD__ || __NetBSD__ */ #ifdef BZIP2_EXTENSION { snprintf(input, sizeof(input), "%s.%s", filename, BZIP2_EXTENSION); if (UncompressNamed(man_globals, input, filename, file)) { man_globals->compress = TRUE; man_globals->gzip = FALSE; man_globals->bzip2 = TRUE; snprintf(man_globals->save_file, sizeof(man_globals->save_file), "%s/%s%s/%s.%s", path, CAT, section + len_cat, page, BZIP2_EXTENSION); return (TRUE); } } #endif /* BZIP2_EXTENSION */ #ifdef LZMA_EXTENSION { snprintf(input, sizeof(input), "%s.%s", filename, LZMA_EXTENSION); if (UncompressNamed(man_globals, input, filename, file)) { man_globals->compress = TRUE; man_globals->gzip = FALSE; man_globals->lzma = TRUE; snprintf(man_globals->save_file, sizeof(man_globals->save_file), "%s/%s%s/%s.%s", path, CAT, section + len_cat, page, LZMA_EXTENSION); return (TRUE); } } #endif /* LZMA_EXTENSION */ /* * Look for uncompressed file first. */ snprintf(filename, BUFSIZ, "%s/%s%s/%s", path, MAN, section + len_man, page); if (access(filename, R_OK) == 0) { man_globals->compress = FALSE; man_globals->gzip = FALSE; man_globals->deletetempfile = FALSE; snprintf(man_globals->save_file, sizeof(man_globals->save_file), "%s/%s%s/%s", path, CAT, section + len_cat, page); return (TRUE); } #if defined(SMAN) && defined(SFORMAT) /* * Look for uncompressed sgml file next. */ snprintf(input, BUFSIZ, "%s/%s%s/%s", path, SMAN, section + len_sman, page); if (SgmlToRoffNamed(man_globals, input, filename, file)) { man_globals->compress = FALSE; man_globals->gzip = FALSE; man_globals->deletetempfile = TRUE; snprintf(man_globals->save_file, sizeof(man_globals->save_file), "%s/%s%s/%s", path, CAT, section + len_cat, page); return (TRUE); } #endif /* * Then for compressed files in an uncompressed directory. */ snprintf(input, sizeof(input), "%s.%s", filename, COMPRESSION_EXTENSION); if (UncompressNamed(man_globals, input, filename, file)) { man_globals->compress = TRUE; man_globals->deletetempfile = TRUE; snprintf(man_globals->save_file, sizeof(man_globals->save_file), "%s/%s%s/%s.%s", path, CAT, section + len_cat, page, COMPRESSION_EXTENSION); return (TRUE); } #ifdef GZIP_EXTENSION else { snprintf(input, sizeof(input), "%s.%s", filename, GZIP_EXTENSION); if (UncompressNamed(man_globals, input, filename, file)) { man_globals->compress = TRUE; man_globals->gzip = TRUE; man_globals->deletetempfile = TRUE; snprintf(man_globals->save_file, sizeof(man_globals->save_file), "%s/%s%s/%s.%s", path, CAT, section + len_cat, page, GZIP_EXTENSION); return (TRUE); } } #endif #ifdef BZIP2_EXTENSION { snprintf(input, sizeof(input), "%s.%s", filename, BZIP2_EXTENSION); if (UncompressNamed(man_globals, input, filename, file)) { man_globals->compress = TRUE; man_globals->gzip = TRUE; snprintf(man_globals->save_file, sizeof(man_globals->save_file), "%s/%s%s/%s.%s", path, CAT, section + len_cat, page, BZIP2_EXTENSION); return (TRUE); } } #endif #ifdef LZMA_EXTENSION { snprintf(input, sizeof(input), "%s.%s", filename, LZMA_EXTENSION); if (UncompressNamed(man_globals, input, filename, file)) { man_globals->compress = TRUE; man_globals->lzma = TRUE; snprintf(man_globals->save_file, sizeof(man_globals->save_file), "%s/%s%s/%s.%s", path, CAT, section + len_cat, page, LZMA_EXTENSION); return (TRUE); } } #endif /* * And lastly files in a compressed directory. */ snprintf(input, sizeof(input), "%s/%s%s.%s/%s", path, MAN, section + len_man, COMPRESSION_EXTENSION, page); if (UncompressNamed(man_globals, input, filename, file)) { man_globals->compress = TRUE; man_globals->deletetempfile = TRUE; snprintf(man_globals->save_file, sizeof(man_globals->save_file), "%s/%s%s.%s/%s", path, CAT, section + len_cat, COMPRESSION_EXTENSION, page); return (TRUE); } return (FALSE); } /* Function Name: AddCursor * Description: This function adds the cursor to the window. * Arguments: w - the widget to add the cursor to. * cursor - the cursor to add to this widget. * Returns: none */ void AddCursor(Widget w, Cursor cursor) { XColor colors[2]; Arg args[10]; Cardinal num_args = 0; Colormap c_map; if (!XtIsRealized(w)) { PopupWarning(NULL, "Widget is not realized, no cursor added.\n"); return; } XtSetArg(args[num_args], XtNcolormap, &c_map); num_args++; XtGetValues(w, args, num_args); colors[0].pixel = resources.cursors.fg_color; colors[1].pixel = resources.cursors.bg_color; XQueryColors(XtDisplay(w), c_map, colors, 2); XRecolorCursor(XtDisplay(w), cursor, colors, colors + 1); XDefineCursor(XtDisplay(w), XtWindow(w), cursor); } /* Function Name: ChangeLabel * Description: This function changes the label field of the * given widget to the string in str. * Arguments: w - the widget. * str - the string to change the label to. * Returns: none */ void ChangeLabel(Widget w, const char *str) { Arg arglist[3]; /* An argument list. */ if (w == NULL) return; XtSetArg(arglist[0], XtNlabel, str); /* shouldn't really have to do this. */ XtSetArg(arglist[1], XtNwidth, 0); XtSetArg(arglist[2], XtNheight, 0); XtSetValues(w, arglist, (Cardinal) 1); } /* * In an ideal world this would be part of the XToolkit, and I would not * have to do it, but such is life sometimes. Perhaps in X11R3. */ /* Function Name: PositionCenter * Description: This function positions the given widgets center * in the following location. * Arguments: widget - the widget widget to position * x,y - The location for the center of the widget * above - number of pixels above center to locate this widget * left - number of pixels left of center to locate this widget * h_space, v_space - how close to get to the edges of the * parent window. * Returns: none * Note: This should only be used with a popup widget that has override * redirect set. */ void PositionCenter(Widget widget, int x, int y, int above, int left, int v_space, int h_space) { Arg wargs[2]; int x_temp, y_temp; /* location of the new window. */ int parent_height, parent_width; /* Height and width of the parent widget or the root window if it has no parent. */ x_temp = x - left - Width(widget) / 2 + BorderWidth(widget); y_temp = y - above - Height(widget) / 2 + BorderWidth(widget); parent_height = HeightOfScreen(XtScreen(widget)); parent_width = WidthOfScreen(XtScreen(widget)); /* * Check to make sure that all edges are within the viewable part of the * root window, and if not then force them to be. */ if (x_temp < h_space) x_temp = v_space; if (y_temp < v_space) (y_temp = 2); if (y_temp + Height(widget) + v_space > parent_height) y_temp = parent_height - Height(widget) - v_space; if (x_temp + Width(widget) + h_space > parent_width) x_temp = parent_width - Width(widget) - h_space; XtSetArg(wargs[0], XtNx, x_temp); XtSetArg(wargs[1], XtNy, y_temp); XtSetValues(widget, wargs, 2); } /* Function Name: ParseEntry(entry, path, sect, page) * Description: Parses the manual pages entry filenames. * Arguments: str - the full path name. * path - the path name. RETURNED * sect - the section name. RETURNED * page - the page name. RETURNED * Returns: none. */ void ParseEntry(const char *entry, char *path, char *sect, char *page) { char *c, temp[BUFSIZ]; strcpy(temp, entry); c = strrchr(temp, '/'); if (c == NULL) PrintError("Failed to find / in ParseEntry."); *c++ = '\0'; if (page != NULL) strcpy(page, c); c = strrchr(temp, '/'); if (c == NULL) PrintError("Failed to find / in ParseEntry."); *c++ = '\0'; #if defined(SFORMAT) && defined(SMAN) /* sgmltoroff sometimes puts an extra ./ in the path to .so entries */ if (strcmp(c, ".") == 0) { c = strrchr(temp, '/'); if (c == NULL) PrintError("Failed to find / in ParseEntry."); *c++ = '\0'; } #endif #if defined(__OpenBSD__) || defined(__NetBSD__) /* Skip machine subdirectory if present */ if (strcmp(c, MACHINE) == 0) { c = strrchr(temp, '/'); if (c == NULL) PrintError("Failed to find / in ParseEntry."); *c++ = '\0'; } #endif if (sect != NULL) strcpy(sect, c); if (path != NULL) strcpy(path, temp); } /* Function Name: GetGlobals * Description: Gets the pseudo globals associated with the * manpage associated with this widget. * Arguments: w - a widget in the manpage. * Returns: the pseudo globals. * Notes: initial_widget is a globals variable. * manglobals_context is a global variable. */ ManpageGlobals * GetGlobals(Widget w) { Widget temp; caddr_t data; while ((temp = XtParent(w)) != initial_widget && (temp != NULL)) w = temp; if (temp == NULL) XtAppError(XtWidgetToApplicationContext(w), "Xman: Could not locate widget in tree, exiting"); if (XFindContext(XtDisplay(w), XtWindow(w), manglobals_context, &data) != XCSUCCESS) XtAppError(XtWidgetToApplicationContext(w), "Xman: Could not find global data, exiting"); return ((ManpageGlobals *) data); } /* Function Name: SaveGlobals * Description: Saves the pseudo globals on the widget passed * to this function, although GetGlobals assumes that * the data is associated with the popup child of topBox. * Arguments: w - the widget to associate the data with. * globals - data to associate with this widget. * Returns: none. * Notes: WIDGET MUST BE REALIZED. * manglobals_context is a global variable. */ void SaveGlobals(Widget w, ManpageGlobals * globals) { if (XSaveContext(XtDisplay(w), XtWindow(w), manglobals_context, (caddr_t) globals) != XCSUCCESS) XtAppError(XtWidgetToApplicationContext(w), "Xman: Could not save global data, are you out of memory?"); } /* Function Name: RemoveGlobals * Description: Removes the pseudo globals from the widget passed * to this function. * Arguments: w - the widget to remove the data from. * Returns: none. * Notes: WIDGET MUST BE REALIZED. * manglobals_context is a global variable. */ void RemoveGlobals(Widget w) { if (XDeleteContext(XtDisplay(w), XtWindow(w), manglobals_context) != XCSUCCESS) XtAppError(XtWidgetToApplicationContext(w), "Xman: Could not remove global data?"); } x11-apps-7.7+5+nmu1ubuntu1/xman/compile0000755000000000000000000001624512656634710014532 0ustar #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xman/app-defaults/0000775000000000000000000000000012520517207015522 5ustar x11-apps-7.7+5+nmu1ubuntu1/xman/app-defaults/Xman0000664000000000000000000001400412476465600016360 0ustar *input: True *topBox: True *topBox.Title: Xman *topBox.IconName: Xman *manualBrowser.Title: Manual Page *manualBrowser.IconName: Manual Page *manualBrowser.geometry: 780x600 *manualFontBold: -*-courier-bold-r-*-*-*-120-*-*-*-*-*-* *manualFontItalic: -*-courier-medium-o-*-*-*-120-*-*-*-*-*-* *manualFontNormal: -*-courier-medium-r-*-*-*-120-*-*-*-*-*-* *manualFontSymbol: -*-symbol-*-*-*-*-*-120-*-*-*-*-*-* !*directoryFontNormal: -*-courier-medium-r-*-*-*-120-*-*-*-*-*-* *directoryFontNormal: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-*-* !*directoryFontNormal: -*-lucida-bold-r-*-*-*-120-*-*-*-*-*-* !*SimpleMenu.BackingStore: Always !*SimpleMenu.SaveUnder: Off *horizPane.orientation: horizontal *horizPane*showGrip: False *horizPane.min: 22 *horizPane.max: 22 *topLabel.BorderWidth: 0 *search*label.BorderWidth: 0 *search*dialog*value: Xman !*optionMenu.Label: Options !*sectionMenu.Label: Sections *horizPane*options.Label: Options *horizPane*sections.Label: Sections *helpButton.Label: Help *helpButton.Tip: Open help browser *quitButton.Label: Quit *quitButton.Tip: Quit Xman *manpageButton.Label: Manual Page *manpageButton.Tip: Open new manpage browser *topLabel.Label: Manual Browser !*SimpleMenu*menuLabel*vertSpace: 100 !*SimpleMenu*menuLabel*leftMargin: 20 *displayDirectory.Label: Display Directory *displayManualPage.Label: Display Manual Page *help.Label: Help *help.geometry: 780x600 *search.Label: Search *removeThisManpage.Label: Remove This Manpage *help*removeThisManpage.Label: Remove Help *openNewManpage.Label: Open New Manpage *showVersion.Label: Show Version *quit.Label: Quit *pleaseStandBy*Label: Formatting Manual Page, Please Stand By... *search*dialog.Label: Type string to search for: *search*apropos.Label: Apropos *search*manualPage.Label: Manual Page *search*cancel.Label: Cancel *likeToSave*dialog.Label: Would you like to save this formatted Manual Page? *likeToSave*yes.Label: Yes *likeToSave*no.Label: No *translations: #override \ Ctrlq: Quit() \n\ Ctrlc: Quit() \n\ Ctrln: CreateNewManpage() \n\ Ctrlh: PopupHelp() \n\ Ctrls: PopupSearch() *help*Paned.manualPage.translations:#override \ Ctrl: \ XawPositionSimpleMenu(optionMenu) \ MenuPopup(optionMenu) \n\ Ctrlq: Quit() \n\ Ctrlc: Quit() \n\ Ctrlr: RemoveThisManpage() \n\ Ctrln: CreateNewManpage() \n\ Ctrlh: PopupHelp() \n\ Ctrld: GotoPage(Directory) \n\ Ctrlm: GotoPage(ManualPage) \n\ Ctrlv: ShowVersion() \n\ Prior: Page(Back) \n\ Next : Page(Forward) \n\ Shift,: Page(Line,-1) \n\ Shift,: Page(Line,1) \n\ Ctrl,: Page(Back) \n\ Ctrl,: Page(Forward) \n\ ~Shift ~Ctrl,: Page(Line,-5) \n\ ~Shift ~Ctrl,: Page(Line,5) *manualBrowser*manualPage.translations: #override \ Ctrl: \ XawPositionSimpleMenu(optionMenu) \ MenuPopup(optionMenu) \n\ Ctrl: \ XawPositionSimpleMenu(sectionMenu) \ MenuPopup(sectionMenu) \n\ Shift,:GotoPage(Directory)\n\ Ctrlq: Quit() \n\ Ctrlc: Quit() \n\ Ctrlr: RemoveThisManpage() \n\ Ctrln: CreateNewManpage() \n\ Ctrlh: PopupHelp() \n\ Ctrld: GotoPage(Directory) \n\ Ctrlm: GotoPage(ManualPage) \n\ Ctrlv: ShowVersion() \n\ Prior: Page(Back) \n\ Next : Page(Forward) \n\ Shift,: Page(Line,-1) \n\ Shift,: Page(Line,1) \n\ Ctrl,: Page(Back) \n\ Ctrl,: Page(Forward) \n\ ~Shift ~Ctrl,: Page(Line,-5) \n\ ~Shift ~Ctrl,: Page(Line,5) \n\ Ctrls: PopupSearch() !*manualBrowser*directory.background: Grey80 *manualBrowser*directory.translations: #override \ Ctrl: \ XawPositionSimpleMenu(optionMenu) \ MenuPopup(optionMenu) \n\ Ctrl: \ XawPositionSimpleMenu(sectionMenu) \ MenuPopup(sectionMenu) \n\ Shift,: GotoPage(Manpage) \n\ Ctrlq: Quit() \n\ Ctrlc: Quit() \n\ Ctrlr: RemoveThisManpage() \n\ Ctrln: CreateNewManpage() \n\ Ctrlh: PopupHelp() \n\ Ctrld: GotoPage(Directory) \n\ Ctrlm: GotoPage(ManualPage) \n\ Ctrlv: ShowVersion() \n\ Ctrls: PopupSearch() *manualBrowser*search*manualPage.translations: #augment \ ,: Search(Manpage) reset() *manualBrowser*search*apropos.translations: #augment \ ,: Search(Apropos) reset() *manualBrowser*search*cancel*translations: #augment \ ,: Search(Cancel) reset() *manualBrowser*search*value*translations: #override \ Return: Search(Manpage) \n\ Ctrlm: Search(Manpage) *topBox*search*manualPage.translations: #augment \ ,: Search(Manpage, Open) reset() *topBox*search*apropos.translations: #augment \ ,: Search(Apropos, Open) reset() *topBox*search*cancel*translations: #augment \ ,: Search(Cancel, Open) reset() *topBox*search*value*translations: #override \ Return: Search(Manpage, Open) \n\ Ctrlm: Search(Manpage, Open) *manualBrowser*likeToSave*yes.translations: #override \ ,: SaveFormattedPage(Save) reset() \n\ y: SaveFormattedPage(Save) \n\ n: SaveFormattedPage(Cancel) *manualBrowser*likeToSave*no.translations: #override \ ,: SaveFormattedPage(Cancel) reset() \n\ y: SaveFormattedPage(Save) \n\ n: SaveFormattedPage(Cancel) *manualBrowser*likeToSave*translations: #override \ y: SaveFormattedPage(Save) \n\ n: SaveFormattedPage(Cancel) *helpButton.translations: #augment \ ,: PopupHelp() reset() *quitButton.translations: #augment \ ,: Quit() reset() *manpageButton.translations: #augment \ ,: CreateNewManpage() reset() ! EOF. x11-apps-7.7+5+nmu1ubuntu1/xman/handler.c0000664000000000000000000005513312476465600014736 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * xman - X window system manual page display program. * Author: Chris D. Peterson, MIT Project Athena * Created: October 29, 1987 */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include "globals.h" #include "vendor.h" #ifdef INCLUDE_XPRINT_SUPPORT #include "printdialog.h" #include "print.h" #endif /* INCLUDE_XPRINT_SUPPORT */ #ifdef RELEASE_VERSION #define XMAN_VERSION "Xman Version " PACKAGE_VERSION " - X11R" RELEASE_VERSION #else #define XMAN_VERSION "Xman Version " PACKAGE_VERSION #endif static void PutUpManpage(ManpageGlobals * man_globals, FILE * file); static void ToggleBothShownState(ManpageGlobals * man_globals); /* Function Name: OptionCallback * Description: This is the callback function for the callback menu. * Arguments: w - the widget we are calling back from. * globals_pointer - a pointer to the pseudo globals structure * for this manpage. * junk - (call data) not used. * Returns: none. */ /*ARGSUSED*/ void OptionCallback(Widget w, XtPointer pointer, XtPointer junk) { ManpageGlobals *man_globals = (ManpageGlobals *) pointer; String params; Cardinal num_params = 1; if (w == man_globals->search_entry) PopupSearch(XtParent(w), NULL, NULL, NULL); else if (w == man_globals->dir_entry) { /* Put Up Directory */ params = "Directory"; GotoPage(XtParent(w), NULL, ¶ms, &num_params); } else if (w == man_globals->manpage_entry) { /* Put Up Man Page */ params = "ManualPage"; GotoPage(XtParent(w), NULL, ¶ms, &num_params); } else if (w == man_globals->help_entry) /* Help */ PopupHelp(XtParent(w), NULL, NULL, NULL); else if (w == man_globals->both_screens_entry) /*Toggle Both_Shown State. */ ToggleBothShownState(man_globals); else if (w == man_globals->remove_entry) /* Kill the manpage */ RemoveThisManpage(XtParent(w), NULL, NULL, NULL); else if (w == man_globals->open_entry) /* Open new manpage */ CreateNewManpage(XtParent(w), NULL, NULL, NULL); #ifdef INCLUDE_XPRINT_SUPPORT else if (w == man_globals->print_entry) /* Print current manpage */ PrintThisManpage(XtParent(w), NULL, NULL, NULL); #endif /* INCLUDE_XPRINT_SUPPORT */ else if (w == man_globals->version_entry) /* Get version */ ShowVersion(XtParent(w), NULL, NULL, NULL); else if (w == man_globals->quit_entry) /* Quit. */ Quit(XtParent(w), NULL, NULL, NULL); } /* Function Name: ToggleBothShownState; * Description: toggles the state of the both shown feature. * Arguments: man_globals - the man globals structure. * Returns: none. */ /* * I did not have a two state widget, which is the way this * should really be done. 1/22/88 - CDP. */ static void ToggleBothShownState(ManpageGlobals * man_globals) { const char *label_str; Arg arglist[1]; if (man_globals->both_shown == TRUE) { label_str = SHOW_BOTH; if (man_globals->dir_shown) XtUnmanageChild(man_globals->manpagewidgets.manpage); else XtUnmanageChild(man_globals->manpagewidgets.directory); } else { Widget manpage = man_globals->manpagewidgets.manpage; Widget dir = man_globals->manpagewidgets.directory; label_str = SHOW_ONE; XtSetArg(arglist[0], XtNpreferredPaneSize, resources.directory_height); XtSetValues(dir, arglist, (Cardinal) 1); if (!man_globals->dir_shown) { XtUnmanageChild(manpage); XtManageChild(dir); } XtManageChild(manpage); } man_globals->both_shown = !man_globals->both_shown; if (man_globals->dir_shown) ChangeLabel(man_globals->label, man_globals->section_name[man_globals->current_directory]); else ChangeLabel(man_globals->label, man_globals->manpage_title); XtSetArg(arglist[0], XtNlabel, label_str); XtSetValues(man_globals->both_screens_entry, arglist, ONE); /* if both are shown there is no need to switch between the two. */ XtSetArg(arglist[0], XtNsensitive, !man_globals->both_shown); XtSetValues(man_globals->manpage_entry, arglist, ONE); XtSetValues(man_globals->dir_entry, arglist, ONE); } /* Function Name: Popup * Description: This function pops up the given widget under the cursor. * Arguments: w - the widget to popup. * grab_kind - the kind of grab to register. * Returns: none */ /* How far off the top of the widget to have the initial cursor position. */ #define OFF_OF_TOP 25 void Popup(Widget w, XtGrabKind grab_kind) { int x_root, y_root, y_pos, garbage; unsigned int mask; Window junk_window; XQueryPointer(XtDisplay(w), XtWindow(w), &junk_window, &junk_window, &x_root, &y_root, &garbage, &garbage, &mask); y_pos = OFF_OF_TOP - Height(w) / 2 - BorderWidth(w); PositionCenter(w, x_root, y_root, y_pos, 0, 2, 2); XtPopup(w, grab_kind); } /* Function Name: PutUpManpage * Description: Puts the manpage on the display. * Arguments: man_globals - a pointer to the pseudo globals structure * for this manpage. * file - the file to display. * Returns: none. */ static void PutUpManpage(ManpageGlobals * man_globals, FILE * file) { String params = "ManualPage"; Cardinal num_params = 1; if (file == NULL) return; OpenFile(man_globals, file); if (!man_globals->both_shown) { Arg arglist[1]; XtSetArg(arglist[0], XtNsensitive, TRUE); XtSetValues(man_globals->manpage_entry, arglist, ONE); XtSetValues(man_globals->both_screens_entry, arglist, ONE); } GotoPage(man_globals->manpagewidgets.manpage, NULL, ¶ms, &num_params); } /* Function Name: DirectoryHandler * Description: This is the callback function for the directory listings. * Arguments: w - the widget we are calling back from. * global_pointer - the pointer to the pseudo global structure * associated with this manpage. * ret_val - return value from the list widget. * Returns: none. */ void DirectoryHandler(Widget w, XtPointer global_pointer, XtPointer ret_val) { FILE *file; /* The manpage file. */ ManpageGlobals *man_globals = (ManpageGlobals *) global_pointer; XawListReturnStruct *ret_struct = (XawListReturnStruct *) ret_val; file = FindManualFile(man_globals, man_globals->current_directory, ret_struct->list_index); PutUpManpage(man_globals, file); if ((file != NULL) && (file != man_globals->curr_file)) { fclose(file); } } /* Function Name: DirPopupCallback * Description: This is the callback function for the callback menu. * Arguments: w - the widget we are calling back from. * pointer - a pointer to the pseudo globals structure * for this manpage. * junk - (call data) not used. * Returns: none. */ /*ARGSUSED*/ void DirPopupCallback(Widget w, XtPointer pointer, XtPointer junk) { ManpageGlobals *man_globals; MenuStruct *menu_struct; Widget parent; int number; int current_box; menu_struct = (MenuStruct *) pointer; man_globals = (ManpageGlobals *) menu_struct->data; number = menu_struct->number; current_box = man_globals->current_directory; /* We have used this guy, pop down the menu. */ if (number != current_box) { /* This is the only one that we know has a parent. */ parent = XtParent(man_globals->manpagewidgets.box[INITIAL_DIR]); MakeDirectoryBox(man_globals, parent, man_globals->manpagewidgets.box + number, number); XtUnmanageChild(man_globals->manpagewidgets.box[current_box]); XtManageChild(man_globals->manpagewidgets.box[number]); XawListUnhighlight(man_globals->manpagewidgets.box[current_box]); ChangeLabel(man_globals->label, man_globals->section_name[number]); man_globals->current_directory = number; } /* put up directory. */ if (!man_globals->both_shown) { XtUnmanageChild(man_globals->manpagewidgets.manpage); XtManageChild(man_globals->manpagewidgets.directory); } } /************************************************************ * * Action Routines. * ************************************************************/ /* Function Name: SaveFormattedPage * Description: This is the action routine may save the manpage. * Arguments: w - any widget in the widget tree. * event - NOT USED. * params, num_params - the parameters passed to the action * routine, can be either Manpage or * Directory. * Returns: none. */ /*ARGSUSED*/ void SaveFormattedPage(Widget w, XEvent * event, String * params, Cardinal * num_params) { ManpageGlobals *man_globals; char cmdbuf[BUFSIZ], error_buf[BUFSIZ]; if (*num_params != 1) { XtAppWarning(XtWidgetToApplicationContext(w), "Xman - SaveFormattedPage: This action routine requires one argument."); return; } man_globals = GetGlobals(w); /* * If we are not active then take no action. */ if (man_globals->tempfile[0] == '\0') return; switch (params[0][0]) { case 'S': case 's': #ifndef NO_COMPRESS if (!man_globals->compress) #endif snprintf(cmdbuf, sizeof(cmdbuf), "%s %s %s", COPY, man_globals->tempfile, man_globals->save_file); #ifndef NO_COMPRESS else if (man_globals->gzip) snprintf(cmdbuf, sizeof(cmdbuf), "%s < %s > %s", GZIP_COMPRESS, man_globals->tempfile, man_globals->save_file); else snprintf(cmdbuf, sizeof(cmdbuf), "%s < %s > %s", COMPRESS, man_globals->tempfile, man_globals->save_file); #endif if (!system(cmdbuf)) { /* make sure the formatted man page is fully accessible by the world */ if (chmod(man_globals->save_file, CHMOD_MODE) != 0) { snprintf(error_buf, sizeof(error_buf), "Couldn't set permissions on formatted man page '%s'.\n", man_globals->save_file); PopupWarning(man_globals, error_buf); } } else { snprintf(error_buf, sizeof(error_buf), "Error while executing the command '%s'.\n", cmdbuf); PopupWarning(man_globals, error_buf); } break; case 'C': case 'c': break; default: PopupWarning(man_globals, "Xman - SaveFormattedPage: " "Unknown argument must be either 'Save' or 'Cancel'."); return; } /* * We do not need the filename anymore, and have the fd open. * We will remove it. */ remove(man_globals->tempfile); XtPopdown(XtParent(XtParent(w))); } /* Function Name: GotoPage * Description: The Action routine that switches over to the manpage * or directory. * Arguments: w - any widget in the widget tree. * event - NOT USED. * params, num_params - the parameters passed to the action * routine, can be either Manpage or * Directory. * Returns: none. */ /*ARGSUSED*/ void GotoPage(Widget w, XEvent * event, String * params, Cardinal * num_params) { ManpageGlobals *man_globals; Arg arglist[1]; Boolean sensitive; if (*num_params != 1) { XtAppWarning(XtWidgetToApplicationContext(w), "Xman - GotoPage: This action routine requires one argument."); return; } man_globals = GetGlobals(w); if (man_globals->both_shown) { ChangeLabel(man_globals->label, man_globals->section_name[man_globals->current_directory]); return; } switch (params[0][0]) { case 'M': case 'm': XtSetArg(arglist[0], XtNsensitive, &sensitive); XtGetValues(man_globals->manpage_entry, arglist, ONE); if (sensitive) { ChangeLabel(man_globals->label, man_globals->manpage_title); XtUnmanageChild(man_globals->manpagewidgets.directory); XtManageChild(man_globals->manpagewidgets.manpage); man_globals->dir_shown = FALSE; } break; case 'D': case 'd': ChangeLabel(man_globals->label, man_globals->section_name[man_globals->current_directory]); XtUnmanageChild(man_globals->manpagewidgets.manpage); XtManageChild(man_globals->manpagewidgets.directory); man_globals->dir_shown = TRUE; break; default: XtAppWarning(XtWidgetToApplicationContext(w), "Xman - GotoPage: Unknown argument must be " "either Manpage or Directory."); return; } } /* Function Name: Quit. * Description: Quits Xman. * Arguments: w - any widget. * event - NOT USED. * params, num_params - NOT USED. * Returns: none. */ /*ARGSUSED*/ void Quit(Widget w, XEvent * event, String * params, Cardinal * num_params) { XtAppSetExitFlag(XtWidgetToApplicationContext(w)); } /* Function Name: PopupHelp * Description: Pops up xman's help. * Arguments: w - NOT USED. * event - NOT USED. * params, num_params - NOT USED. * Returns: none. */ /*ARGSUSED*/ void PopupHelp(Widget w, XEvent * event, String * params, Cardinal * num_params) { if (MakeHelpWidget()) XtPopup(help_widget, XtGrabNone); } /* Function Name: PopupSearch * Description: Pops up this manual pages search widget. * Arguments: w - any widget in this manpage. * event - NOT USED. * params, num_params - NOT USED. * Returns: none. */ /*ARGSUSED*/ void PopupSearch(Widget w, XEvent * event, String * params, Cardinal * num_params) { ManpageGlobals *man_globals = GetGlobals(w); if (man_globals->search_widget) { if (!XtIsRealized(man_globals->search_widget)) { XtRealizeWidget(man_globals->search_widget); AddCursor(man_globals->search_widget, resources.cursors.search_entry); } Popup(man_globals->search_widget, XtGrabNone); } } /* Function Name: CreateNewManpage * Description: Creates A New Manual Page. * Arguments: w - NOT USED. * event - NOT USED. * params, num_params - NOT USED. * Returns: none. */ /*ARGSUSED*/ void CreateNewManpage(Widget w, XEvent * event, String * params, Cardinal * num_params) { if (CreateManpage(NULL)) man_pages_shown++; } /* Function Name: RemoveThisManpage * Description: Removes a manual page. * Arguments: w - any widget in the manpage. * event - NOT USED. * params, num_params - NOT USED. * Returns: none. */ /*ARGSUSED*/ void RemoveThisManpage(Widget w, XEvent * event, String * params, Cardinal * num_params) { ManpageGlobals *man_globals = GetGlobals(w); if (man_globals->This_Manpage != help_widget) { RemoveGlobals(man_globals->This_Manpage); XtDestroyWidget(man_globals->This_Manpage); XtFree((char *) man_globals->section_name); XtFree((char *) man_globals->manpagewidgets.box); XtFree((char *) man_globals); if ((--man_pages_shown) == 0) Quit(w, NULL, NULL, NULL); } else XtPopdown(help_widget); } /* Function Name: Search * Description: Actually performs a search. * Arguments: w - any widget in the manpage. * event - NOT USED. * params, num_params - NOT USED. * Returns: none. */ /*ARGSUSED*/ void Search(Widget w, XEvent * event, String * params, Cardinal * num_params) { ManpageGlobals *man_globals = GetGlobals(w); FILE *file = NULL; XtPopdown(XtParent(XtParent(w))); /* popdown the search widget */ if ((*num_params < 1) || (*num_params > 2)) { XtAppWarning(XtWidgetToApplicationContext(w), "Xman - Search: This action routine requires one or two arguments."); return; } switch (params[0][0]) { case 'a': case 'A': file = DoSearch(man_globals, APROPOS); break; case 'm': case 'M': file = DoSearch(man_globals, MANUAL); break; case 'c': case 'C': file = NULL; break; default: XtAppWarning(XtWidgetToApplicationContext(w), "Xman - Search: First parameter unknown."); file = NULL; break; } if (*num_params == 2) switch (params[1][0]) { case 'O': case 'o': if (file != NULL) { Widget w2; char *label; w2 = CreateManpage(file); if (w2) { man_pages_shown++; /* Put title into new manual page. */ label = man_globals->manpage_title; man_globals = GetGlobals(w2); strcpy(man_globals->manpage_title, label); ChangeLabel(man_globals->label, label); } } break; default: XtAppWarning(XtWidgetToApplicationContext(w), "Xman - Search: Second parameter unknown."); break; } else { PutUpManpage(man_globals, file); } if ((file != NULL) && (file != man_globals->curr_file)) { fclose(file); } } #ifdef INCLUDE_XPRINT_SUPPORT static void printshellDestroyXtProc(Widget w, XtPointer client_data, XtPointer callData) { ManpageGlobals *mg = GetGlobals(w); XawPrintDialogClosePrinterConnection(mg->printdialog, False); } static void printOKXtProc(Widget w, XtPointer client_data, XtPointer callData) { XawPrintDialogCallbackStruct *pdcs = (XawPrintDialogCallbackStruct *) callData; Cardinal n; Arg args[2]; ManpageGlobals *mg = GetGlobals(w); Widget topwindow = mg->This_Manpage; FILE *file; Log(("printOKXtProc: OK.\n")); /* Get file object */ n = 0; XtSetArg(args[n], XtNfile, &file); n++; XtGetValues(mg->manpagewidgets.manpage, args, n); Assertion(file != NULL, (("printOKXtProc: file == NULL.\n"))); DoPrintManpage("Xman", file, topwindow, pdcs->pdpy, pdcs->pcontext, pdcs->colorspace, printshellDestroyXtProc, mg->manpage_title, pdcs->printToFile ? pdcs->printToFileName : NULL); XtPopdown(mg->printdialog_shell); } static void printCancelXtProc(Widget w, XtPointer client_data, XtPointer callData) { ManpageGlobals *mg = GetGlobals(w); Log(("printCancelXtProc: cancel.\n")); XtPopdown(mg->printdialog_shell); Log(("destroying print dialog shell...\n")); XtDestroyWidget(mg->printdialog_shell); mg->printdialog_shell = NULL; mg->printdialog = NULL; Log(("... done\n")); } /* Function Name: PrintThisManpage * Description: Print the current manual page. * Arguments: mg - manpage globals * Returns: none. */ /*ARGSUSED*/ void PrintThisManpage(Widget w, XEvent * event, String * params, Cardinal * num_params) { ManpageGlobals *mg = GetGlobals(w); Dimension width, height; Position x, y; Widget parent = mg->This_Manpage; Widget topwindow = mg->This_Manpage; Log(("print!\n")); if (!mg->printdialog) { int n; Arg args[20]; n = 0; XtSetArg(args[n], XtNallowShellResize, True); n++; mg->printdialog_shell = XtCreatePopupShell("printdialogshell", transientShellWidgetClass, topwindow, args, n); n = 0; mg->printdialog = XtCreateManagedWidget("printdialog", printDialogWidgetClass, mg->printdialog_shell, args, n); XtAddCallback(mg->printdialog, XawNOkCallback, printOKXtProc, NULL); XtAddCallback(mg->printdialog, XawNCancelCallback, printCancelXtProc, NULL); XtRealizeWidget(mg->printdialog_shell); } /* Center dialog */ XtVaGetValues(mg->printdialog_shell, XtNwidth, &width, XtNheight, &height, NULL); x = (Position) (XWidthOfScreen(XtScreen(parent)) - width) / 2; y = (Position) (XHeightOfScreen(XtScreen(parent)) - height) / 3; XtVaSetValues(mg->printdialog_shell, XtNx, x, XtNy, y, NULL); XtPopup(mg->printdialog_shell, XtGrabNonexclusive); } #endif /* INCLUDE_XPRINT_SUPPORT */ /* Function Name: ShowVersion * Description: Show current version. * Arguments: w - any widget in the manpage. * event - NOT USED. * params, num_params - NOT USED. * Returns: none. */ /*ARGSUSED*/ void ShowVersion(Widget w, XEvent * event, String * params, Cardinal * num_params) { ManpageGlobals *man_globals = GetGlobals(w); ChangeLabel(man_globals->label, XMAN_VERSION); } x11-apps-7.7+5+nmu1ubuntu1/xman/man.h0000664000000000000000000002466012476465600014102 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif /* X toolkit header files */ #include #include #include #include /* Std system and C header files */ #include #include #include #include /* X include files */ #include /* Widget header files. */ #include #include #include #include #include #include #include #include #include #include #include /* program specific header files. */ #include "ScrollByL.h" #include "defs.h" #define Error(x) { printf x ; exit(EXIT_FAILURE); } #define Assertion(expr, msg) { if (!(expr)) { Error msg } } #ifdef DEBUG # define Log(x) { if(True) printf x; } #else # define Log(x) { if(False) printf x; } #endif /* DEBUG */ /* * Assigning values here allows the user of Bitwise Or. */ typedef struct _XmanFonts { XFontStruct *directory; /* The font for the directory. */ } XmanFonts; typedef struct _XmanCursors { Cursor top, /* The top Cursor, default for xman. */ help, /* The top cursor for the help menu. */ manpage, /* The cursor for the Manpage. */ search_entry; /* The cursor for the text widget in the search box. */ Pixel fg_color; /* foreground color of cursors. */ Pixel bg_color; /* background color of cursors. */ } XmanCursors; typedef struct _ManPageWidgets { Widget manpage, /* The manual page window (scrolled) */ directory, /* The widget in which all directories will appear. */ *box; /* The boxes containing the sections. */ } ManPageWidgets; typedef struct _MenuStruct { caddr_t data; int number; XrmQuark quark; } MenuStruct; /* * The manual sections and entries */ typedef struct tManual { char *blabel; /* The button label. */ char **entries; /* The individual man page file names. */ char **entries_less_paths; /* Entry names only */ int nentries; /* how many (TOTAL) */ int nalloc; /* how much space allocated */ int flags; /* suffix, fold */ } Manual; /* pseudo Globals that are specific to each manpage created. */ typedef struct _ManpageGlobals { int current_directory; /* The directory currently being shown on this manpage. */ Boolean dir_shown, /* True if the directory is then current visible screen */ both_shown; /* If true then both the manpage and the directory are to be shown. */ Widget label, /* The label widget at the top of the page. */ standby, /* The please standby widget. */ save, /* The "would you like to save?" widget. */ search_widget, /* The search widget popup. */ help_button, /* The help button. */ option_menu, /* The option menu. */ text_widget; /* text widget containing search string. */ /* Widgets (Objects really) for the command menu entries. */ Widget dir_entry, manpage_entry, help_entry, search_entry, both_screens_entry, remove_entry, open_entry, print_entry, version_entry, quit_entry; #ifdef INCLUDE_XPRINT_SUPPORT /* Print objects and data */ Widget printdialog_shell; /* Shell for the print dialog */ Widget printdialog; /* Print dialog */ #endif /*INCLUDE_XPRINT_SUPPORT */ /* Misc. */ char manpage_title[80]; /* The label to use for the current manpage. */ char save_file[80]; /* the name of the file to save formatted page into. */ char tempfile[80]; /* the name of the file to copy the formatted page from. */ Boolean compress; /* Compress file on save? */ Boolean gzip; /* Gzip file on save? */ Boolean bzip2; /* Bzip2 file on save? */ Boolean lzma; Boolean deletetempfile; /* Need to delete tempfile when done? */ char **section_name; /* The name of each of the sections */ ManPageWidgets manpagewidgets; /* The manpage widgets. */ /* Things to remember when cleaning up when killing manpage. */ Widget This_Manpage; /* a pointer to the root of this manpage. */ FILE *curr_file; /* Current file shown in manpage widget */ } ManpageGlobals; /* Resource manager sets these. */ typedef struct _Xman_Resources { XmanFonts fonts; /* The fonts used for the man pages. */ XmanCursors cursors; /* The cursors for xman. */ Boolean show_help_syntax; /* True if syntax message should be dumped to stdout. */ Boolean both_shown_initial; /* The initial state of the manual pages show two screens or only one. */ Boolean top_box_active; /* Put up the Top Box. */ Boolean clear_search_string; /* clear the search string each time it is popped down? */ int directory_height; /* The default height of directory in both_shown mode. */ char *help_file; /* The name of the help file. */ char *title; /* The title for topBox */ Boolean iconic; /* Should topBox come up in an iconic state */ } Xman_Resources; /************************************************************ * * Function Definitions * ************************************************************/ /* Standard library function definitions. */ #include /* buttons.c */ ManpageGlobals *InitPsuedoGlobals(void); Widget CreateManpage(FILE * file); void CreateManpageWidget(ManpageGlobals * man_globals, char *name, Boolean full_instance); void FormUpWidgets(Widget parent, const char **full_size, const char **half_size); void MakeDirectoryBox(ManpageGlobals * man_globals, Widget parent, Widget * dir_disp, int section); void MakeSaveWidgets(ManpageGlobals * man_globals, Widget parent); void MakeTopBox(void); /* handler.c */ void DirPopupCallback(Widget w, XtPointer pointer, XtPointer junk); void DirectoryHandler(Widget w, XtPointer global_pointer, XtPointer ret_val); void OptionCallback(Widget w, XtPointer pointer, XtPointer junk); void Popup(Widget w, XtGrabKind grab_kind); /* Action Routines. */ void CreateNewManpage(Widget w, XEvent * event, String * params, Cardinal * num_params); void GotoPage(Widget w, XEvent * event, String * params, Cardinal * num_params); void PopupHelp(Widget w, XEvent * event, String * params, Cardinal * num_params); void PopupSearch(Widget w, XEvent * event, String * params, Cardinal * num_params); void Quit(Widget w, XEvent * event, String * params, Cardinal * num_params); void RemoveThisManpage(Widget w, XEvent * event, String * params, Cardinal * num_params); void SaveFormattedPage(Widget w, XEvent * event, String * params, Cardinal * num_params); void Search(Widget w, XEvent * event, String * params, Cardinal * num_params); #ifdef INCLUDE_XPRINT_SUPPORT void PrintThisManpage(Widget w, XEvent * event, String * params, Cardinal * num_params); #endif /* INCLUDE_XPRINT_SUPPORT */ void ShowVersion(Widget w, XEvent * event, String * params, Cardinal * num_params); /* help.c */ Boolean MakeHelpWidget(void); Boolean OpenHelpfile(ManpageGlobals * man_globals); /* man.c */ Bool ReadManConfig(char manpath[]); int Man(void); /* misc.c */ #ifndef HAVE_MKSTEMP _X_HIDDEN int Xmkstemp (char *template); # define mkstemp Xmkstemp #endif FILE *FindManualFile(ManpageGlobals * man_globals, int section_num, int entry_num); ManpageGlobals *GetGlobals(Widget w); void AddCursor(Widget w, Cursor cursor); void ChangeLabel(Widget w, const char *str); void OpenFile(ManpageGlobals * man_globals, FILE * file); void PopupWarning(ManpageGlobals * man_globals, const char *string); void PositionCenter(Widget widget, int x, int y, int above, int left, int v_space, int h_space); void PrintError(const char *string) _X_NORETURN; void RemoveGlobals(Widget w); void SaveGlobals(Widget w, ManpageGlobals * globals); void ParseEntry(const char *entry, char *path, char *sect, char *page); FILE *Format(ManpageGlobals * man_globals, const char *entry); /* search */ FILE *DoSearch(ManpageGlobals * man_globals, int type); void MakeSearchWidget(ManpageGlobals * man_globals, Widget parent); /* tkfunctions.c */ int Width(Widget); int Height(Widget); int BorderWidth(Widget); char *Name(Widget); x11-apps-7.7+5+nmu1ubuntu1/xman/ChangeLog0000664000000000000000000013177012476465617014741 0ustar commit 27ae1a020119b5254c0238ef60a1ba602befba56 Author: Alan Coopersmith Date: Fri Mar 6 19:06:48 2015 -0800 xman 1.1.4 Signed-off-by: Alan Coopersmith commit 4e70edc503ad153c4223995ae5fb4adf980b01bd Author: Alan Coopersmith Date: Wed Nov 12 19:25:49 2014 -0800 Ask groff for text instead of postscript on Solaris In the last case fallback to groff in #ifdef HANDLE_ROFFSEQ, it was just running "groff -man", which generates postscript output, which xman displays as a text dump of the postscript source, not very readable. Hit on Solaris since it wasn't caught by the earlier checks for CSRG_BASED, linux, __CYGWIN__, and __DARWIN__, which cover most other cases. Signed-off-by: Alan Coopersmith commit ddb35139f98bcf276ef328db00961dc5a1b4ecf7 Author: Alan Coopersmith Date: Fri Jul 11 20:12:43 2014 -0700 Fix typos & wording issues in source comments Signed-off-by: Alan Coopersmith commit b07a3b3bc4c039bf0c2b03c3c60eae7c86c6fc6e Author: Alan Coopersmith Date: Sat May 31 23:35:02 2014 -0700 autogen.sh: Honor NOCONFIGURE=1 See http://people.gnome.org/~walters/docs/build-api.txt Signed-off-by: Alan Coopersmith commit c9919b02bb41013789dc28f63285483ca8b18740 Author: Alan Coopersmith Date: Sat May 31 23:35:01 2014 -0700 configure: Drop AM_MAINTAINER_MODE Signed-off-by: Alan Coopersmith commit f6ae31ee1da66ecdd9ad049a5aa4fe82aca209c8 Author: Alan Coopersmith Date: Sat May 31 23:34:53 2014 -0700 config: Add missing AC_CONFIG_SRCDIR Regroup AC statements under the Autoconf initialization section. Regroup AM statements under the Automake initialization section. Signed-off-by: Alan Coopersmith commit e3a9f82775946f056e997df4528e5ff536edf4a5 Author: Thomas Klausner Date: Thu May 22 00:16:59 2014 +0200 Fix shadow warning. Reviewed-by: Alan Coopersmith Signed-off-by: Thomas Klausner commit bb926ce84421b1fc9795c229ce32332b77a4b18d Author: Jörg Sonnenberger Date: Thu May 22 00:15:36 2014 +0200 Fix tautology to the intended check. Reviewed-by: Alan Coopersmith Signed-off-by: Thomas Klausner commit 15382f62a734d5b4bde30378dab525deadae72c2 Author: Jon TURNEY Date: Wed Feb 19 14:51:34 2014 +0000 Use same FORMAT command on cygwin as on linux in HANDLE_ROFFSEQ case as well Signed-off-by: Jon TURNEY Reviewed-by: Yaakov Selkowitz commit a2976b6403ce3a98e8bb4f8db8c1703588800ee8 Author: Alan Coopersmith Date: Fri Oct 18 23:23:44 2013 -0700 Ensure fgets read at least one byte before modifying string If a file has a \0 byte (binary file, strange encoding, corruption), fgets() can return a string starting with a \0 byte - check for that before checking to see if the byte before the \0 is a \n, so we don't reach back before the start of our memory buffer. Also check that the penultimate byte is a \n before we chop it off, in case we're reading from a file missing a newline, or a line longer than fit in the buffer provided to fgets(). Signed-off-by: Alan Coopersmith commit 617209a03a219abfd0fc626be1a038d20443178b Author: Alan Coopersmith Date: Sun Sep 8 09:11:57 2013 -0700 Fix "no search will be preformed" typo in dialog box message Signed-off-by: Alan Coopersmith commit 46c0034ae501360edb541082d0eadb23babf302e Author: Alan Coopersmith Date: Fri Sep 6 23:46:22 2013 -0700 xman 1.1.3 Signed-off-by: Alan Coopersmith commit 9382d2510db6184fee7a531add217c5e38cefea4 Author: Alan Coopersmith Date: Fri Sep 6 23:44:27 2013 -0700 COPYING: Remove notice for Xprint code removed in 5722ca728763e7 Signed-off-by: Alan Coopersmith commit 64e6ead0bde2806f7be8222bd4805293d9c0f6ce Author: Alan Coopersmith Date: Wed Aug 7 23:59:04 2013 -0700 Resync Solaris man page section list with current Solaris xman Signed-off-by: Alan Coopersmith commit cf05d354a937e234f60d90c36c7bd676c521b548 Author: Alan Coopersmith Date: Sun Apr 21 13:11:23 2013 -0700 Check for CreateManpage returning NULL Now that it can propogate the malloc failure on from InitPsuedoGlobals, we need to check its result before using it as well. Signed-off-by: Alan Coopersmith commit 4d31718584028d9f3df144d54269c4b62a8b5bb5 Author: Alan Coopersmith Date: Sun Apr 21 13:08:38 2013 -0700 Check for InitPsuedoGlobals() returning NULL Fixes possible NULL pointer dereferences warned about by parfait: Read from null pointer 'man_globals' at line 162 of buttons.c in function 'CreateManpage'. Function 'InitPsuedoGlobals' may return constant 'NULL' at line 183, called at line 153. Null pointer introduced at line 183 in function 'InitPsuedoGlobals'. Read from null pointer 'man_globals' at line 59 of help.c in function 'MakeHelpWidget'. Function 'InitPsuedoGlobals' may return constant 'NULL' at line 185, called at line 56. Null pointer introduced at line 183 of buttons.c in function 'InitPsuedoGlobals'. and various ones following from each path from those points. Signed-off-by: Alan Coopersmith commit e34e8c6d3203cfeed0f98aae504f318a26d5d75b Author: Alan Coopersmith Date: Sun Apr 21 11:29:59 2013 -0700 Close file pointer before setting it to NULL in Format() Avoids more file leaks Signed-off-by: Alan Coopersmith commit 58b857bcc005552b1ae90733c52d456dc56c3f9b Author: Alan Coopersmith Date: Sun Apr 21 10:36:41 2013 -0700 Fix file leak in ConstructCommand() File was never closed in any code path. Found by parfait 1.1 bug checking tool: Error: File Leak File Leak: Leaked File file at line 729 of misc.c in function 'ConstructCommand'. file initialized at line 703 with fopen file leaks when fopen(fname, "r") != NULL at line 703. at line 771 of misc.c in function 'ConstructCommand'. file initialized at line 703 with fopen file leaks when fopen(fname, "r") != NULL at line 703. at line 773 of misc.c in function 'ConstructCommand'. file initialized at line 703 with fopen file leaks when fopen(fname, "r") != NULL at line 703. at line 763 of misc.c in function 'ConstructCommand'. file initialized at line 703 with fopen file leaks when fopen(fname, "r") != NULL at line 703 and left <= 1 at line 762. Signed-off-by: Alan Coopersmith commit d25a3b87ce9fdf950b42f45b644242d72e7167b3 Author: Alan Coopersmith Date: Sat Apr 20 09:56:08 2013 -0700 configure: check for groff and enable groff extensions if found Check for groff never got translated from imake to autoconf Signed-off-by: Alan Coopersmith Reviewed-by: Dan Nicholson commit 72b3760a2a5c4ea81c3bebf085b3b8f5ac56730e Author: Alan Coopersmith Date: Sat Apr 20 08:58:46 2013 -0700 Provide a fallback mkstemp so we don't need to maintain 2 API versions Unifies the file handling API's to always return an open fd or FILE *, instead of delaying the open when mkstemp was not available. Signed-off-by: Alan Coopersmith Reviewed-by: Dan Nicholson commit 5ca3757aaa698c8482cec092551e0cc72597981d Author: Alan Coopersmith Date: Sat Apr 20 09:38:27 2013 -0700 Fix scroll wheel when CapsLock, NumLock or other modifiers are on "None" means no modifiers at all, when all we really want is not Shift or Control, which have their own mappings. Signed-off-by: Alan Coopersmith commit 78c43bb3d12ed38bc5d750c3e0b1f7f0ea44cf0d Author: Alan Coopersmith Date: Sat Apr 20 09:02:32 2013 -0700 Increase default text window sizes from 600 to 780 pixels Old defaults weren't wide enough to display 80 columns of text in our default fonts, so our help & man pages didn't fit. Signed-off-by: Alan Coopersmith commit f82ad2fe93d85190e21a9fcdcc66fdd9ccdbbdb6 Author: Alan Coopersmith Date: Sat Apr 20 08:54:29 2013 -0700 Stop checking for OSMINORVERSION in list of Solaris man page sections It's never defined in the autotool setup, so these sections were always hidden - better to always define them and let the existing logic filter them out if they don't exist. Signed-off-by: Alan Coopersmith commit 2c52f843d4a359e32273bef4c08a49bcaec56100 Author: Alan Coopersmith Date: Sat Apr 20 00:04:18 2013 -0700 Use strchr() & strrchr() instead of index() & rindex() Welcome to ANSI C89. Signed-off-by: Alan Coopersmith commit 0c2d9fa7e5c2c109c68037e1b4da56fc4598b61b Author: Alan Coopersmith Date: Fri Apr 19 23:55:11 2013 -0700 Use remove() instead of unlink() In normal cases, no difference. If somehow our file path ends up pointing to a directory, can save having to fsck to clean up the mess, if someone is silly enough to be running xman as root. Signed-off-by: Alan Coopersmith commit 2e5d074873fe7440c397cbf257b0a9c2da28e08b Author: Alan Coopersmith Date: Fri Apr 19 23:08:32 2013 -0700 Mark PrintError as noreturn Suggested by gcc -Wsuggest-attribute=noreturn Signed-off-by: Alan Coopersmith commit 0d8f02da4e3e9d65608b26222d76ce75567956d0 Author: Alan Coopersmith Date: Fri Apr 19 23:04:17 2013 -0700 Remove unused NULLSTR macro Signed-off-by: Alan Coopersmith commit da80716836bd7a049e74503c660d853e512e6239 Author: Alan Coopersmith Date: Fri Apr 19 23:02:23 2013 -0700 constify char *'s to clear compiler complaints Can't get them all, due to Xt API, but this gets rid of dozens of warnings when building with gcc 4.7. Signed-off-by: Alan Coopersmith commit 27b1aadf2b24ad18e2d0d722e3b720f3f846dfec Author: Alan Coopersmith Date: Fri Apr 19 20:19:11 2013 -0700 Replace StrAlloc with XtNewString Wasn't as hard as the comment suggested. Signed-off-by: Alan Coopersmith commit e92ce109f36918b700eaaafed338fd532d017aa9 Author: Alan Coopersmith Date: Fri Apr 19 20:13:21 2013 -0700 Remove XConsortium/XFree86/XdotOrg RCS/CVS id tags Signed-off-by: Alan Coopersmith commit 0d0b3ac1adbbfc055555f6f9be1f61ed4686d235 Author: Alan Coopersmith Date: Fri Apr 19 23:34:12 2013 -0700 unifdef SYSV386 (really defined(SYSV) && defined(i386)) Signed-off-by: Alan Coopersmith commit bc2cd98ebf50dab5db099a812b9dedc62b593c85 Author: Alan Coopersmith Date: Fri Apr 19 23:27:17 2013 -0700 unifdef -Uhcx Signed-off-by: Alan Coopersmith commit c50a01ea37e0242943d276b6af39b81860cba2a3 Author: Alan Coopersmith Date: Fri Apr 19 23:25:09 2013 -0700 unifdef -UmacII Signed-off-by: Alan Coopersmith commit 08da0a2c5be93a9b711722d725b005e23bd50638 Author: Alan Coopersmith Date: Fri Apr 19 23:22:39 2013 -0700 unifdef -Uultrix Signed-off-by: Alan Coopersmith commit 401961177f9411e80213bab0d66ad0d82a1e96f1 Author: Alan Coopersmith Date: Fri Apr 19 20:23:49 2013 -0700 unifdef -UUTEK -Uapollo -ULynx Signed-off-by: Alan Coopersmith commit 767616ea1e22716901e9043faa912b25f56c23f0 Author: Alan Coopersmith Date: Fri Apr 19 20:11:51 2013 -0700 unifdef -UCRAY Signed-off-by: Alan Coopersmith commit 2803776db88953904e5b789c5d81ab375c7653f7 Author: Alan Coopersmith Date: Fri Apr 19 20:10:05 2013 -0700 Convert to X.Org standard code style Mostly via util/modular/x-indent-all.sh, plus some manual cleanup Signed-off-by: Alan Coopersmith commit 8140c2d43519fc44606a82e0d249541a2cdf516d Author: Alan Coopersmith Date: Fri Apr 19 18:41:23 2013 -0700 Fix numerous typos & spelling errors in comments and message strings Signed-off-by: Alan Coopersmith commit eec31c83594049fc52c985daacca0f8007a2a410 Author: Alan Coopersmith Date: Fri Apr 19 18:04:12 2013 -0700 Use everywhere instead of checking for X_NOT_POSIX/SYSV/USG/etc. Signed-off-by: Alan Coopersmith commit 6ffd48bf0084e3e26dee31b16b7234805db00c44 Author: Alan Coopersmith Date: Fri Jan 4 18:45:53 2013 -0800 unifdef -U__UNIXOS2__ Signed-off-by: Alan Coopersmith commit 2a502d748344549a2b74f8e147243048a400c451 Author: Eric S. Raymond Date: Thu Aug 23 12:34:15 2012 -0400 Eliminate use of tab stops. Use real TBL markup where indicated. These changes assist structural translation to DocBook. Signed-off-by: Eric S. Raymond commit a52a5150dd353a6dcc8db1720d0616d14b14905e Author: Christos Zoulas Date: Thu Jul 12 20:26:03 2012 +0200 Rename PIC to ROFF_PIC to avoid problems with "-DPIC" compilations. Signed-off-by: Thomas Klausner Signed-off-by: Alan Coopersmith commit 0824a8ce82e053723b661bf1c2864e52eebac917 Author: Alan Coopersmith Date: Wed Jun 29 20:53:53 2011 -0700 xman 1.1.2 Signed-off-by: Alan Coopersmith commit b8e4ebb00593d8b58815921cf5eb2d1e8a3738a7 Author: Alan Coopersmith Date: Fri Mar 4 18:16:48 2011 -0800 Remove xmu dependency by inlining AssignMax macro No calls from libXmu were used, just one instance of one simple macro that made the code harder to understand, so stop requiring it and linking directly to it. (Of course, libXaw still depends on it, so it will still be loaded indirectly.) Signed-off-by: Alan Coopersmith Reviewed-by: Matt Turner commit ca7ff690136a35b8dad90271db5966cc9614b1c1 Author: Alan Coopersmith Date: Fri Jan 28 23:10:22 2011 -0800 Use snprintf to PATH_MAX sized buffers to construct filenames Simpler than trying to calculate the size to malloc. Could have used XtAsprintf() but didn't seem worth the dependency for two simple calls with a standard, well-known maximum size. Signed-off-by: Alan Coopersmith Reviewed-by: Dirk Wallenstein commit 48709d1ed5002255fa322cb3f0c4b8d5a5a7f3de Author: Alan Coopersmith Date: Fri Jan 28 22:38:08 2011 -0800 Convert more sprintf calls to snprintf Previous conversion seems to have missed many calls right next to ones that were converted to snprintf already Signed-off-by: Alan Coopersmith Reviewed-by: Dirk Wallenstein commit 35265840bba5aa4098b2f12522ef4c80b17c604a Author: Alan Coopersmith Date: Fri Jan 28 22:35:35 2011 -0800 Don't need to copy static strings to a buffer before calling PopupWarning Signed-off-by: Alan Coopersmith Reviewed-by: Dirk Wallenstein commit 72817de248a160ae84532662268b380b701908e8 Author: Alan Coopersmith Date: Fri Jan 28 22:24:47 2011 -0800 Mark string argument to PopupWarning as a const char * PopupWarning just copies the string into the message it displays, via snprintf, and never writes to it. Signed-off-by: Alan Coopersmith Reviewed-by: Dirk Wallenstein commit 382d261e50ac976001376c3a660fba0a55faad6d Author: Gaetan Nadon Date: Thu Jan 13 14:18:09 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 461b7068c522a9a3a92cd64ac1b664d079803807 Author: Gaetan Nadon Date: Thu Jan 13 14:12:46 2011 -0500 man: replace hard coded man page section with substitution strings Signed-off-by: Gaetan Nadon commit d7cb024227f8df08840937335ddf3f6f1bc95bef Author: Gaetan Nadon Date: Thu Jan 13 11:15:47 2011 -0500 man: remove trailing spaces and tabs Using s/[ \t]*$// Signed-off-by: Gaetan Nadon commit a2b1b62a8603e21f4944ed55951d8682964f11b7 Author: Gaetan Nadon Date: Wed Jan 12 16:28:02 2011 -0500 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS This silences an Autoconf warning commit e62b0d9d0515221b5b82e5dbf63f10be8e2b2f1d Author: Gaetan Nadon Date: Wed Jan 12 15:29:50 2011 -0500 config: replace deprecated AC_HELP_STRING with AS_HELP_STRING This silences an Automake warning. Signed-off-by: Gaetan Nadon commit bee5d67ab054decda85e2ba2fc70cf8a53b74fcd Author: Alan Coopersmith Date: Sat Oct 30 17:31:47 2010 -0700 xman 1.1.1 Signed-off-by: Alan Coopersmith commit 689cb1e03b0feb46bf198a468e4cc5c91ff59aa6 Author: Alan Coopersmith Date: Sat Oct 30 17:29:22 2010 -0700 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now Signed-off-by: Alan Coopersmith commit 98f366e764334a853b291b84856996e3dfad8959 Author: Alan Coopersmith Date: Sat Oct 30 17:28:38 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS Enables use of platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit 8d75f5d9e4c2c1f819dfc4e523ad88a2a0b0e251 Author: Gaetan Nadon Date: Sat Oct 30 17:28:03 2010 -0700 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon Signed-off-by: Alan Coopersmith commit fd30b754d17685ad971294ce31e34de5fede5a25 Author: Gaetan Nadon Date: Sun Aug 8 12:00:53 2010 -0400 config: update direct dependencies for xman Depends on xproto through the inclusion of X.h. Depends on Xaw through the inclusion of List.h Depends on Xmu through the inclusion of Xmu/Misc.h Depends on Xt through the inclusion of Intrinsic.h PKG_CHECK_MODULES calls AC_SUBST for CFLAGS and LIBS Reviewed-by: Alan Coopersmith Signed-off-by: Gaetan Nadon commit 96224f67f30830c2b49045313dfa746d155c56bf Author: Alan Coopersmith Date: Fri Aug 6 15:08:24 2010 -0700 Fill in COPYING file with copyright notices from source code Signed-off-by: Alan Coopersmith commit 522ee7a23d31a0a0e359922d1194214db215bb6f Author: Gaetan Nadon Date: Wed Feb 10 17:28:55 2010 -0500 make: remove version.h from xman_SOURCES Commit cac7f814053ddbc8ec14666cfe85adc34344220f removed the file from git. Signed-off-by: Gaetan Nadon commit b36ab48574afae17c7701bc55a3a0d6a971c3ced Author: Gaetan Nadon Date: Sat Dec 19 20:48:48 2009 -0500 configure.ac: use backticks rather than $() for cmd subs Use "$PKG_CONFIG" rather than hard coded "pkg-config" Signed-off-by: Gaetan Nadon commit 9b52967330f1c6466a5b8729ad36a0a96b3dcd62 Author: Gaetan Nadon Date: Thu Nov 26 09:19:54 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit 05e1d899bc5df593b2fff79753aa7a53a8cc18aa Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit 8cdd724d38f63ca07b75e106db3d087c53f67eed Author: Gaetan Nadon Date: Mon Oct 26 22:08:39 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit 350724e6ee4a77586fcd8f026305a72cb3a9d3ca Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit cac7f814053ddbc8ec14666cfe85adc34344220f Author: Matthieu Herrb Date: Tue Oct 27 22:45:12 2009 +0100 Fix version display. Reviewed-by: Peter Hutterer Signed-off-by: Matthieu Herrb commit b82eb1279acc60f9ebb93730ac002dfde2118a4b Author: Alan Coopersmith Date: Fri Oct 16 14:10:04 2009 -0700 xman 1.1.0 Signed-off-by: Alan Coopersmith commit 2983ab485ff3fd68ff33d81f9fa46977ec724ac6 Author: Alan Coopersmith Date: Thu Oct 15 18:20:41 2009 -0700 Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS Signed-off-by: Alan Coopersmith commit 6c4d017430014699b5e108f10765e89bcc3f41cf Author: Yaakov Selkowitz Date: Thu Oct 15 16:09:44 2009 -0500 Cygwin uses Linux-style man Signed-off-by: Yaakov Selkowitz commit 44334f70b6623395bbef78513f712dbbf5cbfba0 Author: Alan Coopersmith Date: Thu Oct 1 14:54:27 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit 86e63ab1821387f6fcf3fce506357f76ad8dd194 Author: Paulo Cesar Pereira de Andrade Date: Thu Jan 17 17:42:12 2008 -0200 Add lzma manpage extension support. This should really be handled by the existing code to handle multiple extension formats... commit e4b0097161ec84b288ca480149ed0185e742d7a3 Author: Paulo Cesar Pereira de Andrade Date: Tue Jan 13 18:16:03 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, and corrects make distcheck. commit 3afab6ff3cd896514d3bb733244e3bb9640d1e7c Author: Jeremy Huddleston Date: Sat Nov 8 15:03:18 2008 -0800 Apple: Added Tiger's man.conf location to the search path commit 5722ca728763e7ec57088593e76ba84db61a726c Author: Julien Cristau Date: Thu Aug 21 00:38:27 2008 +0200 Remove xprint remnants commit f3579250f8aa332f2015cb1352ed8b7373eb10db Author: James Cloos Date: Wed Aug 20 10:32:52 2008 -0400 xaw8 is gone, use xaw7 commit 74dbdc66607017cd9ba3c2c3dba4a5536332fabb Author: Julien Cristau Date: Fri Mar 28 11:53:13 2008 +0100 Use AM_CFLAGS instead of xman_CFLAGS and remove AM_PROG_CC_C_O commit 6c9f3307ba95604654d0f0227b7e0457ef4bc47f Author: Jeremy Huddleston Date: Thu Mar 27 20:15:54 2008 -0700 Build fix for case insensitive file systems Also added AM_PROG_CC_C_O commit dbfa16889ae66d5880e23c9a63f8385896512020 Author: James Cloos Date: Sat Feb 9 21:53:14 2008 -0500 Allow xman to use bzip2 to decompress man pages Patch is from Mandriva as posted to bugzilla bug 14400. Use bunzip2(1) to decompress man pages, akin to the current support for gzip(1)ed pages. commit 2d03acacffae87865201991fc9ef44a7208ccb8f Author: James Cloos Date: Thu Dec 6 16:37:24 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit 137a0fd2e258d9337049263895b1d6142af3a464 Author: Jeremy C. Reed Date: Thu Aug 16 11:45:37 2007 -0500 Allow xman to be cross build by adding a ./configure --with-manconfig= option. (Based on discussion on xorg list at end of July.) commit 8077ab96dbb30ec5b5b4bbc67124fc6f2681cdb5 Author: Matthieu Herrb Date: Fri Aug 10 16:19:58 2007 +0200 Bump version for release commit 112a1b17708c8213cb19f31934458c19dd31f360 Author: Alan Coopersmith Date: Wed Jan 3 20:26:26 2007 -0800 renamed: .cvsignore -> .gitignore commit bede0f3651f51ce5bc99a2d6543664e3817d14f4 Author: Alan Coopersmith Date: Wed Jan 3 20:25:54 2007 -0800 Sun Bug 6504978: xman on Solaris x86 does not render correctly, nroff visible commit 7e0441a748aa62459bc74b08196e48e89860123e Author: Adam Jackson Date: Sun Apr 2 01:13:58 2006 +0000 Bump to 1.0.2. commit d76e42586ff3032b1427b9c130ed65c09078f4e4 Author: Alan Coopersmith Date: Fri Jan 6 22:39:24 2006 +0000 Sun bug 6240826: xman typo: 'geometery' in usage message (Sam Lau) commit d0b90cd56262986a6b8a57d91f1f833d3039bc9e Author: Kevin E Martin Date: Wed Dec 21 02:29:52 2005 +0000 Update package version for X11R7 release. commit e8eb7902e02e7ccad9ddd32eb517d989f90b3fa3 Author: Kevin E Martin Date: Tue Dec 20 21:54:20 2005 +0000 Bump hardcoded version number. commit cf34c7ba82f1aa7d25d1d7e9ad70aea39c05d780 Author: Adam Jackson Date: Mon Dec 19 16:22:46 2005 +0000 Stub COPYING files commit 4676f39901599df979f6a5da84234e76a713b583 Author: Kevin E Martin Date: Thu Dec 15 00:24:09 2005 +0000 Update package version number for final X11R7 release candidate. commit 28b5296571c67d70d8808e2f80d2c3f51fba15b6 Author: Kevin E Martin Date: Thu Dec 8 17:55:17 2005 +0000 Add configure options to allow hard-coded paths to be changed. commit 898dc25befe1d90e36e3735b011039745176e861 Author: Kevin E Martin Date: Wed Dec 7 16:18:01 2005 +0000 Change to use the app-defaults default dir configured in libXt. commit 60093efc850bea280c2931f81b90ee8d83a21df6 Author: Kevin E Martin Date: Tue Dec 6 22:48:24 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit 3863a37b310d213e58732d6a5c9c7c878cdf1a8d Author: Kevin E Martin Date: Sat Dec 3 05:49:26 2005 +0000 Update package version number for X11R7 RC3 release. commit e0dfbe139da41143cdfc3c222110db790f160f3e Author: Alan Coopersmith Date: Mon Nov 28 22:01:44 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit e4156c926662a13bea5c59ecfc128dfd5b5f988c Author: Eric Anholt Date: Mon Nov 21 10:35:02 2005 +0000 Another pass at .cvsignores for apps. commit 1a530f943936c8fe145e00567406a6c321dd9176 Author: Eric Anholt Date: Sun Nov 20 22:08:54 2005 +0000 Add/improve .cvsignore files for apps. commit d373967af861fb2c97dde15e56f13f575acc48da Author: Alan Coopersmith Date: Sun Nov 20 04:13:45 2005 +0000 Add dependency on xp module when building with Xprint support. commit 4b7d00e52f22d0c98152bc47f47a317619175ae9 Author: Kevin E Martin Date: Wed Nov 9 21:09:22 2005 +0000 Update package version number for X11R7 RC2 release. commit aaca206527e4fe4e3a825daae4261554681cec58 Author: Kean Johnson Date: Tue Nov 8 06:33:33 2005 +0000 See ChangeLog entry 2005-11-07 for details. commit 61785b3b0421ab82f88671dd5d515579cd5d8243 Author: Kevin E Martin Date: Wed Oct 19 02:47:56 2005 +0000 Update package version number for RC1 release. commit 4c5fda0874b94edf9189eb84839e9ae46df99df6 Author: Alan Coopersmith Date: Tue Oct 18 00:32:54 2005 +0000 Change default install dir for app-default files from $(sysconfdir)/X11/app-defaults to $(libdir)/X11/app-defaults to match the monolith & allow localization commit 009cf19ab0940f771eb5967a8f6528f20333b597 Author: Alan Coopersmith Date: Mon Oct 17 23:56:24 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 58076d1a51b69c6ef84258b2e3c4361fd6ac30e8 Author: Alan Coopersmith Date: Fri Oct 14 00:25:47 2005 +0000 Use sed to fill in variables in man page commit 41f684bf50fea4b96ebea38e728bb771b83dc736 Author: Alan Coopersmith Date: Mon Aug 1 20:25:30 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit f1b20d6d1578c6c57eed9fb81fd8d28282fc8bcc Author: Kevin E Martin Date: Fri Jul 29 21:22:36 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit c42be410ac62efc0252fae37b4ed1fb9d30bd457 Author: Alan Coopersmith Date: Thu Jul 28 23:16:55 2005 +0000 Set default man path for Solaris. commit f4f185f8700de48dcb5b888cd113dcb9aff91829 Author: Alan Coopersmith Date: Thu Jul 28 22:47:57 2005 +0000 Install xman.help Attempt to determine man page configuration file location and format (based on Imake MANCONFIGSTYLE and MANCONF settings - needs testing on various Linux & BSD flavors to see if I translated correctly) commit 7a3bd9a41a227ad0590d4104fd8ecc21e2099cd0 Author: Matthieu Herrb Date: Sat Jul 23 16:48:10 2005 +0000 fix remainig DEP_{CFLAGS,LIBS} references commit caa0a44964149cdbe1e3585b7799540e0827b4fc Author: Adam Jackson Date: Wed Jul 20 19:32:02 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit 0423e9c256b9fd808e09f306e9b7b668c799ed45 Author: Alan Coopersmith Date: Sat Jul 16 22:07:13 2005 +0000 Add #ifdef HAVE_CONFIG_H/#include "config.h" to files that need it to get HAS_MKSTEMP defined in modular builds. commit eb70952e2e8c3d103f8fcb3012328e542337c87a Author: Alan Coopersmith Date: Sat Jul 16 21:59:14 2005 +0000 Define HAS_MKSTEMP if mkstemp() is present (needed for improved protection against tempfile race conditions in many places) commit 622dfb510ce2896a79418a6227a8af634827b796 Author: Søren Sandmann Pedersen Date: Thu Jul 14 22:40:16 2005 +0000 Add _BSD_SOURCE to lots of applications - patch from Stefan Dirsch commit 6698505ac69196e38e1187c54204fb84ff6effe2 Author: Søren Sandmann Pedersen Date: Wed Jul 6 14:14:10 2005 +0000 Make Xman build again. - Use $xaw_use_xprint instead of $XAW_USE_XPRINT - Generate Xman by linking from either Xman-xprint.ad or Xman-noxprint.ad Both pointed out by Stefan Dirsch. commit fb0ffe45044025c82e1597b9cff7f8e1b2f216e6 Author: Søren Sandmann Pedersen Date: Tue Jul 5 22:51:11 2005 +0000 Add build systems for xlogo, xlsatoms, xlsclients, xmag, xman, xmessage, xmh, xmore. lib/Xaw/xaw.m4: Add an AM_CONDITIONAL and a shell variable xaw_use_xprint symlink.sh: add some extra files for xgc, xinit, xkbcomp, xlogo, xmb, and xmodmap xc/programs/xmore/xmore.c: Conditionalize use of xprint commit feaa900afe02312131f4f6f503fe6efa85a41eba Author: Roland Mainz Date: Mon Apr 11 01:06:15 2005 +0000 xc/programs/Xserver/Xprint/attributes.c xc/programs/glxgears/glxgears.c xc/programs/xdbedizzy/xdbedizzy.c xc/programs/xedit/Imakefile xc/programs/xedit/Xedit-xprint.ad xc/programs/xedit/util.c xc/programs/xedit/xedit.h xc/programs/xlogo/print.c xc/programs/xlogo/xlogo.c xc/programs/xlogo/xlogo.h xc/programs/xman/Imakefile xc/programs/xman/print.h xc/programs/xmore/Imakefile xc/programs/xmore/print.c xc/programs/xmore/print.h xc/programs/xmore/printdialog.c xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c xc/programs/xphelloworld/xphelloworld/xphelloworld.c xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c //bugs.freedesktop.org/show_bug.cgi?id=790) attachment #2379 (https://bugs.freedesktop.org/attachment.cgi?id=2379) Implement support client+Xserver support for passing output (stdout+stderr) of the spooler command started by the Xprint server back to the application using the "xp-spooler-command-results" XPJobAttr attribute (applications can fetch the attribute value after the XPEndJobNotify event was received; more details can be found in http://xprint.mozdev.org/docs/dtprint_fspec.ps). commit 821677f646bcaee8b5e4759d97909d05120de4d2 Author: Roland Mainz Date: Sat Apr 9 06:42:15 2005 +0000 //bugs.freedesktop.org/show_bug.cgi?id=2942) attachment #2360 (https://bugs.freedesktop.org/attachment.cgi?id=2360) Fix possible crash due uninitalised structure when "xman" opens the print dialog. commit a42a211aba369513bf31d6d34c966c36c1ccc714 Author: Roland Mainz Date: Mon Jan 3 01:06:35 2005 +0000 xc/lib/XprintAppUtil/xpapputil.c xc/lib/XprintAppUtil/xpapputil.h xc/lib/XprintUtil/xprintutil.c xc/lib/XprintUtil/xprintutil.h xc/programs/glxgears/glxgears.c xc/programs/xdbedizzy/xdbedizzy.c xc/programs/xedit/Xedit-xprint.ad xc/programs/xedit/commands.c xc/programs/xlogo/print.c xc/programs/xlsfonts/xlsfonts.c xc/programs/xlsfonts/xlsfonts.man xc/programs/xlsfonts/xlsfonts.sgml xc/programs/xman/Xman-xprint.ad xc/programs/xman/handler.c xc/programs/xman/print.c xc/programs/xman/print.h xc/programs/xmore/XMore.ad xc/programs/xmore/print.c xc/programs/xmore/print.h xc/programs/xmore/printdialog.c xc/programs/xmore/printdialog.h xc/programs/xmore/printdialogprivates.h xc/programs/xmore/xmore.c xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c xc/programs/xphelloworld/xphelloworld/xphelloworld.c xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c xc/programs/xphelloworld/xpxthelloworld/xpxthelloworld.c xc/programs/xplsprinters/xplsprinters.c //bugs.freedesktop.org/show_bug.cgi?id=1706) attachment #1615 (https://bugs.freedesktop.org/attachment.cgi?id=1615): XprintUtils 2004/Q3 update. This adds various new features to the XprintUtils library including support for page resolutions where X_resolution!=Y_resolution, listfonts-mode control and initial framework for the COLORSPACE extension. Patch by Roland Mainz and Julien Lafon . commit 6abedd2bce33d244546a3efed44beb95c6571157 Author: Egbert Eich Date: Mon Oct 18 14:21:47 2004 +0000 Made handling of DevelDrivers for x86-64 more conformant to other platforms. Compress all font encodings (Stefan Dirsch). Fixed warnings. Turn on forwarding XNSpotLocation event to XIM server in OffTheSpot and Root mode (bugzilla #1580, James Su). Added another compose key combination for the Euro symbol (Stefan Dirsch). Added support for UTF-8 in ja_JP, ko_KR and zh_TW locales (Mike Fabian). Changed default encoding for ru from KOI8-R to ISO8859-5 (Mike Fabian). This is the encoding that is also used by glibc. We may break other libcs - lets see who complains. Added explanation for DESTDIR to install to a different directory than /. Added some early bailouts to atiprobe if PCI structure pointer is NULL to prevent sig11. XV support doesn't depend on 2D acceleration any more. This patch removes this limitation from the NSC driver. This is a patch that I have committed to XFree86 a while ago but never ported over to X.Org. Matthieu Herrb contributed some build fixes. Fixing SetDPMSTimers() so that DPMS*Time == 0 disables the appropriate timer. This takes advantage of the fact that TimerSet() with a timeout argument 0 behaves like TimerCanel(). Use /dev/xconsole (named pipe) or devpts for system logger (Werner Fink). Create missing links for backward compatibility to XFree86 (Stefan Dirsch). Changed comment to mention xorg. Changed cursor for the 'kill' action from XC_draped_box to XC_Pirate. If you don't like it we can change it back (original author unkown). Added 'pic' to the man page rendering command pipeline (Werner Fink). Added missing return value (Stefan Dirsch, Roland Mainz) commit 4cf1c874d8ea1eb2222e10ca92c2c5afa30e1326 Author: Roland Mainz Date: Tue Oct 12 22:46:40 2004 +0000 Fix for https://freedesktop.org/bugzilla/show_bug.cgi?id=1601 - Fix problems with wrong page counts in xedit&co. when a global "*geometry" resource was overriding the internal geometry management used by XawPrintShell(=usually adjust to current page size, the resource was turning this into a static value). (Original patch by Felix Schulte ) commit b9b8f24095964cdfe21b52a5f2667a42fdc6220d Author: Matthieu Herrb Date: Wed Sep 29 20:04:57 2004 +0000 Avoid several buffer overflows if search string is too long. Bugzilla #1481. commit 545064318591f8c27701da0af0ebc5d9fd1b2ec5 Author: Kevin E Martin Date: Thu Sep 2 08:40:33 2004 +0000 Restore xman and xedit changes that were previously reverted, and make Xprint support optional (Bug #1273, Roland Mainz). commit 50a3e1e4269fe2ef6c97ff40a6dc02d074e7ba95 Author: Kristian Høgsberg Date: Mon Aug 16 16:36:26 2004 +0000 As discussed and agreed on on the release-wranglers meeting of August 16, I'm committing the patch from bug #1060 to back out unconditional Xprint functionality. Back out Xprint changes. Revert xman to CVS of June 5, revert xlogo to CVS of May 8, revert xedit to CVS of April 25, to back out unconditional Xprint support. Fix up Xprint config logic to be like the rest of the extensions: BuildXprint is a one-stop option for disabling everything Xprint related. XprtServer controls building Xprt, BuildXprintLib controls building Xprint libs and BuildXprintClients controls building clients related to Xprint. BuiltXprint defaults to YES and the other options respects relevant settings, i.e. BuildServer and BuildServersOnly. Build Xaw regardless of BuildXprintLib setting. Only build xphelloworld, xplsprinters and xprehashprinterlist when BuildXprintClients it YES. Disable building xmore, it has always supported XawPrintShell. Make Xprint support depend on BuildXprintLib. commit 6b0d9917116797e38b554397b815c555bf55a721 Author: Roland Mainz Date: Thu Jul 29 00:40:35 2004 +0000 Fix for https://freedesktop.org/bugzilla/show_bug.cgi?id=938 - Update XawPrintShell per feedback and review comments. commit 24ffc96e3347125c213090d9c9550fbf48756459 Author: Alan Hourihane Date: Thu Jul 1 13:54:46 2004 +0000 DoSearch is defined in search.c commit 7cf0973ed5076c513b3a970a8250066a05b0473e Author: Roland Mainz Date: Tue Jun 8 02:44:35 2004 +0000 Fix for http://freedesktop.org/bugzilla/show_bug.cgi?id=668 - Add print support to xman commit 113139a1b202d0b94dcd24facc7b2c584faf294e Author: Alan Coopersmith Date: Sat May 22 19:20:06 2004 +0000 Set HasMkstemp to YES on Solaris xc/programs/xman/man.c xc/programs/xman/man.h xc/programs/xman/misc.c xman cannot display SGML man pages on Solaris commit 313f95249e4621b9002bdd054106b8b743ff64ae Author: Egbert Eich Date: Fri Apr 23 19:54:58 2004 +0000 Merging XORG-CURRENT into trunk commit 0b24854cbc017733d4e782db65912a473ec053be Author: Egbert Eich Date: Sun Mar 14 08:35:40 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit 7093a5ad5e15f7c2a7bb8feb6f3255f9a4f8983a Author: Egbert Eich Date: Wed Mar 3 12:13:15 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit 471b69d7053fb225fee8a2ff987c789d421aedfa Author: Egbert Eich Date: Thu Feb 26 13:36:26 2004 +0000 readding XFree86's cvs IDs commit 31f5f6a32ae09278b3bb6f8aecc18793d66b3437 Author: Egbert Eich Date: Thu Feb 26 09:24:14 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit 06d8bbebd1daa587dc5509d9d464646a9ae07c45 Author: Kaleb Keithley Date: Tue Nov 25 19:29:15 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit 1504e01d61c573156fe82c2395362f0567102d8a Author: Kaleb Keithley Date: Fri Nov 14 16:49:23 2003 +0000 XFree86 4.3.0.1 commit 36fca7804971e1b209138fcf82aee2d74cb2583e Author: Kaleb Keithley Date: Fri Nov 14 16:49:23 2003 +0000 Initial revision x11-apps-7.7+5+nmu1ubuntu1/xman/defs.h0000664000000000000000000001234312476465600014243 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * xman - X window system manual page display program. * Author: Chris D. Peterson, MIT Project Athena * Created: October 22, 1987 */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #ifndef HELPFILE #define HELPFILE "/usr/lib/X11/xman.help" /* name of the default helpfile. */ #endif /* The default cursors */ #define XMAN_CURSOR "left_ptr" /* Top level cursor. */ #define HELP_CURSOR "left_ptr" /* The help cursor. */ #define MANPAGE_CURSOR "left_ptr" /* The manpage cursor. */ #define SEARCH_ENTRY_CURSOR "question_arrow" /* The search text widget cursor. */ #define DIRECTORY_NORMAL "fixed" /* The default dir font */ #define OPTION_MENU "optionMenu" /* Name of the Option Menu. */ #define SECTION_MENU "sectionMenu" /* Name of the Section Menu. */ #define HELP_BUTTON "helpButton" /* Name of top help button */ #define QUIT_BUTTON "quitButton" /* Name of top quit button */ #define MANPAGE_BUTTON "manpageButton" /* Name of top manpage button */ #define TOPBOXNAME "topBox" /* Name of the Top Box. */ #define MANNAME "manualBrowser" /* name for each manual page widget. */ #define SEARCHNAME "search" /* The name for the search widget. */ #define HELPNAME "help" /* The name of the help widget. */ #define DIRECTORY_NAME "directory" /* name of the directory widget. */ #define MANUALPAGE "manualPage" /* name of the Scrollbyline widget that contains the man page. */ #define DIALOG "dialog" /* Names of the menu buttons */ #ifdef INCLUDE_XPRINT_SUPPORT #define NUM_OPTIONS 10 /* Number of menu options. */ #else /* !INCLUDE_XPRINT_SUPPORT */ #define NUM_OPTIONS 9 /* Number of menu options. */ #endif /* !INCLUDE_XPRINT_SUPPORT */ #define DIRECTORY "displayDirectory" #define MANPAGE "displayManualPage" #define HELP "help" #define SEARCH "search" #define BOTH_SCREENS "showBothScreens" #define REMOVE_MANPAGE "removeThisManpage" #define OPEN_MANPAGE "openNewManpage" #ifdef INCLUDE_XPRINT_SUPPORT #define PRINT_MANPAGE "printManualPage" #endif /* INCLUDE_XPRINT_SUPPORT */ #define SHOW_VERSION "showVersion" #define QUIT "quit" /* definitions of string to use for show both and show one. */ #define SHOW_BOTH "Show Both Screens" #define SHOW_ONE "Show One Screen" /* * Things will not look right if you change these names to make * MANUALSEARCH longer APROPOSSEARCH, see search.c for details. */ #define MANUALSEARCH "manualPage" #define APROPOSSEARCH "apropos" #define CANCEL "cancel" #define MANUAL 0 #define APROPOS 1 #define NO_SECTION_DEFAULTS ("no default sections") /* * Define HANDLE_ROFFSEQ to enable parsing of '\" * sequences in source files to set the format pipeline. * This is necessary because the default pipeline causes incorrect * display of ascii(7) on Linux. * This depends on GNU roff. */ #ifdef HAS_GROFF #define HANDLE_ROFFSEQ #endif #define DEFAULT_WIDTH 500 /* The default width of xman. */ #define SECTALLOC 8 /* The number of entries allocated at a time for the manual structures. */ #define ENTRYALLOC 100 /* The number of entries allocated at a time for a section. */ #define INITIAL_DIR 0 /* The Initial Directory displayed. */ #define COPY "cp" /* copy command */ #define CHMOD_MODE 00666 /* permissions set on saved formatted files */ #define MANDESC "mandesc" /* name of the mandesc files */ #define INDENT 15 #define TYP20STR "MMMMMMMMMMMMMMMMMMMM" #define FILE_SAVE "yes" #define CANCEL_FILE_SAVE "no" #define MANTEMP "/tmp/xmanXXXXXX" /* * Macro Definitions. */ #define streq(a, b) ( strcmp((a), (b)) == 0 ) /* * Function definitions moved to man.h */ x11-apps-7.7+5+nmu1ubuntu1/xman/iconclosed.h0000664000000000000000000000401212476465600015436 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * Author: Chris D. Peterson, MIT Project Athena * Created: January 29, 1988 */ #define iconclosed_width 20 #define iconclosed_height 30 static const unsigned char iconclosed_bits[] = { 0x00, 0x00, 0x00, 0xfc, 0xff, 0x07, 0x0e, 0xf8, 0x07, 0x06, 0x00, 0x05, 0xfe, 0xff, 0x04, 0xbe, 0xfb, 0x04, 0xbe, 0xfb, 0x04, 0xbe, 0xfb, 0x04, 0xbe, 0xfb, 0x04, 0xbe, 0xfb, 0x04, 0x3e, 0xf8, 0x04, 0xfe, 0xff, 0x04, 0xfe, 0xff, 0x04, 0x3e, 0xf8, 0x04, 0xbe, 0xfb, 0x04, 0xbe, 0xfb, 0x04, 0x3e, 0xf8, 0x04, 0xbe, 0xff, 0x04, 0xbe, 0xff, 0x04, 0xfe, 0xff, 0x04, 0xfe, 0xff, 0x04, 0x3e, 0xf9, 0x04, 0x3e, 0xf9, 0x04, 0xbe, 0xfa, 0x04, 0xbe, 0xfa, 0x04, 0xbe, 0xfb, 0x06, 0xbe, 0xfb, 0x05, 0xfe, 0xff, 0x00, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00 }; x11-apps-7.7+5+nmu1ubuntu1/xman/depcomp0000755000000000000000000005601612656634710014531 0ustar #! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xman/ScrollByL.h0000664000000000000000000000537612476465600015177 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _XtScrollByLine_h #define _XtScrollByLine_h /*********************************************************************** * * ScrollByLine Widget (subclass of Simple) * ***********************************************************************/ /* * The default fonts. */ #ifdef ATHENA #define MANPAGE_NORMAL "fixed" #define MANPAGE_BOLD "helvetica-bold12" #define MANPAGE_ITALIC "helvetica-boldoblique12" #define MANPAGE_SYMBOL "symbol-medium12" #else #define MANPAGE_NORMAL "*-new century schoolbook-medium-r-normal--*-120-*" #define MANPAGE_BOLD "*-new century schoolbook-bold-r-normal--*-120-*" #define MANPAGE_ITALIC "*-new century schoolbook-bold-i-normal--*-120-*" #define MANPAGE_SYMBOL "*-symbol-medium-r-normal--*-120-*" #endif /* ATHENA */ #define XtNindent "indent" #define XtNforceVert "forceVert" #define XtNmanualFontNormal "manualFontNormal" #define XtNmanualFontBold "manualFontBold" #define XtNmanualFontItalic "manualFontItalic" #define XtNmanualFontSymbol "manualFontSymbol" #define XtNNumTotalLines "numTotalLines" #define XtNNumVisibleLines "numVisibleLines" #define XtCIndent "Indent" #define XtCNumTotalLines "NumTotalLines" #define XtCNumVisibleLines "NumVisibleLines" /* Class record constants */ extern WidgetClass scrollByLineWidgetClass; typedef struct _ScrollByLineClassRec *ScrollByLineWidgetClass; typedef struct _ScrollByLineRec *ScrollByLineWidget; #endif /* _XtScrollByLine_h --- DON'T ADD STUFF AFTER THIS LINE */ x11-apps-7.7+5+nmu1ubuntu1/xman/config.guess0000775000000000000000000012367212514123564015472 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-11-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xman/man.c0000664000000000000000000007631612476465600014102 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include "globals.h" #include "vendor.h" /* vendor-specific defines and data */ #include #ifdef DEBUG static char error_buf[BUFSIZ]; /* The buffer for error messages. */ #endif /* DEBUG */ static void AddToCurrentSection(Manual * local_manual, char *path); static void InitManual(Manual * l_manual, char *label); static void ReadCurrentSection(Manual * local_manual, char *path); static void ReadMandescFile(SectionList ** section_list, char *path); static void SortAndRemove(Manual * man, int number); static void SortList(SectionList ** list); #define SECT_ERROR -1 #ifndef Byte #define Byte unsigned char #endif #ifndef reg #define reg register #endif static void sortstrs(Byte * data[], int size, Byte * otherdata[]); static void sortstrs_block(Byte **, Byte **, int, Byte, Byte **, Byte **); static void sortstrs_block_oo(Byte **, Byte **, int, Byte, int *, int *, Byte **, Byte **); /* Function Name: Man * Description: Builds a list of all manual directories and files. * Arguments: none. * Returns: the number of manual sections. */ int Man(void) { SectionList *list = NULL; char *ptr, *lang = NULL, manpath[BUFSIZ], buf[BUFSIZ], *path, *current_label; int sect, num_alloced; /* * Get the environment variable MANPATH, and if it doesn't exist then use * SYSMANPATH and LOCALMANPATH. */ /* if MANPATH variable ends in ':'. So, should extend it's value to the * default search path. */ *manpath = '\0'; if ((ptr = getenv("MANPATH")) != NULL) strcpy(manpath, ptr); if (ptr == NULL || streq(ptr, "") || ptr[strlen(ptr) - 1] == ':') { lang = getenv("LANG"); #ifdef MANCONF if (!ReadManConfig(manpath + strlen(manpath))) #endif { #ifdef MANCONF if (manpath[strlen(manpath) - 1] != ':') strcat(manpath, ":"); #endif strcat(manpath, SYSMANPATH); #ifdef LOCALMANPATH strcat(manpath, ":"); strcat(manpath, LOCALMANPATH); #endif } } /* * Get the list of manual directories in the users MANPATH that we should * open to look for manual pages. The ``mandesc'' file is read here. */ for (path = manpath; (ptr = strchr(path, ':')) != NULL; path = ++ptr) { *ptr = '\0'; if (lang != NULL) { strcpy(buf, path); strcat(buf, "/"); strncat(buf, lang, sizeof(buf) - strlen(path) + 1); buf[sizeof(buf) - strlen(path) + 1] = '\0'; ReadMandescFile(&list, buf); } ReadMandescFile(&list, path); } if (lang != NULL) { strcpy(buf, path); strcat(buf, "/"); strncat(buf, lang, sizeof(buf) - strlen(path) + 1); buf[sizeof(buf) - strlen(path) + 1] = '\0'; ReadMandescFile(&list, buf); } ReadMandescFile(&list, path); SortList(&list); sect = 0; num_alloced = SECTALLOC; manual = (Manual *) XtMalloc(sizeof(Manual) * num_alloced); InitManual(manual, list->label); manual[sect].flags = list->flags; current_label = NULL; while (list != NULL) { SectionList *old_list; if (current_label == NULL || streq(list->label, current_label)) AddToCurrentSection(manual + sect, list->directory); else { if (manual[sect].nentries == 0) { /* empty section, re-use it. */ XtFree(manual[sect].blabel); manual[sect].blabel = list->label; manual[sect].flags = list->flags; } else { if (++sect >= num_alloced) { num_alloced += SECTALLOC; manual = (Manual *) XtRealloc((char *) manual, (sizeof(Manual) * num_alloced)); if (manual == NULL) PrintError ("Could not allocate memory for manual sections."); } InitManual(manual + sect, list->label); manual[sect].flags = list->flags; } AddToCurrentSection(manual + sect, list->directory); } /* Save label to see if it matches next entry. */ current_label = list->label; old_list = list; list = list->next; XtFree((char *) old_list); /* free what you allocate. */ } if (manual[sect].nentries != 0) sect++; /* don't forget that last section. */ SortAndRemove(manual, sect); #ifdef notdef /* dump info. */ DumpManual(sect); #endif /* * realloc manual to be minimum space necessary. */ if (sect == 0) PrintError("No manual pages found."); manual = (Manual *) XtRealloc((char *) manual, (sizeof(Manual) * sect)); if (manual == NULL) PrintError("Could not allocate memory for manual sections."); return (sect); /* return the number of man sections. */ } /* Function Name: SortList * Description: Sorts the list of sections to search. * Arguments: list - a pointer to the list to sort. * Returns: a sorted list. * * This is the most complicated part of the entire operation. * all sections with the same label must by right next to each other, * but the sections that are in the standard list have to come first. */ static void SortList(SectionList ** list) { SectionList *local; SectionList *head, *last, *inner, *old; if (*list == NULL) PrintError("No manual sections to read, exiting."); /* * First step * * Look for standard list items, and more them to the top of the list. */ last = NULL; /* keep Saber happy. */ for (local = *list; local->next != NULL; local = local->next) { if (local->flags) { if (local == *list) /* top element is already standard. */ break; head = local; /* Find end of standard block */ for (old = NULL; (local->next != NULL) && (local->flags); old = local, local = local->next); if (old != NULL) { last->next = old->next; /* Move the block. */ old->next = *list; *list = head; } break; /* First step accomplished. */ } last = local; } /* * Second step * * Move items with duplicate labels right next to each other. * * Changed to keep the order of the list entries unchanged. */ for (local = *list; local->next != NULL; local = local->next) { head = local; old = inner = local->next; while (inner != NULL) { if (streq(inner->label, local->label)) { if (old != inner) { old->next = inner->next; last = inner->next; inner->next = head->next; head->next = inner; head = inner; old = inner = last; continue; } else head = inner; } old = inner; inner = inner->next; } } } /* Function Name: ReadMandescFile * Description: Reads the mandesc file, and adds more sections as * necessary. * Arguments: path - path name if the current search directory. * section_list - pointer to the list of sections. * Returns: TRUE in we should use default sections */ static void ReadMandescFile(SectionList ** section_list, char *path) { char mandesc_file[BUFSIZ]; /* full path to the mandesc file. */ FILE *descfile; char string[BUFSIZ], local_file[BUFSIZ]; Boolean use_defaults = TRUE; char *cp; snprintf(mandesc_file, sizeof(mandesc_file), "%s/%s", path, MANDESC); if ((descfile = fopen(mandesc_file, "r")) != NULL) { while (fgets(string, BUFSIZ, descfile) != NULL) { size_t len = strlen(string); if (len == 0) continue; if (string[len - 1] == '\n') string[len - 1] = '\0'; /* Strip off the CR. */ if (streq(string, NO_SECTION_DEFAULTS)) { use_defaults = FALSE; continue; } if ((cp = strchr(string, '\t')) != NULL) { char *s; *cp++ = '\0'; strcpy(local_file, MAN); strcat(local_file, string); if ((s = strchr(cp, '\t')) != NULL) { *s++ = '\0'; if (streq(s, SUFFIX)) AddNewSection(section_list, path, local_file, cp, MSUFFIX); else if (streq(s, FOLD)) AddNewSection(section_list, path, local_file, cp, MFOLD); else if (streq(s, FOLDSUFFIX)) AddNewSection(section_list, path, local_file, cp, MFOLDSUFFIX); else AddNewSection(section_list, path, local_file, cp, MNULL); } else AddNewSection(section_list, path, local_file, cp, MNULL); } else { snprintf(local_file, sizeof(local_file), "%s%c", MAN, string[0]); AddNewSection(section_list, path, local_file, (string + 1), FALSE); #ifdef SEARCHOTHER snprintf(local_file, sizeof(local_file), "%s%c", SEARCHOTHER, string[0]); AddNewSection(section_list, path, local_file, (string + 1), FALSE); #endif } } fclose(descfile); } if (use_defaults) AddStandardSections(section_list, path); } /* Function Name: AddNewSection * Description: Adds the new section onto the current section list. * Arguments: list - pointer to the section list. * path - the path to the current manual section. * file - the file to save. * label - the current section label. * flags = 1 - add a suffix * = 2 - fold to lower case * Returns: none. */ void AddNewSection(SectionList ** list, const char *path, const char *file, const char *label, int flags) { SectionList *local_list, *end; char full_path[BUFSIZ]; /* Allocate a new list element */ local_list = (SectionList *) XtMalloc(sizeof(SectionList)); if (*list != NULL) { for (end = *list; end->next != NULL; end = end->next); end->next = local_list; } else *list = local_list; local_list->next = NULL; local_list->label = XtNewString(label); snprintf(full_path, sizeof(full_path), "%s/%s", path, file); local_list->directory = XtNewString(full_path); local_list->flags = flags; } /* Function Name: AddToCurrentSection * Description: This function gets the names of the manual page * directories, then closes the directory. * Arguments: local_manual - a pointer to a manual pages structure. * path - the path to this directory. * Returns: none. */ static void AddToCurrentSection(Manual * local_manual, char *path) { char temp_path[BUFSIZ]; #if defined(__OpenBSD__) || defined(__NetBSD__) snprintf(temp_path, sizeof(temp_path), "%s/%s", path, MACHINE); ReadCurrentSection(local_manual, temp_path); #endif ReadCurrentSection(local_manual, path); snprintf(temp_path, sizeof(temp_path), "%s.%s", path, COMPRESSION_EXTENSION); ReadCurrentSection(local_manual, temp_path); } /* Function Name: ReadCurrentSection * Description: Actually does the work of adding entries to the * new section * Arguments: local_manual - a pointer to a manual pages structure. * path - the path to this directory. * compressed - Is this a compressed directory? * Returns: TRUE if any entries are found. */ static void ReadCurrentSection(Manual * local_manual, char *path) { DIR *dir; register struct dirent *dp; register int nentries; register int nalloc; char full_name[BUFSIZ], *ptr; if ((dir = opendir(path)) == NULL) { #ifdef DEBUG snprintf(error_buf, sizeof(error_buf), "Can't open directory %s", path); PopupWarning(NULL, error_buf); #endif /* DEBUG */ return; } /* * Remove the compression extension from the path name. */ if ((ptr = strrchr(path, '.')) != NULL) { #if !defined(__SCO__) && !defined(ISC) if (streq(ptr + 1, COMPRESSION_EXTENSION)) #else if (strpbrk(ptr + 1, COMPRESSION_EXTENSIONS) != NULL) #endif *ptr = '\0'; #ifdef GZIP_EXTENSION else if (streq(ptr + 1, GZIP_EXTENSION)) *ptr = '\0'; #endif #ifdef BZIP2_EXTENSION else if (streq(ptr + 1, BZIP2_EXTENSION)) *ptr = '\0'; #endif #ifdef LZMA_EXTENSION else if (streq(ptr + 1, LZMA_EXTENSION)) *ptr = '\0'; #endif } nentries = local_manual->nentries; nalloc = local_manual->nalloc; while ((dp = readdir(dir)) != NULL) { char *name = dp->d_name; if (name[0] == '.') continue; if (strchr(name, '.') == NULL) continue; if (nentries >= nalloc) { nalloc += ENTRYALLOC; local_manual->entries = (char **) XtRealloc((char *) local_manual->entries, nalloc * sizeof(char *)); local_manual->entries_less_paths = (char **) XtRealloc((char *) local_manual->entries_less_paths, nalloc * sizeof(char *)); } snprintf(full_name, sizeof(full_name), "%s/%s", path, name); /* * Remove the compression extension from the entry name. */ if ((ptr = strrchr(full_name, '.')) != NULL) { #if !defined(__SCO__) && !defined(ISC) if (streq(ptr + 1, COMPRESSION_EXTENSION)) #else if (strpbrk(ptr + 1, COMPRESSION_EXTENSIONS) != NULL) #endif *ptr = '\0'; #ifdef GZIP_EXTENSION else if (streq(ptr + 1, GZIP_EXTENSION)) *ptr = '\0'; #endif #ifdef BZIP2_EXTENSION else if (streq(ptr + 1, BZIP2_EXTENSION)) *ptr = '\0'; #endif #ifdef LZMA_EXTENSION else if (streq(ptr + 1, LZMA_EXTENSION)) *ptr = '\0'; #endif #ifdef IGNORE_EXTENSION /* skip files with specified extension - they're not real man pages */ else if (streq(ptr + 1, IGNORE_EXTENSION)) { continue; } #endif /* IGNORE_EXTENSION */ } local_manual->entries[nentries] = XtNewString(full_name); local_manual->entries_less_paths[nentries] = strrchr(local_manual->entries[nentries], '/'); if (local_manual->entries_less_paths[nentries] == NULL) PrintError("Internal error while cataloging manual pages."); ++nentries; } local_manual->nentries = nentries; local_manual->nalloc = nalloc; closedir(dir); } /* Function Name: SortAndRemove * Description: This function sorts all the entry names and * then removes all the duplicate entries. * Arguments: man - a pointer to the manual structure. * number - the number of manual sections. * Returns: an improved manual stucure */ static void SortAndRemove(Manual * man, int number) { int i; char *l1, *l2, **s1; for (i = 0; i < number; man++, i++) { /* sort each section */ register int i2 = 0; #ifdef DEBUG printf("sorting section %d - %s\n", i, man->blabel); #endif /* DEBUG */ s1 = (char **) malloc(man->nentries * sizeof(char *)); /* temporarily remove suffixes of entries, preventing them from */ /* being used in alphabetic comparison ie sccs-delta.1 vs sccs.1 */ for (i2 = 0; i2 < man->nentries; i2++) if ((s1[i2] = strrchr(man->entries_less_paths[i2], '.')) != NULL) *s1[i2] = '\0'; sortstrs((Byte **) man->entries_less_paths, man->nentries, (Byte **) man->entries); /* put back suffixes */ for (i2 = 0; i2 < man->nentries; i2++) if (s1[i2] != NULL) *s1[i2] = '.'; free(s1); #ifdef DEBUG printf("removing from section %d.\n", i); #endif /* DEBUG */ { register int j, k, nent, nentm1; int j2; nent = man->nentries; nentm1 = nent - 1; j = 0; l2 = man->entries_less_paths[j++]; if (l2 == NULL) PrintError ("Internal error while removing duplicate manual pages."); while (j < nentm1) { l1 = l2; l2 = man->entries_less_paths[j++]; if (l2 == NULL) PrintError ("Internal error while removing duplicate manual pages."); if (streq(l1, l2)) { j2 = j - 1; k = j2; while (j < nent) { man->entries_less_paths[k] = man->entries_less_paths[j]; man->entries[k++] = man->entries[j++]; } j = j2; --man->nentries; --nent; --nentm1; } } } } } /* ******* Replacement for qsort to keep ******* identical entries in order A somewhat ugly hack of something that was once simpler... */ /* Sort an array of pointers to strings, keeping it in ascending order by (1) string comparison and (2) original entry order in the pointer array. This is a modified radix exchange algorithm. In case there's insufficient memory for a temporary copy of the pointer array, the original order of identical strings isn't preserved. */ static void sortstrs(Byte * data[], int size, Byte * otherdata[]) { Byte **sp, **ep; Byte **othersp, **otherep; int *origorder; origorder = (int *) calloc(size, sizeof(int)); if (origorder) { reg int i; for (i = 0; i < size; ++i) origorder[i] = i; } sp = data; ep = &data[size - 1]; othersp = otherdata; otherep = &otherdata[size - 1]; if (origorder) { sortstrs_block_oo(sp, ep, 0, 0x80, origorder, &origorder[size - 1], othersp, otherep); free(origorder); } else sortstrs_block(sp, ep, 0, 0x80, othersp, otherep); } /*---------------------------------*/ /* Sort 1 block of data on 1 bit */ /*---------------------------------*/ static void sortstrs_block(Byte ** start, Byte ** end, int offset, Byte mask, Byte ** otherstart, Byte ** otherend) { reg Byte **sp, **ep; reg Byte m; reg int off; reg Byte *t; reg int curstrlen; int maxstrlen; Byte **othersp, **otherep; #define newstring(ptr) \ { \ t = *ptr; \ curstrlen = 0; \ while ( *t++ ) ++ curstrlen; \ if ( curstrlen > maxstrlen ) maxstrlen = curstrlen; \ t = *ptr; \ } maxstrlen = 0; sp = start; ep = end; off = offset; m = mask; othersp = otherstart; otherep = otherend; while (1) { newstring(sp) while (((sp != ep) && ((curstrlen < off) || ((t[off] & m) == 0)))) { ++sp; ++othersp; newstring(sp) } if (sp == ep) break; newstring(ep); while (((sp != ep) && (curstrlen >= off) && ((t[off] & m) != 0))) { --ep; --otherep; newstring(ep) } if (sp == ep) break; t = *sp; *sp = *ep; *ep = t; t = *othersp; *othersp = *otherep; *otherep = t; } t = *sp; if ((curstrlen < off) || ((t[off] & m) == 0)) { if (ep != end) { ++ep; ++otherep; } } else { if (sp != start) { --sp; --othersp; } } m >>= 1; if (m == 0) { m = 0x80; if (++off >= maxstrlen) return; } if (sp != start) sortstrs_block(start, sp, off, m, otherstart, othersp); if (ep != end) sortstrs_block(ep, end, off, m, otherep, otherend); } /*-----------------------------------------------------------------*/ /* Sort 1 block of data on 1 bit; check for out-of-order entries */ /*-----------------------------------------------------------------*/ static void sortstrs_block_oo(Byte ** start, Byte ** end, int offset, Byte mask, int *ostart, int *oend, Byte ** otherstart, Byte ** otherend) { reg Byte **sp, **ep; reg int *osp, *oep; reg Byte m; reg int off; reg Byte *t; reg int u; reg int curstrlen; int maxstrlen; Byte **othersp, **otherep; #define newstring(ptr) \ { \ t = *ptr; \ curstrlen = 0; \ while ( *t++ ) ++ curstrlen; \ if ( curstrlen > maxstrlen ) maxstrlen = curstrlen; \ t = *ptr; \ } maxstrlen = 0; sp = start; ep = end; osp = ostart; oep = oend; off = offset; m = mask; othersp = otherstart; otherep = otherend; while (1) { newstring(sp) while (((sp != ep) && ((curstrlen < off) || ((t[off] & m) == 0)))) { ++sp; ++osp; ++othersp; newstring(sp) } if (sp == ep) break; newstring(ep); while (((sp != ep) && (curstrlen >= off) && ((t[off] & m) != 0))) { --ep; --oep; --otherep; newstring(ep) } if (sp == ep) break; t = *sp; *sp = *ep; *ep = t; t = *othersp; *othersp = *otherep; *otherep = t; u = *osp; *osp = *oep; *oep = u; } t = *sp; if ((curstrlen < off) || ((t[off] & m) == 0)) { if (ep != end) { ++ep; ++oep; ++otherep; } } else { if (sp != start) { --sp; --osp; --othersp; } } m >>= 1; if (m == 0) { m = 0x80; if (++off >= maxstrlen) { /* Finished sorting block of strings: *//* Restore duplicates to original order */ reg Byte **cp; reg int *ocp; Byte **othercp; if (sp != start) { cp = start; ocp = ostart; othercp = otherstart; while (cp != sp) { if (*ocp > *(ocp + 1)) { t = *(cp + 1); *(cp + 1) = *cp; *cp = t; t = *(othercp + 1); *(othercp + 1) = *othercp; *othercp = t; u = *(ocp + 1); *(ocp + 1) = *ocp; *ocp = u; if (cp != start) { --cp; --ocp; --othercp; continue; } } ++cp; ++ocp; ++othercp; } } if (ep != end) { cp = ep; ocp = oep; othercp = otherep; while (cp != end) { if (*ocp > *(ocp + 1)) { t = *(cp + 1); *(cp + 1) = *cp; *cp = t; t = *(othercp + 1); *(othercp + 1) = *othercp; *othercp = t; u = *(ocp + 1); *(ocp + 1) = *ocp; *ocp = u; if (cp != ep) { --cp; --ocp; --othercp; continue; } } ++cp; ++ocp; ++othercp; } } return; } } if (sp != start) sortstrs_block_oo(start, sp, off, m, ostart, osp, otherstart, othersp); if (ep != end) sortstrs_block_oo(ep, end, off, m, oep, oend, otherep, otherend); } /* Function Name: InitManual * Description: Initializes this manual section. * Arguments: l_manual - local copy of the manual structure. * label - the button label for this section. * Returns: none. */ static void InitManual(Manual * l_manual, char *label) { bzero(l_manual, sizeof(Manual)); /* clear it. */ l_manual->blabel = label; /* set label. */ } #if defined(DEBUG) /* Function Name: DumpManual * Description: Debugging function that dumps the entire manual page * structure. * Arguments: number - the number of sections. * Returns: none. */ void DumpManual(int number) { register int i, j; for (i = 0; i < number; i++) { printf("label: %s\n", manual[i].blabel); for (j = 0; j < manual[i].nentries; j++) printf("%s\n", manual[i].entries[j]); } } #endif /* DEBUG */ #ifdef MANCONF #if defined(MANCONFIGSTYLE_FreeBSD) /* Function Name: ReadManConfig * Description: Reads man.conf file used by FreeBSD man * Argument: manpath - char array to return path in. * Returns: TRUE if read was successful. */ Bool ReadManConfig(char manpath[]) { FILE *fp; char line[BUFSIZ]; char *path; Bool firstpath = TRUE; if (!(fp = fopen(MANCONF, "r"))) return (FALSE); while (fgets(line, sizeof(line), fp)) { path = strtok(line, " \t\n"); if (!path || *path == '#') continue; if (strcmp(path, "MANPATH_MAP") == 0) path = strtok((char *) NULL, " \t\n"); else if (strcmp(path, "MANDATORY_MANPATH") != 0 && strcmp(path, "OPTIONAL_MANPATH") != 0) return (FALSE); path = strtok((char *) NULL, " \t\n"); if (!path || *path == '#') return FALSE; if (firstpath) { strcpy(manpath, path); firstpath = FALSE; } else if (!strstr(manpath, path)) { strcat(manpath, ":"); strcat(manpath, path); } } fclose(fp); return (!firstpath); } #elif defined(MANCONFIGSTYLE_Linux) /* not FreeBSD */ /* Function Name: ReadManConfig * Description: Reads man.conf file used by Linux man * Argument: manpath - char array to return path in. * Returns: TRUE if read was successful. */ Bool ReadManConfig(char manpath[]) { FILE *fp; char line[BUFSIZ]; char *path; Bool firstpath = TRUE; if (!(fp = fopen(MANCONF, "r"))) return (FALSE); while (fgets(line, sizeof(line), fp)) { path = strtok(line, " \t\n"); if (!path || *path == '#' || (strcmp(path, "MANPATH") != 0)) continue; path = strtok((char *) NULL, " \t\n"); if (!path || *path == '#') return FALSE; if (firstpath) { strcpy(manpath, path); firstpath = FALSE; } else { strcat(manpath, ":"); strcat(manpath, path); } } fclose(fp); return (!firstpath); } #elif defined(MANCONFIGSTYLE_OpenBSD) /* not FreeBSD or Linux */ /* Function Name: ReadManConfig * Description: Reads man.conf file used by Open/NetBSD * Argument: manpath - char array to return path in. * Returns: TRUE if read was successful. * * This version expands the glob pattern that can be found * in man.conf */ #include Bool ReadManConfig(char manpath[]) { FILE *fp; char line[BUFSIZ]; char *path; Bool firstpath = TRUE; glob_t gs; int i; if (!(fp = fopen(MANCONF, "r"))) return (FALSE); while (fgets(line, sizeof(line), fp)) { path = strtok(line, " \t\n"); if (!path || *path == '#') continue; if (strcmp(path, "_default")) { /* for now */ continue; } memset(&gs, 0, sizeof(glob_t)); while ((path = strtok((char *) NULL, " \t\n"))) { if (glob(path, GLOB_BRACE, NULL, &gs) < 0) { fclose(fp); return FALSE; } } /* while */ for (i = 0; i < gs.gl_pathc; i++) { if (firstpath) { strcpy(manpath, gs.gl_pathv[i]); firstpath = FALSE; } else { strcat(manpath, ":"); strcat(manpath, gs.gl_pathv[i]); } } /* for */ globfree(&gs); } fclose(fp); return (!firstpath); } #elif defined(MANCONFIGSTYLE_BSD) /* not FreeBSD, Linux, or OpenBSD */ /* Function Name: ReadManConfig * Description: Reads man.conf file used by BSD 4.4 * Argument: manpath - char array to return path in. * Returns: TRUE if read was successful. */ Bool ReadManConfig(char manpath[]) { FILE *fp; char line[BUFSIZ]; char *path; Bool firstpath = TRUE; if (!(fp = fopen(MANCONF, "r"))) return (FALSE); while (fgets(line, sizeof(line), fp)) { path = strtok(line, " \t\n"); if (!path || *path == '#' || strcmp(path, "_default")) continue; while ((path = strtok((char *) NULL, " \t\n"))) { if (firstpath) { strcpy(manpath, path); firstpath = FALSE; } else { strcat(manpath, ":"); strcat(manpath, path); } } } fclose(fp); return (!firstpath); } #else /* not BSD */ #error "MANCONF defined (in vendor.h) for unknown operating system." #endif /* MANCONFIGSTYLE == FreeBSD ... BSD */ #endif /* MANCONF */ x11-apps-7.7+5+nmu1ubuntu1/xman/globals.h0000664000000000000000000000453312476465600014747 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _globals_h #define _globals_h #include "man.h" extern Xman_Resources resources; /* Resource manager sets these. */ /* bookkeeping global variables. */ extern Widget help_widget; /* The help widget. */ extern int default_height, default_width; /* Approximately the default width and height, of the manpage when shown, the the top level manual page window */ extern int man_pages_shown; /* The current number of manual pages being shown, if 0 we exit. */ extern Manual *manual; /* The manual structure. */ extern int sections; /* The number of manual sections. */ extern XContext manglobals_context; /* The context for man_globals. */ extern Widget initial_widget; /* The initial widget, never realized. */ extern char **saved_argv; extern int saved_argc; extern Atom wm_delete_window; extern Widget top; #endif /* _globals_h */ x11-apps-7.7+5+nmu1ubuntu1/xman/search.c0000664000000000000000000003002012476465600014552 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include "globals.h" #include "vendor.h" /* Map and control-M to goto beginning of file. */ #define SEARCHARGS 10 static FILE *DoManualSearch(ManpageGlobals *man_globals, char *string); static int BEntrySearch(char *string, char **first, int number); /* Function Name: MakeSearchWidget * Description: This Function Creates the Search Widget. * Arguments: man_globals - the pseudo globals for this manpage. * w - the widgets parent * Returns: the search widget. */ void MakeSearchWidget(ManpageGlobals * man_globals, Widget parent) { Widget dialog, command, text, cancel; Arg arglist[2]; Cardinal num_args = 0; XtSetArg(arglist[0], XtNtransientFor, parent); man_globals->search_widget = XtCreatePopupShell(SEARCHNAME, transientShellWidgetClass, parent, arglist, 1); if (resources.clear_search_string) { XtSetArg(arglist[0], XtNvalue, ""); num_args++; } dialog = XtCreateManagedWidget(DIALOG, dialogWidgetClass, man_globals->search_widget, arglist, num_args); if ((text = XtNameToWidget(dialog, "value")) == (Widget) NULL) PopupWarning(NULL, "Could not find text widget in MakeSearchWidget."); else XtSetKeyboardFocus(dialog, text); XawDialogAddButton(dialog, MANUALSEARCH, NULL, NULL); XawDialogAddButton(dialog, APROPOSSEARCH, NULL, NULL); XawDialogAddButton(dialog, CANCEL, NULL, NULL); /* * This is a bit gross, but it get the cancel button underneath the * others, and forms them up to the right size.. */ if (((command = XtNameToWidget(dialog, MANUALSEARCH)) == (Widget) NULL) || ((cancel = XtNameToWidget(dialog, CANCEL)) == (Widget) NULL)) PopupWarning(NULL, "Could not find manual search widget in MakeSearchWidget."); else { static const char *half_size[] = { MANUALSEARCH, APROPOSSEARCH, NULL }; static const char *full_size[] = { "label", "value", CANCEL, NULL }; num_args = 0; XtSetArg(arglist[num_args], XtNfromVert, command); num_args++; XtSetArg(arglist[num_args], XtNfromHoriz, NULL); num_args++; XtSetValues(cancel, arglist, num_args); FormUpWidgets(dialog, full_size, half_size); } } /* Function Name: SearchString * Description: Returns the search string. * Arguments: man_globals - the globals. * Returns: the search string. */ static char * SearchString(ManpageGlobals * man_globals) { Widget dialog; dialog = XtNameToWidget(man_globals->search_widget, DIALOG); if (dialog != NULL) return (XawDialogGetValueString(dialog)); PopupWarning(man_globals, "Could not get the search string, no search will be performed."); return (NULL); } /* Function Name: DoSearch * Description: This function performs a search for a man page or apropos * search upon search string. * Arguments: man_globals - the pseudo globals for this manpage. * type - the type of search. * Returns: none. */ #define LOOKLINES 6 /* * Manual searches look through the list of manual pages for the right one * with a binary search. * * Apropos searches still exec man -k. * * If nothing is found then I send a warning message to the user, and do * nothing. */ FILE * DoSearch(ManpageGlobals * man_globals, int type) { char cmdbuf[BUFSIZ], *mantmp, *manpath; char tmp[BUFSIZ], path[BUFSIZ]; char string_buf[BUFSIZ], cmp_str[BUFSIZ], error_buf[BUFSIZ]; char *search_string = SearchString(man_globals); FILE *file; int fd; int count; Boolean flag; if (search_string == NULL) return (NULL); /* If the string is empty or starts with a space then do not search */ if (streq(search_string, "")) { PopupWarning(man_globals, "Search string is empty."); return (NULL); } if (strlen(search_string) >= BUFSIZ) { PopupWarning(man_globals, "Search string too long."); return (NULL); } if (search_string[0] == ' ') { PopupWarning(man_globals, "First character cannot be a space."); return (NULL); } if (type == APROPOS) { char label[BUFSIZ]; strcpy(tmp, MANTEMP); /* get a temp file. */ fd = mkstemp(tmp); if (fd < 0) { PopupWarning(man_globals, "Cant create temp file"); return NULL; } mantmp = tmp; manpath = getenv("MANPATH"); if (manpath == NULL || streq(manpath, "")) { #ifdef MANCONF if (!ReadManConfig(path)) #endif { strcpy(path, SYSMANPATH); #ifdef LOCALMANPATH strcat(path, ":"); strcat(path, LOCALMANPATH); #endif } } else { strcpy(path, manpath); } snprintf(label, sizeof(label), "Results of apropos search on: %s", search_string); #ifdef NO_MANPATH_SUPPORT /* not quite correct, but the best I can do. */ snprintf(cmdbuf, sizeof(cmdbuf), APROPOS_FORMAT, search_string, mantmp); #else snprintf(cmdbuf, sizeof(cmdbuf), APROPOS_FORMAT, path, search_string, mantmp); #endif if (system(cmdbuf) != 0) { /* execute search. */ snprintf(error_buf, sizeof(error_buf), "Something went wrong trying to run %s\n", cmdbuf); PopupWarning(man_globals, error_buf); } if ((file = fdopen(fd, "r")) == NULL) PrintError("lost temp file? out of temp space?"); /* * Since we keep the FD open we can remove the file safely, this * will keep extra files out of /tmp. */ remove(mantmp); snprintf(string_buf, sizeof(string_buf), "%s: nothing appropriate", search_string); /* * Check first LOOKLINES lines for "nothing appropriate". */ count = 0; flag = FALSE; while ((fgets(cmp_str, BUFSIZ, file) != NULL) && (count < LOOKLINES)) { size_t len = strlen(cmp_str); if (len > 0 && cmp_str[len - 1] == '\n') /* strip off the '\n' */ cmp_str[len - 1] = '\0'; if (streq(cmp_str, string_buf)) { flag = TRUE; break; } count++; } /* * If the file is less than this number of lines then assume that there is * nothing appropriate found. This does not confuse the apropos filter. */ if (flag) { fclose(file); file = NULL; ChangeLabel(man_globals->label, string_buf); return (NULL); } snprintf(man_globals->manpage_title, sizeof(man_globals->manpage_title), "%s", label); ChangeLabel(man_globals->label, label); fseek(file, 0L, SEEK_SET); /* reset file to point at top. */ } else { /* MANUAL SEARCH */ file = DoManualSearch(man_globals, search_string); if (file == NULL) { snprintf(string_buf, sizeof(string_buf), "No manual entry for %s.", search_string); ChangeLabel(man_globals->label, string_buf); if (man_globals->label == NULL) PopupWarning(man_globals, string_buf); return (NULL); } } if (resources.clear_search_string) { Arg arglist[1]; Widget dialog; dialog = XtNameToWidget(man_globals->search_widget, DIALOG); if (dialog == NULL) PopupWarning(man_globals, "Could not clear the search string."); XtSetArg(arglist[0], XtNvalue, ""); XtSetValues(dialog, arglist, (Cardinal) 1); } return (file); } /* Function Name: DoManualSearch * Description: performs a manual search. * Arguments: man_globals - the manual page specific globals. * Returns: the filename of the man page. */ #define NO_ENTRY -100 static FILE * DoManualSearch(ManpageGlobals * man_globals, char *string) { int e_num = NO_ENTRY; int i; /* search current section first. */ i = man_globals->current_directory; e_num = BEntrySearch(string, manual[i].entries, manual[i].nentries); /* search other sections. */ if (e_num == NO_ENTRY) { i = 0; /* At the exit of the loop i needs to be the one we used. */ while (TRUE) { if (i == man_globals->current_directory) if (++i >= sections) return (NULL); e_num = BEntrySearch(string, manual[i].entries, manual[i].nentries); if (e_num != NO_ENTRY) break; if (++i >= sections) return (NULL); } /* * Manual page found in some other section, unhighlight the current one. */ if (man_globals->manpagewidgets.box != NULL) XawListUnhighlight(man_globals->manpagewidgets. box[man_globals->current_directory]); } else { /* * Highlight the element we are searching for if it is in the directory * listing currently being shown. */ if (man_globals->manpagewidgets.box != NULL) XawListHighlight(man_globals->manpagewidgets.box[i], e_num); } return (FindManualFile(man_globals, i, e_num)); } /* Function Name: BEntrySearch * Description: binary search through entries. * Arguments: string - the string to match. * first - the first entry in the list. * number - the number of entries. * Returns: a pointer to the entry found. */ static int BEntrySearch(char *string, char **first, int number) { int check, cmp, len_cmp, global_number; char *head, *tail; global_number = 0; while (TRUE) { if (number == 0) { return (NO_ENTRY); /* didn't find it. */ } check = number / 2; head = strrchr(first[global_number + check], '/'); if (head == NULL) PrintError("index failure in BEntrySearch"); head++; tail = strrchr(head, '.'); if (tail == NULL) /* not an error, some systems (e.g. sgi) have only a .z suffix */ tail = head + strlen(head); cmp = strncmp(string, head, (tail - head)); len_cmp = strlen(string) - (int) (tail - head); if (cmp == 0 && len_cmp == 0) { return (global_number + check); } else if (cmp < 0 || ((cmp == 0) && (len_cmp < 0))) number = check; else { /* cmp > 0 || ((cmp == 0) && (len_cmp > 0)) */ global_number += (check + 1); number -= (check + 1); } } } x11-apps-7.7+5+nmu1ubuntu1/xman/ScrollByL.c0000664000000000000000000011142512476465600015163 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include #include #include #include #include #include /* depends on IntrinsicP.h */ #include #include #include "ScrollByLP.h" /* Default Translation Table */ static char defaultTranslations[] = "f: Page(Forward) \n\ b: Page(Back) \n\ 1: Page(Line, 1) \n\ 2: Page(Line, 2) \n\ 3: Page(Line, 3) \n\ 4: Page(Line, 4) \n\ \\ : Page(Forward)"; /**************************************************************** * * ScrollByLine Resources * ****************************************************************/ #define Offset(field) XtOffset(ScrollByLineWidget, scroll.field) #define CoreOffset(field) XtOffset(ScrollByLineWidget, core.field) static XtResource resources[] = { {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), CoreOffset(width), XtRImmediate, (caddr_t) 500}, {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), CoreOffset(height), XtRImmediate, (caddr_t) 700}, {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), Offset(foreground), XtRString, "XtDefaultForeground"}, {XtNforceVert, XtCBoolean, XtRBoolean, sizeof(Boolean), Offset(force_vert), XtRImmediate, (caddr_t) FALSE}, {XtNindent, XtCIndent, XtRDimension, sizeof(Dimension), Offset(indent), XtRImmediate, (caddr_t) 15}, {XtNuseRight, XtCBoolean, XtRBoolean, sizeof(Boolean), Offset(use_right), XtRImmediate, (caddr_t) FALSE}, {XtNmanualFontNormal, XtCFont, XtRFontStruct, sizeof(XFontStruct *), Offset(normal_font), XtRString, MANPAGE_NORMAL}, {XtNmanualFontBold, XtCFont, XtRFontStruct, sizeof(XFontStruct *), Offset(bold_font), XtRString, MANPAGE_BOLD}, {XtNmanualFontItalic, XtCFont, XtRFontStruct, sizeof(XFontStruct *), Offset(italic_font), XtRString, MANPAGE_ITALIC}, {XtNmanualFontSymbol, XtCFont, XtRFontStruct, sizeof(XFontStruct *), Offset(symbol_font), XtRString, MANPAGE_SYMBOL}, {XtNfile, XtCFile, XtRFile, sizeof(FILE *), Offset(file), XtRImmediate, (caddr_t) NULL}, {XtNNumTotalLines, XtCNumTotalLines, XtRInt, sizeof(int), Offset(lines), XtRImmediate, (caddr_t) 0}, {XtNNumVisibleLines, XtCNumVisibleLines, XtRInt, sizeof(int), Offset(num_visible_lines), XtRImmediate, (caddr_t) 0}, }; #undef Offset #undef CoreOffset /**************************************************************** * * Full class record constant * ****************************************************************/ static void CreateScrollbar(Widget w); static Boolean ScrollVerticalText(Widget w, int new_line, Boolean force_redisp); static void Layout(Widget w); static void LoadFile(Widget w); static void MoveAndClearText(Widget w, int old_y, int height, int new_y); static void PaintText(Widget w, int y_loc, int height); static void PrintText(Widget w, int start_line, int num_lines, int location); static void SetThumbHeight(Widget w); static void VerticalJump(Widget w, XtPointer junk, XtPointer percent_ptr); static void VerticalScroll(Widget w, XtPointer client_data, XtPointer call_data); /* semi - public functions. */ static void Realize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes); static void Initialize(Widget req, Widget new, ArgList args, Cardinal *num_args); static void Destroy(Widget w); static void Redisplay(Widget w, XEvent *event, Region region); static void Page(Widget w, XEvent *event, String *params, Cardinal *num_params); static Boolean SetValuesHook(Widget w, ArgList args, Cardinal *num_args); static XtActionsRec actions[] = { {"Page", Page}, }; #define superclass (&simpleClassRec) #define SuperClass simpleWidgetClass ScrollByLineClassRec scrollByLineClassRec = { { /* core_class fields */ /* superclass */ (WidgetClass) superclass, /* class_name */ "ScrollByLine", /* widget_size */ sizeof(ScrollByLineRec), /* class_initialize */ NULL, /* class_part_init */ NULL, /* class_inited */ FALSE, /* initialize */ Initialize, /* initialize_hook */ NULL, /* realize */ Realize, /* actions */ actions, /* num_actions */ XtNumber(actions), /* resources */ resources, /* num_resources */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, /* compress_exposure */ FALSE, /* compress_enterleave */ TRUE, /* visible_interest */ FALSE, /* destroy */ Destroy, /* resize */ Layout, /* expose */ Redisplay, /* set_values */ NULL, /* set_values_hook */ SetValuesHook, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ defaultTranslations, /* query_geometry */ XtInheritQueryGeometry, /* display_accelerator */ XtInheritDisplayAccelerator, /* extension */ NULL, }, { /* simple fields */ /* change_sensitive */ XtInheritChangeSensitive } }; WidgetClass scrollByLineWidgetClass = (WidgetClass) &scrollByLineClassRec; /**************************************************************** * * Private Routines * ****************************************************************/ /* Function Name: Layout * Description: This function lays out the scroll widget. * Arguments: w - the scroll widget. * key - a boolean: if true then resize the widget to the child * if false the resize children to fit widget. * Returns: TRUE if successful. */ static void Layout(Widget w) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; Dimension width, height; Widget bar; Position bar_bw; CreateScrollbar(w); /* * For now always show the bar. */ bar = sblw->scroll.bar; height = sblw->core.height; width = sblw->core.width; bar_bw = bar->core.border_width; /* Move child and v_bar to correct location. */ if (sblw->scroll.use_right) { XtMoveWidget(bar, width - (bar->core.width + bar_bw), -bar_bw); sblw->scroll.offset = 0; } else { XtMoveWidget(bar, -bar_bw, -bar_bw); sblw->scroll.offset = bar->core.width + bar_bw; } /* resize the scrollbar to be the correct height or width. */ XtResizeWidget(bar, bar->core.width, height, bar->core.border_width); SetThumbHeight(w); sblw->scroll.num_visible_lines = height / sblw->scroll.font_height + 1; } /* ARGSUSED */ static void GExpose(Widget w, XtPointer junk, XEvent * event, Boolean * cont) { /* * Graphics exposure events are not currently sent to exposure proc. */ if (event->type == GraphicsExpose) Redisplay(w, event, NULL); } /* ChildExpose */ /* * Repaint the widget's child Window Widget. */ /* ARGSUSED */ static void Redisplay(Widget w, XEvent * event, Region region) { int top, height; /* the locations of the top and height of the region that needs to be repainted. */ /* * This routine tells the client which sections of the window to * repaint in his callback function which does the actual repainting. */ if (event->type == Expose) { top = event->xexpose.y; height = event->xexpose.height; } else { top = event->xgraphicsexpose.y; height = event->xgraphicsexpose.height; } PaintText(w, top, height); } /* redisplay (expose) */ /* Function Name: PaintText * Description: paints the text at the give location for a given height. * Arguments: w - the sbl widget. * y_loc, height - location and size of area to paint. * Returns: none */ static void PaintText(Widget w, int y_loc, int height) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; int start_line, location; start_line = y_loc / sblw->scroll.font_height + sblw->scroll.line_pointer; if (start_line >= sblw->scroll.lines) return; /* * Only integer arithmetic makes this possible. */ location = y_loc / sblw->scroll.font_height * sblw->scroll.font_height; PrintText(w, start_line, sblw->scroll.num_visible_lines, location); } /* Function Name: Page * Description: This function pages the widget, by the amount it receives * from the translation Manager. * Arguments: w - the ScrollByLineWidget. * event - the event that caused this return. * params - the parameters passed to it. * num_params - the number of parameters. * Returns: none. */ /* ARGSUSED */ static void Page(Widget w, XEvent * event, String * params, Cardinal * num_params) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; Widget bar = sblw->scroll.bar; if (*num_params < 1) return; /* * If no scroll bar is visible then do not page, as the entire window is shown, * or scrolling has been turned off. */ if (bar == (Widget) NULL) return; switch (params[0][0]) { case 'f': case 'F': /* move one page forward */ VerticalScroll(bar, NULL, (XtPointer) ((long) bar->core.height)); break; case 'b': case 'B': /* move one page backward */ VerticalScroll(bar, NULL, (XtPointer) (-(long) bar->core.height)); break; case 'L': case 'l': /* move one line forward */ VerticalScroll(bar, NULL, (XtPointer) ((long) atoi(params[1]) * sblw->scroll.font_height)); break; default: return; } } /* Function Name: CreateScrollbar * Description: createst the scrollbar for us. * Arguments: w - sblw widget. * Returns: none. */ static void CreateScrollbar(Widget w) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; Arg args[5]; Cardinal num_args = 0; if (sblw->scroll.bar != NULL) return; XtSetArg(args[num_args], XtNorientation, XtorientVertical); num_args++; sblw->scroll.bar = XtCreateWidget("scrollbar", scrollbarWidgetClass, w, args, num_args); XtAddCallback(sblw->scroll.bar, XtNscrollProc, VerticalScroll, NULL); XtAddCallback(sblw->scroll.bar, XtNjumpProc, VerticalJump, NULL); } /* Function Name: ScrollVerticalText * Description: This accomplished the actual movement of the text. * Arguments: w - the ScrollByLine Widget. * new_line - the new location for the line pointer * force_redisplay - should we force this window to get * redisplayed? * Returns: True if the thumb needs to be moved. */ static Boolean ScrollVerticalText(Widget w, int new_line, Boolean force_redisp) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; int num_lines = sblw->scroll.num_visible_lines; int max_lines, old_line; Boolean move_thumb = FALSE; /* * Do not let the window extend out of bounds. */ if (new_line < 0) { new_line = 0; move_thumb = TRUE; } else { max_lines = sblw->scroll.lines - (int) w->core.height / sblw->scroll.font_height; if (max_lines < 0) max_lines = 0; if (new_line > max_lines) { new_line = max_lines; move_thumb = TRUE; } } /* * If forced to redisplay then do a full redisplay and return. */ old_line = sblw->scroll.line_pointer; sblw->scroll.line_pointer = new_line; /* Set current top of page. */ if (force_redisp) MoveAndClearText(w, 0, /* cause a full redisplay */ 0, 0); if (new_line == old_line) return (move_thumb); /* * Scroll forward. */ else if (new_line < old_line) { int lines_to_scroll = old_line - new_line; MoveAndClearText(w, 0, num_lines - lines_to_scroll, lines_to_scroll); } /* * Scroll back. */ else { int lines_to_scroll = new_line - old_line; MoveAndClearText(w, lines_to_scroll, num_lines - lines_to_scroll, 0); } return (move_thumb); } /* Function Name: MoveAndClearText * Description: Blits as much text as it can and clear the * remaining area with generate exposures TRUE. * Arguments: w - the sbl widget. * old_y - the old y position. * height - height of area to move. * new_y - new y position. * Returns: none */ static void MoveAndClearText(Widget w, int old_y, int height, int new_y) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; int from_left = sblw->scroll.indent + sblw->scroll.offset - 1; int y_clear; old_y *= sblw->scroll.font_height; new_y *= sblw->scroll.font_height; height *= sblw->scroll.font_height; /* * If we are already at the right location then do nothing. * (height == 0). * * If we have scrolled more than a screen height then just clear * the window. */ if (height <= sblw->scroll.font_height) { /* avoid rounding errors. */ XClearArea(XtDisplay(w), XtWindow(w), from_left, 0, (unsigned int) 0, (unsigned int) 0, FALSE); PaintText(w, 0, (int) sblw->core.height); return; } if ((int) height + (int) old_y > (int) w->core.height) height = w->core.height - old_y; XCopyArea(XtDisplay(w), XtWindow(w), XtWindow(w), sblw->scroll.move_gc, from_left, old_y, (unsigned int) w->core.width - from_left, (unsigned int) height, from_left, new_y); if (old_y > new_y) height -= sblw->scroll.font_height / 2; /* clear 1/2 font of extra space, to make sure we don't lose or gain descenders. */ else height -= sblw->scroll.font_height; /* clear 1 font of extra space, to make sure we don't overwrite with a last line in buffer. */ if (old_y > new_y) y_clear = height; else y_clear = 0; /* * We cannot use generate exposures, since that may allow another move and * clear before the area get repainted, this would be bad. */ XClearArea(XtDisplay(w), XtWindow(w), from_left, y_clear, (unsigned int) 0, (unsigned int) (w->core.height - height), FALSE); PaintText(w, (int) y_clear, (int) (w->core.height - height)); } /* Function Name: SetThumbHeight * Description: Set the height of the thumb. * Arguments: w - the sblw widget. * Returns: none */ static void SetThumbHeight(Widget w) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; float shown; if (sblw->scroll.bar == NULL) return; if (sblw->scroll.lines == 0) shown = 1.0; else shown = (float) w->core.height / (float) (sblw->scroll.lines * sblw->scroll.font_height); if (shown > 1.0) shown = 1.0; XawScrollbarSetThumb(sblw->scroll.bar, (float) -1, shown); } /* Function Name: SetThumb * Description: Set the thumb location. * Arguments: w - the sblw. * Returns: none */ static void SetThumb(Widget w) { float location; ScrollByLineWidget sblw = (ScrollByLineWidget) w; if ((sblw->scroll.lines == 0) || (sblw->scroll.bar == NULL)) return; location = (float) sblw->scroll.line_pointer / (float) sblw->scroll.lines; XawScrollbarSetThumb(sblw->scroll.bar, location, (float) -1); } /* Function Name: VerticalJump. * Description: This function moves the test * as the vertical scroll bar is moved. * Arguments: w - the scrollbar widget. * junk - not used. * percent - the position of the scrollbar. * Returns: none. */ /* ARGSUSED */ static void VerticalJump(Widget w, XtPointer junk, XtPointer percent_ptr) { float percent = *((float *) percent_ptr); int new_line; /* The new location for the line pointer. */ ScrollByLineWidget sblw = (ScrollByLineWidget) XtParent(w); new_line = (int) ((float) sblw->scroll.lines * percent); if (ScrollVerticalText((Widget) sblw, new_line, FALSE)) SetThumb((Widget) sblw); } /* Function Name: VerticalScroll * Description: This function moves the position of the interior window * as the vertical scroll bar is moved. * Arguments: w - the scrollbar widget. * junk - not used. * pos - the position of the cursor. * Returns: none. */ /* ARGSUSED */ static void VerticalScroll(Widget w, XtPointer client_data, XtPointer call_data) { int pos = (int) (long) call_data; int new_line; /* The new location for the line pointer. */ ScrollByLineWidget sblw = (ScrollByLineWidget) XtParent(w); new_line = sblw->scroll.line_pointer + (pos / sblw->scroll.font_height); (void) ScrollVerticalText((Widget) sblw, new_line, FALSE); SetThumb((Widget) sblw); } /* ARGSUSED */ static void Initialize(Widget req, Widget new, ArgList args, Cardinal * num_args) { ScrollByLineWidget sblw = (ScrollByLineWidget) new; unsigned long figWidth; Atom atomNum; sblw->scroll.top_line = NULL; sblw->scroll.line_pointer = 0; LoadFile(new); sblw->scroll.bar = (Widget) NULL; sblw->scroll.font_height = (sblw->scroll.normal_font->max_bounds.ascent + sblw->scroll.normal_font->max_bounds.descent); atomNum = XInternAtom(XtDisplay(req), "FIGURE_WIDTH", False); if (XGetFontProperty(sblw->scroll.normal_font, atomNum, &figWidth)) sblw->scroll.h_width = figWidth; else sblw->scroll.h_width = XTextWidth(sblw->scroll.normal_font, "$", 1); } /* Initialize. */ /* Function Name: CreateGCs * Description: Creates the graphics contexts that we need. * Arguments: w - the sblw. * Returns: none */ static void CreateGCs(Widget w) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; XtGCMask mask; XGCValues values; values.graphics_exposures = TRUE; sblw->scroll.move_gc = XtGetGC(w, GCGraphicsExposures, &values); mask = GCForeground | GCFont; values.foreground = sblw->scroll.foreground; values.font = sblw->scroll.normal_font->fid; sblw->scroll.normal_gc = XtGetGC(w, mask, &values); values.font = sblw->scroll.italic_font->fid; sblw->scroll.italic_gc = XtGetGC(w, mask, &values); values.font = sblw->scroll.bold_font->fid; sblw->scroll.bold_gc = XtGetGC(w, mask, &values); values.font = sblw->scroll.symbol_font->fid; sblw->scroll.symbol_gc = XtGetGC(w, mask, &values); } /* Function Name: DestroyGCs * Description: removes all gcs for this widget. * Arguments: w - the widget. * Returns: none */ static void DestroyGCs(Widget w) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; XtReleaseGC(w, sblw->scroll.normal_gc); XtReleaseGC(w, sblw->scroll.bold_gc); XtReleaseGC(w, sblw->scroll.italic_gc); XtReleaseGC(w, sblw->scroll.move_gc); } static void Realize(Widget w, Mask *valueMask, XSetWindowAttributes * attributes) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; CreateScrollbar(w); CreateGCs(w); Layout(w); (*SuperClass->core_class.realize) (w, valueMask, attributes); XtRealizeWidget(sblw->scroll.bar); /* realize scrollbar. */ XtMapWidget(sblw->scroll.bar); /* map scrollbar. */ XtAddEventHandler(w, 0, TRUE, GExpose, NULL); /* Get Graphics Exposures */ } /* Realize */ /* Function Name: Destroy * Description: Cleans up when we are killed. * Arguments: w - the widget. * Returns: none */ static void Destroy(Widget w) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; if (sblw->scroll.bar != NULL) XtDestroyWidget(sblw->scroll.bar); /* Destroy scrollbar. */ if (sblw->scroll.file != NULL) fclose(sblw->scroll.file); DestroyGCs(w); } /* * * Set Values * */ /* ARGSUSED */ static Boolean SetValuesHook(Widget w, ArgList args, Cardinal * num_args) { Boolean ret = TRUE; Cardinal i; for (i = 0; i < *num_args; i++) { if (strcmp(XtNfile, args[i].name) == 0) { LoadFile(w); ret = TRUE; } } /* * Changing anything else will have strange effects, I don't need it so * I didn't code it. */ return (ret); } /* Set Values */ /* * A little design philosophy is probably wise to include at this point. * * One of the things that I has hoped to achieve with xman is to make the * viewing of manpage not only easy for the nieve user, but also fast for * the experienced user, I wanted to be able to use it too. To achieve this * I end up sacrificing a bit of start up time for the manual data structure. * As well as, the overhead of reading the entire file before putting it up * on the display. This is actually hardly even noticeable since most manual * pages are shots, one to two pages - the notable exception is of course csh, * but then that should be broken up anyway. * * METHOD: * * I allocate a chunk of space that is the size of the file, plus a null for * debugging. Then copies the file into this chunk of memory. I then allocate * an array of char*'s that are assigned to the beginning of each line. Yes, * this means that I have to read the file twice, and could probably be more * clever about it, but once it is in memory the second read is damn fast. * There are a few obscurities here about guessing the number of lines and * reallocing if I guess wrong, but other than that it is pretty straight * forward. * * Chris Peterson * 1/27/88 */ #define ADD_MORE_MEM 100 /* first guesses for allocations. */ #define CHAR_PER_LINE 40 /* Function Name: LoadFile * Description: Loads the current file into the internal memory. * Arguments: w - the sblw. * Returns: none */ static void LoadFile(Widget w) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; FILE *file = sblw->scroll.file; char *page; char **line_pointer, **top_line; /* pointers to beginnings of the lines of the file. */ int nlines; /* the current number of allocated lines. */ struct stat fileinfo; /* file information from fstat. */ if (sblw->scroll.top_line != NULL) { XtFree(*(sblw->scroll.top_line)); /* free characters. */ XtFree((char *) (sblw->scroll.top_line)); /* free lines. */ } sblw->scroll.top_line = NULL; if (file == NULL) return; /* * Get file size and allocate a chunk of memory for the file to be * copied into. */ if (fstat(fileno(file), &fileinfo)) XtAppError(XtWidgetToApplicationContext(w), "SBLW LoadFile: Failure in fstat."); /* * Allocate a space for a list of pointer to the beginning of each line. */ if ((nlines = fileinfo.st_size / CHAR_PER_LINE) == 0) return; page = XtMalloc(fileinfo.st_size + 1); /* leave space for the NULL */ top_line = line_pointer = (char **) XtMalloc(nlines * sizeof(char *)); /* * Copy the file into memory. */ fseek(file, 0L, SEEK_SET); if (fread(page, sizeof(char), fileinfo.st_size, file) == 0) XtAppError(XtWidgetToApplicationContext(w), "SBLW LoadFile: Failure in fread."); /* put NULL at end of buffer. */ *(page + fileinfo.st_size) = '\0'; /* * Go through the file setting a line pointer to the character after each * new line. If we run out of line pointer space then realloc that space * with space for more lines. */ *line_pointer++ = page; /* first line points to first char in buffer. */ while (*page != '\0') { if (*page == '\n') { *line_pointer++ = page + 1; if (line_pointer >= top_line + nlines) { top_line = (char **) XtRealloc((char *) top_line, (nlines + ADD_MORE_MEM) * sizeof(char *)); line_pointer = top_line + nlines; nlines += ADD_MORE_MEM; } } page++; } /* * Realloc the line pointer space to take only the minimum amount of memory */ sblw->scroll.lines = nlines = line_pointer - top_line - 1; top_line = (char **) XtRealloc((char *) top_line, nlines * sizeof(char *)); /* * Store the memory pointers */ sblw->scroll.top_line = top_line; sblw->scroll.line_pointer = 0; SetThumbHeight(w); SetThumb(w); } #define NLINES 66 /* This is the number of lines to wait until we boldify the line again, this allows me to bold the first line of each page. */ #define BACKSPACE 010 /* I doubt you would want to change this. */ #define NORMAL 0 #define BOLD 1 #define ITALIC 2 #define SYMBOL 3 #define WHICH(italic, bold) ((bold) ? BOLD : ((italic) ? ITALIC : NORMAL)) /* Choose BOLD over ITALICS. If neither */ /* is chosen, use NORMAL. */ static int DumpText(Widget w, int x_loc, int y_loc, char *buf, int len, int format); static Boolean Boldify(char *); /* Function Name: PrintText * Description: This function actually prints the text. * Arguments: w - the ScrollByLine widget. * start_line - line to start printing, * num_lines - the number of lines to print. * location - the location to print the text. * Returns: none. */ /* ARGSUSED */ static void PrintText(Widget w, int start_line, int num_lines, int location) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; register char *bufp, *c; /* Generic char pointers */ int current_line; /* the number of the current line */ char buf[BUFSIZ]; /* Misc. characters */ Boolean italicflag = FALSE; /* Print text in italics?? */ Boolean first = TRUE; /* First line of a manual page??? */ int x_loc, y_loc; /* x and y location of text. */ /* * For table hack * To get columns to line up reasonably in most cases, make the * assumption that they were lined up using lots of spaces, where * lots is greater than two. Use a space width of 70% of the * widest character in the font. */ int h_col, h_fix; char *h_c; /* * Nothing loaded, take no action. */ if (sblw->scroll.top_line == NULL || num_lines == 0) return; current_line = start_line; /* Set the first character to print at the first line. */ c = *(sblw->scroll.top_line + start_line); /* * Because XDrawString uses the bottom of the text as a position * reference, add the height from the top of the font to the baseline * to the ScollByLine position reference. */ y_loc = location + sblw->scroll.normal_font->max_bounds.ascent; /* * Ok, here's the more than mildly heuristic man page formatter. * We put chars into buf until either a font change or newline * occurs (at which time we flush it to the screen.) */ bufp = buf; x_loc = sblw->scroll.offset + sblw->scroll.indent; h_col = 0; /* * A fix: * Assume that we are always starting to print on or before the * first line of a page, and then prove it if we aren't. */ for (h_fix = 1; h_fix <= (start_line % NLINES); h_fix++) if (**(sblw->scroll.top_line + start_line - h_fix) != '\n') { first = FALSE; break; } while (TRUE) { if (current_line % NLINES == 0) first = TRUE; /* * Lets make sure that we do not run out of space in our buffer, making full * use of it is not critical since no window will be wide enough to display * nearly BUFSIZ characters. */ if ((bufp - buf) > (BUFSIZ - 10)) /* Toss everything until we find a or the end of the buffer. */ while ((*c != '\n') && (*c != '\0')) c++; switch (*c) { case '\0': /* If we reach the end of the file then return */ DumpText(w, x_loc, y_loc, buf, bufp - buf, WHICH(italicflag, first)); return; case '\n': if (bufp != buf) { Boolean bold; *bufp = '\0'; /* for Boldify. */ bold = ((first) || ((x_loc == (sblw->scroll.offset + sblw->scroll.indent)) && Boldify(buf))); (void) DumpText(w, x_loc, y_loc, buf, bufp - buf, WHICH(italicflag, bold)); if (bold) first = FALSE; } /* * If we have painted the required number of lines then we should now return. */ if (++current_line == start_line + num_lines) return; bufp = buf; italicflag = FALSE; x_loc = sblw->scroll.offset + sblw->scroll.indent; h_col = 0; y_loc += sblw->scroll.font_height; break; /* * This tab handling code is not very clever it moves the cursor over * to the next boundary of eight (8) spaces, as calculated in width just * before the printing loop started. */ case '\t': /* TAB */ x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf, WHICH(italicflag, first)); h_col += bufp - buf; bufp = buf; italicflag = FALSE; x_loc = sblw->scroll.offset + sblw->scroll.indent; h_col = h_col + 8 - (h_col % 8); x_loc += sblw->scroll.h_width * h_col; break; case ' ': h_c = c + 1; while (*h_c == ' ') h_c++; if (h_c - c < 4) { *bufp++ = *c; break; } x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf, WHICH(italicflag, first)); h_col += bufp - buf; bufp = buf; italicflag = FALSE; x_loc = sblw->scroll.offset + sblw->scroll.indent; h_col += (h_c - c); x_loc += sblw->scroll.h_width * h_col; c = h_c - 1; break; case '\033': /* ignore esc sequences for now */ c++; /* should always be esc-x */ break; /* * Overstrike code supplied by: cs.utexas.edu!ut-emx!clyde@rutgers.edu * Since my manual pages do not have overstrike I couldn't test this. */ case BACKSPACE: /* Backspacing for nroff bolding */ if (c[-1] == c[1] && c[1] != BACKSPACE) { /* overstriking one char */ if (bufp > buf) { bufp--; /* Zap 1st instance of char to bolden */ x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf, WHICH(italicflag, FALSE)); h_col += bufp - buf; } bufp = buf; *bufp++ = c[1]; x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf, BOLD); h_col += bufp - buf; bufp = buf; first = FALSE; /* * Nroff bolding looks like: * C\bC\bC\bCN... * c points to ----^ ^ * it needs to point to --^ */ while (*c == BACKSPACE && c[-1] == c[1]) c += 2; c--; /* Back up to previous char */ } else { if ((c[-1] == 'o' && c[1] == '+') /* Nroff bullet */ ||(c[-1] == '+' && c[1] == 'o')) { /* Nroff bullet */ /* If we run into a bullet, print out */ /* everything that's accumulated to this */ /* point, then the bullet, then resume. */ if (bufp > buf) { bufp--; x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf, WHICH(italicflag, FALSE)); h_col += bufp - buf; } bufp = buf; *bufp = (char) 183; x_loc = DumpText(w, x_loc, y_loc, buf, 1, SYMBOL); h_col++; c++; } else { /* 'real' backspace - back up output ptr */ if (bufp > buf) bufp--; } } break; /* End of contributed overstrike code. */ case '_': /* look for underlining [italicize] */ if (*(c + 1) == BACKSPACE) { if (!italicflag) { /* font change? */ if (bufp != buf) { x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf, NORMAL); h_col += bufp - buf; bufp = buf; } italicflag = TRUE; } c += 2; *bufp++ = *c; break; } /* else fall through to default, because this was a real underscore. */ default: if (italicflag) { /* font change? */ if (bufp != buf) { x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf, WHICH(italicflag, FALSE)); h_col += bufp - buf; bufp = buf; } italicflag = FALSE; } *bufp++ = *c; break; } c++; } } /* Function Name: DumpText * Description: Dumps text to the screen. * Arguments: w - the widget. * x_loc - to dump text at. * y_loc - the y_location to draw_text. * buf - buffer to dump. * italic, bold, boolean that tells us which gc to use. * Returns: x_location of the end of the text. */ static int DumpText(Widget w, int x_loc, int y_loc, char *buf, int len, int format) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; GC gc; XFontStruct *font; switch (format) { case ITALIC: gc = sblw->scroll.italic_gc; font = sblw->scroll.italic_font; break; case BOLD: gc = sblw->scroll.bold_gc; font = sblw->scroll.bold_font; break; case SYMBOL: gc = sblw->scroll.symbol_gc; font = sblw->scroll.symbol_font; break; default: gc = sblw->scroll.normal_gc; font = sblw->scroll.normal_font; break; } XDrawString(XtDisplay(w), XtWindow(w), gc, x_loc, y_loc, buf, len); return (x_loc + XTextWidth(font, buf, len)); } /* Function Name: Boldify * Description: look for keyword. * Arguments: sp - string pointer. * Returns: 1 if keyword else 0. */ static Boolean Boldify(register char *sp) { register char *sp_pointer; int length, count; /* * If there are not lower case letters in the line the assume it is a * keyword and boldify it in PrintManpage. */ length = strlen(sp); for (sp_pointer = sp, count = 0; count < length; sp_pointer++, count++) if (!isupper(*sp_pointer) && !isspace(*sp_pointer)) return (0); return (1); } #undef superclass #undef SuperClass x11-apps-7.7+5+nmu1ubuntu1/xman/icon_help.h0000664000000000000000000000437112476465600015264 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * xman - X window system manual page display program. * Author: Chris D. Peterson, MIT Project Athena * Created: August 15, 1988 */ #define icon_help_width 30 #define icon_help_height 30 static const unsigned char icon_help_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xf8, 0xdf, 0xfe, 0x07, 0x3e, 0xfc, 0x0f, 0x1f, 0x06, 0x00, 0x00, 0x18, 0x06, 0x00, 0x00, 0x18, 0x06, 0xe0, 0x03, 0x18, 0x06, 0xf0, 0x07, 0x18, 0x06, 0x18, 0x0c, 0x18, 0x06, 0x0c, 0x18, 0x18, 0x06, 0x0c, 0x18, 0x18, 0x06, 0x0c, 0x18, 0x18, 0x06, 0x00, 0x18, 0x18, 0x06, 0x00, 0x18, 0x18, 0x06, 0x00, 0x0c, 0x18, 0x06, 0x80, 0x07, 0x18, 0x06, 0xc0, 0x03, 0x18, 0x06, 0xc0, 0x00, 0x18, 0x06, 0xc0, 0x00, 0x18, 0x06, 0xc0, 0x00, 0x18, 0x06, 0xc0, 0x00, 0x18, 0x06, 0x00, 0x00, 0x18, 0x06, 0x00, 0x00, 0x18, 0x06, 0xc0, 0x00, 0x18, 0x06, 0xc0, 0x00, 0x18, 0xc6, 0x03, 0xf0, 0x18, 0xfe, 0x1f, 0xfe, 0x1f, 0x3e, 0xfc, 0x0f, 0x1f, 0x06, 0xc0, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00 }; x11-apps-7.7+5+nmu1ubuntu1/xman/tkfuncs.c0000664000000000000000000000503612476465600014773 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include #include #include #include #include #include #include "globals.h" /* * I am doing the "wrong" thing here by looking in the core field for the * widget to get this info, the "right" thing to do is to do a XtGetValues * to get this information. */ /* Function Name: Width * Description: finds the width of a widget. * Arguments: w - the widget. * Returns: the width of that widget. */ int Width(Widget w) { return ((int) w->core.width); } /* Function Name: Height * Description: finds the height of a widget. * Arguments: w - the widget. * Returns: the height of that widget. */ int Height(Widget w) { return ((int) w->core.height); } /* Function Name: BorderWidth * Description: finds the BorderWidth of a widget. * Arguments: w - the widget. * Returns: the BorderWidth of that widget. */ int BorderWidth(Widget w) { return ((int) w->core.border_width); } /* * These functions have got to be able to get at the widget tree, I don't see * any way around this one. */ /* Function Name: Name * Description: This function returns the correct popup child * Arguments: w - widget * Returns: the popup child. */ char * Name(Widget w) { return (w->core.name); } x11-apps-7.7+5+nmu1ubuntu1/xman/man/0000775000000000000000000000000012656635743013730 5ustar x11-apps-7.7+5+nmu1ubuntu1/xman/man/xman.man0000664000000000000000000003457712476465600015401 0ustar .\" t .\" .TH XMAN 1 __xorgversion__ .SH NAME xman \- Manual page display program for the X Window System .SH SYNOPSIS .B xman [ .I \-options \&.\|.\|. ] .SH DESCRIPTION .I Xman is a manual page browser. The default size of the initial \fIxman\fP window is small so that you can leave it running throughout your entire login session. In the initial window there are three options: \fIHelp\fP will pop up a window with on-line help, \fIQuit\fP will exit, and \fIManual Page\fP will pop up a window with a manual page browser in it. Typing Control-S will pop up a window prompting for a specific manual page to display. You may display more than one manual page browser window at a time from a single execution of \fIxman\fP. .PP For further information on using \fIxman\fP, please read the on-line help information. Most of this manual will discuss customization of \fIxman\fP. .SH "OPTIONS" .PP Xman supports all standard Toolkit command line arguments (see \fIX\fP(__miscmansuffix__)). The following additional arguments are supported. .sp .IP "\fB\-helpfile\fP \fIfilename\fP" Specifies a helpfile to use other than the default. .IP \fB\-bothshown\fP Allows both the manual page and manual directory to be on the screen at the same time. .IP \fB\-notopbox\fP Starts without the Top Menu with the three buttons in it. .IP "\fB\-geometry\fP \fIWxH+X+Y\fP" Sets the size and location of the Top Menu with the three buttons in it. .IP "\fB\-pagesize\fP \fIWxH+X+Y\fP" Sets the size and location of all the Manual Pages. .SH "CUSTOMIZING XMAN" .PP .I Xman allows customization of both the directories to be searched for manual pages, and the name that each directory will map to in the \fISections\fP menu. Xman determines which directories it will search by reading the \fIMANPATH\fP environment variable. If no \fIMANPATH\fP is found then the directory is /usr/man is searched on POSIX systems. This environment is expected to be a colon-separated list of directories for xman to search. .sp .nf setenv MANPATH /mit/kit/man:/usr/man .fi .PP By default, .I xman will search each of the following directories (in each of the directories specified in the users MANPATH) for manual pages. If manual pages exist in that directory then they are added to list of manual pages for the corresponding menu item. A menu item is only displayed for those sections that actually contain manual pages. .TS l l. Directory Section Name - - man1 (1) User Commands man2 (2) System Calls man3 (3) Subroutines man4 (4) Devices man5 (5) File Formats man6 (6) Games man7 (7) Miscellaneous man8 (8) Sys. Administration manl (l) Local mann (n) New mano (o) Old .TE For instance, a user has three directories in her manual path and each contain a directory called \fIman3\fP. All these manual pages will appear alphabetically sorted when the user selects the menu item called \fI(__libmansuffix__) Subroutines\fP. If there is no directory called \fImano\fP in any of the directories in her MANPATH, or there are no manual pages in any of the directories called \fImano\fP then no menu item will be displayed for the section called \fI(o) Old\fP. .SH "BSD AND LINUX SYSTEMS" .PP In newer BSD and Linux systems, \fIXman\fP will search for a file named \fI/etc/man.conf\fP which will contain the list of directories containing manual pages. See \fIman.conf\fP(__filemansuffix__) for a complete description of the file format. .SH "THE MANDESC FILE" .PP By using the \fImandesc\fP file a user or system manager is able to more closely control which manual pages will appear in each of the sections represented by menu items in the \fISections\fP menu. This functionality is only available on a section by section basis, and individual manual pages may not be handled in this manner. (Although generous use of symbolic links \(em see \fIln\fP(__appmansuffix__) \(em will allow almost any configuration you can imagine.) .PP The format of the mandesc file is a character followed by a label. The character determines which of the sections will be added under this label. For instance suppose that you would like to create an extra menu item that contains all programmer subroutines. This label should contain all manual pages in both sections two and three. The \fImandesc\fP file would look like this: .nf 2Programmer Subroutines 3Programmer Subroutines .fi This will add a menu item to the \fISections\fP menu that would bring up a listing of all manual pages in sections two and three of the Programmers Manual. Since the label names are \fIexactly\fP the same they will be added to the same section. Note, however, that the original sections still exist. .PP If you want to completely ignore the default sections in a manual directory then add the line: .nf no default sections .fi anywhere in your mandesc file. This keeps xman from searching the default manual sections \fIIn that directory only\fP. As an example, suppose you want to do the same thing as above, but you don't think that it is useful to have the \fISystem Calls\fP or \fISubroutines\fP sections any longer. You would need to duplicate the default entries, as well as adding your new one. .nf no default sections 1(1) User Commands 2Programmer Subroutines 3Programmer Subroutines 4(4) Devices 5(5) File Formats 6(6) Games 7(7) Miscellaneous 8(8) Sys. Administration l(l) Local n(n) New o(o) Old .fi Xman will read any section that is of the from \fIman\fP, where is an upper or lower case letter (they are treated distinctly) or a numeral (0-9). Be warned, however, that man(__appmansuffix__) and catman(__adminmansuffix__) will not search directories that are non-standard. .SH WIDGETS In order to specify resources, it is useful to know the hierarchy of the widgets which compose \fIxman\fR. In the notation below, indentation indicates hierarchical structure. The widget class name is given first, followed by the widget instance name. .sp .nf .ft CW Xman xman \fI(This widget is never used)\fP TopLevelShell topBox Form form Label topLabel Command helpButton Command quitButton Command manpageButton TransientShell search DialogWidgetClass dialog Label label Text value Command manualPage Command apropos Command cancel TransientShell pleaseStandBy Label label TopLevelShell manualBrowser Paned Manpage_Vpane Paned horizPane MenuButton options MenuButton sections Label manualBrowser Viewport directory List directory List directory . . (one for each section, . created on the fly) . ScrollByLine manualPage SimpleMenu optionMenu SmeBSB displayDirectory SmeBSB displayManualPage SmeBSB help SmeBSB search SmeBSB showBothScreens SmeBSB removeThisManpage SmeBSB openNewManpage SmeBSB showVersion SmeBSB quit SimpleMenu sectionMenu SmeBSB . . (one for each section) . TransientShell search DialogWidgetClass dialog Label label Text value Command manualPage Command apropos Command cancel TransientShell pleaseStandBy Label label TransientShell likeToSave Dialog dialog Label label Text value Command yes Command no TopLevelShell help Paned Manpage_Vpane Paned horizPane MenuButton options MenuButton sections Label manualBrowser ScrollByLine manualPage SimpleMenu optionMenu SmeBSB displayDirectory SmeBSB displayManualPage SmeBSB help SmeBSB search SmeBSB showBothScreens SmeBSB removeThisManpage SmeBSB openNewManpage SmeBSB showVersion SmeBSB quit .ft .fi .SH "APPLICATION RESOURCES" \fIxman\fP has the following application-specific resources which allow customizations unique to \fIxman\fP. .PP .TP 18 \fBmanualFontNormal\fP (Class \fBFont\fP) The font to use for normal text in the manual pages. .TP 18 \fBmanualFontBold\fP (Class \fBFont\fP) The font to use for bold text in the manual pages. .TP 18 \fBmanualFontItalic\fP (Class \fBFont\fP) The font to use for italic text in the manual pages. .TP 18 \fBdirectoryFontNormal\fP (Class \fBFont\fP) The font to use for the directory text. .TP 18 \fBbothShown\fP (Class \fBBoolean\fP) Either `true' or `false,' specifies whether or not you want both the directory and the manual page shown at start up. .TP 18 \fBdirectoryHeight\fP (Class \fBDirectoryHeight\fP) The height in pixels of the directory, when the directory and the manual page are shown simultaneously. .TP 18 \fBtopCursor\fP (Class \fBCursor\fP) The cursor to use in the top box. .TP 18 \fBhelpCursor\fP (Class \fBCursor\fP) The cursor to use in the help window. .TP 18 \fBmanpageCursor\fP (Class \fBCursor\fP) The cursor to use in the manual page window. .TP 18 \fBsearchEntryCursor\fP (Class \fBCursor\fP) The cursor to use in the search entry text widget. .TP 18 \fBpointerColor\fP (Class \fBForeground\fP) This is the color of all the cursors (pointers) specified above. The name was chosen to be compatible with xterm. .TP 18 \fBhelpFile\fP (Class \fBFile\fP) Use this rather than the system default helpfile. .TP 18 \fBtopBox\fP (Class \fBBoolean\fP) Either `true' or `false,' determines whether the top box (containing the help, quit and manual page buttons) or a manual page is put on the screen at start-up. The default is true. .TP 18 \fBverticalList\fP (Class \fBBoolean\fP) Either `true' or `false,' determines whether the directory listing is vertically or horizontally organized. The default is horizontal (false). .SH "GLOBAL ACTIONS" \fIXman\fP defines all user interaction through global actions. This allows the user to modify the translation table of any widget, and bind any event to the new user action. The list of actions supported by \fIxman\fP are: .TP 1.5i .B GotoPage(\fIpage\fB) When used in a manual page display window this will allow the user to move between a directory and manual page display. The \fIpage\fP argument can be either \fBDirectory\fP or \fBManualPage\fP. .TP 1.5i .B Quit() This action may be used anywhere, and will exit xman. .TP 1.5i .B Search(\fItype\fB, \fIaction\fB) Only useful when used in a search popup, this action will cause the search widget to perform the named search type on the string in the search popup's value widget. This action will also pop down the search widget. The \fItype\fP argument can be either \fBApropos\fP, \fBManpage\fP or \fBCancel\fP. If an \fIaction\fP of \fBOpen\fP is specified then xman will open a new manual page to display the results of the search, otherwise xman will attempt to display the results in the parent of the search popup. .TP 1.5i .B PopupHelp() This action may be used anywhere, and will popup the help widget. .TP 1.5i .B PopupSearch() This action may be used anywhere except in a help window. It will cause the search popup to become active and visible on the screen, allowing the user search for a manual page. .TP 1.5i .B CreateNewManpage() This action may be used anywhere, and will create a new manual page display window. .TP 1.5i .B RemoveThisManpage() This action may be used in any manual page or help display window. When called it will remove the window, and clean up all resources associated with it. .TP 1.5i .B SaveFormattedPage(\fIaction\fP) This action can only be used in the \fBlikeToSave\fP popup widget, and tells xman whether to \fBSave\fP or \fBCancel\fP a save of the manual page that has just been formatted. .TP 1.5i .B ShowVersion() This action may be called from any manual page or help display window, and will cause the informational display line to show the current version of xman. .SH FILES .IP "\fI\fP/man<\fIcharacter\fP>" 2.5i .IP "\fI\fP/cat<\fIcharacter\fP>" .IP "\fI\fP/mandesc" .IP __apploaddir__/Xman specifies required resources. .IP /tmp .I Xman creates temporary files in /tmp for all unformatted man pages and all apropos searches. .SH "SEE ALSO" .IR X (__miscmansuffix__), .IR man (__appmansuffix__), .IR apropos (__appmansuffix__), .IR catman (8), .I "Athena Widget Set" .SH ENVIRONMENT .TP 1.5i .B DISPLAY the default host and display to use. .TP 1.5i .B MANPATH the search path for manual pages. Directories are separated by colons (e.g. /usr/man:/mit/kit/man:/foo/bar/man). .TP 1.5i .B XENVIRONMENT to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .TP 1.5i .B XAPPLRESDIR A string that will have ``Xman'' appended to it. This string will be the full path name of a user app-defaults file to be merged into the resource database after the system app-defaults file, and before the resources that are attached to the display. .br See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHORS Chris Peterson, MIT X Consortium from the V10 version written by Barry Shein formerly of Boston University. Bug fixes and Linux support by Carlos A M dos Santos, for The XFree86 Project. x11-apps-7.7+5+nmu1ubuntu1/xman/man/Makefile.am0000664000000000000000000000052212476465600015754 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = xman.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/xman/help.c0000664000000000000000000000652712476465600014254 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * xman - X window system manual page display program. * Author: Chris D. Peterson, MIT Project Athena * Created: January 19, 1988 */ #include "globals.h" /* Function Name: MakeHelpWidget. * Description: This function creates the help widget so that it will be * ready to be displayed. * Arguments: none. * Returns: none. */ Boolean MakeHelpWidget(void) { ManpageGlobals *man_globals; /* The pseudo global structure. */ if (help_widget != NULL) /* If we already have a help widget. then do not create one. */ return (TRUE); man_globals = InitPsuedoGlobals(); if (man_globals == NULL) return (FALSE); CreateManpageWidget(man_globals, HELPNAME, FALSE); help_widget = man_globals->This_Manpage; if (OpenHelpfile(man_globals) == FALSE) { XtDestroyWidget(help_widget); help_widget = NULL; return (FALSE); } ChangeLabel(man_globals->label, "Xman Help"); XtManageChild(man_globals->manpagewidgets.manpage); XtRealizeWidget(help_widget); SaveGlobals(man_globals->This_Manpage, man_globals); AddCursor(help_widget, resources.cursors.manpage); /* * Set up ICCCM delete window. */ XtOverrideTranslations (man_globals->This_Manpage, XtParseTranslationTable("WM_PROTOCOLS: RemoveThisManpage()")); (void) XSetWMProtocols(XtDisplay(man_globals->This_Manpage), XtWindow(man_globals->This_Manpage), &wm_delete_window, 1); return (TRUE); } /* Function Name: OpenHelpfile * Description: opens the helpfile. * Arguments: man_globals - the pseudo globals structure. * Returns: False if no helpfile was found. */ Boolean OpenHelpfile(ManpageGlobals * man_globals) { FILE *help_file_ptr; if ((help_file_ptr = fopen(resources.help_file, "r")) == NULL) { PopupWarning(man_globals, "Could not open help file, NO HELP WILL BE AVAILABLE."); return (FALSE); } OpenFile(man_globals, help_file_ptr); return (TRUE); } x11-apps-7.7+5+nmu1ubuntu1/xman/ScrollByLP.h0000664000000000000000000000727712476465600015321 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _XtScrollByLinePrivate_h #define _XtScrollByLinePrivate_h #include #include "ScrollByL.h" /*********************************************************************** * * ScrollByLine Widget Private Data * ***********************************************************************/ /* New fields for the ScrollByLine widget class record */ typedef struct { int mumble; /* No new procedures */ } ScrollByLineClassPart; /* Full class record declaration */ typedef struct _ScrollByLineClassRec { CoreClassPart core_class; SimpleClassPart simple_class; ScrollByLineClassPart scrolled_widget_class; } ScrollByLineClassRec; extern ScrollByLineClassRec scrollByLineClassRec; /* New fields for the ScrollByLine widget record */ typedef struct _ScrollByLinePart { Pixel foreground; /* The color for the foreground of the text. */ Boolean force_vert, /* Must have scrollbar visible */ use_right; /* put scroll bar on right side of window. */ FILE *file; /* The file to display. */ Dimension indent; /* amount to indent the file. */ XFontStruct *bold_font, /* The four fonts. */ *normal_font, *italic_font, *symbol_font; int h_width; /* Main font width */ /* variables not in resource list. */ Widget bar; /* The scrollbar. */ int font_height; /* the height of the font. */ int line_pointer; /* The line that currently is at the top of the window being displayed. */ Dimension offset; /* Drawing offset because of scrollbar. */ GC move_gc; /* GC to use when moving the text. */ GC bold_gc, normal_gc, italic_gc, symbol_gc; /* gc for drawing. */ char **top_line; /* The top line of the file. */ int lines; /* Total number of line in the file. */ int num_visible_lines; /* Number of lines visible */ } ScrollByLinePart; /**************************************************************** * * Full instance record declaration * ****************************************************************/ typedef struct _ScrollByLineRec { CorePart core; SimplePart simple; ScrollByLinePart scroll; } ScrollByLineRec; #endif /* _XtScrollByLinePrivate_h --- DON'T ADD STUFF AFTER THIS LINE */ x11-apps-7.7+5+nmu1ubuntu1/xman/config.sub0000775000000000000000000010622312514123564015126 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-12-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xman/vendor.h0000664000000000000000000001436012476465600014620 0ustar /* Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* Vendor-specific definitions */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #ifdef CSRG_BASED #include #endif #define SUFFIX "suffix" #define FOLD "fold" #define FOLDSUFFIX "foldsuffix" #define MNULL 0 #define MSUFFIX 1 #define MFOLD 2 #define MFOLDSUFFIX 3 /* * The directories to search. Assume that the manual directories are more * complete than the cat directories. */ #define SEARCHDIR MAN #if (defined(sgi) || (defined(SVR4) && !defined(sun)) || (defined(BSD) && (BSD >= 199103)) || defined(linux) || defined(__CYGWIN__) ) # define SEARCHOTHER CAT #endif /* * The default manual page directory. * * The MANPATH environment variable will override this. */ #ifndef SYSMANPATH #if defined(__bsdi__) # define SYSMANPATH "/usr/share/man:/usr/contrib/man:/usr/contrib/isode/man:/usr/local/man" #elif defined(__OpenBSD__) || defined(__DARWIN__) # define SYSMANPATH "/usr/share/man:/usr/local/man:/usr/X11R6/man" #elif defined(SVR4) && defined(sun) # define SYSMANPATH "/usr/share/man:/usr/X11/man:/usr/openwin/share/man:/usr/dt/share/man:/usr/sfw/share/man" #elif defined(SVR4) || defined(__osf__) || (defined(BSD) && (BSD >= 199103)) # define SYSMANPATH "/usr/share/man" #elif defined(sgi) # define SYSMANPATH "/usr/catman/a_man:/usr/catman/g_man:/usr/catman/p_man:/usr/catman/u_man:/usr/man/p_man:/usr/man/u_man:/usr/man" #endif #ifndef SYSMANPATH # define SYSMANPATH "/usr/man" #endif #endif /* * Compression Definitions. */ #if defined(sgi) # define COMPRESSION_EXTENSION "z" # define UNCOMPRESS_FORMAT "pcat %s > %s" # define NO_COMPRESS /* mac can't handle using pack as a filter and xman needs it to be done that way. */ #elif defined (ISC) || defined(__SCO__) || defined(__UNIXWARE__) # define COMPRESSION_EXTENSION "Z" /* dummy */ # if !defined(__SCO__) && !defined(__UNIXWARE__) # define COMPRESSION_EXTENSIONS "zZF" /* pack, compress, freeze */ # else # define COMPRESSION_EXTENSIONS "zZ" /* pack, compress */ # endif # define UNCOMPRESS_FORMAT uncompress_format # define UNCOMPRESS_FORMAT_1 "pcat %s > %s" # define UNCOMPRESS_FORMAT_2 "zcat < %s > %s" # define UNCOMPRESS_FORMAT_3 "fcat < %s > %s" # define NO_COMPRESS #else # define COMPRESSION_EXTENSION "Z" # define UNCOMPRESS_FORMAT "zcat < %s >> %s" # define COMPRESS "compress" # define GZIP_EXTENSION "gz" # define GUNZIP_FORMAT "gzip -c -d < %s >> %s" # define GZIP_COMPRESS "gzip" # define BZIP2_EXTENSION "bz2" # define BUNZIP2_FORMAT "bunzip2 -c -d < %s >> %s" # define BZIP2_COMPRESS "bzip2" # define LZMA_EXTENSION "lzma" # define UNLZMA_FORMAT "unlzma -c -d < %s >> %s" # define LZMA_COMPRESS "lzma" #endif /* * The command filters for the manual and apropos searches. */ #if defined(hpux) # define NO_MANPATH_SUPPORT #endif #ifdef NO_MANPATH_SUPPORT # define APROPOS_FORMAT ("man -k %s | pr -h Apropos >> %s") #else # define APROPOS_FORMAT ("man -M %s -k %s | pr -h Apropos >> %s") #endif #ifndef HANDLE_ROFFSEQ # if defined(CSRG_BASED) # define FORMAT "| eqn | tbl | nroff -mandoc" # elif defined(BSD) && (BSD >= 199103) # define FORMAT "| eqn | tbl | nroff -man" # elif defined(linux) || defined(__CYGWIN__) # define FORMAT "| pic | eqn | tbl -Tlatin1 | GROFF_NO_SGR= groff -Tlatin1 -mandoc" # else # define FORMAT "| neqn | nroff -man" /* The format command. */ # endif # define TBL "tbl" #else /* HANDLE_ROFFSEQ */ # if defined(linux) # define ZSOELIM "zsoelim" # else # define ZSOELIM "soelim" #endif # define EQN "eqn" # define TBL "tbl" # define GRAP "grap" # define ROFF_PIC "pic" # define VGRIND "vgrind" # define REFER "refer" # if defined(CSRG_BASED) # define FORMAT "nroff -mandoc" # elif defined(linux) || defined(__CYGWIN__) # define FORMAT "GROFF_NO_SGR= groff -Tlatin1 -mandoc" # elif defined(__DARWIN__) # define FORMAT "nroff -man" # else # define FORMAT "GROFF_NO_SGR= groff -Tlatin1 -man" # endif # define DEFAULT_MANROFFSEQ "et" #endif /*HANDLE_ROFFSEQ */ /* * Names of the man and cat dirs. */ #ifdef __bsdi__ #define MAN "cat" #else #define MAN "man" #endif #if defined(SCO) # define CAT "cat." #else # define CAT "cat" #endif /* Solaris has nroff man pages in "man" and sgml man pages in "sman" */ #if defined(sun) && defined(SVR4) # define SFORMAT "/usr/lib/sgml/sgml2roff" # define SMAN "sman" # undef SEARCHOTHER # define SEARCHOTHER SMAN # define SGMLENT_EXTENSION "ent" /* SGML entity files end in ".ent" */ #endif typedef struct _SectionList { struct _SectionList *next; char *label; /* section label */ char *directory; /* section directory */ int flags; } SectionList; extern char *CreateManpageName(const char *entry, int section, int flags); extern void AddStandardSections(SectionList ** list, const char *path); extern void AddNewSection(SectionList ** list, const char *path, const char *file, const char *label, int flags); x11-apps-7.7+5+nmu1ubuntu1/xman/icon_open.h0000664000000000000000000000437212476465600015276 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * xman - X window system manual page display program. * Author: Chris D. Peterson, MIT Project Athena * Created: January 29, 1988 */ #define icon_open_width 30 #define icon_open_height 30 static const unsigned char icon_open_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xf8, 0xdf, 0xfe, 0x07, 0x3e, 0xfc, 0x0f, 0x1f, 0x06, 0x00, 0x00, 0x18, 0x06, 0x30, 0x03, 0x18, 0xc6, 0x31, 0xe3, 0x18, 0x36, 0x32, 0x13, 0x1b, 0x06, 0x30, 0x03, 0x18, 0xc6, 0xf1, 0xe3, 0x18, 0x36, 0xe2, 0x11, 0x1b, 0x06, 0x00, 0x00, 0x18, 0xc6, 0xf1, 0xe3, 0x18, 0x36, 0x32, 0x13, 0x1b, 0x06, 0x30, 0x03, 0x18, 0xc6, 0xf1, 0xe3, 0x18, 0x36, 0x32, 0x10, 0x1b, 0x06, 0x30, 0x00, 0x18, 0xc6, 0x01, 0xe0, 0x18, 0x36, 0x3a, 0x17, 0x1b, 0x06, 0xf8, 0x07, 0x18, 0xc6, 0xd9, 0xe6, 0x18, 0x36, 0xda, 0x16, 0x1b, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0xc6, 0x03, 0xf0, 0x18, 0xfe, 0x1f, 0xfe, 0x1f, 0x3e, 0xfc, 0x0f, 0x1f, 0x06, 0xc0, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00 }; x11-apps-7.7+5+nmu1ubuntu1/xman/xman.help0000664000000000000000000002016112476465600014763 0ustar XMAN is an X Window System manual browsing tool. GETTING STARTED By default, xman starts by creating a small window that contains three "buttons" (places on which to click a pointer button). Two of these buttons, Help and Quit, are self-explanatory. The third, Manual Page, creates a new manual page browser window; you may use this button to open a new manual page any time xman is running. A new manual page starts up displaying this help information. The manual page contains three sections. In the upper left corner are two menu buttons. When the mouse is clicked on either of these buttons a menu is popped up. The contents of these menus is described below. Directly to the right of the menu buttons is an informational display. This display usually contains the name of the directory or manual page being displayed. It is also used to display warning messages and the current version of xman. The last and largest section is the information display. This section of the application contains either a list of manual pages to choose from or the text of a manual page. To use xman pull down the Sections menu to select a manual section. When the section is displayed, click the left pointer button on the name of the manual page that you would like to see. Xman will replace the directory listing with the manual page you selected. That should be enough to get you started. Once you understand the basics of how to use xman, take a look at the rest of this file to see the advanced features that are available to make using xman fast and efficient. SCROLLING TEXT The scroll bars are similar to xterm and xmh scroll bars; clicking the left or right pointer button with the pointer at the bottom of the scroll bar will scroll the text down or up one page, respectively. Clicking with the pointer farther up the scroll bar scrolls proportionally less than one page. Clicking the middle button a portion of the way down the scroll bar will move the text window that portion of the way down the text. Holding the middle button and moving the pointer up and down allows the text to be scrolled dynamically. You may also type 'f' or to scroll down one page, and 'b' to scroll up one page. RESIZING WINDOWS You can resize any of the windows in xman with your window manager, and xman will do the best it can to resize everything internally into a useful configuration. The only control over the internal arrangement that you have is moving the border between the manual page and directory when both are displayed. This is done by clicking and holding the any pointer button when the cursor is over the small square (grip) on the right side of the screen. The grip is located on the horizontal line which separates the panes. The grip may be moved up and down to resize the panes of the screen, and when the pointer button is released xman will move the pane boundary to the newly specified location. MENU COMMANDS There are two ways to activate the menus. The first is to click any pointer button in the menu button corresponding to the menu you want to activate. The second method is to hold down the "Control" key and click the left pointer button for the Options menu or the middle pointer button for the Sections menu. Reguardless of how the menu was activated, selecting items is the same. Once a menu is activated, continue to hold down the pointer button and drag the pointer cursor over the item that you would like to activate. Once the item that you want to select is highlighted, select it by releasing the pointer button. To avoid making a menu selection, move the pointer cursor outside the menu and release the button. Selecting one of the items in the Sections menu will display the named directory. The following commands are available through the Options menu: Display Directory Show the current section directory. Display Manual Page Show the current manual page. Help Create a help window with this text displayed. Search Pop up a dialogue box that allows the entire tree of manual pages to be searched for a specific name. A keyword (apropos) search is also available through this dialogue box. Show Both Screens Split the manual page display window to display both the current manual page and the directory. Show One Screen Return to a single screen display of either a manual page or directory listing. Remove This Man Page Remove this manual page, do not quit. Open New Man Page Pop up a new manual page browser window. Show Version Print the current version of xman to the information display window. Please include the version number when reporting bugs. Quit Close all xman windows and quit xman. SUMMARY OF BASIC ACTIONS In a menu button: CLICK: Pop up a menu In a directory, manual page, or scroll bar: CLICK LEFT: Pop up the Options menu. CLICK MIDDLE: Pop up the Sections menu. In a directory: CLICK LEFT: Bring up named manual page CLICK MIDDLE: Go to manual page previously chosen. In a manual page or apropos listing: CLICK MIDDLE: Go to directory of manual pages. In scroll bars: CLICK LEFT: Move down - more if pointer is near bottom of window, less if at top. CLICK MIDDLE: Move top of page to current pointer position. CLICK RIGHT: Move up - more if pointer is near bottom of window, less if at top. SEARCHING Xman has a built-in searching utility that allows the user to search the entire manual page tree for a specific topic (manual page search) or a keyword (apropos search). The search dialogue box can be activated from the Options menu, or by the key Control-s. If the search is started from the small initial topbox xman will open a new manual page if the search was successful, and fail silently if the search was unsuccessful. Manual page searches are performed starting in the currently displayed section. If no match is found then the remaining sections are searched in the order that the sections appear in the Sections menu, starting at the top. The current version of xman immediately displays the first manual page that it finds. If the manual page cannot be found that fact is noted in the informational display. An apropos search will search a list of short descriptions for all manual pages on the system and return a list of all descriptions which contain the keyword specified. KEYBOARD ACCELERATORS Xman contains a set of preinstalled keyboard accelerators. These are a set of key bindings that perform many of the same operations as the menu items. Since it is not necessary to pull down the menu, these actions can be performed more quickly, hence the name accelerators. The default key bindings for xman are: Anywhere: Control - c Exit xman Control - h Create the help window Control - n Create a new man page Control - q Exit xman Control - s Create a search popup In a manual page, directory, or help window: Control - r Remove this manual page or help display Control - v Show the current version of xman In a manual page or directory: Control - d Display Directory Control - m Display Man Page In a manual page only: b Page Back f Page forward Page forward 1 One line forward 2 Two lines forward 3 Three lines forward 4 Four lines forward Note: Control-s does not have any effect in the help window. FURTHER INFORMATION Xman is highly customizable. Through the X resource database a user can customize the look and feel of this application so that it meets a preferred style of interaction. Almost any configuration that is available dynamically can be specified through resources. This includes changing the size, color, and fonts, starting with no topbox, showing both screens, and rebinding the keyboard accelerators. The information on customizing xman is contained in the xman manual page, I will leave it to you to figure out how to find and display that information :-) Chris D. Peterson MIT X Consortium CREDITS Version: Use 'Show Version' menu item. Written By: Chris D. Peterson - formerly MIT X Consortium Based Upon: Xman for X10 by Barry Shein - Boston University Copyright 1988, 1989 X Consortium Edited by Donna Converse and Dave Sternlicht x11-apps-7.7+5+nmu1ubuntu1/xman/Makefile.am0000664000000000000000000000402612476465600015204 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = xman helpdir=@HELPDIR@ dist_help_DATA = xman.help AM_CFLAGS = $(CWARNFLAGS) $(XMAN_CFLAGS) \ -D_BSD_SOURCE -DHELPFILE=\"$(helpdir)/xman.help\" xman_LDADD = $(XMAN_LIBS) xman_SOURCES = \ buttons.c \ defs.h \ globals.c \ globals.h \ handler.c \ help.c \ iconclosed.h \ icon_help.h \ icon_open.h \ main.c \ man.c \ man.h \ misc.c \ ScrollByL.c \ ScrollByL.h \ ScrollByLP.h \ search.c \ tkfuncs.c \ vendor.c \ vendor.h # App default files DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ dist_appdefault_DATA = app-defaults/Xman MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xman/main.c0000664000000000000000000002471412476465600014246 0ustar /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * xman - X window system manual page display program. * Author: Chris D. Peterson, MIT Project Athena * Created: October 22, 1987 */ #include "globals.h" #ifndef ZERO #include #endif /* ZERO */ static void ArgError(int argc, char **argv); static void AdjustDefResources(void); #define Offset(field) (XtOffsetOf(Xman_Resources , field)) static XtResource my_resources[] = { {"directoryFontNormal", XtCFont, XtRFontStruct, sizeof(XFontStruct *), Offset(fonts.directory), XtRString, DIRECTORY_NORMAL}, {"bothShown", XtCBoolean, XtRBoolean, sizeof(Boolean), Offset(both_shown_initial), XtRString, "False"}, {"directoryHeight", "DirectoryHeight", XtRInt, sizeof(int), Offset(directory_height), XtRString, "150"}, {"topCursor", XtCCursor, XtRCursor, sizeof(Cursor), Offset(cursors.top), XtRString, XMAN_CURSOR}, {"helpCursor", XtCCursor, XtRCursor, sizeof(Cursor), Offset(cursors.help), XtRString, HELP_CURSOR}, {"manpageCursor", XtCCursor, XtRCursor, sizeof(Cursor), Offset(cursors.manpage), XtRString, MANPAGE_CURSOR}, {"searchEntryCursor", XtCCursor, XtRCursor, sizeof(Cursor), Offset(cursors.search_entry), XtRString, SEARCH_ENTRY_CURSOR}, {"pointerColor", XtCForeground, XtRPixel, sizeof(Pixel), Offset(cursors.fg_color), XtRString, "XtDefaultForeground"}, {"pointerColorBackground", XtCBackground, XtRPixel, sizeof(Pixel), Offset(cursors.bg_color), XtRString, "XtDefaultBackground"}, {"help", XtCBoolean, XtRBoolean, sizeof(Boolean), Offset(show_help_syntax), XtRImmediate, NULL}, {"helpFile", XtCFile, XtRString, sizeof(char *), Offset(help_file), XtRString, HELPFILE}, {"topBox", XtCBoolean, XtRBoolean, sizeof(Boolean), Offset(top_box_active), XtRString, "True"}, {"clearSearchString", "ClearSearchString", XtRBoolean, sizeof(Boolean), Offset(clear_search_string), XtRImmediate, (caddr_t) TRUE}, {"title", XtCString, XtRString, sizeof(char *), Offset(title), XtRString, "xman"}, {"iconic", XtCBoolean, XtRBoolean, sizeof(Boolean), Offset(iconic), XtRString, "False"}, }; #undef Offset /* * The resource that we absolutely need. */ static char *fallback_resources[] = { "Xman*quitButton.translations: #override \\n : Quit() reset()", "Xman*helpButton.sensitive: FALSE", "Xman*manpageButton.sensitive: FALSE", "Xman*helpButton.Label: Help", "Xman*quitButton.Label: Quit", "Xman*manpageButton.Label: Manual Page", "Xman*topLabel.label: No App-Defaults File", NULL, }; /* * This is necessary to keep all TopLevel shells from becoming * the size that is specified on the command line. */ static XrmOptionDescRec xman_options[] = { {"-geometry", "*topBox.geometry", XrmoptionSepArg, (caddr_t) NULL}, {"-help", "help", XrmoptionNoArg, (caddr_t) "True"}, {"=", "*topBox.geometry", XrmoptionIsArg, (caddr_t) NULL}, {"-pagesize", "*manualBrowser.geometry", XrmoptionSepArg, (caddr_t) NULL}, {"-notopbox", "topBox", XrmoptionNoArg, (caddr_t) "False"}, {"-helpfile", "helpFile", XrmoptionSepArg, (caddr_t) NULL}, {"-bothshown", "bothShown", XrmoptionNoArg, (caddr_t) "True"}, {"-title", "title", XrmoptionSepArg, (caddr_t) "xman"}, {"-iconic", "iconic", XrmoptionNoArg, (caddr_t) "True"}, }; static XtActionsRec xman_actions[] = { {"GotoPage", GotoPage}, {"Quit", Quit}, {"Search", Search}, {"PopupHelp", PopupHelp}, {"PopupSearch", PopupSearch}, {"CreateNewManpage", CreateNewManpage}, {"RemoveThisManpage", RemoveThisManpage}, {"SaveFormattedPage", SaveFormattedPage}, #ifdef INCLUDE_XPRINT_SUPPORT {"PrintThisManpage", PrintThisManpage}, #endif /* INCLUDE_XPRINT_SUPPORT */ {"ShowVersion", ShowVersion}, }; char **saved_argv; int saved_argc; /* * This atom is used to make the application ICCCM compliant. */ Atom wm_delete_window; /* Function Name: main * Description: This is the main driver for Xman. * Arguments: argc, argv - the command line arguments. * Returns: return, what return. */ int main(int argc, char **argv) { XtAppContext app_con; saved_argc = argc; saved_argv = (char **) XtMalloc(argc * sizeof(char *)); bcopy(argv, saved_argv, argc * sizeof(char *)); XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); initial_widget = XtAppInitialize(&app_con, "Xman", xman_options, XtNumber(xman_options), &argc, argv, fallback_resources, NULL, ZERO); wm_delete_window = XInternAtom(XtDisplay(initial_widget), "WM_DELETE_WINDOW", False); manglobals_context = XStringToContext(MANNAME); AdjustDefResources(); XtGetApplicationResources(initial_widget, (caddr_t) & resources, my_resources, XtNumber(my_resources), NULL, (Cardinal) 0); if ((argc != 1) || (resources.show_help_syntax)) { ArgError(argc, argv); return EXIT_FAILURE; } XtAppAddActions(app_con, xman_actions, XtNumber(xman_actions)); if (!resources.fonts.directory) PrintError("Failed to get the directory font."); #ifdef DEBUG printf("debugging mode\n"); #endif /* * Set the default width and height. * I am not real happy with this method, but it will usually do something * reasonable, if not the "right" thing. It is not a real big issue since * it is easy to change the values with resources or command line options. * NOTE: if you are in a 100 dpi display you will lose. */ default_width = DEFAULT_WIDTH; default_height = DisplayHeight(XtDisplay(initial_widget), DefaultScreen(XtDisplay(initial_widget))); default_height *= 3; default_height /= 4; if ((sections = Man()) == 0) PrintError ("There are no manual sections to display, check your MANPATH."); if (resources.top_box_active) MakeTopBox(); else (void) CreateManpage(NULL); /* * We need to keep track of the number of manual pages that are shown on * the screen so that if this user does not have a top box then when they * remove all their manual pages we can kill off the xman process. * To make things easier we will consider the top box a shown manual page * here, but since you cannot remove it, man_page_shown only goes to zero when * no top box is present. */ man_pages_shown = 1; XtAppMainLoop(app_con); return EXIT_SUCCESS; } /* Function Name: ArgError * Description: Prints error message about unknown arguments. * Arguments: argc, argv - args not understood. * Returns: none. */ static void ArgError(int argc, char **argv) { int i; static const char **syntax, *syntax_def[] = { "-help", "Print this message", "-helpfile ", "Specifies the helpfile to use.", "-bothshown", "Show both the directory and manpage at once.", "-notopbox", "Starts with manpage rather than topbox.", "-geometry ", "Specifies the geometry of the top box.", "=", "Specifies the geometry of the top box.", "-pagesize ", "Specifies the geometry of the manual page.", "-bw ", "Width of all window borders.", "-borderwidth ", "Width of all window borders.", "-bd ", "Color of all window borders.", "-bordercolor ", "Color of all window borders.", "-fg ", "Foreground color for the application.", "-foreground ", "Foreground color for the application.", "-bg ", "Background color for the application.", "-background ", "Background color for the application.", "-display ", "Specify a display that is not the default", "-fn ", "Font to be used for button and label text.", "-font ", "Font to be used for button and label text.", "-name ", "Change the name used for retrieving resources.", "-title ", "Change the name without affecting resources.", "-xrm ", "Specifies a resource on the command line.", NULL, NULL, }; syntax = syntax_def; for (i = 1; i < argc; i++) (void) printf("This argument is unknown to Xman: %s\n", argv[i]); (void) printf("\nKnown arguments are:\n"); while (*syntax != NULL) { printf("%-30s - %s\n", syntax[0], syntax[1]); syntax += 2; } } /* Function Name: AdjustDefResources * Description: Changes default resources which contain paths when * XWINHOME is set * Arguments: none * Returns: nothing */ static void AdjustDefResources(void) { char *xwinhome = NULL; int i; if (!(xwinhome = getenv("XWINHOME"))) return; for (i = 0; i < sizeof(my_resources) / sizeof(XtResource); i++) { if (!strcmp(my_resources[i].resource_name, "helpFile")) { char filename[PATH_MAX]; snprintf(filename, sizeof(filename), "%s/lib/X11/xman.help", xwinhome); if (!(my_resources[i].default_addr = strdup(filename))) { fprintf(stderr, "malloc failure\n"); exit(EXIT_FAILURE); } } } } x11-apps-7.7+5+nmu1ubuntu1/xman/missing0000755000000000000000000001533012656634710014545 0ustar #! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xman/configure.ac0000664000000000000000000001244312656635743015447 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xman], [1.1.4], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xman]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS AC_CANONICAL_HOST AC_CHECK_PROG([GROFF], [groff], [found], [missing]) if test "x$GROFF" = "xfound" ; then AC_DEFINE([HAS_GROFF], 1, [Define to 1 if you have the groff package.]) fi AC_CHECK_FUNCS([mkstemp]) AC_ARG_WITH(helpdir, AS_HELP_STRING([--with-helpdir=], [Set default directory for xman.help (default: ${datadir}/X11)]), [HELPDIR="$withval"], [HELPDIR=${datadir}/X11]) AC_SUBST([HELPDIR]) AC_ARG_WITH(sysmanpath, AS_HELP_STRING([--with-sysmanpath=], [Set default system man page search path]), [SYSMANPATH="$withval"], []) if test x$SYSMANPATH != x; then AC_DEFINE_UNQUOTED(SYSMANPATH, "$SYSMANPATH", [Default system man page search path (default: none)]) fi AC_ARG_WITH(localmanpath, AS_HELP_STRING([--with-localmanpath=], [Set default local man page search path]), [LOCALMANPATH="$withval"], []) if test x$LOCALMANPATH != x; then AC_DEFINE_UNQUOTED(LOCALMANPATH, "$LOCALMANPATH", [Default local man page search path (default: none)]) fi # Obtain compiler/linker options from depedencies PKG_CHECK_MODULES(XMAN, [xproto >= 7.0.17 xaw7 xt]) AC_ARG_WITH(manconfig, AS_HELP_STRING([--with-manconfig=], [Set default system man configuration file]), [MANCONF="$withval"], []) if test x$MANCONF = x; then # Check for man page config files AC_CHECK_FILE([/etc/man.conf], [MANCONF="/etc/man.conf"], AC_CHECK_FILE([/etc/man.config], [MANCONF="/etc/man.config"], AC_CHECK_FILE([/etc/manpath.config], [MANCONF="/etc/manpath.config"], AC_CHECK_FILE([/usr/share/misc/man.conf], [MANCONF="/usr/share/misc/man.conf"])))) fi if test x$MANCONF != x ; then AC_DEFINE_UNQUOTED(MANCONF, "$MANCONF", [Define to path to man config file if you have one]) # Try to determine format of config file # would be better to somehow determine from the files themselves, but # we'll guess based on pathname and OS for now (mirrors old Imake tests) AC_MSG_CHECKING([man config file format]) if test x$MANCONF = x/etc/manpath.config ; then MAN_CONFIG_STYLE="FreeBSD" else case $host_os in *darwin* | *openbsd* | *netbsd* ) MAN_CONFIG_STYLE="OpenBSD" ;; *linux* | cygwin* ) MAN_CONFIG_STYLE="Linux" ;; *bsd* ) MAN_CONFIG_STYLE="BSD" ;; *) ;; esac fi AC_MSG_RESULT($MAN_CONFIG_STYLE) case $MAN_CONFIG_STYLE in FreeBSD) AC_DEFINE([MANCONFIGSTYLE_FreeBSD],1, [Define to 1 if you have FreeBSD format manpath.config]) ;; OpenBSD) AC_DEFINE([MANCONFIGSTYLE_OpenBSD],1, [Define to 1 if you have OpenBSD format manpath.config]) ;; BSD) AC_DEFINE([MANCONFIGSTYLE_BSD],1, [Define to 1 if you have BSD format manpath.config]) ;; Linux) AC_DEFINE([MANCONFIGSTYLE_Linux],1, [Define to 1 if you have Linux format man.conf or man.config]) ;; *) AC_MSG_ERROR([Could not determine man page file config format.]) esac fi PKG_CHECK_MODULES(APPDEFS, xt) xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` AC_ARG_WITH(appdefaultdir, AS_HELP_STRING([--with-appdefaultdir=], [specify directory for app-defaults files (default is autodetected)]), [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) if test "x$RELEASE_VERSION" != "x"; then AC_DEFINE_UNQUOTED([RELEASE_VERSION], "$RELEASE_VERSION", [Release version string if set]) fi AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xman/README0000664000000000000000000000130112476465600014021 0ustar xman is a graphical manual page browser using the Athena Widgets (Xaw) toolkit. All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xman http://cgit.freedesktop.org/xorg/app/xman For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xman/COPYING0000664000000000000000000000241212476465600014200 0ustar Copyright (c) 1987, 1988, 1989, 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. x11-apps-7.7+5+nmu1ubuntu1/xman/INSTALL0000664000000000000000000003660012476465617014214 0ustar Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/x11perf/0000775000000000000000000000000012656635743013500 5ustar x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_lines.c0000664000000000000000000001742312514116510015422 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "x11perf.h" static XPoint *points; static GC pgc; static void GenerateLines(XParms xp, Parms p, Bool ddashed) { int size; int half; /* Half of width if wide line */ int i; int rows; /* Number of rows filled in current column */ int x, y; /* Next point */ int xdir, ydir; /* Which direction x, y are going */ int bigxdir; int x1 = 0, y1 = 0; /* offsets to compute next point from current */ int phase; /* how far into 0..4*(size_1) we are */ float phasef; /* how far we are in real numbers */ float phaseinc; /* how much to increment phasef at each segment */ int size4; /* 4 * size */ if(ddashed) pgc = xp->ddfggc; else pgc = xp->fggc; size = p->special; size4 = 4 * (size+1); half = (size + 19) / 20; points = (XPoint *)malloc((p->objects+1) * sizeof(XPoint)); /* All this x, x1, x1inc, etc. stuff is to create a pattern that (1) scans down the screen vertically (2) rotates the endpoints through all possible orientations (3) bounces off bottom and top of window as needed (4) moves left or right at each bounce to make things less boring */ x = half; y = half; xdir = 1; ydir = 1; bigxdir = 1; phasef = 0.0; phaseinc = ((float)size4) / ((float)p->objects); if (phaseinc < 1.0) phaseinc = 1.0; rows = 0; points[0].x = x; points[0].y = y; for (i = 1; i != (p->objects+1); i++) { phase = phasef; switch (phase / (size+1)) { case 0: x1 = size; y1 = phase; break; case 1: x1 = size - phase % (size+1); y1 = size; break; case 2: x1 = phase % (size+1); y1 = size; break; case 3: x1 = size; y1 = size - phase % (size+1); break; } /* end switch */ /* Move down or up the screen */ y += (ydir * y1); /* If off either top or bottom, backtrack to previous position and go the other way instead. Also move in bigxdir if not already. */ rows++; if (y < half || y >= (HEIGHT-half) || rows > MAXROWS) { rows = 0; if (bigxdir > 0) { if (x + size < WIDTH - half) { xdir = 1; } else { bigxdir = -1; } } else { if (x - size > half) { xdir = -1; } else { bigxdir = 1; } } ydir = -ydir; y += (2 * ydir * y1); /* If still off top or bottom, we can't do the line we want. This will happen infrequently if the window is not twice the length of the line. So instead, let's draw a line that puts the line after this approximately through the center of the window. Since it is very unlikely that both x and y will need such adjustment, line length (in pixels) should not change...we just can't get the slope we want for this line. */ if (y < half) { y = (HEIGHT - y1)/2; ydir = 1; } else if (y > (HEIGHT - half)) { y = (HEIGHT + y1)/2; ydir = -1; } } /* Move x left or right by x1 */ x += (xdir * x1); xdir = -xdir; /* Again, if we are off the bottom then we can't really draw the line we want. */ if (x < half) { x = (WIDTH - x1)/2; xdir = 1; } else if (x > (WIDTH - half)) { x = (WIDTH + x1)/2; xdir = -1; } points[i].x = x; points[i].y = y; /* Increment phasef */ phasef += phaseinc; if (phasef >= size4) phasef -= size4; } } int InitLines(XParms xp, Parms p, int64_t reps) { GenerateLines(xp, p, False); return reps; } static int GenerateWideLines(XParms xp, Parms p, int64_t reps, Bool ddashed) { int size; GenerateLines(xp, p, ddashed); size = p->special; if(ddashed) { XSetLineAttributes(xp->d, xp->ddbggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); XSetLineAttributes(xp->d, xp->ddfggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); } else { XSetLineAttributes(xp->d, xp->bggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); XSetLineAttributes(xp->d, xp->fggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); } return reps; } int InitWideLines(XParms xp, Parms p, int64_t reps) { return GenerateWideLines(xp, p, reps, False); } int InitDashedLines(XParms xp, Parms p, int64_t reps) { char dashes[2]; GenerateLines(xp, p, False); /* Modify GCs to draw dashed */ XSetLineAttributes(xp->d, xp->bggc, 0, LineOnOffDash, CapButt, JoinMiter); XSetLineAttributes(xp->d, xp->fggc, 0, LineOnOffDash, CapButt, JoinMiter); dashes[0] = 3; dashes[1] = 2; XSetDashes(xp->d, xp->fggc, 0, dashes, 2); XSetDashes(xp->d, xp->bggc, 0, dashes, 2); return reps; } int InitWideDashedLines(XParms xp, Parms p, int64_t reps) { int size; XGCValues gcv; char dashes[2]; (void)GenerateWideLines(xp, p, reps, False); size = p->special; size = (size + 9) / 10; /* Modify GCs to draw dashed */ dashes[0] = 2*size; dashes[1] = 2*size; gcv.line_style = LineOnOffDash; XChangeGC(xp->d, xp->fggc, GCLineStyle, &gcv); XChangeGC(xp->d, xp->bggc, GCLineStyle, &gcv); XSetDashes(xp->d, xp->fggc, 0, dashes, 2); XSetDashes(xp->d, xp->bggc, 0, dashes, 2); return reps; } int InitDoubleDashedLines(XParms xp, Parms p, int64_t reps) { char dashes[2]; GenerateLines(xp, p, True); /* Modify GCs to draw dashed */ XSetLineAttributes(xp->d, xp->ddbggc, 0, LineDoubleDash, CapButt, JoinMiter); XSetLineAttributes(xp->d, xp->ddfggc, 0, LineDoubleDash, CapButt, JoinMiter); dashes[0] = 3; dashes[1] = 2; XSetDashes(xp->d, xp->ddfggc, 0, dashes, 2); XSetDashes(xp->d, xp->ddbggc, 0, dashes, 2); return reps; } int InitWideDoubleDashedLines(XParms xp, Parms p, int64_t reps) { int size; XGCValues gcv; char dashes[2]; (void)GenerateWideLines(xp, p, reps, True); size = p->special; size = (size + 9) / 10; /* Modify GCs to draw dashed */ dashes[0] = 2*size; dashes[1] = 2*size; gcv.line_style = LineDoubleDash; XChangeGC(xp->d, xp->ddfggc, GCLineStyle, &gcv); XChangeGC(xp->d, xp->ddbggc, GCLineStyle, &gcv); XSetDashes(xp->d, xp->ddfggc, 0, dashes, 2); XSetDashes(xp->d, xp->ddbggc, 0, dashes, 2); return reps; } void DoLines(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != reps; i++) { XDrawLines(xp->d, xp->w, pgc, points, p->objects+1, CoordModeOrigin); if (pgc == xp->ddbggc) pgc = xp->ddfggc; else if(pgc == xp->ddfggc) pgc = xp->ddbggc; else if (pgc == xp->bggc) pgc = xp->fggc; else pgc = xp->bggc; CheckAbort (); } } void EndLines(XParms xp, Parms p) { free(points); } x11-apps-7.7+5+nmu1ubuntu1/x11perf/x11perf.h0000664000000000000000000004143712514116510015123 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #if HAVE_CONFIG_H #include "config.h" #endif #ifndef VMS #include #include #include #else #include #include #endif #if defined(XlibSpecificationRelease) && XlibSpecificationRelease >= 5 #include #endif #include #include #define POLY 1000 /* # (small) items in poly calls */ #define MAXROWS 40 /* Max rows of items in poly calls */ #define MAXCOLS 25 /* Max columns of items */ #define WIDTH 600 /* Size of large window to work within */ #define HEIGHT 600 #define CHILDSIZE 8 /* Size of children on windowing tests */ #define CHILDSPACE 4 /* Space between children */ #define BigTile ((char *)2) /* Big tile/stipple */ #define OddTile ((char *)1) /* Odd sized tile/stipple */ #define PictStandardNative 5 typedef unsigned char Version; #define VERSION1_2 ((Version)(1 << 0)) #define VERSION1_3 ((Version)(1 << 1)) #define VERSION1_4 ((Version)(1 << 2)) #define VERSION1_5 ((Version)(1 << 3)) #define VERSION1_6 ((Version)(1 << 4)) #define V1_2ONLY VERSION1_2 #define V1_2FEATURE (VERSION1_2 | VERSION1_3 | VERSION1_4 | VERSION1_5 | VERSION1_6) #define V1_3FEATURE (VERSION1_3 | VERSION1_4 | VERSION1_5 | VERSION1_6) #define V1_4FEATURE (VERSION1_4 | VERSION1_5 | VERSION1_6) #define V1_5FEATURE (VERSION1_5 | VERSION1_6) #define V1_6FEATURE (VERSION1_6) typedef struct _Parms { /* Required fields */ int objects; /* Number of objects to process in one X call */ /* Optional fields. (Wouldn't object-oriented programming be nice ?) */ int special; /* Usually size of objects to paint */ const char *font, *bfont; int fillStyle; /* Solid, transparent stipple, opaque stipple, tile */ } ParmRec, *Parms; typedef struct _XParms { Display *d; Window w; Pixmap p; GC fggc; GC bggc; GC ddfggc; GC ddbggc; Picture w_picture; Picture p_picture; unsigned long foreground; unsigned long background; unsigned long ddbackground; XVisualInfo vinfo; Bool pack; Version version; Bool save_under; int backing_store; unsigned long planemask; int func; int format; Colormap cmap; } XParmRec, *XParms; typedef int (*InitProc)(XParms xp, Parms p, int64_t reps); typedef void (*Proc)(XParms xp, Parms p, int64_t reps); typedef void (*CleanupProc)(XParms xp, Parms p); typedef enum { WINDOW, /* Windowing test, rop, planemask have no affect */ ROP, /* Graphics test, rop, planemask has some affect */ PLANEMASK, /* Graphics test, rop no affect, planemask some affect */ NONROP, /* Graphics or overhead test, rop has no affect */ COMP /* Graphics test, render op */ } TestType; typedef struct _Test { const char *option; /* Name to use in prompt line */ const char *label; /* Fuller description of test */ const char *label14; /* Labels that are different in Version 1.4 */ InitProc init; /* Initialization procedure */ Proc proc; /* Timed benchmark procedure */ CleanupProc passCleanup;/* Cleanup between repetitions of same test */ CleanupProc cleanup; /* Cleanup after test */ Version versions; /* Test in 1.2 only, 1.3 only, or both */ TestType testType; /* Windowing, graphics rop, graphics non-rop */ int clips; /* Number of obscuring windows to force clipping*/ ParmRec parms; /* Parameters passed to test procedures */ } Test; extern void NullProc(XParms xp, Parms p); extern int NullInitProc(XParms xp, Parms p, int64_t reps); extern Test test[]; extern int abortTest; extern void AbortTest (void) _X_NORETURN; #define CheckAbort() if (abortTest) AbortTest () #define ForEachTest(x) for (x = 0; test[x].option != NULL; x++) /* do_arcs.c */ extern int InitCircles ( XParms xp, Parms p, int64_t reps ); extern int InitPartCircles ( XParms xp, Parms p, int64_t reps ); extern int InitChordPartCircles ( XParms xp, Parms p, int64_t reps ); extern int InitSlicePartCircles ( XParms xp, Parms p, int64_t reps ); extern int InitWideCircles ( XParms xp, Parms p, int64_t reps ); extern int InitPartWideCircles ( XParms xp, Parms p, int64_t reps ); extern int InitDashedCircles ( XParms xp, Parms p, int64_t reps ); extern int InitWideDashedCircles ( XParms xp, Parms p, int64_t reps ); extern int InitDoubleDashedCircles ( XParms xp, Parms p, int64_t reps ); extern int InitWideDoubleDashedCircles ( XParms xp, Parms p, int64_t reps ); extern int InitEllipses ( XParms xp, Parms p, int64_t reps ); extern int InitPartEllipses ( XParms xp, Parms p, int64_t reps ); extern int InitChordPartEllipses ( XParms xp, Parms p, int64_t reps ); extern int InitSlicePartEllipses ( XParms xp, Parms p, int64_t reps ); extern int InitWideEllipses ( XParms xp, Parms p, int64_t reps ); extern int InitPartWideEllipses ( XParms xp, Parms p, int64_t reps ); extern int InitDashedEllipses ( XParms xp, Parms p, int64_t reps ); extern int InitWideDashedEllipses ( XParms xp, Parms p, int64_t reps ); extern int InitDoubleDashedEllipses ( XParms xp, Parms p, int64_t reps ); extern int InitWideDoubleDashedEllipses ( XParms xp, Parms p, int64_t reps ); extern void DoArcs ( XParms xp, Parms p, int64_t reps ); extern void DoFilledArcs ( XParms xp, Parms p, int64_t reps ); extern void EndArcs ( XParms xp, Parms p ); /* do_blt.c */ extern int InitScroll ( XParms xp, Parms p, int64_t reps ); extern void DoScroll ( XParms xp, Parms p, int64_t reps ); extern void MidScroll ( XParms xp, Parms p ); extern void EndScroll ( XParms xp, Parms p ); extern int InitCopyWin ( XParms xp, Parms p, int64_t reps ); extern int InitCopyPix ( XParms xp, Parms p, int64_t reps ); extern int InitGetImage ( XParms xp, Parms p, int64_t reps ); extern int InitPutImage ( XParms xp, Parms p, int64_t reps ); extern void DoCopyWinWin ( XParms xp, Parms p, int64_t reps ); extern void DoCopyPixWin ( XParms xp, Parms p, int64_t reps ); extern void DoCopyWinPix ( XParms xp, Parms p, int64_t reps ); extern void DoCopyPixPix ( XParms xp, Parms p, int64_t reps ); extern void DoGetImage ( XParms xp, Parms p, int64_t reps ); extern void DoPutImage ( XParms xp, Parms p, int64_t reps ); #ifdef MITSHM extern int InitShmPutImage ( XParms xp, Parms p, int64_t reps ); extern int InitShmGetImage ( XParms xp, Parms p, int64_t reps ); extern void DoShmPutImage ( XParms xp, Parms p, int64_t reps ); extern void DoShmGetImage ( XParms xp, Parms p, int64_t reps ); extern void EndShmPutImage ( XParms xp, Parms p ); extern void EndShmGetImage ( XParms xp, Parms p ); #endif extern void MidCopyPix ( XParms xp, Parms p ); extern void EndCopyWin ( XParms xp, Parms p ); extern void EndCopyPix ( XParms xp, Parms p ); extern void EndGetImage ( XParms xp, Parms p ); extern int InitCopyPlane ( XParms xp, Parms p, int64_t reps ); extern void DoCopyPlane ( XParms xp, Parms p, int64_t reps ); int InitCompositeWin(XParms xp, Parms p, int64_t reps); void EndCompositeWin (XParms xp, Parms p); void DoCompositeWinWin (XParms xp, Parms p, int64_t reps); int InitCompositePix(XParms xp, Parms p, int64_t reps); void EndCompositePix (XParms xp, Parms p); void DoCompositePixWin (XParms xp, Parms p, int64_t reps); /* do_complex.c */ extern int InitComplexPoly ( XParms xp, Parms p, int64_t reps ); extern void DoComplexPoly ( XParms xp, Parms p, int64_t reps ); extern void EndComplexPoly ( XParms xp, Parms p ); extern int InitGeneralPoly ( XParms xp, Parms p, int64_t reps ); extern void DoGeneralPoly ( XParms xp, Parms p, int64_t reps ); /* do_dots.c */ extern int InitDots ( XParms xp, Parms p, int64_t reps ); extern void DoDots ( XParms xp, Parms p, int64_t reps ); extern void EndDots ( XParms xp, Parms p ); /* do_lines.c */ extern int InitLines ( XParms xp, Parms p, int64_t reps ); extern int InitWideLines ( XParms xp, Parms p, int64_t reps ); extern int InitDashedLines ( XParms xp, Parms p, int64_t reps ); extern int InitWideDashedLines ( XParms xp, Parms p, int64_t reps ); extern int InitDoubleDashedLines ( XParms xp, Parms p, int64_t reps ); extern int InitWideDoubleDashedLines ( XParms xp, Parms p, int64_t reps ); extern void DoLines ( XParms xp, Parms p, int64_t reps ); extern void EndLines ( XParms xp, Parms p ); /* do_movewin.c */ extern int InitMoveWindows ( XParms xp, Parms p, int64_t reps ); extern void DoMoveWindows ( XParms xp, Parms p, int64_t reps ); extern void EndMoveWindows ( XParms xp, Parms p ); extern void DoResizeWindows ( XParms xp, Parms p, int64_t reps ); extern int InitCircWindows ( XParms xp, Parms p, int64_t reps ); extern void DoCircWindows ( XParms xp, Parms p, int64_t reps ); extern void EndCircWindows ( XParms xp, Parms p ); extern int InitMoveTree ( XParms xp, Parms p, int64_t reps ); extern void DoMoveTree ( XParms xp, Parms p, int64_t reps ); extern void EndMoveTree ( XParms xp, Parms p ); /* do_rects.c */ extern int InitRectangles ( XParms xp, Parms p, int64_t reps ); extern void DoRectangles ( XParms xp, Parms p, int64_t reps ); extern void DoOutlineRectangles ( XParms xp, Parms p, int64_t reps ); extern void EndRectangles ( XParms xp, Parms p ); /* do_segs.c */ extern int InitSegments ( XParms xp, Parms p, int64_t reps ); extern int InitDashedSegments ( XParms xp, Parms p, int64_t reps ); extern int InitDoubleDashedSegments ( XParms xp, Parms p, int64_t reps ); extern int InitHorizSegments ( XParms xp, Parms p, int64_t reps ); extern int InitWideHorizSegments ( XParms xp, Parms p, int64_t reps ); extern int InitVertSegments ( XParms xp, Parms p, int64_t reps ); extern int InitWideVertSegments ( XParms xp, Parms p, int64_t reps ); extern void DoSegments ( XParms xp, Parms p, int64_t reps ); extern void EndSegments ( XParms xp, Parms p ); /* do_simple.c */ extern void DoNoOp ( XParms xp, Parms p, int64_t reps ); extern void DoGetAtom ( XParms xp, Parms p, int64_t reps ); extern void DoQueryPointer ( XParms xp, Parms p, int64_t reps ); extern int InitGetProperty ( XParms xp, Parms p, int64_t reps ); extern void DoGetProperty ( XParms xp, Parms p, int64_t reps ); /* do_text.c */ extern int InitText ( XParms xp, Parms p, int64_t reps ); extern int InitText16 ( XParms xp, Parms p, int64_t reps ); extern void DoText ( XParms xp, Parms p, int64_t reps ); extern void DoText16 ( XParms xp, Parms p, int64_t reps ); extern void DoPolyText ( XParms xp, Parms p, int64_t reps ); extern void DoPolyText16 ( XParms xp, Parms p, int64_t reps ); extern void DoImageText ( XParms xp, Parms p, int64_t reps ); extern void DoImageText16 ( XParms xp, Parms p, int64_t reps ); extern void ClearTextWin ( XParms xp, Parms p ); extern void EndText ( XParms xp, Parms p ); extern void EndText16 ( XParms xp, Parms p ); #ifdef XFT extern int InitAAText (XParms xp, Parms p, int64_t reps ); extern void DoAAText (XParms xp, Parms p, int64_t reps ); extern void EndAAText ( XParms xp, Parms p ); #endif /* do_traps.c */ extern int InitTrapezoids ( XParms xp, Parms p, int64_t reps ); extern void DoTrapezoids ( XParms xp, Parms p, int64_t reps ); extern void EndTrapezoids ( XParms xp, Parms p ); #if defined(XRENDER) && defined(XFT) extern int InitFixedTraps ( XParms xp, Parms p, int64_t reps ); extern void DoFixedTraps ( XParms xp, Parms p, int64_t reps ); extern void EndFixedTraps ( XParms xp, Parms p ); extern int InitFixedTrapezoids ( XParms xp, Parms p, int64_t reps ); extern void DoFixedTrapezoids ( XParms xp, Parms p, int64_t reps ); extern void EndFixedTrapezoids ( XParms xp, Parms p ); #endif /* do_tris.c */ extern int InitTriangles ( XParms xp, Parms p, int64_t reps ); extern void DoTriangles ( XParms xp, Parms p, int64_t reps ); extern void EndTriangles ( XParms xp, Parms p ); /* do_valgc.c */ extern int InitGC ( XParms xp, Parms p, int64_t reps ); extern void DoChangeGC ( XParms xp, Parms p, int64_t reps ); extern void EndGC ( XParms xp, Parms p ); /* do_windows.c */ extern int CreateParents ( XParms xp, Parms p, int64_t reps ); extern void MapParents ( XParms xp, Parms p, int64_t reps ); extern void MapParentsCleanup ( XParms xp, Parms p ); extern int InitCreate ( XParms xp, Parms p, int64_t reps ); extern void CreateChildren ( XParms xp, Parms p, int64_t reps ); extern void DestroyChildren ( XParms xp, Parms p ); extern void EndCreate ( XParms xp, Parms p ); extern int InitMap ( XParms xp, Parms p, int64_t reps ); extern void UnmapParents ( XParms xp, Parms p, int64_t reps ); extern void UnmapParentsCleanup ( XParms xp, Parms p); extern int InitDestroy ( XParms xp, Parms p, int64_t reps ); extern void DestroyParents ( XParms xp, Parms p, int64_t reps ); extern void RenewParents ( XParms xp, Parms p ); extern int InitPopups ( XParms xp, Parms p, int64_t reps ); extern void DoPopUps ( XParms xp, Parms p, int64_t reps ); extern void EndPopups ( XParms xp, Parms p ); /***************************************************************************** About x11perf: Many graphics benchmarks assume that the graphics device is used to display the output of a single fancy graphics application, and that the user gets his work done on some other device, like a terminal. Such benchmarks usually measure drawing speed for lines, polygons, text, etc. Since workstations are not used as standalone graphics engines, but as super-terminals, x11perf measures window management performance as well as traditional graphics performace. x11perf includes benchmarks for the time it takes to create and map windows (as when you start up an application); to map a pre-existing set of windows onto the screen (as when you deiconify an application or pop up a menu); and to rearrange windows (as when you slosh windows to and fro trying to find the one you want). x11perf also measures graphics performance for operations not normally used in standalone graphics displays, but are nonetheless used frequently by X applications. Such operations include CopyPlane (used by the PostScript previewer), scrolling (used in text windows), and various stipples and tiles (used for CAD and half-toning, respectively). x11perf DOES NOT attempt to whittle down measurements to a single ``HeXStones'' number. We consider such numbers to be uninformative at best and misleading at worst. x11perf should be used to analyze particular strengths and weaknesses of servers, and is most useful when used by a server writer who wants to analyze and improve a server. For repeatable results, x11perf should be run using a local connection on a freshly-started server. The default configuration runs each test 5 times, in order to see if each trial takes approximately the same amount of time. Strange glitches should be examined; if non-repeatable I chalk them up to daemons and network traffic. Each trial is run for 5 seconds, in order to reduce random time differences. The number of objects processed per second is displayed to 3 significant digits, but you'll be lucky on most UNIX system if the numbers are actually consistent to 2 digits. The current program is mostly the responsibility of Joel McCormack. It is based upon the x11perf developed by Phil Karlton, Susan Angebranndt, and Chris Kent, who wanted to assess performance differences between various servers. Mary Walker, Todd Newman, and I added several tests in order to write and tune the pmax (DECStation 3100) servers. For a general release to the world, I've basically rewritten x11perf to ease making comparisons between widely varying machines, to cover most important X functionality (the notable exception being wide lines), and to exercise graphics operations in as many different orientations and alignments as possible. ******************************************************************************/ x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_dots.c0000664000000000000000000000352612514116510015260 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "x11perf.h" static XPoint *points; static GC pgc; int InitDots(XParms xp, Parms p, int64_t reps) { int i; pgc = xp->fggc; points = (XPoint *)malloc(p->objects * sizeof(XPoint)); for (i = 0; i != p->objects; i++) { points[i].x = 2 * (i/MAXROWS); points[i].y = 2 * (i%MAXROWS); } return reps; } void DoDots(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != reps; i++) { XDrawPoints(xp->d, xp->w, pgc, points, p->objects, CoordModeOrigin); if (pgc == xp->bggc) pgc = xp->fggc; else pgc = xp->bggc; CheckAbort (); } } void EndDots(XParms xp, Parms p) { free(points); } x11-apps-7.7+5+nmu1ubuntu1/x11perf/bitmaps.h0000664000000000000000000000237412514116510015271 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ /* Set fill style (if any) to a bitmap or tile */ extern void SetFillStyle(XParms xp, Parms p); x11-apps-7.7+5+nmu1ubuntu1/x11perf/compile0000755000000000000000000001624512656634617015063 0ustar #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_tests.c0000664000000000000000000015736312514116510015462 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "x11perf.h" /* * some test must be done a certain multiple of times. That multiple is * in the second half of the products below. You can edit the multiplier, * just not the multiplicand. */ Test test[] = { {"-dot", "Dot", NULL, InitDots, DoDots, NullProc, EndDots, V1_2FEATURE, ROP, 0, {POLY}}, {"-rect1", "1x1 rectangle", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {POLY, 1, NULL, NULL, FillSolid}}, {"-rect10", "10x10 rectangle", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {POLY, 10, NULL, NULL, FillSolid}}, {"-rect100", "100x100 rectangle", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {36, 100, NULL, NULL, FillSolid}}, {"-rect500", "500x500 rectangle", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {1, 500, NULL, NULL, FillSolid}}, {"-srect1", "1x1 stippled rectangle", "1x1 stippled rectangle (8x8 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {POLY, 1, NULL, NULL, FillStippled}}, {"-srect10", "10x10 stippled rectangle", "10x10 stippled rectangle (8x8 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {POLY, 10, NULL, NULL, FillStippled}}, {"-srect100", "100x100 stippled rectangle", "100x100 stippled rectangle (8x8 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {36, 100, NULL, NULL, FillStippled}}, {"-srect500", "500x500 stippled rectangle", "500x500 stippled rectangle (8x8 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {1, 500, NULL, NULL, FillStippled}}, {"-osrect1", "1x1 opaque stippled rectangle", "1x1 opaque stippled rectangle (8x8 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {POLY, 1, NULL, NULL, FillOpaqueStippled}}, {"-osrect10", "10x10 opaque stippled rectangle", "10x10 opaque stippled rectangle (8x8 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {POLY, 10, NULL, NULL, FillOpaqueStippled}}, {"-osrect100", "100x100 opaque stippled rectangle", "100x100 opaque stippled rectangle (8x8 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {36, 100, NULL, NULL, FillOpaqueStippled}}, {"-osrect500", "500x500 opaque stippled rectangle", "500x500 opaque stippled rectangle (8x8 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {1, 500, NULL, NULL, FillOpaqueStippled}}, {"-tilerect1", "1x1 4x4 tiled rectangle", "1x1 tiled rectangle (4x4 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {POLY, 1, NULL, NULL, FillTiled}}, {"-tilerect10", "10x10 4x4 tiled rectangle", "10x10 tiled rectangle (4x4 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {POLY, 10, NULL, NULL, FillTiled}}, {"-tilerect100", "100x100 4x4 tiled rectangle", "100x100 tiled rectangle (4x4 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {36, 100, NULL, NULL, FillTiled}}, {"-tilerect500", "500x500 4x4 tiled rectangle", "500x500 tiled rectangle (4x4 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {1, 500, NULL, NULL, FillTiled}}, {"-oddsrect1", "1x1 stippled rectangle (17x15 stipple)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, {POLY, 1, "OddTile", NULL, FillStippled}}, {"-oddsrect10", "10x10 stippled rectangle (17x15 stipple)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, {POLY, 10, "OddTile", NULL, FillStippled}}, {"-oddsrect100", "100x100 stippled rectangle (17x15 stipple)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, {36, 100, "OddTile", NULL, FillStippled}}, {"-oddsrect500", "500x500 stippled rectangle (17x15 stipple)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, {1, 500, "OddTile", NULL, FillStippled}}, {"-oddosrect1", "1x1 opaque stippled rectangle (17x15 stipple)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, {POLY, 1, "OddTile", NULL, FillOpaqueStippled}}, {"-oddosrect10", "10x10 opaque stippled rectangle (17x15 stipple)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, {POLY, 10, "OddTile", NULL, FillOpaqueStippled}}, {"-oddosrect100", "100x100 opaque stippled rectangle (17x15 stipple)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, {36, 100, "OddTile", NULL, FillOpaqueStippled}}, {"-oddosrect500", "500x500 opaque stippled rectangle (17x15 stipple)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, {1, 500, "OddTile", NULL, FillOpaqueStippled}}, {"-oddtilerect1", "1x1 tiled rectangle (17x15 tile)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, {POLY, 1, "OddTile", NULL, FillTiled}}, {"-oddtilerect10", "10x10 tiled rectangle (17x15 tile)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, {POLY, 10, "OddTile", NULL, FillTiled}}, {"-oddtilerect100", "100x100 tiled rectangle (17x15 tile)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, {36, 100, "OddTile", NULL, FillTiled}}, {"-oddtilerect500", "500x500 tiled rectangle (17x15 tile)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, {1, 500, "OddTile", NULL, FillTiled}}, {"-bigsrect1", "1x1 161x145 stippled rectangle", "1x1 stippled rectangle (161x145 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {POLY, 1, "mensetmanus", NULL, FillStippled}}, {"-bigsrect10", "10x10 161x145 stippled rectangle", "10x10 stippled rectangle (161x145 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {POLY, 10, "mensetmanus", NULL, FillStippled}}, {"-bigsrect100", "100x100 161x145 stippled rectangle", "100x100 stippled rectangle (161x145 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {36, 100, "mensetmanus", NULL, FillStippled}}, {"-bigsrect500", "500x500 161x145 stippled rectangle", "500x500 stippled rectangle (161x145 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {1, 500, "mensetmanus", NULL, FillStippled}}, {"-bigosrect1", "1x1 161x145 opaque stippled rectangle", "1x1 opaque stippled rectangle (161x145 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {POLY, 1, "mensetmanus", NULL, FillOpaqueStippled}}, {"-bigosrect10", "10x10 161x145 opaque stippled rectangle", "10x10 opaque stippled rectangle (161x145 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {POLY, 10, "mensetmanus", NULL, FillOpaqueStippled}}, {"-bigosrect100", "100x100 161x145 opaque stippled rectangle", "100x100 opaque stippled rectangle (161x145 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {36, 100, "mensetmanus", NULL, FillOpaqueStippled}}, {"-bigosrect500", "500x500 161x145 opaque stippled rectangle", "500x500 opaque stippled rectangle (161x145 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {1, 500, "mensetmanus", NULL, FillOpaqueStippled}}, {"-bigtilerect1", "1x1 161x145 tiled rectangle", "1x1 tiled rectangle (161x145 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {POLY, 1, "mensetmanus", NULL, FillTiled}}, {"-bigtilerect10", "10x10 161x145 tiled rectangle", "10x10 tiled rectangle (161x145 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {POLY, 10, "mensetmanus", NULL, FillTiled}}, {"-bigtilerect100", "100x100 161x145 tiled rectangle", "100x100 tiled rectangle (161x145 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {36, 100, "mensetmanus", NULL, FillTiled}}, {"-bigtilerect500", "500x500 161x145 tiled rectangle", "500x500 tiled rectangle (161x145 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, {1, 500, "mensetmanus", NULL, FillTiled}}, {"-eschertilerect1", "1x1 216x208 tiled rectangle", "1x1 tiled rectangle (216x208 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {POLY, 1, "escherknot", NULL, FillTiled}}, {"-eschertilerect10", "10x10 216x208 tiled rectangle", "10x10 tiled rectangle (216x208 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {POLY, 10, "escherknot", NULL, FillTiled}}, {"-eschertilerect100", "100x100 216x208 tiled rectangle", "100x100 tiled rectangle (216x208 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {36, 100, "escherknot", NULL, FillTiled}}, {"-eschertilerect500", "500x500 216x208 tiled rectangle", "500x500 tiled rectangle (216x208 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {1, 500, "escherknot", NULL, FillTiled}}, {"-seg1", "1-pixel line segment", NULL, InitSegments, DoSegments, NullProc, EndSegments, V1_2FEATURE, ROP, 0, {POLY, 1}}, {"-seg10", "10-pixel line segment", NULL, InitSegments, DoSegments, NullProc, EndSegments, V1_2FEATURE, ROP, 0, {POLY, 10}}, {"-seg100", "100-pixel line segment", NULL, InitSegments, DoSegments, NullProc, EndSegments, V1_2FEATURE, ROP, 0, {POLY, 100}}, {"-seg500", "500-pixel line segment", NULL, InitSegments, DoSegments, NullProc, EndSegments, V1_2FEATURE, ROP, 0, {POLY, 500}}, {"-seg100c1", "100-pixel line segment (1 kid)", NULL, InitSegments, DoSegments, NullProc, EndSegments, V1_2FEATURE, ROP, 1, {POLY, 100}}, {"-seg100c2", "100-pixel line segment (2 kids)", NULL, InitSegments, DoSegments, NullProc, EndSegments, V1_2FEATURE, ROP, 2, {POLY, 100}}, {"-seg100c3", "100-pixel line segment (3 kids)", NULL, InitSegments, DoSegments, NullProc, EndSegments, V1_2FEATURE, ROP, 3, {POLY, 100}}, {"-dseg10", "10-pixel dashed segment", NULL, InitDashedSegments, DoSegments, NullProc, EndSegments, V1_2FEATURE, ROP, 0, {POLY, 10}}, {"-dseg100", "100-pixel dashed segment", NULL, InitDashedSegments, DoSegments, NullProc, EndSegments, V1_2FEATURE, ROP, 0, {POLY, 100}}, {"-ddseg100", "100-pixel double-dashed segment", NULL, InitDoubleDashedSegments, DoSegments, NullProc, EndSegments, V1_2FEATURE, ROP, 0, {POLY, 100}}, {"-hseg10", "10-pixel horizontal line segment", NULL, InitHorizSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, {POLY, 10}}, {"-hseg100", "100-pixel horizontal line segment", NULL, InitHorizSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, {POLY, 100}}, {"-hseg500", "500-pixel horizontal line segment", NULL, InitHorizSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, {POLY, 500}}, {"-vseg10", "10-pixel vertical line segment", NULL, InitVertSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, {POLY, 10}}, {"-vseg100", "100-pixel vertical line segment", NULL, InitVertSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, {POLY, 100}}, {"-vseg500", "500-pixel vertical line segment", NULL, InitVertSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, {POLY, 500}}, {"-whseg10", "10x1 wide horizontal line segment", NULL, InitWideHorizSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, {200, 10}}, {"-whseg100", "100x10 wide horizontal line segment", NULL, InitWideHorizSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, {100, 100}}, {"-whseg500", "500x50 wide horizontal line segment", NULL, InitWideHorizSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, {50, 500}}, {"-wvseg10", "10x1 wide vertical line segment", NULL, InitWideVertSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, {200, 10}}, {"-wvseg100", "100x10 wide vertical line segment", NULL, InitWideVertSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, {100, 100}}, {"-wvseg500", "500x50 wide vertical line segment", NULL, InitWideVertSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, {50, 500}}, {"-line1", "1-pixel line", NULL, InitLines, DoLines, NullProc, EndLines, V1_2FEATURE, ROP, 0, {POLY, 1}}, {"-line10", "10-pixel line", NULL, InitLines, DoLines, NullProc, EndLines, V1_2FEATURE, ROP, 0, {POLY, 10}}, {"-line100", "100-pixel line", NULL, InitLines, DoLines, NullProc, EndLines, V1_2FEATURE, ROP, 0, {POLY, 100}}, {"-line500", "500-pixel line", NULL, InitLines, DoLines, NullProc, EndLines, V1_2FEATURE, ROP, 0, {POLY, 500}}, {"-dline10", "10-pixel dashed line", NULL, InitDashedLines, DoLines, NullProc, EndLines, V1_2FEATURE, ROP, 0, {POLY, 10}}, {"-dline100", "100-pixel dashed line", NULL, InitDashedLines, DoLines, NullProc, EndLines, V1_2FEATURE, ROP, 0, {POLY, 100}}, {"-ddline100", "100-pixel double-dashed line", NULL, InitDoubleDashedLines, DoLines, NullProc, EndLines, V1_2FEATURE, ROP, 0, {POLY, 100}}, {"-wline10", "10x1 wide line", NULL, InitWideLines, DoLines, NullProc, EndLines, V1_2FEATURE, ROP, 0, {100, 10}}, {"-wline100", "100x10 wide line", NULL, InitWideLines, DoLines, NullProc, EndLines, V1_2FEATURE, ROP, 0, {100, 100}}, {"-wline500", "500x50 wide line", NULL, InitWideLines, DoLines, NullProc, EndLines, V1_2FEATURE, ROP, 0, {50, 500}}, {"-wdline100", "100x10 wide dashed line", NULL, InitWideDashedLines, DoLines, NullProc, EndLines, V1_2FEATURE, ROP, 0, {100, 100}}, {"-wddline100", "100x10 wide double-dashed line", NULL, InitWideDoubleDashedLines, DoLines, NullProc, EndLines, V1_2FEATURE, ROP, 0, {100, 100}}, {"-orect10", "10x10 rectangle outline", NULL, InitRectangles, DoOutlineRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {POLY, 10, NULL, "0", FillSolid}}, {"-orect100", "100x100 rectangle outline", NULL, InitRectangles, DoOutlineRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {36, 100, NULL, "0", FillSolid}}, {"-orect500", "500x500 rectangle outline", NULL, InitRectangles, DoOutlineRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {1, 500, NULL, "0", FillSolid}}, {"-worect10", "10x10 wide rectangle outline", NULL, InitRectangles, DoOutlineRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {POLY, 10, NULL, "1", FillSolid}}, {"-worect100", "100x100 wide rectangle outline", NULL, InitRectangles, DoOutlineRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {36, 100, NULL, "10", FillSolid}}, {"-worect500", "500x500 wide rectangle outline", NULL, InitRectangles, DoOutlineRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, {1, 500, NULL, "50", FillSolid}}, {"-circle1", "1-pixel circle", NULL, InitCircles, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {POLY, 1}}, {"-circle10", "10-pixel circle", NULL, InitCircles, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {POLY, 10}}, {"-circle100", "100-pixel circle", NULL, InitCircles, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {200, 100}}, {"-circle500", "500-pixel circle", NULL, InitCircles, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {50, 500}}, {"-dcircle100", "100-pixel dashed circle", NULL, InitDashedCircles, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {100, 100}}, {"-ddcircle100", "100-pixel double-dashed circle", NULL, InitDoubleDashedCircles, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {100, 100}}, {"-wcircle10", "10-pixel wide circle", NULL, InitWideCircles, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {POLY, 10}}, {"-wcircle100", "100-pixel wide circle", NULL, InitWideCircles, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {100, 100}}, {"-wcircle500", "500-pixel wide circle", NULL, InitWideCircles, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {25, 500}}, {"-wdcircle100", "100-pixel wide dashed circle", NULL, InitWideDashedCircles, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {100, 100}}, {"-wddcircle100", "100-pixel wide double-dashed circle", NULL, InitWideDoubleDashedCircles, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {100, 100}}, {"-pcircle10", "10-pixel partial circle", NULL, InitPartCircles, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {POLY, 10}}, {"-pcircle100", "100-pixel partial circle", NULL, InitPartCircles, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {198, 100}}, {"-wpcircle10", "10-pixel wide partial circle", NULL, InitPartWideCircles, DoArcs, NullProc, EndArcs, V1_3FEATURE, ROP, 0, {POLY, 10}}, {"-wpcircle100", "100-pixel wide partial circle", NULL, InitPartWideCircles, DoArcs, NullProc, EndArcs, V1_3FEATURE, ROP, 0, {198, 100}}, {"-fcircle1", "1-pixel solid circle", NULL, InitCircles, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {POLY, 1}}, {"-fcircle10", "10-pixel solid circle", NULL, InitCircles, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {POLY, 10}}, {"-fcircle100", "100-pixel solid circle", NULL, InitCircles, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {100, 100}}, {"-fcircle500", "500-pixel solid circle", NULL, InitCircles, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {20, 500}}, {"-fcpcircle10", "10-pixel fill chord partial circle", NULL, InitChordPartCircles, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {POLY, 10}}, {"-fcpcircle100", "100-pixel fill chord partial circle", NULL, InitChordPartCircles, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {108, 100}}, {"-fspcircle10", "10-pixel fill slice partial circle", NULL, InitSlicePartCircles, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {POLY, 10}}, {"-fspcircle100", "100-pixel fill slice partial circle", NULL, InitSlicePartCircles, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {108, 100}}, {"-ellipse10", "10-pixel ellipse", NULL, InitEllipses, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {500, 10}}, {"-ellipse100", "100-pixel ellipse", NULL, InitEllipses, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {300, 100}}, {"-ellipse500", "500-pixel ellipse", NULL, InitEllipses, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {100, 500}}, {"-dellipse100", "100-pixel dashed ellipse", NULL, InitDashedEllipses, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {25, 100}}, {"-ddellipse100", "100-pixel double-dashed ellipse", NULL, InitDoubleDashedEllipses, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {25, 100}}, {"-wellipse10", "10-pixel wide ellipse", NULL, InitWideEllipses, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {200, 10}}, {"-wellipse100", "100-pixel wide ellipse", NULL, InitWideEllipses, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {25, 100}}, {"-wellipse500", "500-pixel wide ellipse", NULL, InitWideEllipses, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {20, 500}}, {"-wdellipse100", "100-pixel wide dashed ellipse", NULL, InitWideDashedEllipses, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {25, 100}}, {"-wddellipse100", "100-pixel wide double-dashed ellipse", NULL, InitWideDoubleDashedEllipses, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {25, 100}}, {"-pellipse10", "10-pixel partial ellipse", NULL, InitPartEllipses, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {540, 10}}, {"-pellipse100", "100-pixel partial ellipse", NULL, InitPartEllipses, DoArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {360, 100}}, {"-wpellipse10", "10-pixel wide partial ellipse", NULL, InitPartWideEllipses, DoArcs, NullProc, EndArcs, V1_3FEATURE, ROP, 0, {540, 10}}, {"-wpellipse100", "100-pixel wide partial ellipse", NULL, InitPartWideEllipses, DoArcs, NullProc, EndArcs, V1_3FEATURE, ROP, 0, {360, 100}}, {"-fellipse10", "10-pixel filled ellipse", NULL, InitEllipses, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {200, 10}}, {"-fellipse100", "100-pixel filled ellipse", NULL, InitEllipses, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {25, 100}}, {"-fellipse500", "500-pixel filled ellipse", NULL, InitEllipses, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {10, 500}}, {"-fcpellipse10", "10-pixel fill chord partial ellipse", NULL, InitChordPartEllipses, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {270, 10}}, {"-fcpellipse100", "100-pixel fill chord partial ellipse", NULL, InitChordPartEllipses, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {36, 100}}, {"-fspellipse10", "10-pixel fill slice partial ellipse", NULL, InitSlicePartEllipses, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {270, 10}}, {"-fspellipse100", "100-pixel fill slice partial ellipse", NULL, InitSlicePartEllipses, DoFilledArcs, NullProc, EndArcs, V1_2FEATURE, ROP, 0, {36, 100}}, {"-triangle1", "Fill 1-pixel/side triangle", NULL, InitTriangles, DoTriangles, NullProc, EndTriangles, V1_2ONLY, ROP, 0, {POLY, 1}}, {"-triangle10", "Fill 10-pixel/side triangle", NULL, InitTriangles, DoTriangles, NullProc, EndTriangles, V1_2ONLY, ROP, 0, {POLY, 10}}, {"-triangle100", "Fill 100-pixel/side triangle", NULL, InitTriangles, DoTriangles, NullProc, EndTriangles, V1_2ONLY, ROP, 0, {100, 100}}, {"-triangle1", "Fill 1x1 equivalent triangle", NULL, InitTriangles, DoTriangles, NullProc, EndTriangles, V1_3FEATURE, ROP, 0, {POLY, 1}}, {"-triangle10", "Fill 10x10 equivalent triangle", NULL, InitTriangles, DoTriangles, NullProc, EndTriangles, V1_3FEATURE, ROP, 0, {POLY, 10}}, {"-triangle100", "Fill 100x100 equivalent triangle", NULL, InitTriangles, DoTriangles, NullProc, EndTriangles, V1_3FEATURE, ROP, 0, {100, 100}}, {"-trap1", "Fill 1x1 trapezoid", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {POLY, 1}}, {"-trap10", "Fill 10x10 trapezoid", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_2FEATURE, ROP, 0, {POLY, 10}}, {"-trap100", "Fill 100x100 trapezoid", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_2FEATURE, ROP, 0, {POLY/10, 100}}, {"-trap300", "Fill 300x300 trapezoid", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {2, 300}}, {"-strap1", "Fill 1x1 stippled trapezoid (8x8 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {POLY, 1, NULL, NULL, FillStippled}}, {"-strap10", "Fill 10x10 stippled trapezoid", "Fill 10x10 stippled trapezoid (8x8 stipple)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_2FEATURE, ROP, 0, {POLY, 10, NULL, NULL, FillStippled}}, {"-strap100", "Fill 100x100 stippled trapezoid", "Fill 100x100 stippled trapezoid (8x8 stipple)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_2FEATURE, ROP, 0, {100, 100, NULL, NULL, FillStippled}}, {"-strap300", "Fill 300x300 stippled trapezoid (8x8 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {2, 300, NULL, NULL, FillStippled}}, {"-ostrap1", "Fill 1x1 opaque stippled trapezoid (8x8 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {POLY, 1, NULL, NULL, FillOpaqueStippled}}, {"-ostrap10", "Fill 10x10 opaque stippled trapezoid", "Fill 10x10 opaque stippled trapezoid (8x8 stipple)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_2FEATURE, ROP, 0, {POLY, 10, NULL, NULL, FillOpaqueStippled}}, {"-ostrap100", "Fill 100x100 opaque stippled trapezoid", "Fill 100x100 opaque stippled trapezoid (8x8 stipple)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_2FEATURE, ROP, 0, {100, 100, NULL, NULL, FillOpaqueStippled}}, {"-ostrap300", "Fill 300x300 opaque stippled trapezoid (8x8 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {2, 300, NULL, NULL, FillOpaqueStippled}}, {"-tiletrap1", "Fill 1x1 tiled trapezoid (4x4 tile)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {POLY, 1, NULL, NULL, FillTiled}}, {"-tiletrap10", "Fill 10x10 tiled trapezoid", "Fill 10x10 tiled trapezoid (4x4 tile)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_2FEATURE, ROP, 0, {POLY, 10, NULL, NULL, FillTiled}}, {"-tiletrap100", "Fill 100x100 tiled trapezoid", "Fill 100x100 tiled trapezoid (4x4 tile)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_2FEATURE, ROP, 0, {100, 100, NULL, NULL, FillTiled}}, {"-tiletrap300", "Fill 300x300 tiled trapezoid (4x4 tile)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {2, 300, NULL, NULL, FillTiled}}, {"-oddstrap1", "Fill 1x1 stippled trapezoid (17x15 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {POLY, 1, "OddTile", NULL, FillStippled}}, {"-oddstrap10", "Fill 10x10 stippled trapezoid (17x15 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {POLY, 10, "OddTile", NULL, FillStippled}}, {"-oddstrap100", "Fill 100x100 stippled trapezoid (17x15 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {100, 100, "OddTile", NULL, FillStippled}}, {"-oddstrap300", "Fill 300x300 stippled trapezoid (17x15 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {2, 300, "OddTile", NULL, FillStippled}}, {"-oddostrap1", "Fill 1x1 opaque stippled trapezoid (17x15 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {POLY, 1, "OddTile", NULL, FillOpaqueStippled}}, {"-oddostrap10", "Fill 10x10 opaque stippled trapezoid (17x15 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {POLY, 10, "OddTile", NULL, FillOpaqueStippled}}, {"-oddostrap100", "Fill 100x100 opaque stippled trapezoid (17x15 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {100, 100, "OddTile", NULL, FillOpaqueStippled}}, {"-oddostrap300", "Fill 300x300 opaque stippled trapezoid (17x15 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {2, 300, "OddTile", NULL, FillOpaqueStippled}}, {"-oddtiletrap1", "Fill 1x1 tiled trapezoid (17x15 tile)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {POLY, 1, "OddTile", NULL, FillTiled}}, {"-oddtiletrap10", "Fill 10x10 tiled trapezoid (17x15 tile)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {POLY, 10, "OddTile", NULL, FillTiled}}, {"-oddtiletrap100", "Fill 100x100 tiled trapezoid (17x15 tile)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {100, 100, "OddTile", NULL, FillTiled}}, {"-oddtiletrap300", "Fill 300x300 tiled trapezoid (17x15 tile)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {2, 300, "OddTile", NULL, FillTiled}}, {"-bigstrap1", "Fill 1x1 stippled trapezoid (161x145 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {POLY, 1, "mensetmanus", NULL, FillStippled}}, {"-bigstrap10", "Fill 10x10 161x145 stippled trapezoid", "Fill 10x10 stippled trapezoid (161x145 stipple)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_3FEATURE, ROP, 0, {POLY, 10, "mensetmanus", NULL, FillStippled}}, {"-bigstrap100", "Fill 100x100 161x145 stippled trapezoid", "Fill 100x100 stippled trapezoid (161x145 stipple)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_3FEATURE, ROP, 0, {100, 100, "mensetmanus", NULL, FillStippled}}, {"-bigstrap300", "Fill 300x300 stippled trapezoid (161x145 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {2, 300, "mensetmanus", NULL, FillStippled}}, {"-bigostrap1", "Fill 1x1 opaque stippled trapezoid (161x145 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {POLY, 1, "mensetmanus", NULL, FillOpaqueStippled}}, {"-bigostrap10", "Fill 10x10 161x145 opaque stippled trapezoid", "Fill 10x10 opaque stippled trapezoid (161x145 stipple)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_3FEATURE, ROP, 0, {POLY, 10, "mensetmanus", NULL, FillOpaqueStippled}}, {"-bigostrap100", "Fill 100x100 161x145 opaque stippled trapezoid", "Fill 100x100 opaque stippled trapezoid (161x145 stipple)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_3FEATURE, ROP, 0, {100, 100, "mensetmanus", NULL, FillOpaqueStippled}}, {"-bigostrap300", "Fill 300x300 opaque stippled trapezoid (161x145 stipple)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {2, 300, "mensetmanus", NULL, FillOpaqueStippled}}, {"-bigtiletrap1", "Fill 1x1 tiled trapezoid (161x145 tile)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {POLY, 1, "mensetmanus", NULL, FillTiled}}, {"-bigtiletrap10", "Fill 10x10 161x145 tiled trapezoid", "Fill 10x10 tiled trapezoid (161x145 tile)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_3FEATURE, ROP, 0, {POLY, 10, "mensetmanus", NULL, FillTiled}}, {"-bigtiletrap100", "Fill 100x100 161x145 tiled trapezoid", "Fill 100x100 tiled trapezoid (161x145 tile)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_3FEATURE, ROP, 0, {100, 100, "mensetmanus", NULL, FillTiled}}, {"-bigtiletrap300", "Fill 300x300 tiled trapezoid (161x145 tile)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {2, 300, "mensetmanus", NULL, FillTiled}}, {"-eschertiletrap1", "Fill 1x1 tiled trapezoid (216x208 tile)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {POLY, 1, "escherknot", NULL, FillTiled}}, {"-eschertiletrap10", "Fill 10x10 216x208 tiled trapezoid", "Fill 10x10 tiled trapezoid (216x208 tile)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_3FEATURE, ROP, 0, {POLY, 10, "escherknot", NULL, FillTiled}}, {"-eschertiletrap100", "Fill 100x100 216x208 tiled trapezoid", "Fill 100x100 tiled trapezoid (216x208 tile)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_3FEATURE, ROP, 0, {36, 100, "escherknot", NULL, FillTiled}}, {"-eschertiletrap300", "Fill 300x300 tiled trapezoid (216x208 tile)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, {2, 300, "escherknot", NULL, FillTiled}}, #if defined(XRENDER) && defined(XFT) {"-aatrap1", "Fill 1x1 aa trap", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 1 }}, {"-aatrap10", "Fill 10x10 aa trap", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 10 }}, {"-aatrap100", "Fill 100x100 aa trap", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 100 }}, {"-aatrap300", "Fill 300x300 aa trap", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 300 }}, {"-aa4trap1", "Fill 1x1 aa trap with 4 bit alpha", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 1, "4" }}, {"-aa4trap10", "Fill 10x10 aa trap with 4 bit alpha", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 10, "4" }}, {"-aa4trap100", "Fill 100x100 aa trap with 4 bit alpha", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 100, "4" }}, {"-aa4trap300", "Fill 300x300 aa trap with 4 bit alpha", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 300, "4" }}, {"-aa1trap1", "Fill 1x1 aa trap with 1 bit alpha", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 1, "1" }}, {"-aa1trap10", "Fill 10x10 aa trap with 1 bit alpha", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 10, "1" }}, {"-aa1trap100", "Fill 100x100 aa trap with 1 bit alpha", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 100, "1" }}, {"-aa1trap300", "Fill 300x300 aa trap with 1 bit alpha", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 300, "1" }}, {"-aatrap2x1", "Fill 2x1 aa trap", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 1, "8,2" }}, {"-aatrap2x10", "Fill 2x10 aa trap", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 10, "8,2" }}, {"-aatrap2x100", "Fill 2x100 aa trap", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 100, "8,2" }}, {"-aatrap2x300", "Fill 2x300 aa trap", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, {POLY, 300, "8,2" }}, {"-aatrapezoid1", "Fill 1x1 aa trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 1 }}, {"-aatrapezoid10", "Fill 10x10 aa trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 10 }}, {"-aatrapezoid100", "Fill 100x100 aa trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 100 }}, {"-aatrapezoid300", "Fill 300x300 aa trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 300 }}, {"-addaatrapezoid1", "Fill 1x1 aa pre-added trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 1, "add" }}, {"-addaatrapezoid10", "Fill 10x10 aa pre-added trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 10, "add" }}, {"-addaatrapezoid100", "Fill 100x100 aa pre-added trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 100, "add" }}, {"-addaatrapezoid300", "Fill 300x300 aa pre-added trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 300, "add" }}, #endif {"-complex10", "Fill 10-pixel/side complex polygon", NULL, InitComplexPoly, DoComplexPoly, NullProc, EndComplexPoly, V1_2ONLY, ROP, 0, {POLY, 10}}, {"-complex100", "Fill 100-pixel/side complex polygons", NULL, InitComplexPoly, DoComplexPoly, NullProc, EndComplexPoly, V1_2ONLY, ROP, 0, {POLY/10, 100}}, {"-complex10", "Fill 10x10 equivalent complex polygon", NULL, InitComplexPoly, DoComplexPoly, NullProc, EndComplexPoly, V1_3FEATURE, ROP, 0, {POLY, 10}}, {"-complex100", "Fill 100x100 equivalent complex polygons", NULL, InitComplexPoly, DoComplexPoly, NullProc, EndComplexPoly, V1_3FEATURE, ROP, 0, {POLY/10, 100}}, {"-64poly10convex", "Fill 10x10 64-gon (Convex)", NULL, InitGeneralPoly, DoGeneralPoly, NullProc, EndComplexPoly, V1_4FEATURE, ROP, 0, {POLY, 10, (char *) 64, (char *) Convex}}, {"-64poly100convex", "Fill 100x100 64-gon (Convex)", NULL, InitGeneralPoly, DoGeneralPoly, NullProc, EndComplexPoly, V1_4FEATURE, ROP, 0, {POLY/10, 100, (char *) 64, (char *) Convex}}, {"-64poly10complex", "Fill 10x10 64-gon (Complex)", NULL, InitGeneralPoly, DoGeneralPoly, NullProc, EndComplexPoly, V1_4FEATURE, ROP, 0, {POLY, 10, (char *) 64, (char *) Complex}}, {"-64poly100complex", "Fill 100x100 64-gon (Complex)", NULL, InitGeneralPoly, DoGeneralPoly, NullProc, EndComplexPoly, V1_4FEATURE, ROP, 0, {POLY/10, 100, (char *) 64, (char *) Complex}}, {"-ftext", "Char in 80-char line (6x13)", NULL, InitText, DoText, ClearTextWin, EndText, V1_2FEATURE, ROP, 0, {80, False, "6x13", NULL}}, {"-f8text", "Char in 70-char line (8x13)", NULL, InitText, DoText, ClearTextWin, EndText, V1_3FEATURE, ROP, 0, {70, False, "8x13", NULL}}, {"-f9text", "Char in 60-char line (9x15)", NULL, InitText, DoText, ClearTextWin, EndText, V1_3FEATURE, ROP, 0, {60, False, "9x15", NULL}}, {"-f14text16", "Char16 in 40-char line (k14)", NULL, InitText16, DoText16, ClearTextWin, EndText16, V1_3FEATURE, ROP, 0, {40, False, "-misc-fixed-medium-r-normal--14-130-75-75-c-140-jisx0208.1983-*", NULL}}, {"-f24text16", "Char16 in 23-char line (k24)", NULL, InitText16, DoText16, ClearTextWin, EndText16, V1_3FEATURE, ROP, 0, {23, False, "-jis-fixed-medium-r-normal--24-230-75-75-c-240-jisx0208.1983-*", NULL}}, {"-tr10text", "Char in 80-char line (TR 10)", NULL, InitText, DoText, ClearTextWin, EndText, V1_2FEATURE, ROP, 0, {80, False, "-adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1", NULL}}, {"-tr24text", "Char in 30-char line (TR 24)", NULL, InitText, DoText, ClearTextWin, EndText, V1_2FEATURE, ROP, 0, {30, False, "-adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1", NULL}}, {"-polytext", "Char in 20/40/20 line (6x13, TR 10)", NULL, InitText, DoPolyText, ClearTextWin, EndText, V1_2FEATURE, ROP, 0, {80, True, "6x13", "-adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1"}}, {"-polytext16", "Char16 in 7/14/7 line (k14, k24)", NULL, InitText16, DoPolyText16, ClearTextWin, EndText16, V1_3FEATURE, ROP, 0, {28, True, "-misc-fixed-medium-r-normal--14-130-75-75-c-140-jisx0208.1983-*", "-jis-fixed-medium-r-normal--24-230-75-75-c-240-jisx0208.1983-*"}}, {"-fitext", "Char in 80-char image line (6x13)", NULL, InitText, DoImageText, ClearTextWin, EndText, V1_2FEATURE, PLANEMASK, 0, {80, False, "6x13", NULL}}, {"-f8itext", "Char in 70-char image line (8x13)", NULL, InitText, DoImageText, ClearTextWin, EndText, V1_3FEATURE, PLANEMASK, 0, {70, False, "8x13", NULL}}, {"-f9itext", "Char in 60-char image line (9x15)", NULL, InitText, DoImageText, ClearTextWin, EndText, V1_3FEATURE, PLANEMASK, 0, {60, False, "9x15", NULL}}, {"-f14itext16", "Char16 in 40-char image line (k14)", NULL, InitText16, DoImageText16, ClearTextWin, EndText16, V1_3FEATURE, PLANEMASK, 0, {40, False, "-misc-fixed-medium-r-normal--14-130-75-75-c-140-jisx0208.1983-*", NULL}}, {"-f24itext16", "Char16 in 23-char image line (k24)", NULL, InitText16, DoImageText16, ClearTextWin, EndText16, V1_3FEATURE, PLANEMASK, 0, {23, False, "-jis-fixed-medium-r-normal--24-230-75-75-c-240-jisx0208.1983-*", NULL}}, {"-tr10itext", "Char in 80-char image line (TR 10)", NULL, InitText, DoImageText, ClearTextWin, EndText, V1_2FEATURE, PLANEMASK, 0, {80, False, "-adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1", NULL}}, {"-tr24itext", "Char in 30-char image line (TR 24)", NULL, InitText, DoImageText, ClearTextWin, EndText, V1_2FEATURE, PLANEMASK, 0, {30, False, "-adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1", NULL}}, #ifdef XFT {"-aa10text", "Char in 80-char aa line (Charter 10)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {80, 10, "charter:antialias=true:rgba=0:pixelsize=10", NULL}}, {"-aa24text", "Char in 30-char aa line (Charter 24)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {30, 24, "charter:antialias=true:rgba=0:pixelsize=24", NULL}}, {"-aaftext", "Char in 80-char aa line (Courier 12)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {80, 12, "courier:antialias=true:rgba=0:pixelsize=12", NULL}}, {"-a10text", "Char in 80-char a line (Charter 10)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {80, 10, "charter:antialias=false:rgba=0:pixelsize=10", NULL}}, {"-a24text", "Char in 30-char a line (Charter 24)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {30, 24, "charter:antialias=false:rgba=0:pixelsize=24", NULL}}, {"-aftext", "Char in 80-char a line (Courier 12)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {80, 12, "courier:antialias=false:rgba=0:pixelsize=12", NULL}}, {"-rgb10text", "Char in 80-char rgb line (Charter 10)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {80, 10, "charter:antialias=true:rgba=rgb:pixelsize=10", NULL}}, {"-rgb24text", "Char in 30-char rgb line (Charter 24)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {30, 24, "charter:antialias=true:rgba=rgb:pixelsize=24", NULL}}, {"-rgbftext", "Char in 80-char rgb line (Courier 12)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {80, 12, "courier:antialias=true:rgba=rgb:pixelsize=12", NULL}}, {"-caa10text", "Char in 80-char aa core line (Charter 10)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {80, 10, "charter:antialias=true:render=false:rgba=0:pixelsize=10", NULL}}, {"-caa24text", "Char in 30-char aa core line (Charter 24)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {30, 24, "charter:antialias=true:render=false:rgba=0:pixelsize=24", NULL}}, {"-caaftext", "Char in 80-char aa core line (Courier 12)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {80, 12, "courier:antialias=true:render=false:rgba=0:pixelsize=12", NULL}}, {"-ca10text", "Char in 80-char a core line (Charter 10)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {80, 10, "charter:antialias=false:render=false:rgba=0:pixelsize=10", NULL}}, {"-ca24text", "Char in 30-char a core line (Charter 24)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {30, 24, "charter:antialias=false:render=false:rgba=0:pixelsize=24", NULL}}, {"-caftext", "Char in 80-char a core line (Courier 12)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {80, 12, "courier:antialias=false:render=false:rgba=0:pixelsize=12", NULL}}, {"-crgb10text", "Char in 80-char rgb core line (Charter 10)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {80, 10, "charter:antialias=true:render=false:rgba=rgb:pixelsize=10", NULL}}, {"-crgb24text", "Char in 30-char rgb core line (Charter 24)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {30, 24, "charter:antialias=true:render=false:rgba=rgb:pixelsize=24", NULL}}, {"-crgbftext", "Char in 80-char rgb core line (Courier 12)", NULL, InitAAText, DoAAText, ClearTextWin, EndAAText, V1_5FEATURE, NONROP, 0, {80, 12, "courier:antialias=true:render=false:rgba=rgb:pixelsize=12", NULL}}, #endif {"-scroll10", "Scroll 10x10 pixels", NULL, InitScroll, DoScroll, MidScroll, EndScroll, V1_2FEATURE, ROP, 0, {1, 10}}, {"-scroll100", "Scroll 100x100 pixels", NULL, InitScroll, DoScroll, MidScroll, EndScroll, V1_2FEATURE, ROP, 0, {1, 100}}, {"-scroll500", "Scroll 500x500 pixels", NULL, InitScroll, DoScroll, MidScroll, EndScroll, V1_2FEATURE, ROP, 0, {1, 500}}, {"-copywinwin10", "Copy 10x10 from window to window", NULL, InitCopyWin, DoCopyWinWin, MidScroll, EndCopyWin, V1_2FEATURE, ROP, 0, {4, 10}}, {"-copywinwin100", "Copy 100x100 from window to window", NULL, InitCopyWin, DoCopyWinWin, MidScroll, EndCopyWin, V1_2FEATURE, ROP, 0, {4, 100}}, {"-copywinwin500", "Copy 500x500 from window to window", NULL, InitCopyWin, DoCopyWinWin, MidScroll, EndCopyWin, V1_2FEATURE, ROP, 0, {4, 500}}, {"-copypixwin10", "Copy 10x10 from pixmap to window", NULL, InitCopyPix, DoCopyPixWin, MidCopyPix, EndCopyPix, V1_2FEATURE, ROP, 0, {4, 10}}, {"-copypixwin100", "Copy 100x100 from pixmap to window", NULL, InitCopyPix, DoCopyPixWin, MidCopyPix, EndCopyPix, V1_2FEATURE, ROP, 0, {4, 100}}, {"-copypixwin500", "Copy 500x500 from pixmap to window", NULL, InitCopyPix, DoCopyPixWin, MidCopyPix, EndCopyPix, V1_2FEATURE, ROP, 0, {4, 500}}, {"-copywinpix10", "Copy 10x10 from window to pixmap", NULL, InitCopyPix, DoCopyWinPix, MidScroll, EndCopyPix, V1_2FEATURE, ROP, 0, {4, 10}}, {"-copywinpix100", "Copy 100x100 from window to pixmap", NULL, InitCopyPix, DoCopyWinPix, MidScroll, EndCopyPix, V1_2FEATURE, ROP, 0, {4, 100}}, {"-copywinpix500", "Copy 500x500 from window to pixmap", NULL, InitCopyPix, DoCopyWinPix, MidScroll, EndCopyPix, V1_2FEATURE, ROP, 0, {4, 500}}, {"-copypixpix10", "Copy 10x10 from pixmap to pixmap", NULL, InitCopyPix, DoCopyPixPix, NullProc, EndCopyPix, V1_2FEATURE, ROP, 0, {4, 10}}, {"-copypixpix100", "Copy 100x100 from pixmap to pixmap", NULL, InitCopyPix, DoCopyPixPix, NullProc, EndCopyPix, V1_2FEATURE, ROP, 0, {4, 100}}, {"-copypixpix500", "Copy 500x500 from pixmap to pixmap", NULL, InitCopyPix, DoCopyPixPix, NullProc, EndCopyPix, V1_2FEATURE, ROP, 0, {4, 500}}, {"-copyplane10", "Copy 10x10 1-bit deep plane", NULL, InitCopyPlane, DoCopyPlane, MidCopyPix, EndCopyPix, V1_2FEATURE, ROP, 0, {4, 10}}, {"-copyplane100", "Copy 100x100 1-bit deep plane", NULL, InitCopyPlane, DoCopyPlane, MidCopyPix, EndCopyPix, V1_2FEATURE, ROP, 0, {4, 100}}, {"-copyplane500", "Copy 500x500 1-bit deep plane", NULL, InitCopyPlane, DoCopyPlane, MidCopyPix, EndCopyPix, V1_2FEATURE, ROP, 0, {4, 500}}, {"-deepcopyplane10", "Copy 10x10 n-bit deep plane", NULL, InitCopyPlane, DoCopyPlane, MidCopyPix, EndCopyPix, V1_5FEATURE, ROP, 0, {4, 10, "Deep"}}, {"-deepcopyplane100", "Copy 100x100 n-bit deep plane", NULL, InitCopyPlane, DoCopyPlane, MidCopyPix, EndCopyPix, V1_5FEATURE, ROP, 0, {4, 100, "Deep"}}, {"-deepcopyplane500", "Copy 500x500 n-bit deep plane", NULL, InitCopyPlane, DoCopyPlane, MidCopyPix, EndCopyPix, V1_5FEATURE, ROP, 0, {4, 500, "Deep"}}, {"-putimage10", "PutImage 10x10 square", NULL, InitPutImage, DoPutImage, MidCopyPix, EndGetImage, V1_2FEATURE, ROP, 0, {4, 10}}, {"-putimage100", "PutImage 100x100 square", NULL, InitPutImage, DoPutImage, MidCopyPix, EndGetImage, V1_2FEATURE, ROP, 0, {4, 100}}, {"-putimage500", "PutImage 500x500 square", NULL, InitPutImage, DoPutImage, MidCopyPix, EndGetImage, V1_2FEATURE, ROP, 0, {4, 500}}, {"-putimagexy10", "PutImage XY 10x10 square", NULL, InitPutImage, DoPutImage, MidCopyPix, EndGetImage, V1_4FEATURE, ROP, 0, {4, 10, "XY"}}, {"-putimagexy100", "PutImage XY 100x100 square", NULL, InitPutImage, DoPutImage, MidCopyPix, EndGetImage, V1_4FEATURE, ROP, 0, {4, 100, "XY"}}, {"-putimagexy500", "PutImage XY 500x500 square", NULL, InitPutImage, DoPutImage, MidCopyPix, EndGetImage, V1_4FEATURE, ROP, 0, {4, 500, "XY"}}, #ifdef MITSHM {"-shmput10", "ShmPutImage 10x10 square", NULL, InitShmPutImage, DoShmPutImage, MidCopyPix, EndShmPutImage, V1_2FEATURE, ROP, 0, {4, 10}}, {"-shmput100", "ShmPutImage 100x100 square", NULL, InitShmPutImage, DoShmPutImage, MidCopyPix, EndShmPutImage, V1_2FEATURE, ROP, 0, {4, 100}}, {"-shmput500", "ShmPutImage 500x500 square", NULL, InitShmPutImage, DoShmPutImage, MidCopyPix, EndShmPutImage, V1_2FEATURE, ROP, 0, {4, 500}}, {"-shmputxy10", "ShmPutImage XY 10x10 square", NULL, InitShmPutImage, DoShmPutImage, MidCopyPix, EndShmPutImage, V1_4FEATURE, ROP, 0, {4, 10, "XY"}}, {"-shmputxy100", "ShmPutImage XY 100x100 square", NULL, InitShmPutImage, DoShmPutImage, MidCopyPix, EndShmPutImage, V1_4FEATURE, ROP, 0, {4, 100, "XY"}}, {"-shmputxy500", "ShmPutImage XY 500x500 square", NULL, InitShmPutImage, DoShmPutImage, MidCopyPix, EndShmPutImage, V1_4FEATURE, ROP, 0, {4, 500, "XY"}}, {"-shmget10", "ShmGetImage 10x10 square", NULL, InitShmGetImage, DoShmGetImage, NullProc, EndShmGetImage, V1_2FEATURE, ROP, 0, {4, 10}}, {"-shmget100", "ShmGetImage 100x100 square", NULL, InitShmGetImage, DoShmGetImage, NullProc, EndShmGetImage, V1_2FEATURE, ROP, 0, {4, 100}}, {"-shmget500", "ShmGetImage 500x500 square", NULL, InitShmGetImage, DoShmGetImage, NullProc, EndShmGetImage, V1_2FEATURE, ROP, 0, {4, 500}}, {"-shmgetxy10", "ShmGetImage XY 10x10 square", NULL, InitShmGetImage, DoShmGetImage, NullProc, EndShmGetImage, V1_4FEATURE, ROP, 0, {4, 10, "XY"}}, {"-shmgetxy100", "ShmGetImage XY 100x100 square", NULL, InitShmGetImage, DoShmGetImage, NullProc, EndShmGetImage, V1_4FEATURE, ROP, 0, {4, 100, "XY"}}, {"-shmgetxy500", "ShmGetImage XY 500x500 square", NULL, InitShmGetImage, DoShmGetImage, NullProc, EndShmGetImage, V1_4FEATURE, ROP, 0, {4, 500, "XY"}}, #endif {"-getimage10", "GetImage 10x10 square", NULL, InitGetImage, DoGetImage, NullProc, EndGetImage, V1_2FEATURE, PLANEMASK, 0, {4, 10}}, {"-getimage100", "GetImage 100x100 square", NULL, InitGetImage, DoGetImage, NullProc, EndGetImage, V1_2FEATURE, PLANEMASK, 0, {4, 100}}, {"-getimage500", "GetImage 500x500 square", NULL, InitGetImage, DoGetImage, NullProc, EndGetImage, V1_2FEATURE, PLANEMASK, 0, {4, 500}}, {"-getimagexy10", "GetImage XY 10x10 square", NULL, InitGetImage, DoGetImage, NullProc, EndGetImage, V1_4FEATURE, PLANEMASK, 0, {4, 10, "XY"}}, {"-getimagexy100", "GetImage XY 100x100 square", NULL, InitGetImage, DoGetImage, NullProc, EndGetImage, V1_4FEATURE, PLANEMASK, 0, {4, 100, "XY"}}, {"-getimagexy500", "GetImage XY 500x500 square", NULL, InitGetImage, DoGetImage, NullProc, EndGetImage, V1_4FEATURE, PLANEMASK, 0, {4, 500, "XY"}}, {"-compwinwin10", "Composite 10x10 from window to window", NULL, InitCompositeWin, DoCompositeWinWin, MidScroll, EndCompositeWin, VERSION1_6, COMP, 0, {4, 10}}, {"-compwinwin100", "Composite 100x100 from window to window", NULL, InitCompositeWin, DoCompositeWinWin, MidScroll, EndCompositeWin, VERSION1_6, COMP, 0, {4, 100}}, {"-compwinwin500", "Composite 500x500 from window to window", NULL, InitCompositeWin, DoCompositeWinWin, MidScroll, EndCompositeWin, VERSION1_6, COMP, 0, {4, 500}}, {"-comppixwin10", "Composite 10x10 from pixmap to window", NULL, InitCompositePix, DoCompositePixWin, MidScroll, EndCompositeWin, VERSION1_6, COMP, 0, {4, 10}}, {"-comppixwin100", "Composite 100x100 from pixmap to window", NULL, InitCompositePix, DoCompositePixWin, MidScroll, EndCompositeWin, VERSION1_6, COMP, 0, {4, 100}}, {"-comppixwin500", "Composite 500x500 from pixmap to window", NULL, InitCompositePix, DoCompositePixWin, MidScroll, EndCompositeWin, VERSION1_6, COMP, 0, {4, 500}}, {"-magpixwin10", "Scale 5x5 from pixmap to 10x10 window", NULL, InitCompositePix, DoCompositePixWin, MidScroll, EndCompositeWin, VERSION1_6, COMP, 0, {4, 10, NULL, NULL, 0x20000}}, {"-magpixwin100", "Scale 50x50 from pixmap to 100x100 window", NULL, InitCompositePix, DoCompositePixWin, MidScroll, EndCompositeWin, VERSION1_6, COMP, 0, {4, 100, NULL, NULL, 0x20000}}, {"-magpixwin500", "Scale 250x250 from pixmap to 500x500 window", NULL, InitCompositePix, DoCompositePixWin, MidScroll, EndCompositeWin, VERSION1_6, COMP, 0, {4, 500, NULL, NULL, 0x20000}}, {"-minpixwin10", "Scale 10x10 from pixmap to 5x5 window", NULL, InitCompositePix, DoCompositePixWin, MidScroll, EndCompositeWin, VERSION1_6, COMP, 0, {4, 5, NULL, NULL, 0x8000}}, {"-minpixwin100", "Scale 100x100 from pixmap to 5x5 window", NULL, InitCompositePix, DoCompositePixWin, MidScroll, EndCompositeWin, VERSION1_6, COMP, 0, {4, 5, NULL, NULL, 0x8000}}, {"-minpixwin500", "Scale 500x500 from pixmap to 250x250 window", NULL, InitCompositePix, DoCompositePixWin, MidScroll, EndCompositeWin, VERSION1_6, COMP, 0, {4, 250, NULL, NULL, 0x8000}}, {"-noop", "X protocol NoOperation", NULL, NullInitProc, DoNoOp, NullProc, NullProc, V1_2FEATURE, PLANEMASK, 0, {1}}, {"-atom", "GetAtomName", NULL, NullInitProc, DoGetAtom, NullProc, NullProc, VERSION1_2 | VERSION1_3, NONROP, 0, {1}}, {"-pointer", "QueryPointer", NULL, NullInitProc, DoQueryPointer, NullProc, NullProc, V1_4FEATURE, NONROP, 0, {1}}, {"-prop", "GetProperty", NULL, InitGetProperty, DoGetProperty, NullProc, NullProc, V1_2FEATURE, NONROP, 0, {1}}, {"-gc", "Change graphics context", NULL, InitGC, DoChangeGC, NullProc, EndGC, V1_2FEATURE, NONROP, 0, {4}}, {"-create", "Create and map subwindows", NULL, InitCreate, CreateChildren, DestroyChildren, EndCreate, V1_2FEATURE, WINDOW, 0, {0, True}}, {"-ucreate", "Create unmapped window", NULL, InitCreate, CreateChildren, DestroyChildren, EndCreate, V1_2FEATURE, WINDOW, 0, {0, False}}, {"-map", "Map window via parent", NULL, InitMap, MapParents, UnmapParentsCleanup, EndCreate, V1_2FEATURE, WINDOW, 0, {0, True}}, {"-unmap", "Unmap window via parent", NULL, InitDestroy, UnmapParents, MapParentsCleanup, EndCreate, V1_2FEATURE, WINDOW, 0, {0, True}}, {"-destroy", "Destroy window via parent", NULL, InitDestroy, DestroyParents, RenewParents, EndCreate, V1_2FEATURE, WINDOW, 0, {0, True}}, {"-popup", "Hide/expose window via popup", NULL, InitPopups, DoPopUps, NullProc, EndPopups, V1_2FEATURE, WINDOW, 0, {0, True}}, {"-move", "Move window", NULL, InitMoveWindows, DoMoveWindows, NullProc, EndMoveWindows, V1_2FEATURE, WINDOW, 0, {0, True}}, {"-umove", "Moved unmapped window", NULL, InitMoveWindows, DoMoveWindows, NullProc, EndMoveWindows, V1_2FEATURE, WINDOW, 0, {0, False}}, {"-movetree", "Move window via parent", NULL, InitMoveTree, DoMoveTree, NullProc, EndMoveTree, V1_2FEATURE, WINDOW, 0, {4, True}}, {"-resize", "Resize window", NULL, InitMoveWindows, DoResizeWindows, NullProc, EndMoveWindows, V1_2FEATURE, WINDOW, 0, {4, True}}, {"-uresize", "Resize unmapped window", NULL, InitMoveWindows, DoResizeWindows, NullProc, EndMoveWindows, V1_2FEATURE, WINDOW, 0, {4, False}}, {"-circulate", "Circulate window", NULL, InitCircWindows, DoCircWindows, NullProc, EndCircWindows, V1_2FEATURE, WINDOW, 0, {4, True}}, {"-ucirculate", "Circulate Unmapped window", NULL, InitCircWindows, DoCircWindows, NullProc, EndCircWindows, V1_2FEATURE, WINDOW, 0, {4, False}}, { NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NONROP, 0, {0, False}} }; x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_tris.c0000664000000000000000000001346012514116510015266 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #undef POLYTRIANGLE_HACK /* don't use this code */ #ifdef POLYTRIANGLE_HACK #include #endif #include "x11perf.h" #include "bitmaps.h" #include #include #define NUM_POINTS 3 /* 3 points to a triangle */ static XPoint *points; static GC pgc; #ifndef PI #define PI 3.14159265357989 #endif static double Area(XPoint p1, XPoint p2, XPoint p3) { return (p1.x*p2.y - p1.x*p3.y + p2.x*p3.y - p2.x*p1.y + p3.x*p1.y - p3.x*p2.y)/2; } /* static double Distance(XPoint p1, XPoint p2) { return sqrt((float) ((p1.x-p2.x)*(p1.x-p2.x) + (p1.y-p2.y)*(p1.y-p2.y))); } */ int InitTriangles(XParms xp, Parms p, int64_t reps) { int i, j, numPoints; int rows; int x, y; int size, iradius; double phi, phiinc, radius, delta, phi2, area, aarea; XPoint *curPoint; pgc = xp->fggc; size = p->special; phi = 0.0; delta = 2.0 * PI / ((double) NUM_POINTS); if (xp->version == VERSION1_2) { radius = ((double) size) * sqrt(3.0)/2.0; phiinc = delta/10.0; } else { /* Version 1.2's radius computation was completely bogus, and resulted in triangles with sides about 50% longer than advertised. However, this inadvertently resulted in triangles with areas just a little bit smaller than the triangle that covers size^2 pixels, which would make the area directly comparable to 10x10 rectangles and 10x10 trapezoids. So here's the new computation so -triangleN has the same area as -rectN. */ radius = ((double) size) * sqrt(sqrt(16.0/27.0)); phiinc = 1.75*PI / ((double) p->objects); } iradius = (int) (radius + 0.5); numPoints = (p->objects) * NUM_POINTS; points = (XPoint *)malloc(numPoints * sizeof(XPoint)); curPoint = points; x = iradius; y = iradius; rows = 0; aarea = 0.0; for (i = 0; i != p->objects; i++) { for (j = 0; j != NUM_POINTS; j++) { phi2 = phi + ((double) j) * delta; curPoint->x = (int) ((double)x + (radius * cos(phi2)) + 0.5); curPoint->y = (int) ((double)y + (radius * sin(phi2)) + 0.5); curPoint++; } area = Area(curPoint[-1], curPoint[-2], curPoint[-3]); aarea += area; /* printf("%6.1lf %6.1lf %6.1lf %6.1lf\n", Distance(curPoint[-1], curPoint[-2]), Distance(curPoint[-1], curPoint[-3]), Distance(curPoint[-2], curPoint[-3]), area); */ phi += phiinc; y += 2 * iradius; rows++; if (y + iradius > HEIGHT || rows == MAXROWS) { rows = 0; y = iradius; x += 2 * iradius; if (x + iradius > WIDTH) { x = iradius; } } } /* printf("Average area = %6.2lf\n", aarea/p->objects); */ SetFillStyle(xp, p); return reps; } #ifndef POLYTRIANGLE_HACK void DoTriangles(XParms xp, Parms p, int64_t reps) { int i, j; XPoint *curPoint; for (i = 0; i != reps; i++) { curPoint = points; for (j = 0; j != p->objects; j++) { XFillPolygon(xp->d, xp->w, pgc, curPoint, NUM_POINTS, Convex, CoordModeOrigin); curPoint += NUM_POINTS; } if (pgc == xp->bggc) pgc = xp->fggc; else pgc = xp->bggc; CheckAbort (); } } #else static xReq _dummy_request = { 0, 0, 0 }; static void XPolyTriangle(register Display *dpy, Drawable d, GC gc, XPoint *points, int n_triangles, int shape, int mode) { register xFillPolyReq *req; register long nbytes; int max_triangles; int n_this_time; int *buf, *pts; int gcid; int last; max_triangles = (dpy->bufmax - dpy->buffer) / 28; LockDisplay(dpy); FlushGC(dpy, gc); dpy->request += n_triangles; pts = (int *) points; gcid = gc->gid; last = shape | (mode << 8); while (n_triangles) { if ((n_this_time = max_triangles) > n_triangles) n_this_time = n_triangles; n_triangles -= n_this_time; GetReqExtra(FillPoly, (SIZEOF(xFillPolyReq) + 12) * n_this_time - SIZEOF(xFillPolyReq), req); --dpy->request; buf = req; while (n_this_time--) { buf[0] = X_FillPoly | (7 << 16); buf[1] = d; buf[2] = gcid; buf[3] = last; buf[4] = pts[0]; buf[5] = pts[1]; buf[6] = pts[2]; buf += 7; pts += 3; } } dpy->last_req = &_dummy_request; UnlockDisplay(dpy); SyncHandle(); } void DoTriangles(XParms xp, Parms p, int64_t reps) { int i, j; XPoint *curPoint; for (i = 0; i != reps; i++) { XPolyTriangle (xp->d, xp->w, pgc, points, p->objects, Convex, CoordModeOrigin); if (pgc == xp->bggc) pgc = xp->fggc; else pgc = xp->bggc; CheckAbort (); } } #endif void EndTriangles(XParms xp, Parms p) { free(points); } x11-apps-7.7+5+nmu1ubuntu1/x11perf/ChangeLog0000664000000000000000000007031712514116540015240 0ustar commit 294ea038fe9cefd690f06f6b5f48507c266b4d24 Author: Alan Coopersmith Date: Thu Apr 16 22:42:25 2015 -0700 x11perf 1.6.0 Signed-off-by: Alan Coopersmith commit bb2c3601b2bc1f4adcd21c79501fc514ae1688f3 Author: Matthieu Herrb Date: Sat Jan 10 10:46:46 2015 +0100 remove srand(1) call as nothing calls any rand like functions in x11perf Signed-off-by: Matthieu Herrb Reviewed-by: Thomas Klausner commit 2b5c1ff8926b82675c8db1f44de4c910dd9265a4 Author: Alan Coopersmith Date: Sat Oct 25 14:10:02 2014 -0700 Combine help_message array into a single string Signed-off-by: Alan Coopersmith commit 2179b566688838439d6388e1468af404e06d7350 Author: Alan Coopersmith Date: Sat Oct 25 13:57:43 2014 -0700 Mark bitmap data as const Signed-off-by: Alan Coopersmith commit ebaf6141a9932f934c87fce0c6f91c5ca25d1f3c Author: Peter Harris Date: Wed Mar 26 13:45:59 2014 -0400 Fix name collision in -rgb*text Prepend a c to the test names of the "core" versions, to match the -aa*text and -caa*text tests. Signed-off-by: Peter Harris commit cb8d37dc33f2044636a04b0f81ebb4023daa93a6 Author: Alan Coopersmith Date: Mon Jun 2 22:08:51 2014 -0700 autogen.sh: Honor NOCONFIGURE=1 See http://people.gnome.org/~walters/docs/build-api.txt Signed-off-by: Alan Coopersmith commit 6333588e55df50cea89171352dcf15db969af69d Author: Alan Coopersmith Date: Mon Jun 2 22:08:51 2014 -0700 configure: Drop AM_MAINTAINER_MODE Signed-off-by: Alan Coopersmith commit 1999b37e12fc358aa21f8dac2d11edff43377fc0 Author: Keith Packard Date: Mon Mar 10 09:12:45 2014 -0700 Add '-pause' option to delay between runs This lets the package cool down to get more consistent performance numbers. Signed-off-by: Keith Packard commit f640487e27a3904831ff85033a2869e981e9d942 Author: Keith Packard Date: Wed Mar 5 19:11:25 2014 -0800 Switch to 64-bit ints commit 9ba0ce7d849bbd94644664b60b50bd1e2d5813b7 Author: Keith Packard Date: Sat Mar 29 13:48:02 2008 -0700 Add scaling composite tests commit 21c0d1903161a88d09c64811cf97dda3a8a8e751 Author: Keith Packard Date: Sat Mar 29 13:47:40 2008 -0700 Fix reported pixmap format name commit 734c164464a3b5d9d9dd2dc3993de85b1f63c2ff Author: Keith Packard Date: Sat Mar 29 11:45:29 2008 -0700 Add up/down scaling composite tests commit ccd5cd064817595cfd0e04a926b73fb17fe31092 Author: Alan Coopersmith Date: Sat Feb 23 10:09:59 2013 -0800 Assume signal handlers return void, as C89 requires Drops use of autoconf's obsolete AC_TYPE_SIGNAL Signed-off-by: Alan Coopersmith commit b1f22217f6c513be07612d8ed88fe5540ce7be48 Author: Alan Coopersmith Date: Sun Jan 20 23:25:16 2013 -0800 Drop imake fallback for RETSIGTYPE definition Signed-off-by: Alan Coopersmith commit 47479aabdb82907929d76ac87ca71f44819791f8 Author: Alan Coopersmith Date: Sun Jan 20 23:22:29 2013 -0800 Mark usage & AbortTest as _X_NORETURN Signed-off-by: Alan Coopersmith commit 5340bddccdd21fd34aae996ac3347ddb71f00de6 Author: Alan Coopersmith Date: Wed Sep 28 18:53:17 2011 -0700 Add const attributes to fix gcc -Wwrite-strings warnings Signed-off-by: Alan Coopersmith commit 84bfc56a89929999db92925c078d9e2f801b1689 Author: Alan Coopersmith Date: Wed Jul 27 18:29:38 2011 -0700 x11perf 1.5.4 Signed-off-by: Alan Coopersmith commit d171454212bff8f4a32cf3cef08566e29237da9d Author: Alan Coopersmith Date: Thu Jul 7 22:40:14 2011 -0700 Add MKTEMP to DIR_SUBSTS in Makefile Needed for commit 1188465112a1 to work after revert of 4af24b2f5b3f8f Signed-off-by: Alan Coopersmith Reviewed-by: Gaetan Nadon commit 86cf2ab52ad5c6b4b262c1673ad5bd4c8713e3e8 Author: Alan Coopersmith Date: Thu Jul 7 17:16:52 2011 -0700 Revert "Let autoconf generate x11perfcomp directly instead of doing it via sed" This reverts commit 4af24b2f5b3f8f2c20271ae323b6fa528b9b2127. Letting autoconf do it failed to handle the recursive expansion needed, resulting in "PATH=${exec_prefix}/lib/X11/x11perfcomp:..." without having exec_prefix defined in x11perfcomp. Signed-off-by: Alan Coopersmith Reviewed-by: Jeremy Huddleston Reviewed-by: Gaetan Nadon commit be99f1c0ecac26255aa9b0bb0347bab1b6e0fb88 Author: Alan Coopersmith Date: Fri Jul 1 19:59:34 2011 -0700 Remove stray remaining CVS id tag Signed-off-by: Alan Coopersmith commit 1188465112a1a3c6acce9d370d448df70fd4fa4d Author: Alan Coopersmith Date: Fri Jul 1 19:51:47 2011 -0700 x11perfcomp should use mktemp instead of pid for tmp directory Signed-off-by: Alan Coopersmith commit 4af24b2f5b3f8f2c20271ae323b6fa528b9b2127 Author: Alan Coopersmith Date: Fri Jul 1 17:38:01 2011 -0700 Let autoconf generate x11perfcomp directly instead of doing it via sed Signed-off-by: Alan Coopersmith commit fefc834c419085b2db3b2d7d57bdbfe240d1b75c Author: Alan Coopersmith Date: Fri Jul 1 17:30:14 2011 -0700 x11perfcomp: use saner $PATH Signed-off-by: Alan Coopersmith commit 4e86c85ac8cf2fc6631be704de45f098d1a58ab3 Author: Alan Coopersmith Date: Fri Mar 11 14:46:00 2011 -0800 Make Makefile.am's compatible with Solaris make Solaris make won't substitute $< in explicit rules, only implicit ones Signed-off-by: Alan Coopersmith commit 8b8f94bca1576e7365c492cfc8131d5aa7bcd7c8 Author: Gaetan Nadon Date: Sat Jan 22 14:41:33 2011 -0500 config: substitute x11perfcompdir using Autoconf @x11perfcompdir@ Use the Autoconf recommended way of substituting bindir and friends, see http://www.gnu.org/software/autoconf/manual/autoconf.html Use # sign for comment in script. Only sed is used, drop the cpp terminology. Reviewed-by: Rémi Cardona Signed-off-by: Gaetan Nadon commit 490ceddc3e97e8c5bf1ed61265525c213abf65d1 Author: Gaetan Nadon Date: Wed Jan 19 10:06:55 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 36d4517099505fac29a3c0b8c6c3779b3f05b8ff Author: Gaetan Nadon Date: Thu Jan 13 17:15:36 2011 -0500 man: replace hard coded man page section with substitution strings Signed-off-by: Gaetan Nadon commit 8ebaae2bf1350b9414d261fc8509fcd898d9b152 Author: Gaetan Nadon Date: Thu Jan 13 11:15:47 2011 -0500 man: remove trailing spaces and tabs Using s/[ \t]*$// Signed-off-by: Gaetan Nadon commit 7f46d58f7523a07e9086b7c47534c37240d83409 Author: Chris Wilson Date: Thu Jan 6 10:58:53 2011 +0000 Add tests for ShmGetImage Similar to GetImage and ShmPutImage, test the performance of retrieving pixel data from the X server without the overhead of copying the pixels. In the upper bound, using XShmGetImage, the performance will be limited by the RTT latency (x11perf -prop). However, comparing the scaling factors of XShmGetImage and XGetImage will give some insight into the driver efficiency. Signed-off-by: Chris Wilson Reviewed-by: Adam Jackson commit c39d831d409537fce2f36c8672f908a7cc810519 Author: Alan Coopersmith Date: Wed Jan 5 16:33:36 2011 -0800 x11perf 1.5.3 Signed-off-by: Alan Coopersmith commit e7917bbec06e5c8e17f07b0eb833602b33111f08 Merge: 5072fb4 cc84118 Author: Peter Harris Date: Tue Nov 23 14:41:33 2010 -0500 Merge fixes from git://anongit.freedesktop.org/~peterh/x11perf commit cc84118bd700745f02c65b2d6900e512e4c333af Author: Peter Harris Date: Mon Oct 29 11:35:22 2007 -0400 Avoid "rep" calculation overflow. On today's fast machines, "treps" can easily overflow a 32-bit number. Use "long long" to calculate reps. Signed-off-by: Peter Harris Reviewed-by: Adam Jackson commit 17a30e7c65c0b03b71b5b1ac54ae3ba33ae3b42a Author: Peter Harris Date: Mon Oct 29 11:29:32 2007 -0400 Clamp test time to positive values. If there is some jitter in the sync time, operations can complete in a negative amount of time (confusing both humans and x11perfcomp). Signed-off-by: Peter Harris Reviewed-by: Adam Jackson commit 5072fb464ffebcd97ec3a33cbff7095c3ec16225 Author: Alan Coopersmith Date: Fri Nov 19 22:34:02 2010 -0800 Remove unneccessary AC_SUBST of CFLAGS & LIBS vars from PKG_CHECK_MODULES Signed-off-by: Alan Coopersmith commit 2f6fa453f485739575296da9317243ddda25c4f6 Author: Alan Coopersmith Date: Fri Nov 19 22:32:12 2010 -0800 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS Regroup AC statements under the Autoconf initialization section. Regroup AM statements under the Automake initialization section. Add missing AC_CONFIG_SRCDIR Signed-off-by: Alan Coopersmith commit d970d9de1c98bc828365f15fb08aaa8dda214dd6 Author: Alan Coopersmith Date: Fri Nov 19 22:28:22 2010 -0800 Bug 31640 - x11perf: Doesn't build without libXft https://bugs.freedesktop.org/show_bug.cgi?id=31640 Fix trapezoid checks to look for both render & xft Signed-off-by: Alan Coopersmith commit 3147d783925bb42c7af78c9f5508c0dc245b942b Author: Alan Coopersmith Date: Tue Sep 21 20:48:33 2010 -0700 x11perf 1.5.2 Signed-off-by: Alan Coopersmith commit 172260eee2180448594def3fcf719ce501528e56 Author: Alan Coopersmith Date: Tue Sep 21 20:46:39 2010 -0700 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Alan Coopersmith commit c4b59fd280aa0f647f7f889122adf8b92b9e5cf8 Author: Alan Coopersmith Date: Tue Sep 21 20:43:58 2010 -0700 config: use AC_PROG_CC & AC_PROG_INSTALL now supplied by XORG_DEFAULT_OPTIONS The existing statements can now be removed from the configuration file. Signed-off-by: Alan Coopersmith commit 4ed4ff8d692293995910da29e4d05ad9191105ea Author: Alan Coopersmith Date: Tue Sep 21 20:42:54 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS The existing statement can now be removed from the configuration file. Signed-off-by: Alan Coopersmith commit 1f990bc605d520f58e0c321a1338da76d76529fa Author: Timo Myyra Date: Sun Sep 19 10:54:40 2010 -0700 Remove reference to xbench in x11perf.man (#29830) xbench isn't supported by fd.o, and searching for it shows the latest version released in 1995. Signed-off-by: Jesse Adkins Signed-off-by: Alan Coopersmith commit 05759c8550bf994f4ae4e87a658aa7ffdd9dd517 Author: Alan Coopersmith Date: Fri Aug 6 08:34:31 2010 -0700 Add HP notice to COPYING for Xmark script Signed-off-by: Alan Coopersmith commit 3b427a6c4cc1551ce445abd975f5a128ea53d9be Author: Gaetan Nadon Date: Thu Jan 7 21:25:09 2010 -0500 COPYING: replace stub with actual copyright notice Refer to x11perf.c Copyright 1988, 1989 by Digital Equipment Corporation Signed-off-by: Gaetan Nadon commit 374bee27ef4d45044f7562ffed162a5b6f095e40 Author: Adam Jackson Date: Sat Jan 2 17:36:17 2010 -0500 Add -falseprecision flag for ludicrously precise stats The normal round-to-three-significant-figures behaviour, while morally correct from a benchmarking perspective, makes it impossible to measure variances between runs of less than 1%. Occasionally you really do need to measure that finely - for example, if tweaking the server's main dispatch loop. Signed-off-by: Adam Jackson commit af29c01b5d41f08053263dfe251d0a2a26c7eb1f Author: Adam Jackson Date: Sat Jan 2 17:23:50 2010 -0500 Death to RCS tags. Signed-off-by: Adam Jackson commit f8193c3f472fb0b7357552d10a6033e8ac08b9fa Author: Gaetan Nadon Date: Thu Nov 26 09:19:52 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit e6d0de5d8f13ca73753cb70b12b2f9b98f82b39f Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit 5d3fb3c68c681cce10d3625bab85bb39c18e5e3b Author: Gaetan Nadon Date: Mon Oct 26 22:08:38 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit 6b8182c54689c67fa35ac471fcfc4e7ee73b7b91 Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit 1b811f2bf9c3cdef966b18ea802f1f79b5f34ef2 Author: Jeremy Huddleston Date: Wed Oct 21 12:47:20 2009 -0700 This is not a GNU project, so declare it foreign. On Wed, 2009-10-21 at 13:36 +1000, Peter Hutterer wrote: > On Tue, Oct 20, 2009 at 08:23:55PM -0700, Jeremy Huddleston wrote: > > I noticed an INSTALL file in xlsclients and libXvMC today, and it > > was quite annoying to work around since 'autoreconf -fvi' replaces > > it and git wants to commit it. Should these files even be in git? > > Can I nuke them for the betterment of humanity and since they get > > created by autoreconf anyways? > > See https://bugs.freedesktop.org/show_bug.cgi?id=24206 As an interim measure, replace AM_INIT_AUTOMAKE([dist-bzip2]) with AM_INIT_AUTOMAKE([foreign dist-bzip2]). This will prevent the generation of the INSTALL file. It is also part of the 24206 solution. Signed-off-by: Jeremy Huddleston commit 98ca2c35b05a2d248063047c50770a018e35e810 Author: Alan Coopersmith Date: Fri Oct 16 17:19:36 2009 -0700 x11perf 1.5.1 Signed-off-by: Alan Coopersmith commit 266da0b9c176cf0dc615005bb0ad4aa585892bd8 Author: Alan Coopersmith Date: Fri Oct 16 17:17:41 2009 -0700 Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS Signed-off-by: Alan Coopersmith commit 9851abff574fe041f4e3f45b39c61d943e3a7f86 Author: Alan Coopersmith Date: Thu Oct 1 14:54:20 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit c7f3c6652e9507e4303fd9ed913c593afb7447f0 Author: Paulo Cesar Pereira de Andrade Date: Tue Jan 13 18:55:51 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, and corrects make distcheck. commit 828c0323450eadaf040749c010918679f5e4fe53 Author: Adam Jackson Date: Fri Mar 7 16:51:53 2008 -0500 x11perf-1.5 commit 1540dc21e1ef7bb473af7616294e5730e38f66ec Author: James Cloos Date: Thu Dec 6 16:37:08 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit b1c5b72bb4bb5f3e116255f9d04b368137ff25f7 Author: Michel Dänzer Date: Thu Nov 1 09:13:43 2007 +0100 Fix typos in descriptions of -compwinwin{1,5}00. commit 569a5eaaef9a5c8bf50f1323fe39e81347976875 Merge: 55aa9c2 e906fe5 Author: Keith Packard Date: Mon Sep 10 16:56:06 2007 +0100 Merge branch 'origin' commit 55aa9c238c5d81c9dc0f679dfd2fea00f356247b Author: Keith Packard Date: Mon Sep 10 16:12:29 2007 +0100 Add Compositing tests. -compwinwinXX, -comppixwinXX where XX is 10, 100 or 500. -pop ... where is one of Clear, Src, Dst, Over, OverReverse, In, InReverse, Out, OutReverse, Atop, AtopReverse, Xor, Add or Saturate. -format ... where is one of RGB24, ARGB32, A8, A4, A1 or NATIVE commit 8b3b9d1d1d3a255000fb43bd09c62ef1e0798023 Author: Keith Packard Date: Mon Sep 10 16:08:51 2007 +0100 Rename .cvsignore to .gitignore commit e906fe589a852e9b4af4aac6c72580494139a0b7 Author: Eric S. Raymond Date: Tue Jan 2 10:07:00 2007 -0800 Bug 9520: Markup problems in Xmark.1x X.Org Bugzilla #9520 commit d36c3c0e7db2254dc1385fe7ffc187797e109e0e Author: Alan Coopersmith Date: Wed Apr 11 15:45:48 2007 -0700 Another man page typo fix: s/aprox./approx./ commit e9bb1f2d13cad8240cc95f1aae19316fe7568cbd Author: Alan Coopersmith Date: Wed Apr 11 15:41:27 2007 -0700 renamed: .cvsignore -> .gitignore commit ad4686b388da891ca07fba41a748ea90a3bb15cb Author: Alan Coopersmith Date: Wed Apr 11 15:39:23 2007 -0700 Bug #10616: Man page typo: s/peform/perform/ X.Org Bugzilla #10616 Reported upstream from Debian Bug #395445 commit fabb885e8db6dd54d31b7223e9bb4f5d9e835d8c Author: Adam Jackson Date: Thu Mar 2 23:36:27 2006 +0000 Bump to 1.4.1 (was 1.0.1 because we screwed up during modularising). commit 21ce0f2bab1743ed15474ba1468286d6782bf781 Author: Keith Packard Date: Tue Feb 14 16:33:38 2006 +0000 Split detection of Xrender and Xft. Add detection of MIT-SHM. Clean up CFLAGS in Makefile.am commit 32393ee83c8ad63dbb54aab709cdd4dc5802a74c Author: Eric Anholt Date: Tue Feb 14 02:48:22 2006 +0000 Detect when Render is available and turn those tests on. commit d121367a04832aafb27800283bac5ce35365d84e Author: Kevin E Martin Date: Wed Dec 21 02:29:48 2005 +0000 Update package version for X11R7 release. commit 883de694b5dac055f0d7fd33cb84ee10c080ba8c Author: Adam Jackson Date: Mon Dec 19 16:22:42 2005 +0000 Stub COPYING files commit 2c3643dc1503b7e9136f678e0af238d507acf262 Author: Kevin E Martin Date: Thu Dec 15 00:24:04 2005 +0000 Update package version number for final X11R7 release candidate. commit 8e9f6aa0f81fa57e8b08684a1110e945f6f0dacd Author: Kevin E Martin Date: Tue Dec 6 22:48:19 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit e09f755a36b9848a7c76013d324713b1ee5cf0e3 Author: Kevin E Martin Date: Sat Dec 3 05:49:18 2005 +0000 Update package version number for X11R7 RC3 release. commit 9a94217191edf8e719ff9d4fbf485b5c33d0bde3 Author: Alan Coopersmith Date: Mon Nov 28 22:01:39 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit 95895b619909e2b9f2e144e972b83aee6595d5f3 Author: Eric Anholt Date: Mon Nov 21 10:34:58 2005 +0000 Another pass at .cvsignores for apps. commit 67eaa3cc45db8ab1a9aedb4675a09d5a3db31a7f Author: Alan Coopersmith Date: Mon Nov 21 03:14:15 2005 +0000 Change dependency from xmu to xmuu since the full xmu (with all its baggage like Xt) is not needed here. commit 583d5d1c988ab24c61e2bbb21a5e5847328e86ec Author: Eric Anholt Date: Sun Nov 20 22:08:50 2005 +0000 Add/improve .cvsignore files for apps. commit 2350482506abae44fcf656a3383c354ac2910d34 Author: Kevin E Martin Date: Wed Oct 19 02:47:50 2005 +0000 Update package version number for RC1 release. commit a489b54c63515aa2be297ef340501b1b7ef09423 Author: Alan Coopersmith Date: Mon Oct 17 23:56:21 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 4ac6e7bffbd29ae179fbc053a8317db4fa2f3f75 Author: Alan Coopersmith Date: Fri Oct 14 00:25:42 2005 +0000 Use sed to fill in variables in man page commit 64a324c6ffd7ba8a9bce52d41db3e63d77b69eca Author: Alan Coopersmith Date: Thu Oct 6 20:04:20 2005 +0000 Strip .sh from filenames of scripts to match the way they are installed by the monolith commit eb51653deaa7a8cac0bac02f4a1fe4cd8291590b Author: Alan Coopersmith Date: Thu Oct 6 03:47:12 2005 +0000 Fix file names of beforelight, x11perfcomp, and xlsclients man pages commit eb44ab57c5e989429f94bb67d01abaef70b9174d Author: Alan Coopersmith Date: Mon Aug 1 20:25:28 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit a1e27c9edcb4b99a0550e674dea66bd1d3111747 Author: Kevin E Martin Date: Fri Jul 29 21:22:30 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit 9dc00b804b6283a6371cae136f0c4abc743e3462 Author: Kevin E Martin Date: Thu Jul 28 15:57:12 2005 +0000 Fix distcheck for remaining apps commit 8b5dc957345bbee8349340e345a6a06ec42a16e8 Author: Alan Coopersmith Date: Tue Jul 26 18:58:15 2005 +0000 Use AC_TYPE_SIGNAL and AC_FUNC_VFORK to replace Imake's SIGNAL_DEFINES and -DHAS_VFORK commit 74c819bed573af85aabd92f023c885e53fb0cf77 Author: Alan Coopersmith Date: Tue Jul 26 18:55:42 2005 +0000 Add config.h includes for modularization Use RETSIGTYPE if defined by autoconf in addition to Imake's SIGNALRETURNSINT. Use HAVE_WORKING_VFORK if defined by autoconf in addition to Imake's HAS_VFORK commit 81a51fb38778c54442657142cf5d57fae4ac3e0e Author: Adam Jackson Date: Wed Jul 20 19:31:51 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit 2975cf615c2e0b79c3392d6d95b393ce4b0fd312 Author: Alan Coopersmith Date: Sat Jul 16 23:29:38 2005 +0000 x11perf/Makefile.am: xinit/Makefile.am: xvidtune/Makefile.am: - Replace $< with portable macro xinit/Makefile.am: xinit/configure.ac: xvidtune/Makefile.am: xvidtune/configure.ac: - Use more portable cpp invocations for pre-processing files xfs/configure.ac: - Add XTRANS_CONNECTION_FLAGS so xtrans transport type defines are set correctly commit 68ebb5b755791822c2f1d9f9659c2ee94bb63f1c Author: Søren Sandmann Pedersen Date: Wed Jun 29 20:41:01 2005 +0000 Add x11perf build system Add some x11perf shell script to symlink.sh commit 21b7ff0b54fcf28e933738aaaedf5aef46880717 Author: Eric Anholt Date: Wed Aug 11 08:05:31 2004 +0000 - Fix the build with old libXrender headers installed by including TOP_INCLUDES first in the INCLUDES line. - Drive-by fix of unused variables warnings in do_traps.c. commit 9f86498395945e52accedc6bf3d938c2d21abd5d Author: Keith Packard Date: Fri Aug 6 23:42:11 2004 +0000 Add RenderAddTraps. Rewrite trapezoid rendering code. commit cc61a0dd9da513e24a0c39793e4e70237a8d35b5 Author: Egbert Eich Date: Fri Apr 23 19:54:38 2004 +0000 Merging XORG-CURRENT into trunk commit 3208453773436841fd97a5a841f75aea2a84ea07 Author: Egbert Eich Date: Sun Mar 14 08:34:59 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit c090b9c09ddb3f21983506a90418d6e5387cbd94 Author: Egbert Eich Date: Wed Mar 3 12:12:54 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit c501072fc6aae9867785226575d87b6a3d89ecaa Author: Egbert Eich Date: Thu Feb 26 13:36:16 2004 +0000 readding XFree86's cvs IDs commit 767875979a99fba9d7c00fd9eb7da316d88596dc Author: Egbert Eich Date: Thu Feb 26 09:23:58 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit c3ee38aec0f064a3916ecef9a29ecf6538a794a1 Author: Kaleb Keithley Date: Tue Nov 25 19:29:03 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit ee11b04c48b57b74beacd0a905fbc96a86c75931 Author: Kaleb Keithley Date: Fri Nov 14 16:48:58 2003 +0000 XFree86 4.3.0.1 commit 76312369bde4267f6405a4e1d26697258cc06b32 Author: Kaleb Keithley Date: Fri Nov 14 16:48:58 2003 +0000 Initial revision commit d7d99c8433b3bd35c8bad352ebd1fc49cff45264 Author: Kaleb Keithley Date: Fri Nov 14 15:54:53 2003 +0000 R6.6 is the Xorg base-line x11-apps-7.7+5+nmu1ubuntu1/x11perf/fillblnk0000664000000000000000000000065012514116510015174 0ustar #!/bin/sh echo '#####EOF#####' | cat $2 - $1 | awk -F: '\ $1 == "#####EOF#####" { filling = 1; currentItem = 1; lastItem = NR; next; } filling != "1" { itemOrder[" " $1] = NR; name[NR] = $1; } filling == "1" { rate[itemOrder[$2]] = $1; } END { for (i = 1; i < lastItem; i++) { if (rate[i] != "") { printf ("%s: %s\n", rate[i], name[i]); } else { printf (" 0 trep @ 0.0 msec (0.0/sec): %s\n", name[i]); } } }' x11-apps-7.7+5+nmu1ubuntu1/x11perf/depcomp0000755000000000000000000005601612656634617015062 0ustar #! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_movewin.c0000664000000000000000000001232112514116510015764 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "x11perf.h" static Window *children; static XPoint *positions; static Window cover; static int rows; static int x_offset, y_offset; /* Private global data for DoMoveWindows */ static int xmax, ymax; static int delta1; /* Private global data for DoResizeWindows */ #define STACK (4*(HEIGHT-10)/CHILDSIZE) int InitMoveWindows(XParms xp, Parms p, int64_t reps) { int i = 0; rows = (p->objects + MAXCOLS - 1) / MAXCOLS; x_offset = 0; y_offset = 0; delta1 = 1; children = (Window *) malloc (p->objects*sizeof (Window)); positions = (XPoint *) malloc(p->objects*sizeof(XPoint)); xmax = (CHILDSIZE+CHILDSPACE) * (rows > 1 ? MAXCOLS : p->objects); ymax = rows * (CHILDSIZE+CHILDSPACE); for (i = 0; i != p->objects; i++) { positions[i].x = (CHILDSIZE+CHILDSPACE) * (i/rows) + CHILDSPACE/2; positions[i].y = (CHILDSIZE+CHILDSPACE) * (i%rows) + CHILDSPACE/2; children[i] = XCreateSimpleWindow(xp->d, xp->w, positions[i].x, positions[i].y, CHILDSIZE, CHILDSIZE, 0, xp->foreground, xp->foreground); } if (p->special) XMapSubwindows (xp->d, xp->w); return reps; } void DoMoveWindows(XParms xp, Parms p, int64_t reps) { int i, j; for (i = 0; i != reps; i++) { x_offset += 1; y_offset += 3; if (y_offset + ymax > HEIGHT) y_offset = 0; if (x_offset + xmax > WIDTH) x_offset = 0; for (j = 0; j != p->objects; j++) { XMoveWindow(xp->d, children[j], positions[j].x + x_offset, positions[j].y + y_offset); } CheckAbort (); } } void EndMoveWindows(XParms xp, Parms p) { free(children); free(positions); } void DoResizeWindows(XParms xp, Parms p, int64_t reps) { int i, j, delta2; for (i = 0; i != reps; i++) { delta1 = -delta1; delta2 = delta1; for (j = 0; j != p->objects; j++) { delta2 = -delta2; XResizeWindow(xp->d, children[j], CHILDSIZE+delta2, CHILDSIZE-delta2); } CheckAbort (); } } int InitCircWindows(XParms xp, Parms p, int64_t reps) { int i; int pos; int color; children = (Window *) malloc (p->objects * sizeof (Window)); for (i = 0; i != p->objects; i++) { pos = i % STACK; color = (i & 1 ? xp->foreground : xp->background); children[i] = XCreateSimpleWindow (xp->d, xp->w, pos*CHILDSIZE/4 + (i/STACK)*2*CHILDSIZE, pos*CHILDSIZE/4, CHILDSIZE, CHILDSIZE, 0, color, color); } if (p->special) XMapSubwindows (xp->d, xp->w); return reps; } void DoCircWindows(XParms xp, Parms p, int64_t reps) { int i, j; for (i = 0; i != reps; i++) { for (j = 0; j != p->objects; j++) XCirculateSubwindows (xp->d, xp->w, RaiseLowest); CheckAbort (); } } void EndCircWindows(XParms xp, Parms p) { free(children); } int InitMoveTree(XParms xp, Parms p, int64_t reps) { int i = 0; rows = (p->objects + MAXCOLS - 1) / MAXCOLS; x_offset = 0; y_offset = 0; delta1 = 1; children = (Window *) malloc (p->objects*sizeof (Window)); positions = (XPoint *) malloc(p->objects*sizeof(XPoint)); xmax = (CHILDSIZE+CHILDSPACE) * (rows > 1 ? MAXCOLS : p->objects); ymax = rows * (CHILDSIZE+CHILDSPACE); cover = XCreateSimpleWindow(xp->d, xp->w, 0, 0, xmax, ymax, 0, xp->background, xp->background); for (i = 0; i != p->objects; i++) { positions[i].x = (CHILDSIZE+CHILDSPACE) * (i/rows) + CHILDSPACE/2; positions[i].y = (CHILDSIZE+CHILDSPACE) * (i%rows) + CHILDSPACE/2; children[i] = XCreateSimpleWindow(xp->d, cover, positions[i].x, positions[i].y, CHILDSIZE, CHILDSIZE, 0, xp->foreground, xp->foreground); } XMapSubwindows (xp->d, cover); XMapWindow (xp->d, cover); return reps; } void DoMoveTree(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != reps; i++) { x_offset += 1; y_offset += 3; if (y_offset + ymax > HEIGHT) y_offset = 0; if (x_offset + xmax > WIDTH) x_offset = 0; XMoveWindow(xp->d, cover, x_offset, y_offset); CheckAbort (); } } void EndMoveTree(XParms xp, Parms p) { XDestroyWindow(xp->d, cover); free(children); free(positions); } x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_blt.c0000664000000000000000000004471112514116510015071 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "x11perf.h" #include #define NUMPOINTS 100 static Pixmap pix; static XImage *image; static XPoint points[NUMPOINTS]; static XSegment *segsa, *segsb; static XSegment *segsa2, *segsb2; #define NegMod(x, y) ((y) - (((-x)-1) % (7)) - 1) static void InitBltLines(void) { int i, x, y; points[0].x = points[0].y = y = 0; for (i = 1; i != NUMPOINTS/2; i++) { if (i & 1) { points[i].x = WIDTH-1; } else { points[i].x = 0; } y += HEIGHT / (NUMPOINTS/2); points[i].y = y; } x = 0; for (i = NUMPOINTS/2; i!= NUMPOINTS; i++) { if (i & 1) { points[i].y = HEIGHT-1; } else { points[i].y = 0; } x += WIDTH / (NUMPOINTS/2); points[i].x = x; } } int InitScroll(XParms xp, Parms p, int64_t reps) { InitBltLines(); XDrawLines(xp->d, xp->w, xp->fggc, points, NUMPOINTS, CoordModeOrigin); return reps; } void DoScroll(XParms xp, Parms p, int64_t reps) { int i, size, x, y, xorg, yorg, delta; size = p->special; xorg = 0; yorg = 0; x = 0; y = 0; if (xp->version == VERSION1_2) { delta = 1; } else { /* Version 1.2 only scrolled up by 1 scanline, which made hardware using page-mode access to VRAM look better on paper than it would perform in a more realistic scroll. So we've changed to scroll by the height of the 6x13 fonts. */ delta = 13; } for (i = 0; i != reps; i++) { XCopyArea(xp->d, xp->w, xp->w, xp->fggc, x, y + delta, size, size, x, y); y += size; if (y + size + delta > HEIGHT) { yorg += delta; if (yorg >= size || yorg + size + delta > HEIGHT) { yorg = 0; xorg++; if (xorg >= size || xorg + size > WIDTH) { xorg = 0; } } y = yorg; x += size; if (x + size > WIDTH) { x = xorg; } } CheckAbort (); } } void MidScroll(XParms xp, Parms p) { XClearWindow(xp->d, xp->w); XDrawLines(xp->d, xp->w, xp->fggc, points, NUMPOINTS, CoordModeOrigin); } void EndScroll(XParms xp, Parms p) { } static void InitCopyLocations(int size, int mul, int div, int64_t reps, XSegment **ap, XSegment **bp) { int x1, y1, x2, y2, i; int xinc, yinc; int width, height; XSegment *a, *b; size = size * mul / div; /* Try to exercise all alignments of src and destination equally, as well as all 4 top-to-bottom/bottom-to-top, left-to-right, right-to-left copying directions. Computation done here just to make sure slow machines aren't measuring anything but the XCopyArea calls. */ xinc = (size & ~3) + 1; yinc = xinc + 3; width = (WIDTH - size) & ~31; height = (HEIGHT - size) & ~31; x1 = 0; y1 = 0; x2 = width; y2 = height; *ap = a = (XSegment *)malloc(reps * sizeof(XSegment)); *bp = b = (XSegment *)malloc(reps * sizeof(XSegment)); for (i = 0; i != reps; i++) { a[i].x1 = x1 * div / mul; a[i].y1 = y1 * div / mul; a[i].x2 = x2 * div / mul; a[i].y2 = y2 * div / mul; /* Move x2, y2, location backward */ x2 -= xinc; if (x2 < 0) { x2 = NegMod(x2, width); y2 -= yinc; if (y2 < 0) { y2 = NegMod(y2, height); } } b[i].x1 = x1 * div / mul; b[i].y1 = y1 * div / mul; b[i].x2 = x2 * div / mul; b[i].y2 = y2 * div / mul; /* Move x1, y1 location forward */ x1 += xinc; if (x1 > width) { x1 %= 32; y1 += yinc; if (y1 > height) { y1 %= 32; } } } /* end for */ } int InitCopyWin(XParms xp, Parms p, int64_t reps) { (void) InitScroll(xp, p, reps); InitCopyLocations(p->special, 1, 1, reps, &segsa, &segsb); return reps; } int InitCopyPix(XParms xp, Parms p, int64_t reps) { GC pixgc; (void) InitCopyWin(xp, p, reps); /* Create pixmap to write stuff into, and initialize it */ pix = XCreatePixmap(xp->d, xp->w, WIDTH, HEIGHT, xp->vinfo.depth); pixgc = XCreateGC(xp->d, pix, 0, NULL); /* need a gc with GXcopy cos pixmaps contain junk on creation. mmm */ XCopyArea(xp->d, xp->w, pix, pixgc, 0, 0, WIDTH, HEIGHT, 0, 0); XFreeGC(xp->d, pixgc); return reps; } int InitGetImage(XParms xp, Parms p, int64_t reps) { (void) InitCopyWin(xp, p, reps); /* Create image to stuff bits into */ image = XGetImage(xp->d, xp->w, 0, 0, WIDTH, HEIGHT, xp->planemask, p->font==NULL?ZPixmap:XYPixmap); if(image==NULL){ printf("XGetImage failed\n"); return False; } return reps; } int InitPutImage(XParms xp, Parms p, int64_t reps) { if(!InitGetImage(xp, p, reps))return False; XClearWindow(xp->d, xp->w); return reps; } static void CopyArea(XParms xp, Parms p, int64_t reps, Drawable src, Drawable dst) { int i, size; XSegment *sa, *sb; size = p->special; for (sa = segsa, sb = segsb, i = 0; i != reps; i++, sa++, sb++) { XCopyArea(xp->d, src, dst, xp->fggc, sa->x1, sa->y1, size, size, sa->x2, sa->y2); XCopyArea(xp->d, src, dst, xp->fggc, sa->x2, sa->y2, size, size, sa->x1, sa->y1); XCopyArea(xp->d, src, dst, xp->fggc, sb->x2, sb->y2, size, size, sb->x1, sb->y1); XCopyArea(xp->d, src, dst, xp->fggc, sb->x1, sb->y1, size, size, sb->x2, sb->y2); CheckAbort (); } } void DoCopyWinWin(XParms xp, Parms p, int64_t reps) { CopyArea(xp, p, reps, xp->w, xp->w); } void DoCopyPixWin(XParms xp, Parms p, int64_t reps) { CopyArea(xp, p, reps, pix, xp->w); } void DoCopyWinPix(XParms xp, Parms p, int64_t reps) { CopyArea(xp, p, reps, xp->w, pix); xp->p = pix; /* HardwareSync will now sync on pixmap */ } void DoCopyPixPix(XParms xp, Parms p, int64_t reps) { CopyArea(xp, p, reps, pix, pix); xp->p = pix; /* HardwareSync will now sync on pixmap */ } void DoGetImage(XParms xp, Parms p, int64_t reps) { int i, size; XSegment *sa, *sb; int format; size = p->special; format = (p->font == NULL) ? ZPixmap : XYPixmap; for (sa = segsa, sb = segsb, i = 0; i != reps; i++, sa++, sb++) { XDestroyImage(image); image = XGetImage(xp->d, xp->w, sa->x1, sa->y1, size, size, xp->planemask, format); if (image) XDestroyImage(image); image = XGetImage(xp->d, xp->w, sa->x2, sa->y2, size, size, xp->planemask, format); if (image) XDestroyImage(image); image = XGetImage(xp->d, xp->w, sb->x2, sb->y2, size, size, xp->planemask, format); if (image) XDestroyImage(image); image = XGetImage(xp->d, xp->w, sb->x1, sb->y1, size, size, xp->planemask, format); /* One might expect XGetSubImage to be slightly faster than XGetImage. Go look at the code in Xlib. MIT X11R3 ran approximately 30 times slower for a 500x500 rectangle. (void) XGetSubImage(xp->d, xp->w, sa->x1, sa->y1, size, size, xp->planemask, ZPixmap, image, sa->x2, sa->y2); (void) XGetSubImage(xp->d, xp->w, sa->x2, sa->y2, size, size, xp->planemask, ZPixmap, image, sa->x1, sa->y1); (void) XGetSubImage(xp->d, xp->w, sb->x2, sb->y2, size, size, xp->planemask, ZPixmap, image, sb->x2, sb->y2); (void) XGetSubImage(xp->d, xp->w, sb->x1, sb->y1, size, size, xp->planemask, ZPixmap, image, sb->x2, sb->y2); */ CheckAbort (); } } void DoPutImage(XParms xp, Parms p, int64_t reps) { int i, size; XSegment *sa, *sb; size = p->special; for (sa = segsa, sb = segsb, i = 0; i != reps; i++, sa++, sb++) { XPutImage(xp->d, xp->w, xp->fggc, image, sa->x1, sa->y1, sa->x2, sa->y2, size, size); XPutImage(xp->d, xp->w, xp->fggc, image, sa->x2, sa->y2, sa->x1, sa->y1, size, size); XPutImage(xp->d, xp->w, xp->fggc, image, sb->x2, sb->y2, sb->x2, sb->y2, size, size); XPutImage(xp->d, xp->w, xp->fggc, image, sb->x1, sb->y1, sb->x2, sb->y2, size, size); CheckAbort (); } } #ifdef MITSHM #include #ifndef Lynx #include #include #else #include #include #endif #include static XImage shm_image; static XShmSegmentInfo shm_info; static int haderror; static int (*origerrorhandler)(Display *, XErrorEvent *); static int shmerrorhandler(Display *d, XErrorEvent *e) { haderror++; if(e->error_code==BadAccess) { fprintf(stderr,"failed to attach shared memory\n"); return 0; } else return (*origerrorhandler)(d,e); } static int InitShmImage(XParms xp, Parms p, int64_t reps, Bool read_only) { int image_size; if(!InitGetImage(xp, p, reps))return False; if (!XShmQueryExtension(xp->d)) { /* * Clean up here because cleanup function is not called if this * function fails */ if (image) XDestroyImage(image); image = NULL; free(segsa); free(segsb); return False; } shm_image = *image; image_size = image->bytes_per_line * image->height; /* allow XYPixmap choice: */ if(p->font)image_size *= xp->vinfo.depth; shm_info.shmid = shmget(IPC_PRIVATE, image_size, IPC_CREAT|0777); if (shm_info.shmid < 0) { /* * Clean up here because cleanup function is not called if this * function fails */ if (image) XDestroyImage(image); image = NULL; free(segsa); free(segsb); perror ("shmget"); return False; } shm_info.shmaddr = (char *) shmat(shm_info.shmid, NULL, 0); if (shm_info.shmaddr == ((char *) -1)) { /* * Clean up here because cleanup function is not called if this * function fails */ if (image) XDestroyImage(image); image = NULL; free(segsa); free(segsb); perror ("shmat"); shmctl (shm_info.shmid, IPC_RMID, NULL); return False; } shm_info.readOnly = read_only; XSync(xp->d,True); haderror = False; origerrorhandler = XSetErrorHandler(shmerrorhandler); XShmAttach (xp->d, &shm_info); XSync(xp->d,True); /* wait for error or ok */ XSetErrorHandler(origerrorhandler); if(haderror){ /* * Clean up here because cleanup function is not called if this * function fails */ if (image) XDestroyImage(image); image = NULL; free(segsa); free(segsb); if(shmdt (shm_info.shmaddr)==-1) perror("shmdt:"); if(shmctl (shm_info.shmid, IPC_RMID, NULL)==-1) perror("shmctl rmid:"); return False; } shm_image.data = shm_info.shmaddr; memmove( shm_image.data, image->data, image_size); shm_image.obdata = (char *) &shm_info; return reps; } int InitShmPutImage(XParms xp, Parms p, int64_t reps) { if (!InitShmImage(xp, p, reps, True)) return False; XClearWindow(xp->d, xp->w); return reps; } int InitShmGetImage(XParms xp, Parms p, int64_t reps) { return InitShmImage(xp, p, reps, False); } void DoShmPutImage(XParms xp, Parms p, int64_t reps) { int i, size; XSegment *sa, *sb; size = p->special; for (sa = segsa, sb = segsb, i = 0; i != reps; i++, sa++, sb++) { XShmPutImage(xp->d, xp->w, xp->fggc, &shm_image, sa->x1, sa->y1, sa->x2, sa->y2, size, size, False); XShmPutImage(xp->d, xp->w, xp->fggc, &shm_image, sa->x2, sa->y2, sa->x1, sa->y1, size, size, False); XShmPutImage(xp->d, xp->w, xp->fggc, &shm_image, sb->x2, sb->y2, sb->x2, sb->y2, size, size, False); XShmPutImage(xp->d, xp->w, xp->fggc, &shm_image, sb->x1, sb->y1, sb->x2, sb->y2, size, size, False); CheckAbort (); } } void DoShmGetImage(XParms xp, Parms p, int64_t reps) { int i, size; XSegment *sa, *sb; size = p->special; shm_image.width = size; shm_image.height = size; for (sa = segsa, sb = segsb, i = 0; i != reps; i++, sa++, sb++) { /* compute offsets into image data? */ XShmGetImage(xp->d, xp->w, &shm_image, sa->x1, sa->y1, xp->planemask); XShmGetImage(xp->d, xp->w, &shm_image, sa->x2, sa->y2, xp->planemask); XShmGetImage(xp->d, xp->w, &shm_image, sb->x2, sb->y2, xp->planemask); XShmGetImage(xp->d, xp->w, &shm_image, sb->x1, sb->y1, xp->planemask); CheckAbort (); } } static void EndShmImage(XParms xp, Parms p) { EndGetImage (xp, p); XShmDetach (xp->d, &shm_info); XSync(xp->d, False); /* need server to detach so can remove id */ if(shmdt (shm_info.shmaddr)==-1) perror("shmdt:"); if(shmctl (shm_info.shmid, IPC_RMID, NULL)==-1) perror("shmctl rmid:"); } void EndShmGetImage(XParms xp, Parms p) { EndShmImage(xp, p); } void EndShmPutImage(XParms xp, Parms p) { EndShmImage(xp, p); } #endif void MidCopyPix(XParms xp, Parms p) { XClearWindow(xp->d, xp->w); } void EndCopyWin(XParms xp, Parms p) { EndScroll(xp, p); free(segsa); free(segsb); if (segsa2) free (segsa2); if (segsb2) free (segsb2); segsa = segsb = segsa2 = segsb2 = NULL; } void EndCopyPix(XParms xp, Parms p) { EndCopyWin(xp, p); XFreePixmap(xp->d, pix); /* * Ensure that the next test doesn't try and sync on the pixmap */ xp->p = (Pixmap)0; } void EndGetImage(XParms xp, Parms p) { EndCopyWin(xp, p); if (image) XDestroyImage(image); } int InitCopyPlane(XParms xp, Parms p, int64_t reps) { XGCValues gcv; GC pixgc; InitBltLines(); InitCopyLocations(p->special, 1, 1, reps, &segsa, &segsb); /* Create pixmap to write stuff into, and initialize it */ pix = XCreatePixmap(xp->d, xp->w, WIDTH, HEIGHT, p->font==NULL ? 1 : xp->vinfo.depth); gcv.graphics_exposures = False; gcv.foreground = 0; gcv.background = 1; pixgc = XCreateGC(xp->d, pix, GCForeground | GCBackground | GCGraphicsExposures, &gcv); XFillRectangle(xp->d, pix, pixgc, 0, 0, WIDTH, HEIGHT); gcv.foreground = 1; gcv.background = 0; XChangeGC(xp->d, pixgc, GCForeground | GCBackground, &gcv); XDrawLines(xp->d, pix, pixgc, points, NUMPOINTS, CoordModeOrigin); XFreeGC(xp->d, pixgc); return reps; } void DoCopyPlane(XParms xp, Parms p, int64_t reps) { int i, size; XSegment *sa, *sb; size = p->special; for (sa = segsa, sb = segsb, i = 0; i != reps; i++, sa++, sb++) { XCopyPlane(xp->d, pix, xp->w, xp->fggc, sa->x1, sa->y1, size, size, sa->x2, sa->y2, 1); XCopyPlane(xp->d, pix, xp->w, xp->fggc, sa->x2, sa->y2, size, size, sa->x1, sa->y1, 1); XCopyPlane(xp->d, pix, xp->w, xp->fggc, sb->x2, sb->y2, size, size, sb->x1, sb->y1, 1); XCopyPlane(xp->d, pix, xp->w, xp->fggc, sb->x1, sb->y1, size, size, sb->x2, sb->y2, 1); CheckAbort (); } } #include static Picture winPict, pixPict; int InitCompositeWin(XParms xp, Parms p, int64_t reps) { XRenderPictFormat *format; (void) InitScroll (xp, p, reps); InitCopyLocations(p->special, 1, 1, reps, &segsa, &segsb); if (p->fillStyle) { int mul = 0x10000; int div = p->fillStyle; InitCopyLocations (p->special, mul, div, reps, &segsa2, &segsb2); } format = XRenderFindVisualFormat (xp->d, xp->vinfo.visual); winPict = XRenderCreatePicture (xp->d, xp->w, format, 0, NULL); return reps; } int InitCompositePix(XParms xp, Parms p, int64_t reps) { XRenderPictFormat *format = NULL; int depth; static XRenderColor c = { 0xffff, 0x0000, 0xffff, 0xffff }; (void) InitCompositeWin (xp, p, reps); /* Create pixmap to write stuff into, and initialize it */ switch (xp->planemask) { case PictStandardNative: depth = xp->vinfo.depth; format = XRenderFindVisualFormat (xp->d, xp->vinfo.visual); break; case PictStandardRGB24: depth = 24; break; case PictStandardARGB32: depth = 32; break; case PictStandardA8: depth = 8; break; case PictStandardA4: depth = 4; break; case PictStandardA1: depth = 1; break; default: depth = 0; break; } if (!format) format = XRenderFindStandardFormat (xp->d, xp->planemask); pix = XCreatePixmap(xp->d, xp->w, WIDTH, HEIGHT, depth); pixPict = XRenderCreatePicture (xp->d, pix, format, 0, NULL); XRenderComposite (xp->d, PictOpClear, winPict, None, pixPict, 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT); XRenderFillRectangle (xp->d, PictOpSrc, pixPict, &c, 0, 0, WIDTH, HEIGHT); #if 1 XRenderComposite (xp->d, PictOpSrc, winPict, None, pixPict, 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT); #endif if (p->fillStyle) { XTransform transform; memset (&transform, '\0', sizeof (transform)); transform.matrix[0][0] = ((long long) 0x10000 * 0x10000) / p->fillStyle; transform.matrix[1][1] = ((long long) 0x10000 * 0x10000) / p->fillStyle; transform.matrix[2][2] = 0x10000; XRenderSetPictureTransform (xp->d, pixPict, &transform); XRenderSetPictureFilter (xp->d, pixPict, FilterBilinear, NULL, 0); } return reps; } void EndCompositeWin (XParms xp, Parms p) { if (winPict) { XRenderFreePicture (xp->d, winPict); winPict = None; } if (pixPict) { XRenderFreePicture (xp->d, pixPict); pixPict = None; } } static void CompositeArea(XParms xp, Parms p, int64_t reps, Picture src, Picture dst) { int i, size; XSegment *sa, *sb; XSegment *sa2, *sb2; size = p->special; sa = segsa; sb = segsb; sa2 = segsa2 ? segsa2 : segsa; sb2 = segsb2 ? segsb2 : segsb; for (i = 0; i < reps; i++) { XRenderComposite (xp->d, xp->func, src, None, dst, sa2->x1, sa2->y1, 0, 0, sa->x2, sa->y2, size, size); XRenderComposite (xp->d, xp->func, src, None, dst, sa2->x2, sa2->y2, 0, 0, sa->x1, sa->y1, size, size); XRenderComposite (xp->d, xp->func, src, None, dst, sb2->x2, sb2->y2, 0, 0, sb->x1, sb->y1, size, size); XRenderComposite (xp->d, xp->func, src, None, dst, sb2->x1, sb2->y1, 0, 0, sb->x2, sb->y2, size, size); CheckAbort (); sa++; sb++; sa2++; sb2++; } } void DoCompositeWinWin (XParms xp, Parms p, int64_t reps) { CompositeArea (xp, p, reps, winPict, winPict); } void DoCompositePixWin (XParms xp, Parms p, int64_t reps) { CompositeArea (xp, p, reps, pixPict, winPict); } x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_arcs.c0000664000000000000000000003036712514116510015242 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "x11perf.h" static XArc *arcs; static GC pgc; #define DegreesToX(degrees) (degrees * 64) static void GenerateCircles(XParms xp, Parms p, Bool partialArcs, Bool ddashed) { int i; int rows; /* Number of rows filled in current column */ int x, y; /* base of square to draw the circle in */ int xorg, yorg; /* Used to get from column to column or row to row */ int size; int half; int startAngle, arcAngle; if(ddashed) pgc = xp->ddfggc; else pgc = xp->fggc; size = p->special; half = (size + 19) / 20; arcs = (XArc *)malloc((p->objects) * sizeof(XArc)); x = xorg = half; y = yorg = half; rows = 0; startAngle = DegreesToX(0); arcAngle = DegreesToX(360); for (i = 0; i != p->objects; i++) { arcs[i].x = x; arcs[i].y = y; arcs[i].width = size; arcs[i].height = size; arcs[i].angle1 = startAngle; arcs[i].angle2 = arcAngle; if (partialArcs) { startAngle += DegreesToX(30); if (startAngle >= DegreesToX(360)) startAngle -= DegreesToX(360); arcAngle -= DegreesToX(20); if (arcAngle <= DegreesToX(0)) arcAngle += DegreesToX(360); } y += size + 1; rows++; if (y >= HEIGHT - size - half || rows == MAXROWS) { /* Go to next column */ rows = 0; x += size + 1; if (x >= WIDTH - size) { yorg++; if (yorg >= size + half || yorg >= HEIGHT - size - half) { yorg = half; xorg++; if (xorg >= size + half || xorg >= WIDTH - size - half) { xorg = half; } } x = xorg; } y = yorg; } } } int InitCircles(XParms xp, Parms p, int64_t reps) { GenerateCircles(xp, p, False, False); return reps; } int InitPartCircles(XParms xp, Parms p, int64_t reps) { GenerateCircles(xp, p, True, False); return reps; } int InitChordPartCircles(XParms xp, Parms p, int64_t reps) { GenerateCircles(xp, p, True, False); XSetArcMode(xp->d, xp->bggc, ArcChord); XSetArcMode(xp->d, xp->fggc, ArcChord); return reps; } int InitSlicePartCircles(XParms xp, Parms p, int64_t reps) { GenerateCircles(xp, p, True, False); XSetArcMode(xp->d, xp->bggc, ArcPieSlice); XSetArcMode(xp->d, xp->fggc, ArcPieSlice); return reps; } static void GenerateWideCircles(XParms xp, Parms p, Bool partialArcs, Bool ddashed) { int size; GenerateCircles(xp, p, partialArcs, ddashed); size = p->special; if(ddashed) { XSetLineAttributes(xp->d, xp->ddbggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); XSetLineAttributes(xp->d, xp->ddfggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); } else { XSetLineAttributes(xp->d, xp->bggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); XSetLineAttributes(xp->d, xp->fggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); } } int InitWideCircles(XParms xp, Parms p, int64_t reps) { GenerateWideCircles (xp, p, False, False); return reps; } int InitPartWideCircles(XParms xp, Parms p, int64_t reps) { GenerateWideCircles (xp, p, True, False); return reps; } int InitDashedCircles(XParms xp, Parms p, int64_t reps) { char dashes[2]; GenerateCircles(xp, p, False, False); /* Modify GCs to draw dashed */ XSetLineAttributes(xp->d, xp->bggc, 0, LineOnOffDash, CapButt, JoinMiter); XSetLineAttributes(xp->d, xp->fggc, 0, LineOnOffDash, CapButt, JoinMiter); dashes[0] = 3; dashes[1] = 2; XSetDashes(xp->d, xp->fggc, 0, dashes, 2); XSetDashes(xp->d, xp->bggc, 0, dashes, 2); return reps; } int InitWideDashedCircles(XParms xp, Parms p, int64_t reps) { int size; XGCValues gcv; char dashes[2]; GenerateWideCircles(xp, p, False, False); size = p->special; size = (size + 9) / 10; /* Modify GCs to draw dashed */ dashes[0] = 2*size; dashes[1] = 2*size; gcv.line_style = LineOnOffDash; XChangeGC(xp->d, xp->fggc, GCLineStyle, &gcv); XChangeGC(xp->d, xp->bggc, GCLineStyle, &gcv); XSetDashes(xp->d, xp->fggc, 0, dashes, 2); XSetDashes(xp->d, xp->bggc, 0, dashes, 2); return reps; } int InitDoubleDashedCircles(XParms xp, Parms p, int64_t reps) { char dashes[2]; GenerateCircles(xp, p, False, True); /* Modify GCs to draw dashed */ XSetLineAttributes(xp->d, xp->ddbggc, 0, LineDoubleDash, CapButt, JoinMiter); XSetLineAttributes(xp->d, xp->ddfggc, 0, LineDoubleDash, CapButt, JoinMiter); dashes[0] = 3; dashes[1] = 2; XSetDashes(xp->d, xp->ddfggc, 0, dashes, 2); XSetDashes(xp->d, xp->ddbggc, 0, dashes, 2); return reps; } int InitWideDoubleDashedCircles(XParms xp, Parms p, int64_t reps) { int size; XGCValues gcv; char dashes[2]; GenerateWideCircles(xp, p, False, True); size = p->special; size = (size + 9) / 10; /* Modify GCs to draw dashed */ dashes[0] = 2*size; dashes[1] = 2*size; gcv.line_style = LineDoubleDash; XChangeGC(xp->d, xp->ddfggc, GCLineStyle, &gcv); XChangeGC(xp->d, xp->ddbggc, GCLineStyle, &gcv); XSetDashes(xp->d, xp->ddfggc, 0, dashes, 2); XSetDashes(xp->d, xp->ddbggc, 0, dashes, 2); return reps; } static void GenerateEllipses(XParms xp, Parms p, int partialArcs, Bool ddashed) { int size; int half; int rows; /* Number of rows filled in current column */ int i; int x, y; /* base of square to draw ellipse in */ int vsize, vsizeinc; int dir; int startAngle, arcAngle; if(ddashed) pgc = xp->ddfggc; else pgc = xp->fggc; size = p->special; half = (size + 19) / 20; arcs = (XArc *)malloc((p->objects) * sizeof(XArc)); vsize = 1; vsizeinc = (size - 1) / (p->objects - 1); if (vsizeinc == 0) vsizeinc = 1; x = half; y = half; dir = 0; rows = 0; startAngle = DegreesToX(0); arcAngle = DegreesToX(360); for (i = 0; i != p->objects; i++) { arcs[i].x = x; arcs[i].y = y; if ((i & 1) ^ dir) { /* Make vertical axis longer */ arcs[i].width = vsize; arcs[i].height = size; } else { /* Make horizontal axis longer */ arcs[i].width = size; arcs[i].height = vsize; } arcs[i].angle1 = startAngle; arcs[i].angle2 = arcAngle; if (partialArcs) { startAngle += DegreesToX(30); if (startAngle >= DegreesToX(360)) startAngle -= DegreesToX(360); arcAngle -= DegreesToX(20); if (arcAngle <= DegreesToX(0)) arcAngle += DegreesToX(360); } y += size + 1; rows++; if (y >= HEIGHT - size - half || rows == MAXROWS) { /* Go to next column */ rows = 0; y = half; x += size + 1; if (x >= WIDTH - size - half) { x = half; } } vsize += vsizeinc; if (vsize > size) { vsize -= size; dir = 1 - dir; } } } int InitEllipses(XParms xp, Parms p, int64_t reps) { GenerateEllipses(xp, p, False, False); return reps; } int InitPartEllipses(XParms xp, Parms p, int64_t reps) { GenerateEllipses(xp, p, True, False); return reps; } int InitChordPartEllipses(XParms xp, Parms p, int64_t reps) { GenerateEllipses(xp, p, True, False); XSetArcMode(xp->d, xp->bggc, ArcChord); XSetArcMode(xp->d, xp->fggc, ArcChord); return reps; } int InitSlicePartEllipses(XParms xp, Parms p, int64_t reps) { GenerateEllipses(xp, p, True, False); XSetArcMode(xp->d, xp->bggc, ArcPieSlice); XSetArcMode(xp->d, xp->fggc, ArcPieSlice); return reps; } static void GenerateWideEllipses(XParms xp, Parms p, Bool partialArcs, Bool ddashed) { int size; GenerateEllipses (xp, p, partialArcs, ddashed); size = p->special; if(ddashed) { XSetLineAttributes(xp->d, xp->ddbggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); XSetLineAttributes(xp->d, xp->ddfggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); } else { XSetLineAttributes(xp->d, xp->bggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); XSetLineAttributes(xp->d, xp->fggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); } } int InitWideEllipses(XParms xp, Parms p, int64_t reps) { GenerateWideEllipses(xp, p, False, False); return reps; } int InitPartWideEllipses(XParms xp, Parms p, int64_t reps) { GenerateWideEllipses(xp, p, True, False); return reps; } int InitDashedEllipses(XParms xp, Parms p, int64_t reps) { char dashes[2]; GenerateEllipses(xp, p, False, False); /* Modify GCs to draw dashed */ XSetLineAttributes(xp->d, xp->bggc, 0, LineOnOffDash, CapButt, JoinMiter); XSetLineAttributes(xp->d, xp->fggc, 0, LineOnOffDash, CapButt, JoinMiter); dashes[0] = 3; dashes[1] = 2; XSetDashes(xp->d, xp->fggc, 0, dashes, 2); XSetDashes(xp->d, xp->bggc, 0, dashes, 2); return reps; } int InitWideDashedEllipses(XParms xp, Parms p, int64_t reps) { int size; XGCValues gcv; char dashes[2]; GenerateWideEllipses(xp, p, False, False); size = p->special; size = (size + 9) / 10; /* Modify GCs to draw dashed */ dashes[0] = 2*size; dashes[1] = 2*size; gcv.line_style = LineOnOffDash; XChangeGC(xp->d, xp->fggc, GCLineStyle, &gcv); XChangeGC(xp->d, xp->bggc, GCLineStyle, &gcv); XSetDashes(xp->d, xp->fggc, 0, dashes, 2); XSetDashes(xp->d, xp->bggc, 0, dashes, 2); return reps; } int InitDoubleDashedEllipses(XParms xp, Parms p, int64_t reps) { char dashes[2]; GenerateEllipses(xp, p, False, True); /* Modify GCs to draw dashed */ XSetLineAttributes(xp->d, xp->ddbggc, 0, LineDoubleDash, CapButt, JoinMiter); XSetLineAttributes(xp->d, xp->ddfggc, 0, LineDoubleDash, CapButt, JoinMiter); dashes[0] = 3; dashes[1] = 2; XSetDashes(xp->d, xp->ddfggc, 0, dashes, 2); XSetDashes(xp->d, xp->ddbggc, 0, dashes, 2); return reps; } int InitWideDoubleDashedEllipses(XParms xp, Parms p, int64_t reps) { int size; XGCValues gcv; char dashes[2]; GenerateWideEllipses(xp, p, False, True); size = p->special; size = (size + 9) / 10; /* Modify GCs to draw dashed */ dashes[0] = 2*size; dashes[1] = 2*size; gcv.line_style = LineDoubleDash; XChangeGC(xp->d, xp->ddfggc, GCLineStyle, &gcv); XChangeGC(xp->d, xp->ddbggc, GCLineStyle, &gcv); XSetDashes(xp->d, xp->ddfggc, 0, dashes, 2); XSetDashes(xp->d, xp->ddbggc, 0, dashes, 2); return reps; } void DoArcs(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != reps; i++) { XDrawArcs(xp->d, xp->w, pgc, arcs, p->objects); if (pgc == xp->ddbggc) pgc = xp->ddfggc; else if(pgc == xp->ddfggc) pgc = xp->ddbggc; else if (pgc == xp->bggc) pgc = xp->fggc; else pgc = xp->bggc; CheckAbort (); } } void DoFilledArcs(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != reps; i++) { XFillArcs(xp->d, xp->w, pgc, arcs, p->objects); if (pgc == xp->ddbggc) pgc = xp->ddfggc; else if(pgc == xp->ddfggc) pgc = xp->ddbggc; else if (pgc == xp->bggc) pgc = xp->fggc; else pgc = xp->bggc; CheckAbort (); } } void EndArcs(XParms xp, Parms p) { free(arcs); } x11-apps-7.7+5+nmu1ubuntu1/x11perf/config.guess0000775000000000000000000012367212514123564016015 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-11-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/x11perf/Xmark0000664000000000000000000006520712514116510014472 0ustar #! /bin/sh # ############################################################ # # Usage: Xmark datafile # ############################################################ # # # CHANGE HISTORY: # # X11perfcompDR -- Creates a Digital Review compatible breakdown of # x11perf v1.2 results as described in "Take Your Pick Of Graphics" # by John Montgomery, Digital Review, May 7th, 1990, Page 44. # 8/30/90 v1.0 program created by Lonnie Mandigo # 1/18/91 Modification by Lonnie Mandigo # Fixed a bug to include UCIRC in data. # 2/5/91 Modification by Lonnie Mandigo # Now removes sum.tmp file when finished. # 3/18/91 v1.01 Increased resolution to handle zero ratios. # Minor aesethic cleanups and better error handling. # Lonnie Mandigo and Jason Levitt (jason@cs.utexas.edu) # 3/4/93 Converted to Xmark by Bob Kuseski # to produce a single number representing the ratio between # the xpc weighted averages of the output from x11perf Rev 1.3 # for the server under test and a SparcStation 1 # 3/10/93 Changed to produce THREE output numbers and added bounds # checking of input data. # 3/15/93 Removed usage of '-F' in grep for compatibility reasons # 3/16/93 Corrected usage of substr() and used two greps versus fgrep # 4/12/93 Eliminated use of functions and \n in echo # ############################################################ # Copyright (c) 1993 by Hewlett-Packard Company # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both the copyright notice and this permission notice appear in # supporting documentation, and that the name of Hewlett-Packard not be # used in advertising or publicity pertaining to distribution of the # software without specific, written prior permission. # ############################################################ # Instructions: # # Usage: Xmark datafile # # where: 'datafile' is created by running x11perf Rev 1.3 # with the flags below: # # x11perf -display mysystem:0.0 -v1.3 -rop GXcopy GXxor -all > datafile # or # x11perf -display mysystem:0.0 -v1.3 -rop GXcopy -all > datafile # x11perf -display mysystem:0.0 -v1.3 -rop GXxor -all >> datafile # or # x11perf -display mysystem:0.0 -v1.3 -rop GXxor -all > datafile # x11perf -display mysystem:0.0 -v1.3 -rop GXcopy -all >> datafile # # Xmark summarizes the results relative to the data contained in # the datafile. Xmark writes to standard out, so if you want to # capture the output in a file, use: # # Xmark datafile > output.comp # # The 'output.comp' contains THREE numbers: # - Weighted x11perf number of the server under test # - Weighted x11perf number of the SparcStation 1 # - Xmark = the ratio of the above two numbers # # Note the SparcStation 1 number comes from a: # X11R5 Xsun # Standard with SunOS 4.1.2 # SunOs 4.1.2 # CG3 dumb Color Frame Buffer # ############################################################ ############################################################ # Cleanup on interrupt trap \ "echo Interrupt: removing temporary files. >& 2 ;rm -f temp.$$ rates.$$ awkfile.$$; exit 1" 1 2 3 9 15 # Must have only one file specified if [ "$#" -ne 1 ] then echo "Usage: $0 datafile" >& 2 exit 1 fi # Must be an ordinary file if [ ! -f "$1" ] then echo "Error: data file does not exist or is not ordinary." >& 2 exit 1 fi # See if the date file has the correct number of results. LC1=`grep trep "$1" | wc -l` LC2=441 # Number of test without Shared Memory Transport LC3=447 # Number of test with Shared Memory Transport if [ "$LC1" -ne "$LC2" ] && [ "$LC1" -ne "$LC3" ] then echo "WARNING: datafile contains $LC1, not "$LC2" or "$LC3" 'trep' results;" >& 2 if [ "$LC1" -gt "$LC2" ] then echo "extra results are probably OK." >& 2 echo "" fi fi DATA=$1 grep trep $DATA > temp.$$ grep server $DATA >> temp.$$ # convert the averages to standard form. cat > awkfile.$$ <<'EOS' BEGIN { weight["10x10 rectangle"] = 37; weight["Scroll 500x500 pixels"] = 33; weight["100x100 rectangle"] = 32; weight["10-pixel line segment"] = 31; weight["10-pixel line"] = 30; weight["PutImage 100x100 square"] = 30; weight["Scroll 100x100 pixels"] = 29; weight["PutImage 500x500 square"] = 29; weight["500x500 rectangle"] = 29; weight["100-pixel line"] = 28; weight["Char in 60-char line (9x15)"] = 28; weight["Char in 80-char image line (6x13)"] = 28; weight["Char in 80-char line (6x13)"] = 27; weight["Char in 80-char image line (TR 10)"] = 27; weight["100-pixel line segment"] = 27; weight["Char in 80-char line (TR 10)"] = 27; weight["Char in 60-char image line (9x15)"] = 26; weight["Copy 100x100 from pixmap to window"] = 26; weight["Copy 500x500 from pixmap to window"] = 26; weight["Char in 70-char line (8x13)"] = 24; weight["500-pixel line"] = 24; weight["Char in 20/40/20 line (6x13, TR 10)"] = 23; weight["Char in 70-char image line (8x13)"] = 23; weight["Change graphics context"] = 23; weight["Copy 100x100 from window to window"] = 23; weight["10-pixel horizontal line segment"] = 23; weight["10-pixel vertical line segment"] = 23; weight["Copy 500x500 from window to window"] = 22; weight["Char in 30-char line (TR 24)"] = 22; weight["Char16 in 40-char line (k14)"] = 22; weight["500-pixel line segment"] = 22; weight["Char in 30-char image line (TR 24)"] = 22; weight["100-pixel horizontal line segment"] = 22; weight["100-pixel vertical line segment"] = 22; weight["Scroll 10x10 pixels"] = 21; weight["Char16 in 40-char image line (k14)"] = 21; weight["GetImage 500x500 square"] = 21; weight["PutImage 10x10 square"] = 20; weight["GetImage 100x100 square"] = 20; weight["Move window (4 kids)"] = 20; weight["Copy 10x10 from pixmap to window"] = 20; weight["100x100 4x4 tiled rectangle"] = 20; weight["Copy 100x100 from window to pixmap"] = 19; weight["Hide/expose window via popup (4 kids)"] = 19; weight["Copy 500x500 from window to pixmap"] = 19; weight["500-pixel horizontal line segment"] = 19; weight["500-pixel vertical line segment"] = 19; weight["Fill 10x10 equivalent triangle"] = 19; weight["Char16 in 23-char line (k24)"] = 19; weight["1x1 rectangle"] = 19; weight["Char16 in 7/14/7 line (k14, k24)"] = 18; weight["10x10 4x4 tiled rectangle"] = 18; weight["100-pixel line segment (1 kid)"] = 18; weight["100x100 rectangle outline"] = 18; weight["Move window via parent (4 kids)"] = 18; weight["GetAtomName"] = 18; weight["GetProperty"] = 18; weight["Char16 in 23-char image line (k24)"] = 18; weight["100-pixel line segment (3 kids)"] = 17; weight["Resize window (4 kids)"] = 17; weight["Map window via parent (4 kids)"] = 17; weight["Copy 100x100 from pixmap to pixmap"] = 17; weight["Unmap window via parent (4 kids)"] = 17; weight["100-pixel line segment (2 kids)"] = 17; weight["10-pixel solid circle"] = 17; weight["1-pixel line"] = 17; weight["Move window (16 kids)"] = 16; weight["Fill 100x100 equivalent triangle"] = 16; weight["Hide/expose window via popup (16 kids)"] = 16; weight["Move window via parent (16 kids)"] = 16; weight["10x10 rectangle outline"] = 16; weight["Destroy window via parent (4 kids)"] = 16; weight["Create unmapped window (4 kids)"] = 16; weight["Copy 10x10 from window to window"] = 16; weight["Copy 100x100 1-bit deep plane"] = 16; weight["10-pixel circle"] = 16; weight["100x100 opaque stippled rectangle"] = 16; weight["500x500 4x4 tiled rectangle"] = 16; weight["100x100 stippled rectangle"] = 16; weight["Copy 500x500 from pixmap to pixmap"] = 16; weight["Create and map subwindows (16 kids)"] = 16; weight["10x10 stippled rectangle"] = 16; weight["Resize window (16 kids)"] = 16; weight["Map window via parent (16 kids)"] = 15; weight["100-pixel solid circle"] = 15; weight["Copy 500x500 1-bit deep plane"] = 15; weight["500x500 rectangle outline"] = 15; weight["Create and map subwindows (4 kids)"] = 15; weight["Destroy window via parent (16 kids)"] = 15; weight["10x1 wide horizontal line segment"] = 15; weight["10x1 wide vertical line segment"] = 15; weight["100x100 161x145 tiled rectangle"] = 15; weight["1-pixel line segment"] = 15; weight["Unmap window via parent (16 kids)"] = 15; weight["Fill 100x100 trapezoid"] = 14; weight["100-pixel circle"] = 14; weight["10x10 opaque stippled rectangle"] = 14; weight["100-pixel dashed line"] = 14; weight["500x500 161x145 tiled rectangle"] = 14; weight["Copy 10x10 from window to pixmap"] = 14; weight["100x10 wide horizontal line segment"] = 14; weight["100x10 wide vertical line segment"] = 14; weight["100x100 wide rectangle outline"] = 14; weight["100x100 216x208 tiled rectangle"] = 14; weight["Dot"] = 14; weight["10x10 161x145 tiled rectangle"] = 14; weight["Fill 100x100 equivalent complex polygons"] = 14; weight["Move window (50 kids)"] = 13; weight["Move window via parent (50 kids)"] = 13; weight["Circulate window (16 kids)"] = 13; weight["100-pixel dashed segment"] = 13; weight["Create and map subwindows (50 kids)"] = 13; weight["Create and map subwindows (25 kids)"] = 13; weight["10x10 wide rectangle outline"] = 13; weight["500x500 216x208 tiled rectangle"] = 13; weight["Hide/expose window via popup (25 kids)"] = 13; weight["Create and map subwindows (100 kids)"] = 13; weight["Map window via parent (50 kids)"] = 13; weight["Fill 10x10 trapezoid"] = 13; weight["100x10 wide line"] = 13; weight["10x10 216x208 tiled rectangle"] = 13; weight["10-pixel dashed line"] = 13; weight["Map window via parent (100 kids)"] = 13; weight["Copy 10x10 from pixmap to pixmap"] = 13; weight["Map window via parent (25 kids)"] = 13; weight["Create unmapped window (25 kids)"] = 13; weight["Move window (25 kids)"] = 13; weight["Circulate window (4 kids)"] = 12; weight["Move window via parent (25 kids)"] = 12; weight["Create unmapped window (16 kids)"] = 12; weight["Create and map subwindows (75 kids)"] = 12; weight["500x500 opaque stippled rectangle"] = 12; weight["Hide/expose window via popup (100 kids)"] = 12; weight["Create and map subwindows (200 kids)"] = 12; weight["Hide/expose window via popup (50 kids)"] = 12; weight["500x50 wide horizontal line segment"] = 12; weight["500x50 wide vertical line segment"] = 12; weight["100x100 161x145 opaque stippled rectangle"] = 12; weight["Resize window (25 kids)"] = 12; weight["Map window via parent (200 kids)"] = 12; weight["10x10 161x145 opaque stippled rectangle"] = 12; weight["X protocol NoOperation"] = 12; weight["10-pixel dashed segment"] = 12; weight["Resize unmapped window (16 kids)"] = 12; weight["Create unmapped window (100 kids)"] = 12; weight["Fill 10x10 equivalent complex polygon"] = 12; weight["Map window via parent (75 kids)"] = 12; weight["100x100 161x145 stippled rectangle"] = 12; weight["Moved unmapped window (16 kids)"] = 12; weight["Copy 10x10 1-bit deep plane"] = 12; weight["Unmap window via parent (50 kids)"] = 12; weight["GetImage 10x10 square"] = 12; weight["Fill 100x100 tiled trapezoid"] = 12; weight["500x500 wide rectangle outline"] = 12; weight["Fill 100x100 stippled trapezoid"] = 12; weight["500x500 stippled rectangle"] = 12; weight["Moved unmapped window (4 kids)"] = 12; weight["10x10 161x145 stippled rectangle"] = 12; weight["Unmap window via parent (25 kids)"] = 12; weight["500-pixel solid circle"] = 12; weight["Create unmapped window (50 kids)"] = 12; weight["Destroy window via parent (25 kids)"] = 11; weight["Resize window (200 kids)"] = 11; weight["100-pixel filled ellipse"] = 11; weight["Hide/expose window via popup (200 kids)"] = 11; weight["Unmap window via parent (100 kids)"] = 11; weight["Circulate window (25 kids)"] = 11; weight["Resize window (50 kids)"] = 11; weight["Hide/expose window via popup (75 kids)"] = 11; weight["Destroy window via parent (100 kids)"] = 11; weight["Destroy window via parent (50 kids)"] = 11; weight["Create unmapped window (200 kids)"] = 11; weight["Fill 100x100 opaque stippled trapezoid"] = 11; weight["Move window via parent (75 kids)"] = 11; weight["500-pixel filled ellipse"] = 11; weight["Resize unmapped window (4 kids)"] = 11; weight["Move window via parent (200 kids)"] = 11; weight["Move window (75 kids)"] = 11; weight["Fill 10x10 tiled trapezoid"] = 11; weight["Fill 100x100 161x145 stippled trapezoid"] = 11; weight["Move window (200 kids)"] = 11; weight["Fill 10x10 stippled trapezoid"] = 11; weight["Create unmapped window (75 kids)"] = 11; weight["100-pixel fill chord partial circle"] = 10; weight["Circulate Unmapped window (16 kids)"] = 10; weight["Circulate window (50 kids)"] = 10; weight["Move window (100 kids)"] = 10; weight["Circulate window (100 kids)"] = 10; weight["Move window via parent (100 kids)"] = 10; weight["500x50 wide line"] = 10; weight["500-pixel circle"] = 10; weight["100-pixel double-dashed line"] = 10; weight["Unmap window via parent (200 kids)"] = 10; weight["Moved unmapped window (50 kids)"] = 10; weight["10-pixel filled ellipse"] = 10; weight["Resize window (75 kids)"] = 10; weight["Fill 100x100 161x145 tiled trapezoid"] = 10; weight["500x500 161x145 opaque stippled rectangle"] = 10; weight["Fill 100x100 161x145 opaque stippled trapezoid"] = 10; weight["Unmap window via parent (75 kids)"] = 10; weight["Resize unmapped window (25 kids)"] = 10; weight["100-pixel ellipse"] = 10; weight["Destroy window via parent (75 kids)"] = 10; weight["Fill 1x1 equivalent triangle"] = 10; weight["500-pixel ellipse"] = 10; weight["Fill 10x10 opaque stippled trapezoid"] = 10; weight["Resize window (100 kids)"] = 10; weight["500x500 161x145 stippled rectangle"] = 10; weight["Destroy window via parent (200 kids)"] = 10; weight["100-pixel fill slice partial circle"] = 10; weight["Fill 100x100 216x208 tiled trapezoid"] = 9; weight["100-pixel wide circle"] = 9; weight["Moved unmapped window (25 kids)"] = 9; weight["10x1 wide line"] = 9; weight["Resize unmapped window (100 kids)"] = 9; weight["100-pixel double-dashed segment"] = 9; weight["10-pixel fill chord partial circle"] = 9; weight["Circulate window (75 kids)"] = 9; weight["100-pixel partial circle"] = 9; weight["Circulate window (200 kids)"] = 9; weight["Fill 10x10 161x145 stippled trapezoid"] = 9; weight["Circulate Unmapped window (4 kids)"] = 9; weight["100-pixel dashed circle"] = 9; weight["Circulate Unmapped window (25 kids)"] = 9; weight["10-pixel ellipse"] = 9; weight["Resize unmapped window (50 kids)"] = 9; weight["100-pixel partial ellipse"] = 9; weight["Fill 10x10 161x145 tiled trapezoid"] = 8; weight["100x10 wide dashed line"] = 8; weight["10-pixel partial circle"] = 8; weight["100-pixel wide ellipse"] = 8; weight["Fill 10x10 161x145 opaque stippled trapezoid"] = 8; weight["100-pixel wide partial circle"] = 8; weight["Moved unmapped window (75 kids)"] = 8; weight["Resize unmapped window (75 kids)"] = 8; weight["Circulate Unmapped window (100 kids)"] = 8; weight["100-pixel fill slice partial ellipse"] = 8; weight["100x10 wide double-dashed line"] = 8; weight["10-pixel fill slice partial circle"] = 8; weight["100-pixel dashed ellipse"] = 8; weight["100-pixel fill chord partial ellipse"] = 8; weight["100-pixel wide dashed circle"] = 8; weight["100-pixel double-dashed circle"] = 8; weight["Fill 10x10 216x208 tiled trapezoid"] = 7; weight["Moved unmapped window (100 kids)"] = 7; weight["10-pixel wide circle"] = 7; weight["Moved unmapped window (200 kids)"] = 7; weight["Resize unmapped window (200 kids)"] = 7; weight["Circulate Unmapped window (50 kids)"] = 7; weight["1-pixel circle"] = 7; weight["10-pixel partial ellipse"] = 7; weight["500-pixel wide circle"] = 7; weight["500-pixel wide ellipse"] = 7; weight["100-pixel wide partial ellipse"] = 7; weight["Circulate Unmapped window (75 kids)"] = 7; weight["100-pixel wide dashed ellipse"] = 7; weight["100-pixel double-dashed ellipse"] = 7; weight["10-pixel wide ellipse"] = 6; weight["10-pixel wide partial circle"] = 6; weight["1-pixel solid circle"] = 6; weight["100-pixel wide double-dashed circle"] = 6; weight["Circulate Unmapped window (200 kids)"] = 6; weight["1x1 4x4 tiled rectangle"] = 6; weight["10-pixel wide partial ellipse"] = 6; weight["10-pixel fill chord partial ellipse"] = 6; weight["10-pixel fill slice partial ellipse"] = 6; weight["100-pixel wide double-dashed ellipse"] = 5; weight["1x1 161x145 tiled rectangle"] = 5; weight["1x1 216x208 tiled rectangle"] = 5; weight["1x1 stippled rectangle"] = 5; weight["1x1 opaque stippled rectangle"] = 4; weight["1x1 161x145 opaque stippled rectangle"] = 4; weight["1x1 161x145 stippled rectangle"] = 4; weight["ShmPutImage 10x10 square"] = 0; weight["ShmPutImage 100x100 square"] = 0; weight["ShmPutImage 500x500 square"] = 0; weight["(xor) 100-pixel line"] = 16; weight["(xor) 10-pixel line segment"] = 14; weight["(xor) 10-pixel line"] = 13; weight["(xor) 100-pixel line segment"] = 13; weight["(xor) 500-pixel line segment"] = 13; weight["(xor) 500-pixel line"] = 12; weight["(xor) 10x10 rectangle"] = 12; weight["(xor) 100x100 rectangle"] = 12; weight["(xor) 100-pixel vertical line segment"] = 10; weight["(xor) 100x100 rectangle outline"] = 10; weight["(xor) 100-pixel horizontal line segment"] = 10; weight["(xor) 10-pixel vertical line segment"] = 10; weight["(xor) 100-pixel line segment (2 kids)"] = 10; weight["(xor) 10-pixel horizontal line segment"] = 10; weight["(xor) 100-pixel line segment (1 kid)"] = 9; weight["(xor) Char in 80-char line (6x13)"] = 9; weight["(xor) 500-pixel vertical line segment"] = 9; weight["(xor) Copy 100x100 from pixmap to window"] = 9; weight["(xor) 10x10 rectangle outline"] = 9; weight["(xor) 500-pixel horizontal line segment"] = 9; weight["(xor) 100-pixel line segment (3 kids)"] = 9; weight["(xor) PutImage 100x100 square"] = 9; weight["(xor) 500x500 rectangle outline"] = 9; weight["(xor) Char in 80-char line (TR 10)"] = 9; weight["(xor) 500x500 rectangle"] = 9; weight["(xor) Copy 500x500 from pixmap to window"] = 8; weight["(xor) Char in 20/40/20 line (6x13, TR 10)"] = 8; weight["(xor) 100-pixel dashed line"] = 8; weight["(xor) Copy 100x100 1-bit deep plane"] = 8; weight["(xor) Char in 60-char line (9x15)"] = 8; weight["(xor) Char16 in 40-char line (k14)"] = 7; weight["(xor) Fill 10x10 equivalent triangle"] = 7; weight["(xor) PutImage 500x500 square"] = 7; weight["(xor) Copy 100x100 from window to window"] = 7; weight["(xor) 100-pixel dashed segment"] = 7; weight["(xor) 100x100 wide rectangle outline"] = 6; weight["(xor) Char16 in 7/14/7 line (k14, k24)"] = 6; weight["(xor) Fill 100x100 trapezoid"] = 6; weight["(xor) 100-pixel solid circle"] = 6; weight["(xor) 10-pixel solid circle"] = 6; weight["(xor) 1-pixel line segment"] = 6; weight["(xor) 1-pixel line"] = 6; weight["(xor) 10x1 wide horizontal line segment"] = 6; weight["(xor) 10x1 wide vertical line segment"] = 6; weight["(xor) Copy 100x100 from pixmap to pixmap"] = 6; weight["(xor) 10-pixel dashed line"] = 6; weight["(xor) Char in 30-char line (TR 24)"] = 6; weight["(xor) Fill 100x100 equivalent triangle"] = 6; weight["(xor) Copy 10x10 from pixmap to window"] = 6; weight["(xor) Fill 10x10 trapezoid"] = 6; weight["(xor) Char in 70-char line (8x13)"] = 6; weight["(xor) 100-pixel circle"] = 6; weight["(xor) Copy 100x100 from window to pixmap"] = 6; weight["(xor) 10-pixel dashed segment"] = 5; weight["(xor) 10-pixel circle"] = 5; weight["(xor) 10x10 wide rectangle outline"] = 5; weight["(xor) 100x100 stippled rectangle"] = 5; weight["(xor) 100-pixel filled ellipse"] = 5; weight["(xor) 10x10 4x4 tiled rectangle"] = 5; weight["(xor) PutImage 10x10 square"] = 5; weight["(xor) Copy 500x500 from window to window"] = 5; weight["(xor) 500x500 wide rectangle outline"] = 5; weight["(xor) 10x10 stippled rectangle"] = 5; weight["(xor) 100x10 wide line"] = 5; weight["(xor) 100x10 wide horizontal line segment"] = 5; weight["(xor) 100x10 wide vertical line segment"] = 5; weight["(xor) Scroll 100x100 pixels"] = 5; weight["(xor) Char16 in 23-char line (k24)"] = 5; weight["(xor) Dot"] = 5; weight["(xor) Copy 500x500 1-bit deep plane"] = 5; weight["(xor) 100-pixel ellipse"] = 5; weight["(xor) 100x100 4x4 tiled rectangle"] = 5; weight["(xor) Copy 10x10 1-bit deep plane"] = 5; weight["(xor) 1x1 rectangle"] = 5; weight["(xor) 500-pixel solid circle"] = 4; weight["(xor) 500-pixel filled ellipse"] = 4; weight["(xor) 10-pixel filled ellipse"] = 4; weight["(xor) Fill 100x100 stippled trapezoid"] = 4; weight["(xor) 500x50 wide line"] = 4; weight["(xor) 500-pixel circle"] = 4; weight["(xor) 100-pixel double-dashed line"] = 4; weight["(xor) 500x50 wide horizontal line segment"] = 4; weight["(xor) 500x50 wide vertical line segment"] = 4; weight["(xor) 100-pixel dashed circle"] = 4; weight["(xor) 10x10 opaque stippled rectangle"] = 4; weight["(xor) 10-pixel ellipse"] = 4; weight["(xor) Copy 500x500 from pixmap to pixmap"] = 4; weight["(xor) 100x100 161x145 stippled rectangle"] = 4; weight["(xor) 10x10 161x145 tiled rectangle"] = 4; weight["(xor) Copy 10x10 from window to window"] = 4; weight["(xor) Copy 10x10 from pixmap to pixmap"] = 4; weight["(xor) 10x10 161x145 stippled rectangle"] = 4; weight["(xor) 100-pixel wide circle"] = 4; weight["(xor) 500x500 stippled rectangle"] = 4; weight["(xor) 500-pixel ellipse"] = 4; weight["(xor) 10x10 216x208 tiled rectangle"] = 4; weight["(xor) Fill 100x100 equivalent complex polygons"] = 4; weight["(xor) 100-pixel double-dashed segment"] = 3; weight["(xor) 10x10 161x145 opaque stippled rectangle"] = 3; weight["(xor) Fill 10x10 opaque stippled trapezoid"] = 3; weight["(xor) 100-pixel partial circle"] = 3; weight["(xor) Fill 10x10 161x145 stippled trapezoid"] = 3; weight["(xor) Fill 10x10 161x145 opaque stippled trapezoid"] = 3; weight["(xor) Scroll 500x500 pixels"] = 3; weight["(xor) 100x100 opaque stippled rectangle"] = 3; weight["(xor) Fill 10x10 stippled trapezoid"] = 3; weight["(xor) 100x10 wide dashed line"] = 3; weight["(xor) Copy 10x10 from window to pixmap"] = 3; weight["(xor) Copy 500x500 from window to pixmap"] = 3; weight["(xor) 500x500 opaque stippled rectangle"] = 3; weight["(xor) Fill 10x10 tiled trapezoid"] = 3; weight["(xor) 100x100 161x145 tiled rectangle"] = 3; weight["(xor) 100-pixel partial ellipse"] = 3; weight["(xor) 100-pixel fill slice partial circle"] = 3; weight["(xor) Fill 1x1 equivalent triangle"] = 3; weight["(xor) 100-pixel double-dashed circle"] = 3; weight["(xor) 500x500 4x4 tiled rectangle"] = 3; weight["(xor) 100-pixel wide ellipse"] = 3; weight["(xor) 100-pixel fill chord partial circle"] = 3; weight["(xor) 100x100 216x208 tiled rectangle"] = 3; weight["(xor) Fill 10x10 161x145 tiled trapezoid"] = 3; weight["(xor) Fill 100x100 216x208 tiled trapezoid"] = 3; weight["(xor) 500x500 161x145 stippled rectangle"] = 3; weight["(xor) 500x500 161x145 tiled rectangle"] = 3; weight["(xor) 100x100 161x145 opaque stippled rectangle"] = 3; weight["(xor) 500x500 161x145 opaque stippled rectangle"] = 3; weight["(xor) 10x1 wide line"] = 3; weight["(xor) 500x500 216x208 tiled rectangle"] = 3; weight["(xor) 100-pixel dashed ellipse"] = 3; weight["(xor) Fill 100x100 opaque stippled trapezoid"] = 3; weight["(xor) 10-pixel partial circle"] = 3; weight["(xor) 100x10 wide double-dashed line"] = 3; weight["(xor) Fill 100x100 161x145 stippled trapezoid"] = 3; weight["(xor) Fill 100x100 161x145 opaque stippled trapezoid"] = 3; weight["(xor) 100-pixel fill slice partial ellipse"] = 3; weight["(xor) 1-pixel circle"] = 3; weight["(xor) Fill 10x10 equivalent complex polygon"] = 3; weight["(xor) 100-pixel wide dashed circle"] = 2; weight["(xor) 100-pixel wide double-dashed circle"] = 2; weight["(xor) Scroll 10x10 pixels"] = 2; weight["(xor) 10-pixel wide circle"] = 2; weight["(xor) 100-pixel fill chord partial ellipse"] = 2; weight["(xor) Fill 100x100 tiled trapezoid"] = 2; weight["(xor) 100-pixel double-dashed ellipse"] = 2; weight["(xor) 100-pixel wide dashed ellipse"] = 2; weight["(xor) 100-pixel wide double-dashed ellipse"] = 2; weight["(xor) 10-pixel partial ellipse"] = 2; weight["(xor) 100-pixel wide partial circle"] = 2; weight["(xor) 100-pixel wide partial ellipse"] = 2; weight["(xor) 10-pixel fill slice partial circle"] = 2; weight["(xor) 10-pixel wide ellipse"] = 2; weight["(xor) Fill 100x100 161x145 tiled trapezoid"] = 2; weight["(xor) Fill 10x10 216x208 tiled trapezoid"] = 2; weight["(xor) 10-pixel fill chord partial circle"] = 2; weight["(xor) 500-pixel wide circle"] = 2; weight["(xor) 500-pixel wide ellipse"] = 2; weight["(xor) 1-pixel solid circle"] = 2; weight["(xor) 10-pixel fill chord partial ellipse"] = 2; weight["(xor) 10-pixel fill slice partial ellipse"] = 2; weight["(xor) 10-pixel wide partial circle"] = 1; weight["(xor) 10-pixel wide partial ellipse"] = 1; weight["(xor) 1x1 stippled rectangle"] = 1; weight["(xor) 1x1 161x145 stippled rectangle"] = 1; weight["(xor) 1x1 opaque stippled rectangle"] = 1; weight["(xor) 1x1 161x145 opaque stippled rectangle"] = 1; weight["(xor) 1x1 4x4 tiled rectangle"] = 1; weight["(xor) 1x1 161x145 tiled rectangle"] = 1; weight["(xor) 1x1 216x208 tiled rectangle"] = 1; weight["(xor) ShmPutImage 10x10 square"] = 0; weight["(xor) ShmPutImage 100x100 square"] = 0; weight["(xor) ShmPutImage 500x500 square"] = 0; sumofweights = 0; } $0 ~ /server/ { printf("name:%s\n",substr($0,1,index($0,"server")-2)); } { split($0,parts,":"); # get rate and name start = index(parts[1],"(") + 1; # find left parentheses end = index(parts[1],"/"); # find terminating '/' rate = substr(parts[1],start,end-start);# get ops/sec name = parts[2]; while (substr(name,1,1) == " ") { # remove leading spaces name = substr(name,2,length(name)); } thisweight = weight[name]; weight[name] = 0; # clear to avoid double counting sumofweights += thisweight; printf("%d:",thisweight); # output in new format printf("%.1f\n",rate); } END{ printf("sumof:%.1f\n",sumofweights); } EOS awk -f awkfile.$$ temp.$$ > rates.$$ rm -f awkfile.$$ # cleanup # calculate the weighted average sumofweights=`grep sumof rates.$$ | awk -F: ' { print($2) }' - ` if [ "$sumofweights" != "4566.0" ] then echo "ERROR: sum of weights =$sumofweights, not equal to 4566.0;" echo "ABORTING!" rm -f rates.$$ temp.$$ exit 1 fi awk -F: ' BEGIN { logsum = 0; name = "tested" } $1 == "name" { name = $2;next } { weight = $1; rate = $2; if (rate > 0.0) { # generate weighted log sum logsum += ( log( rate ) * weight ); } } END { SparcStation1 = 2118.51; WeightedAverage = exp(logsum/4566.0); printf("Weighted x11perf of %s server =%6.0f\n", name,WeightedAverage); printf("Weighted x11perf of SparcStation 1 server =%5.0f\n", SparcStation1); printf("Xmark =%8.4f\n", WeightedAverage/SparcStation1); }' rates.$$ rm -f temp.$$ rates.$$ awkfile.$$ # cleanup exit 0 x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_text.c0000664000000000000000000003126012514116510015267 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "x11perf.h" #include static char **charBuf; static XFontStruct *font, *bfont; static int height, ypos; static XTextItem *items; static int charsPerLine, totalLines; #define XPOS 20 #define SEGS 3 int InitText(XParms xp, Parms p, int64_t reps) { int i, j; char ch; XGCValues gcv; font = XLoadQueryFont(xp->d, p->font); if (font == NULL) { printf("Could not load font '%s', benchmark omitted\n", p->font); return 0; } bfont = NULL; if (p->bfont != NULL) { bfont = XLoadQueryFont(xp->d, p->bfont); if (bfont == NULL) { printf("Could not load font '%s', benchmark omitted\n", p->bfont); return 0; } } ypos = XPOS; height = (font->max_bounds.ascent + font->max_bounds.descent) + 1; if (bfont != NULL) { int h = (bfont->max_bounds.ascent + bfont->max_bounds.descent) + 1; if (h > height) height = h; } gcv.font = font->fid; XChangeGC(xp->d, xp->fggc, GCFont, &gcv); XChangeGC(xp->d, xp->bggc, GCFont, &gcv); charsPerLine = p->objects; charsPerLine = (charsPerLine + 3) & ~3; p->objects = charsPerLine; totalLines = '\177' - ' ' + 1; if (totalLines > reps) totalLines = reps; charBuf = (char **) malloc(totalLines*sizeof (char *)); if (p->special) items = (XTextItem *) malloc(totalLines*SEGS*sizeof (XTextItem)); for (i = 0; i != totalLines; i++) { charBuf[i] = (char *) malloc (sizeof (char)*charsPerLine); ch = i + ' '; for (j = 0; j != charsPerLine; j++) { charBuf[i][j] = ch; if (ch == '\177') ch = ' '; else ch++; } if (p->special) { items[i*SEGS+0].chars = &(charBuf[i][0]); items[i*SEGS+0].nchars = charsPerLine/4; items[i*SEGS+0].delta = 0; items[i*SEGS+0].font = font->fid; items[i*SEGS+1].chars = &(charBuf[i][charsPerLine/4]); items[i*SEGS+1].nchars = charsPerLine/2; items[i*SEGS+1].delta = 3; items[i*SEGS+1].font = bfont->fid; items[i*SEGS+2].chars = &(charBuf[i][3*charsPerLine/4]); items[i*SEGS+2].nchars = charsPerLine/4; items[i*SEGS+2].delta = 3; items[i*SEGS+2].font = font->fid; } } return reps; } #define GetRealChar(font, totalChars, ch) \ { \ XCharStruct *pci; \ do { \ ch--; \ if (ch < 0) { \ ch = totalChars-1; \ } \ if (font->per_char == NULL) break; \ pci = &(font->per_char[ch]); \ } while ( (pci->lbearing | pci->rbearing | pci->width \ | pci->ascent | pci->descent | pci->attributes) == 0); \ } /* GetRealChar */ int InitText16(XParms xp, Parms p, int64_t reps) { register int i, j; register char *pbuf0, *pbuf1, *pbuf2; XGCValues gcv; int rows, columns, totalChars, ch; int brows, bcolumns = 0, btotalChars = 0, bch = 0; font = XLoadQueryFont(xp->d, p->font); if (font == NULL) { printf("Could not load font '%s', benchmark omitted\n", p->font); return 0; } rows = font->max_byte1 - font->min_byte1 + 1; columns = font->max_char_or_byte2 - font->min_char_or_byte2 + 1; totalChars = rows * columns; totalLines = rows; ch = totalChars; bfont = NULL; if (p->bfont != NULL) { bfont = XLoadQueryFont(xp->d, p->bfont); if (bfont == NULL) { printf("Could not load font '%s', benchmark omitted\n", p->bfont); return 0; } brows = bfont->max_byte1 - bfont->min_byte1 + 1; bcolumns = bfont->max_char_or_byte2 - bfont->min_char_or_byte2 + 1; btotalChars = brows * bcolumns; bch = btotalChars; if (brows > totalLines) totalLines = brows; } ypos = XPOS; height = (font->max_bounds.ascent + font->max_bounds.descent) + 1; if (bfont != NULL) { int h = (bfont->max_bounds.ascent + bfont->max_bounds.descent) + 1; if (h > height) height = h; } gcv.font = font->fid; XChangeGC(xp->d, xp->fggc, GCFont, &gcv); XChangeGC(xp->d, xp->bggc, GCFont, &gcv); charsPerLine = p->objects; if (totalLines > reps) totalLines = reps; if (p->special) { charsPerLine = (charsPerLine + 3) & ~3; /* make a multiple of four */ p->objects = charsPerLine; items = (XTextItem *) malloc(totalLines*SEGS*sizeof (XTextItem)); for (i = 0; i < totalLines; i++) { pbuf0 = items[i*SEGS+0].chars = (char *) malloc (sizeof (char)*charsPerLine/2); items[i*SEGS+0].nchars = charsPerLine/4; items[i*SEGS+0].delta = 0; items[i*SEGS+0].font = font->fid; pbuf1 = items[i*SEGS+1].chars = (char *) malloc (sizeof (char)*charsPerLine); items[i*SEGS+1].nchars = charsPerLine/2; items[i*SEGS+1].delta = 3; items[i*SEGS+1].font = bfont->fid; pbuf2 = items[i*SEGS+2].chars = (char *) malloc (sizeof (char)*charsPerLine/2); items[i*SEGS+2].nchars = charsPerLine/4; items[i*SEGS+2].delta = 3; items[i*SEGS+2].font = font->fid; for (j = 0; j < charsPerLine/4; j++) { GetRealChar(font, totalChars, ch); *pbuf0++ = ch / columns + font->min_byte1; *pbuf0++ = ch % columns + font->min_char_or_byte2; GetRealChar(font, totalChars, ch); *pbuf2++ = ch / columns + font->min_byte1; *pbuf2++ = ch % columns + font->min_char_or_byte2; } for (j = 0; j < charsPerLine/2; j++) { GetRealChar(bfont, btotalChars, bch); *pbuf1++ = bch / bcolumns + bfont->min_byte1; *pbuf1++ = bch % bcolumns + bfont->min_char_or_byte2; } } } else { charBuf = (char **) malloc(totalLines*sizeof (char *)); for (i = 0; i < totalLines; i++) { pbuf0 = charBuf[i] = (char *) malloc (sizeof (char)*charsPerLine*2); for (j = 0; j < charsPerLine; j++) { GetRealChar(font, totalChars, ch); *pbuf0++ = ch / columns + font->min_byte1; *pbuf0++ = ch % columns + font->min_char_or_byte2; } } } return reps; } void DoText(XParms xp, Parms p, int64_t reps) { int i, line, startLine; startLine = 0; line = 0; for (i = 0; i != reps; i++) { XDrawString( xp->d, xp->w, xp->fggc, XPOS, ypos, charBuf[line], charsPerLine); ypos += height; if (ypos > HEIGHT - height) { /* Wraparound to top of window */ ypos = XPOS; line = startLine; startLine = (startLine + 1) % totalLines; } line = (line + 1) % totalLines; CheckAbort (); } } void DoText16(XParms xp, Parms p, int64_t reps) { int i, line, startLine; startLine = 0; line = 0; for (i = 0; i < reps; i++) { XDrawString16( xp->d, xp->w, xp->fggc, XPOS, ypos, (XChar2b *)charBuf[line], charsPerLine); ypos += height; if (ypos > HEIGHT - height) { /* Wraparound to top of window */ ypos = XPOS; line = startLine; startLine = (startLine + 1) % totalLines; } line = (line + 1) % totalLines; CheckAbort (); } } void DoPolyText(XParms xp, Parms p, int64_t reps) { int i, line, startLine; startLine = 0; line = 0; for (i = 0; i != reps; i++) { XDrawText( xp->d, xp->w, xp->fggc, XPOS, ypos, &items[line*SEGS], SEGS); ypos += height; if (ypos > HEIGHT - height) { /* Wraparound to top of window */ ypos = XPOS; line = startLine; startLine = (startLine + 1) % totalLines; } line = (line + 1) % totalLines; CheckAbort (); } } void DoPolyText16(XParms xp, Parms p, int64_t reps) { int i, line, startLine; startLine = 0; line = 0; for (i = 0; i != reps; i++) { XDrawText16( xp->d, xp->w, xp->fggc, XPOS, ypos, (XTextItem16 *)&items[line*SEGS], SEGS); ypos += height; if (ypos > HEIGHT - height) { /* Wraparound to top of window */ ypos = XPOS; line = startLine; startLine = (startLine + 1) % totalLines; } line = (line + 1) % totalLines; CheckAbort (); } } void DoImageText(XParms xp, Parms p, int64_t reps) { int i, line, startLine; startLine = 0; line = 0; for (i = 0; i != reps; i++) { XDrawImageString( xp->d, xp->w, xp->fggc, XPOS, ypos, charBuf[line], charsPerLine); ypos += height; if (ypos > HEIGHT - height) { /* Wraparound to top of window */ ypos = XPOS; startLine = (startLine + 17) % totalLines; line = startLine; } line = (line + 1) % totalLines; CheckAbort (); } } void DoImageText16(XParms xp, Parms p, int64_t reps) { int i, line, startLine; startLine = 0; line = 0; for (i = 0; i != reps; i++) { XDrawImageString16( xp->d, xp->w, xp->fggc, XPOS, ypos, (XChar2b *)charBuf[line], charsPerLine); ypos += height; if (ypos > HEIGHT - height) { /* Wraparound to top of window */ ypos = XPOS; startLine = (startLine + 17) % totalLines; line = startLine; } line = (line + 1) % totalLines; CheckAbort (); } } void ClearTextWin(XParms xp, Parms p) { XClearWindow(xp->d, xp->w); } void EndText(XParms xp, Parms p) { int i; if(font==NULL)return; for (i = 0; i != totalLines; i++) free(charBuf[i]); free(charBuf); if (p->special) free(items); XFreeFont(xp->d, font); if (bfont != NULL) XFreeFont(xp->d, bfont); } void EndText16(XParms xp, Parms p) { int i; if(font==NULL)return; if (p->special) { for (i = 0; i < totalLines; i++) { free(items[i*SEGS+0].chars); free(items[i*SEGS+1].chars); free(items[i*SEGS+2].chars); } free(items); } else { for (i = 0; i < totalLines; i++) { free(charBuf[i]); } free(charBuf); } XFreeFont(xp->d, font); if(bfont != NULL) { XFreeFont(xp->d, bfont); } } #ifdef XFT #include #include static XftFont *aafont; static XftDraw *aadraw; static XftColor aacolor; int InitAAText(XParms xp, Parms p, int64_t reps) { int i, j; char ch; XRenderColor color; aafont = XftFontOpenName (xp->d, DefaultScreen (xp->d), p->font); if (aafont == NULL) { printf("Could not load font '%s', benchmark omitted\n", p->font); return 0; } aadraw = XftDrawCreate (xp->d, xp->w, xp->vinfo.visual, xp->cmap); if (!aadraw) { printf ("Cannot create XftDraw object\n"); XftFontClose (xp->d, aafont); return 0; } color.red = 0; color.green = 0; color.blue = 0; color.alpha = 0xffff; if (!XftColorAllocValue (xp->d, xp->vinfo.visual, xp->cmap, &color, &aacolor)) { printf ("Cannot allocate black\n"); XftFontClose (xp->d, aafont); XftDrawDestroy (aadraw); aafont = NULL; aadraw = NULL; return 0; } ypos = XPOS; height = aafont->height; charsPerLine = p->objects; charsPerLine = (charsPerLine + 3) & ~3; p->objects = charsPerLine; totalLines = '\177' - ' ' + 1; if (totalLines > reps) totalLines = reps; charBuf = (char **) malloc(totalLines*sizeof (char *)); for (i = 0; i != totalLines; i++) { charBuf[i] = (char *) malloc (sizeof (char)*charsPerLine); ch = i + ' '; for (j = 0; j != charsPerLine; j++) { charBuf[i][j] = ch; if (ch == '\177') ch = ' '; else ch++; } } return reps; } void DoAAText(XParms xp, Parms p, int64_t reps) { int i, line, startLine; startLine = 0; line = 0; for (i = 0; i != reps; i++) { XftDrawString8 (aadraw, &aacolor, aafont, XPOS, ypos, (unsigned char *) charBuf[line], charsPerLine); ypos += height; if (ypos > HEIGHT - height) { /* Wraparound to top of window */ ypos = XPOS; line = startLine; startLine = (startLine + 1) % totalLines; } line = (line + 1) % totalLines; CheckAbort (); } } void EndAAText(XParms xp, Parms p) { int i; if(!aadraw)return; for (i = 0; i != totalLines; i++) free(charBuf[i]); free(charBuf); XftDrawDestroy (aadraw); XftFontClose (xp->d, aafont); XftColorFree (xp->d, xp->vinfo.visual, xp->cmap, &aacolor); } #endif x11-apps-7.7+5+nmu1ubuntu1/x11perf/x11perfcomp.in0000664000000000000000000000535412514116510016157 0ustar #! /bin/sh # # Collects multiple outputs of x11perf. Just feed it a list of files, each # containing the output from an x11perf run, and this shell will extract the # object/second information and show it in tabular form. An 80-column line # is big enough to compare 4 different servers. # # This script normally uses the results from $1 to extract the test label # descriptions, so you can run x11perf on a subset of the test and then # compare the results. But note that x11perffill requires the labels file # to be a superset of the x11perf results file. If you run into an ugly # situation in which none of the servers completes the desired tests # (quite possible on non-DEC servers :), you can use -l as $1 and # $2 to force x11perfcomp to use the labels stored in file $2. (You can run # x11perf with the -labels option to generate such a file.) # # Mark Moraes, University of Toronto # Joel McCormack, DEC Western Research Lab # PATH="@x11perfcompdir@:/bin:/usr/bin:$PATH" export PATH MKTEMP="@MKTEMP@" set -e if [ "x$MKTEMP" != "x" ] && [ -x "$MKTEMP" ] ; then tmp=`$MKTEMP -p /tmp -d rates.XXXXXX` if [ "x$tmp" = "x" ]; then exit 1 ; fi else tmp=${TMPDIR-/tmp}/rates.$$ mkdir $tmp || exit 1 fi trap "rm -rf $tmp" 0 1 2 15 mkdir $tmp/rates ratio= allfiles= # Include relative rates in output? Report only relative rates? case $1 in -r|-a) ratio=1 shift; ;; -ro) ratio=2 shift; ;; esac # Get either the provided label file, or construct one from all the # files given. case $1 in -l) cp $2 $tmp/labels shift; shift ;; *) for file in "$@"; do awk '$2 == "reps" || $2 == "trep" { print $0; next; }' $file | sed 's/^.*: //' | sed 's/ /_/g' | awk 'NR > 1 { printf ("%s %s\n", prev, $0); } \ { prev = $0; }' done | tsort 2>/dev/null | sed 's/_/ /g' > $tmp/labels ;; esac # Go through all files, and create a corresponding rate file for each n=1 for i do # Get lines with average numbers, fill in any tests that may be missing # then extract the rate field base=`basename $i` (echo " $n " echo '--------' awk '$2 == "reps" || $2 == "trep" { \ line = $0; \ next; \ } \ NF == 0 && line != "" { \ print line; \ line=""; \ next; \ } \ ' $i > $tmp/$n.avg fillblnk $tmp/$n.avg $tmp/labels | sed 's/( *\([0-9]*\)/(\1/' | awk '$2 == "reps" || $2 == "trep" { \ n = substr($6,2,length($6)-7); \ printf "%8s\n", n; \ }' ) > $tmp/rates/$n echo "$n: $i" allfiles="$allfiles$tmp/rates/$n " n=`expr $n + 1` done case x$ratio in x) ratio=/bin/cat ;; x1) ratio="perfboth $n" ;; *) ratio="perfratio $n" ;; esac echo '' (echo Operation; echo '---------'; cat $tmp/labels) | paste $allfiles - | sed 's/ / /g' | $ratio rm -rf $tmp x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_traps.c0000664000000000000000000002165612514116510015444 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "x11perf.h" #include "bitmaps.h" #define NUM_POINTS 4 /* 4 points to a trapezoid */ static XPoint *points; static GC pgc; int InitTrapezoids(XParms xp, Parms p, int64_t reps) { int i, numPoints; int rows; int x, y; int size, skew; XPoint *curPoint; pgc = xp->fggc; size = p->special; numPoints = (p->objects) * NUM_POINTS; points = (XPoint *)malloc(numPoints * sizeof(XPoint)); curPoint = points; x = size; y = 0; rows = 0; skew = size; for (i = 0; i != p->objects; i++, curPoint += NUM_POINTS) { curPoint[0].x = x - skew; curPoint[0].y = y; curPoint[1].x = x - skew + size; curPoint[1].y = y; curPoint[2].x = x + skew; curPoint[2].y = y + size; curPoint[3].x = x + skew - size; curPoint[3].y = y + size; skew--; if (skew < 0) skew = size; y += size; rows++; if (y + size > HEIGHT || rows == MAXROWS) { rows = 0; y = 0; x += 2 * size; if (x + size > WIDTH) { x = size; } } } SetFillStyle(xp, p); return reps; } void DoTrapezoids(XParms xp, Parms p, int64_t reps) { int i, j; XPoint *curPoint; for (i = 0; i != reps; i++) { curPoint = points; for (j = 0; j != p->objects; j++) { XFillPolygon(xp->d, xp->w, pgc, curPoint, NUM_POINTS, Convex, CoordModeOrigin); curPoint += NUM_POINTS; } if (pgc == xp->bggc) pgc = xp->fggc; else pgc = xp->bggc; CheckAbort (); } } void EndTrapezoids(XParms xp, Parms p) { free(points); } #if defined(XRENDER) && defined(XFT) #include #include static XTrap *traps; static XTrapezoid *trapezoids; static XftDraw *aadraw; static XftColor aablack, aawhite; static XRenderColor transparent = { 0, 0, 0, 0 }; static XRenderPictFormat *maskFormat; static Pixmap maskPixmap; static Picture mask; int InitFixedTraps(XParms xp, Parms p, int64_t reps) { int i, numTraps; int rows; int x, y; int size, skew; XTrap *curTrap; XRenderColor color; int major, minor; int depth; int width; int std_fmt; XRenderQueryVersion (xp->d, &major, &minor); if (major == 0 && minor < 9) return 0; pgc = xp->fggc; size = p->special; numTraps = p->objects; traps = (XTrap *)malloc(numTraps * sizeof(XTrap)); curTrap = traps; x = size; y = 0; rows = 0; skew = size; aadraw = XftDrawCreate (xp->d, xp->w, xp->vinfo.visual, xp->cmap); depth = 0; width = 0; if (p->font) sscanf (p->font, "%d,%d", &depth, &width); switch (depth) { case 8: default: depth = 8; std_fmt = PictStandardA8; break; case 4: std_fmt = PictStandardA4; break; case 1: std_fmt = PictStandardA1; break; } maskFormat = XRenderFindStandardFormat (xp->d, std_fmt); maskPixmap = XCreatePixmap (xp->d, xp->w, WIDTH, HEIGHT, depth); mask = XRenderCreatePicture (xp->d, maskPixmap, maskFormat, 0, NULL); color.red = 0; color.green = 0; color.blue = 0; color.alpha = 0xffff; if (!XftColorAllocValue (xp->d, xp->vinfo.visual, xp->cmap, &color, &aablack)) { XftDrawDestroy (aadraw); aadraw = NULL; return 0; } color.red = 0xffff; color.green = 0xffff; color.blue = 0xffff; color.alpha = 0xffff; if (!XftColorAllocValue (xp->d, xp->vinfo.visual, xp->cmap, &color, &aawhite)) { XftDrawDestroy (aadraw); aadraw = NULL; return 0; } if (width == 0) width = size; for (i = 0; i != p->objects; i++, curTrap ++) { curTrap->top.y = XDoubleToFixed (y); curTrap->top.left = XDoubleToFixed (x - skew); curTrap->top.right = XDoubleToFixed (x - skew + width); curTrap->bottom.y = XDoubleToFixed (y + size); curTrap->bottom.left = XDoubleToFixed (x + skew - width); curTrap->bottom.right = XDoubleToFixed (x + skew); skew--; if (skew < 0) skew = size; y += size; rows++; if (y + size > HEIGHT || rows == MAXROWS) { rows = 0; y = 0; x += 2 * size; if (x + size > WIDTH) { x = size; } } } SetFillStyle(xp, p); return reps; } void DoFixedTraps(XParms xp, Parms p, int64_t reps) { int i; Picture white, black, src, dst; white = XftDrawSrcPicture (aadraw, &aawhite); black = XftDrawSrcPicture (aadraw, &aablack); dst = XftDrawPicture (aadraw); src = black; for (i = 0; i != reps; i++) { XRenderFillRectangle (xp->d, PictOpSrc, mask, &transparent, 0, 0, WIDTH, HEIGHT); XRenderAddTraps (xp->d, mask, 0, 0, traps, p->objects); XRenderComposite (xp->d, PictOpOver, src, mask, dst, 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT); if (src == black) src = white; else src = black; CheckAbort (); } } void EndFixedTraps (XParms xp, Parms p) { free (traps); XftDrawDestroy (aadraw); XRenderFreePicture (xp->d, mask); XFreePixmap (xp->d, maskPixmap); } int InitFixedTrapezoids(XParms xp, Parms p, int64_t reps) { int i, numTraps; int rows; int x, y; int size, skew; XTrapezoid *curTrap; XRenderColor color; pgc = xp->fggc; size = p->special; numTraps = p->objects; trapezoids = (XTrapezoid *)malloc(numTraps * sizeof(XTrapezoid)); curTrap = trapezoids; x = size; y = 0; rows = 0; skew = size; aadraw = XftDrawCreate (xp->d, xp->w, xp->vinfo.visual, xp->cmap); if (p->font && !strcmp (p->font, "add")) { XRenderPictFormat templ; templ.type = PictTypeDirect; templ.depth = 8; templ.direct.alpha = 0; templ.direct.alphaMask = 0xff; maskFormat = XRenderFindFormat (xp->d, PictFormatType | PictFormatDepth | PictFormatAlpha | PictFormatAlphaMask, &templ, 0); } else maskFormat = NULL; color.red = 0; color.green = 0; color.blue = 0; color.alpha = 0xffff; if (!XftColorAllocValue (xp->d, xp->vinfo.visual, xp->cmap, &color, &aablack)) { XftDrawDestroy (aadraw); aadraw = NULL; return 0; } color.red = 0xffff; color.green = 0xffff; color.blue = 0xffff; color.alpha = 0xffff; if (!XftColorAllocValue (xp->d, xp->vinfo.visual, xp->cmap, &color, &aawhite)) { XftDrawDestroy (aadraw); aadraw = NULL; return 0; } for (i = 0; i != p->objects; i++, curTrap ++) { curTrap->top = XDoubleToFixed (y); curTrap->bottom = XDoubleToFixed (y + size); curTrap->left.p1.x = XDoubleToFixed (x - skew); curTrap->left.p1.y = XDoubleToFixed (y); curTrap->left.p2.x = XDoubleToFixed (x + skew - size); curTrap->left.p2.y = XDoubleToFixed (y + size); curTrap->right.p1.x = XDoubleToFixed (x - skew + size); curTrap->right.p1.y = XDoubleToFixed (y); curTrap->right.p2.x = XDoubleToFixed (x + skew); curTrap->right.p2.y = XDoubleToFixed (y + size); skew--; if (skew < 0) skew = size; y += size; rows++; if (y + size > HEIGHT || rows == MAXROWS) { rows = 0; y = 0; x += 2 * size; if (x + size > WIDTH) { x = size; } } } SetFillStyle(xp, p); return reps; } void DoFixedTrapezoids(XParms xp, Parms p, int64_t reps) { int i; Picture white, black, src, dst; white = XftDrawSrcPicture (aadraw, &aawhite); black = XftDrawSrcPicture (aadraw, &aablack); dst = XftDrawPicture (aadraw); src = black; for (i = 0; i != reps; i++) { XRenderCompositeTrapezoids (xp->d, PictOpOver, src, dst, maskFormat, 0, 0, trapezoids, p->objects); if (src == black) src = white; else src = black; CheckAbort (); } } void EndFixedTrapezoids (XParms xp, Parms p) { free (trapezoids); XftDrawDestroy (aadraw); } #endif /* XRENDER */ x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_valgc.c0000664000000000000000000000467012514116510015404 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef VMS #include #else #include #endif #include "x11perf.h" static Window win[2]; int InitGC(XParms xp, Parms p, int64_t reps) { win[0] = XCreateSimpleWindow( xp->d, xp->w, 10, 10, 10, 10, 1, xp->foreground, xp->background); win[1] = XCreateSimpleWindow( xp->d, xp->w, 30, 30, 10, 10, 1, xp->foreground, xp->background); XMapSubwindows(xp->d, xp->w); return reps; } void DoChangeGC(XParms xp, Parms p, int64_t reps) { int i; XGCValues gcv; for (i = 0; i != reps; i++) { gcv.foreground = xp->foreground; XChangeGC(xp->d, xp->fggc, GCForeground , &gcv); XDrawPoint(xp->d, win[0], xp->fggc, 5, 5); gcv.foreground = xp->background; XChangeGC(xp->d, xp->fggc, GCForeground , &gcv); XDrawPoint(xp->d, win[1], xp->fggc, 5, 5); gcv.foreground = xp->background; XChangeGC(xp->d, xp->fggc, GCForeground , &gcv); XDrawPoint(xp->d, win[0], xp->fggc, 5, 5); gcv.foreground = xp->foreground; XChangeGC(xp->d, xp->fggc, GCForeground , &gcv); XDrawPoint(xp->d, win[1], xp->fggc, 5, 5); CheckAbort (); } } void EndGC(XParms xp, Parms p) { XDestroyWindow(xp->d, win[0]); XDestroyWindow(xp->d, win[1]); } x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_rects.c0000664000000000000000000000570112514116510015424 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "x11perf.h" #include "bitmaps.h" static XRectangle *rects; static GC pgc; int InitRectangles(XParms xp, Parms p, int64_t reps) { int i; int size = p->special; int step; int x, y; int rows; int lw = 0; pgc = xp->fggc; if (p->bfont) { lw = atoi (p->bfont); XSetLineAttributes(xp->d, xp->bggc, lw, LineSolid, CapButt, JoinMiter); XSetLineAttributes(xp->d, xp->fggc, lw, LineSolid, CapButt, JoinMiter); lw = (lw >> 1) + 1; } rects = (XRectangle *)malloc(p->objects * sizeof(XRectangle)); x = lw; y = lw; rows = 0; if (xp->pack) { /* Pack rectangles as close as possible, mainly for debugging faster tiling, stippling routines in a server */ step = size; } else { /* Try to exercise all alignments...any odd number is okay */ step = size + 1 + (size % 2); } for (i = 0; i != p->objects; i++) { rects[i].x = x; rects[i].y = y; rects[i].width = rects[i].height = size; y += step; rows++; if (y + size > HEIGHT || rows == MAXROWS) { rows = 0; y = lw; x += step; if (x + size > WIDTH) { x = lw; } } } SetFillStyle(xp, p); return reps; } void DoRectangles(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != reps; i++) { XFillRectangles(xp->d, xp->w, pgc, rects, p->objects); if (pgc == xp->bggc) pgc = xp->fggc; else pgc = xp->bggc; CheckAbort (); } } void DoOutlineRectangles(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != reps; i++) { XDrawRectangles (xp->d, xp->w, pgc, rects, p->objects); if (pgc == xp->bggc) pgc = xp->fggc; else pgc = xp->bggc; CheckAbort (); } } void EndRectangles(XParms xp, Parms p) { free(rects); } x11-apps-7.7+5+nmu1ubuntu1/x11perf/config.h.in0000664000000000000000000000352212656634617015524 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `XShmQueryExtension' function. */ #undef HAVE_XSHMQUERYEXTENSION /* MIT-SHM extension available */ #undef MITSHM /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Xft library available */ #undef XFT /* Xrender library available */ #undef XRENDER x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_complex.c0000664000000000000000000001245012514116510015752 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "x11perf.h" #define NUM_POINTS 4 /* 4 points to an arrowhead */ #define NUM_ANGLES 3 /* But mostly it looks like a triangle */ static XPoint *points; static GC pgc; #include #if defined(QNX4) || defined(__CYGWIN__) || defined(__UNIXOS2__) #define PI 3.14159265358979323846 #else #define PI M_PI #endif /* QNX4 */ int InitComplexPoly(XParms xp, Parms p, int64_t reps) { int i, j, numPoints; int x, y; int size, iradius; double phi, phiinc, radius, delta, phi2; XPoint *curPoint; pgc = xp->fggc; size = p->special; phi = 0.0; delta = 2.0 * PI / ((double) NUM_ANGLES); if (xp->version == VERSION1_2) { radius = ((double) size) * sqrt(3.0)/2.0; phiinc = delta/10.0; } else { /* Version 1.2's radius computation was completely bogus, and resulted in triangles with sides about 50% longer than advertised. Since in version 1.3 triangles are scaled to cover size^2 pixels, we do the same computation here. The arrowheads are a little larger than simple triangles, because they lose 1/3 of their area due to the notch cut out from them, so radius has to be sqrt(3/2) larger than for simple triangles. */ radius = ((double) size) * sqrt(sqrt(4.0/3.0)); phiinc = 1.75*PI / ((double) p->objects); } iradius = (int) radius + 1; numPoints = (p->objects) * NUM_POINTS; points = (XPoint *)malloc(numPoints * sizeof(XPoint)); curPoint = points; x = iradius; y = iradius; for (i = 0; i != p->objects; i++) { for (j = 0; j != NUM_ANGLES; j++) { phi2 = phi + ((double) j) * delta; curPoint->x = (int) ((double)x + (radius * cos(phi2)) + 0.5); curPoint->y = (int) ((double)y + (radius * sin(phi2)) + 0.5); curPoint++; } curPoint->x = x; curPoint->y = y; curPoint++; phi += phiinc; y += 2 * iradius; if (y + iradius >= HEIGHT) { y = iradius; x += 2 * iradius; if (x + iradius >= WIDTH) { x = iradius; } } } return reps; } void DoComplexPoly(XParms xp, Parms p, int64_t reps) { int i, j; XPoint *curPoint; for (i = 0; i != reps; i++) { curPoint = points; for (j = 0; j != p->objects; j++) { XFillPolygon(xp->d, xp->w, pgc, curPoint, NUM_POINTS, Complex, CoordModeOrigin); curPoint += NUM_POINTS; } if (pgc == xp->bggc) pgc = xp->fggc; else pgc = xp->bggc; CheckAbort (); } } void EndComplexPoly(XParms xp, Parms p) { free(points); } int InitGeneralPoly(XParms xp, Parms p, int64_t reps) { int i, j, numPoints; int nsides; int x, y; int size, iradius; double phi, phiinc, inner_radius, outer_radius, delta, phi2; XPoint *curPoint; pgc = xp->fggc; size = p->special; nsides = (long) p->font; phi = 0.0; delta = 2.0 * PI / ((double) nsides); phiinc = delta / 10.0; inner_radius = size / sqrt (nsides * tan (PI / nsides)); outer_radius = inner_radius / cos (PI / (2 * nsides)); numPoints = p->objects * nsides; points = (XPoint *) malloc (numPoints * sizeof (XPoint)); curPoint = points; iradius = outer_radius + 1; x = iradius; y = iradius; for (i = 0; i < p->objects; i++) { phi2 = phi; for (j = 0; j < nsides; j++) { curPoint->x = x + (outer_radius * cos(phi2) + 0.5); curPoint->y = y + (outer_radius * sin(phi2) + 0.5); curPoint++; phi2 += delta; } phi += phiinc; y += 2 * iradius; if (y + iradius >= HEIGHT) { y = iradius; x += 2 * iradius; if (x + iradius >= WIDTH) { x = iradius; } } } return reps; } void DoGeneralPoly(XParms xp, Parms p, int64_t reps) { int i, j; int nsides; int mode; XPoint *curPoint; nsides = (long) p->font; mode = (long) p->bfont; for (i = 0; i != reps; i++) { curPoint = points; for (j = 0; j != p->objects; j++) { XFillPolygon(xp->d, xp->w, pgc, curPoint, nsides, mode, CoordModeOrigin); curPoint += nsides; } if (pgc == xp->bggc) pgc = xp->fggc; else pgc = xp->bggc; CheckAbort (); } } x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_segs.c0000664000000000000000000002136712514116510015253 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "x11perf.h" static XSegment *segments; static GC pgc; static void GenerateSegments(XParms xp, Parms p, Bool ddashed) { int size; int half; int i; int rows; /* Number of rows filled in current column */ int x, y; /* base of square to draw in */ int x1=0, y1=0, x2=0, y2=0; /* offsets into square */ int phase; /* how far into 0..8*size we are */ int phaseinc; /* how much to increment phase at each segment */ int size8; /* 8 * size */ XGCValues gcv; if(ddashed) pgc = xp->ddfggc; else pgc = xp->fggc; size = p->special; size8 = 8 * size; half = (size + 19) / 20; segments = (XSegment *)malloc((p->objects) * sizeof(XSegment)); /* All this x, x1, etc. stuff is to create a pattern that (1) scans down the screen vertically, with each new segment going into a square of size^2. (2) rotates the endpoints clockwise around the square (3) rotates by ``large'' steps if we aren't going to paint enough segments to get full coverage (4) uses CapNotLast so we can create segments of length 1 that nonetheless have a distinct direction */ x = half; y = half; phase = 0; phaseinc = size8 / p->objects; if (phaseinc == 0) phaseinc = 1; rows = 0; for (i = 0; i != p->objects; i++) { switch (phase / size) { case 0: x1 = 0; y1 = 0; x2 = size; y2 = phase; break; case 1: x1 = phase % size; y1 = 0; x2 = size; y2 = size; break; case 2: x1 = size; y1 = 0; x2 = size - phase % size; y2 = size; break; case 3: x1 = size; y1 = phase % size; x2 = 0; y2 = size; break; case 4: x1 = size; y1 = size; x2 = 0; y2 = size - phase % size; break; case 5: x1 = size - phase % size; y1 = size; x2 = 0; y2 = 0; break; case 6: x1 = 0; y1 = size; x2 = phase % size; y2 = 0; break; case 7: x1 = 0; y1 = size - phase % size; x2 = size; y2 = 0; break; } /* end switch */ segments[i].x1 = x + x1; segments[i].y1 = y + y1; segments[i].x2 = x + x2; segments[i].y2 = y + y2; /* Change square to draw segment in */ rows++; y += size; if (y >= HEIGHT - size - half || rows == MAXROWS) { /* Go to next column */ rows = 0; y = half; x += size; if (x >= WIDTH - size - half) { x = half; } } /* Increment phase */ phase += phaseinc; if (phase >= size8) phase -= size8; } gcv.cap_style = CapNotLast; if(ddashed) { XChangeGC(xp->d, xp->ddfggc, GCCapStyle, &gcv); XChangeGC(xp->d, xp->ddbggc, GCCapStyle, &gcv); } else { XChangeGC(xp->d, xp->fggc, GCCapStyle, &gcv); XChangeGC(xp->d, xp->bggc, GCCapStyle, &gcv); } } int InitSegments(XParms xp, Parms p, int64_t reps) { GenerateSegments(xp, p, False); return reps; } int InitDashedSegments(XParms xp, Parms p, int64_t reps) { char dashes[2]; GenerateSegments(xp, p, False); /* Modify GCs to draw dashed */ XSetLineAttributes (xp->d, xp->bggc, 0, LineOnOffDash, CapNotLast, JoinMiter); XSetLineAttributes (xp->d, xp->fggc, 0, LineOnOffDash, CapNotLast, JoinMiter); dashes[0] = 3; dashes[1] = 2; XSetDashes(xp->d, xp->fggc, 0, dashes, 2); XSetDashes(xp->d, xp->bggc, 0, dashes, 2); return reps; } int InitDoubleDashedSegments(XParms xp, Parms p, int64_t reps) { char dashes[2]; GenerateSegments(xp, p, True); /* Modify GCs to draw dashed */ XSetLineAttributes (xp->d, xp->ddbggc, 0, LineDoubleDash, CapNotLast, JoinMiter); XSetLineAttributes (xp->d, xp->ddfggc, 0, LineDoubleDash, CapNotLast, JoinMiter); dashes[0] = 3; dashes[1] = 2; XSetDashes(xp->d, xp->ddfggc, 0, dashes, 2); XSetDashes(xp->d, xp->ddbggc, 0, dashes, 2); return reps; } int InitHorizSegments(XParms xp, Parms p, int64_t reps) { int size; int half; int i; int rows; /* Number of rows filled in current column */ int x, y; /* base of square to draw in */ int y1; /* y position inside square */ int inc; XGCValues gcv; pgc = xp->fggc; size = p->special; half = (size + 19) / 20; segments = (XSegment *)malloc((p->objects) * sizeof(XSegment)); x = half; y = half; y1 = 0; rows = 0; inc = size / p->objects; if (inc == 0) inc = 1; for (i = 0; i != p->objects; i++) { if (i % 2) { segments[i].x1 = x + size; segments[i].x2 = x; segments[i].y1 = y + size - y1; segments[i].y2 = y + size - y1; y1 += inc; if (y1 >= size) y1 -= size; } else { segments[i].x1 = x; segments[i].x2 = x + size; segments[i].y1 = y + y1; segments[i].y2 = y + y1; } rows++; y += size; if (y >= HEIGHT - size - half || rows == MAXROWS) { rows = 0; y = half; x += size; if (x >= WIDTH - size - half) x = half; } } gcv.cap_style = CapNotLast; XChangeGC(xp->d, xp->fggc, GCCapStyle, &gcv); XChangeGC(xp->d, xp->bggc, GCCapStyle, &gcv); return reps; } int InitWideHorizSegments(XParms xp, Parms p, int64_t reps) { int size; (void)InitHorizSegments(xp, p, reps); size = p->special; XSetLineAttributes(xp->d, xp->bggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); XSetLineAttributes(xp->d, xp->fggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); return reps; } int InitVertSegments(XParms xp, Parms p, int64_t reps) { int size; int half; int i; int rows; /* Number of rows filled in current column */ int x, y; /* base of square to draw in */ int x1; /* x position inside square */ int inc; XGCValues gcv; pgc = xp->fggc; size = p->special; half = (size + 19) / 20; segments = (XSegment *)malloc((p->objects) * sizeof(XSegment)); x = half; y = half; x1 = 0; rows = 0; inc = size / p->objects; if (inc == 0) inc = 1; for (i = 0; i != p->objects; i++) { if (i % 2) { segments[i].x1 = x + size - x1; segments[i].x2 = x + size - x1; segments[i].y1 = y + size; segments[i].y2 = y; x1 += inc; if (x1 >= size) x1 -= size; } else { segments[i].x1 = x + x1; segments[i].x2 = x + x1; segments[i].y1 = y; segments[i].y2 = y + size; } rows++; y += size; if (y >= HEIGHT - size - half || rows == MAXROWS) { /* Go to next column */ rows = 0; y = half; x += size; if (x >= WIDTH - size - half) { x = half; } } } gcv.cap_style = CapNotLast; XChangeGC(xp->d, xp->fggc, GCCapStyle, &gcv); XChangeGC(xp->d, xp->bggc, GCCapStyle, &gcv); return reps; } int InitWideVertSegments(XParms xp, Parms p, int64_t reps) { int size; (void)InitVertSegments(xp, p, reps); size = p->special; XSetLineAttributes(xp->d, xp->bggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); XSetLineAttributes(xp->d, xp->fggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); return reps; } void DoSegments(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != reps; i++) { XDrawSegments(xp->d, xp->w, pgc, segments, p->objects); if (pgc == xp->ddbggc) pgc = xp->ddfggc; else if(pgc == xp->ddfggc) pgc = xp->ddbggc; else if (pgc == xp->bggc) pgc = xp->fggc; else pgc = xp->bggc; CheckAbort (); } } void EndSegments(XParms xp, Parms p) { free(segments); } x11-apps-7.7+5+nmu1ubuntu1/x11perf/man/0000775000000000000000000000000012656635743014253 5ustar x11-apps-7.7+5+nmu1ubuntu1/x11perf/man/x11perf.man0000664000000000000000000006427312514116510016225 0ustar .\" Copyright 1988, 1989 Digital Equipment Corporation. .\" Copyright 1989, 1994, 1998 The Open Group .\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" .\" .TH X11PERF 1 __xorgversion__ .SH NAME x11perf \- X11 server performance test program .SH SYNTAX .B x11perf [ \-option ... ] .SH DESCRIPTION The .I x11perf program runs one or more performance tests and reports how fast an X server can execute the tests. .PP Many graphics benchmarks assume that the graphics device is used to display the output of a single fancy graphics application, and that the user gets his work done on some other device, like a terminal. Such benchmarks usually measure drawing speed for lines, polygons, text, etc. .PP Since workstations are not used as standalone graphics engines, but as super-terminals, .I x11perf measures window management performance as well as traditional graphics performance. .I x11perf includes benchmarks for the time it takes to create and map windows (as when you start up an application); to map a pre-existing set of windows onto the screen (as when you deiconify an application or pop up a menu); and to rearrange windows (as when you slosh windows to and fro trying to find the one you want). .PP .I x11perf also measures graphics performance for operations not normally used in standalone graphics displays, but are nonetheless used frequently by X applications. Such operations include CopyPlane (used to map bitmaps into pixels), scrolling (used in text windows), and various stipples and tiles (used for CAD and color half-toning, respectively). .PP .I x11perf should be used to analyze particular strengths and weaknesses of servers, and is most useful to a server writer who wants to analyze and improve a server. .I x11perf is meant to comprehensively exercise just about every X11 operation you can perform; it does not purport to be a representative sample of the operations that X11 applications actually use. While it can be used as a benchmark, it was written and is intended as a performance testing tool. .PP As such, .I x11perf DOES NOT whittle down measurements to a single ``HeXStones'' or ``MeXops'' number. We consider such numbers to be uninformative at best and misleading at worst. Some servers which are very fast for certain applications can be very slow for others. No single number or small set of numbers are sufficient to characterize how an X implementation will perform on all applications. However, by knowledge of your favorite application, you may be able to use the numbers .I x11perf reports to predict its performance on a given X implementation. .PP That said, you might also want to look at .I x11perfcomp(__appmansuffix__), a program to compare the outputs of different .I x11perf runs. You provide a list of files containing results from .I x11perf, and it lays them out in a nice tabular format. .PP For repeatable results, .I x11perf should be run using a local connection on a freshly-started server. The default configuration runs each test 5 times, in order to see if each trial takes approximately the same amount of time. Strange glitches should be examined; if non-repeatable one might chalk them up to daemons and network traffic. Each trial is run for 5 seconds, in order to reduce random time differences. The number of objects processed per second is displayed to 3 significant digits, but you'll be lucky on most UNIX system if the numbers are actually consistent to 2 digits. .I x11perf moves the cursor out of the test window; you should be careful not to bump the mouse and move it back into the window. (A prize to people who correctly explain why!!). .PP Before running a test, .I x11perf determines what the round trip time to the server is, and factors this out of the final timing reported. It ensures that the server has actually performed the work requested by fetching a pixel back from the test window, which means that servers talking to graphics accelerators can't claim that they are done, while in the meantime the accelerator is painting madly. .PP By default .I x11perf automatically calibrates the number of repetitions of each test, so that each should take approximately the same length of time to run across servers of widely differing speeds. However, since each test must be run to completion at least once, some slow servers may take a very long time, particularly on the window moving and resizing tests, and on the arc drawing tests. .PP All timing reports are for the smallest object involved. For example, the line tests use a PolyLine request to paint several lines at once, but report how many lines per second the server can paint, not how many PolyLine requests per second. Text tests paint a line of characters, but report on the number of characters per second. Some window tests map, unmap, or move a single parent window, but report on how many children windows per second the server can map, unmap, or move. .PP The current program is mostly the responsibility of Joel McCormack. It is based upon the x11perf developed by Phil Karlton, Susan Angebranndt, Chris Kent, Mary Walker, and Todd Newman, who wanted to assess performance differences between various servers. Several tests were added in order to write and tune the PMAX (DECStation 3100) servers. For a general release to the world, .I x11perf was rewritten to ease making comparisons between widely varying machines, to cover most important (and unimportant) X functionality, and to exercise graphics operations in as many different orientations and alignments as possible. .SH OPTIONS .I x11perf is solely Xlib based, and accepts the options listed below: .TP 14 .B \-display host:dpy Specifies which display to use. .TP 14 .B \-sync Runs the tests in synchronous mode. Normally only useful for debugging .I x11perf . .TP 14 .B \-pack Runs rectangle tests so that they pack rectangles right next to each other. This makes it easy to debug server code for stipples and tiles...if the pattern looks ugly, you've got alignment problems. .TP 14 .B \-repeat \fI\fP Repeats each test .I n times (by default each test is run 5 times). .TP 14 .B \-time \fI\fP Specifies how long in seconds each test should be run (default 5 seconds). .TP 14 .B \-all Runs all tests. This may take a while. .TP 14 .B \-range \fI\fP[,\fI\fP] Runs all the tests starting from the specified name \fItest1\fP until the name \fItest2\fP, including both the specified tests. The testnames should be one of the options starting from -dot. (eg) -range line100 will perform the tests from the 100 pixel line test, and go on till the last test, -range line100,dline10 will do the tests from line100 to dline10. .TP 14 .B \-labels Generates just the descriptive labels for each test specified. See .I x11perfcomp for more details. .TP 14 .B \-fg \fIcolor-or-pixel\fP Specifies the foreground color or pixel value to use. .TP 14 .B \-bg \fIcolor-or-pixel\fP Specifies the background color or pixel value to use. .TP 14 .B \-clips \fIdefault\fP Default number of clip windows. .TP 14 .B \-ddbg \fIcolor-or-pixel\fP Specifies the color or pixel value to use for drawing the odd segments of a DoubleDashed line or arc. This will default to the bg color. .TP 14 .B \-rop Use specified raster ops (default is GXcopy). This option only affects graphics benchmarks in which the graphics function is actually used. .TP 14 .B \-pm Use specified planemasks (default is ~0). This option only affects graphics benchmarks in which the planemask is actually used. .TP 14 .B \-depth Use a visual with planes per pixel (default is the default visual). .TP 14 .B \-vclass Use a visual with of class . can be StaticGray, GrayScale, StaticColor, PseudoColor, TrueColor, or DirectColor. (default is the default visual). .TP 14 .B \-reps Specify the repetition count (Default is number that takes approx. 5 seconds) .TP 14 .B \-subs Specify the number of sub windows to use in the Window tests. Default is 4, 16, 25, 50, 75, 100 and 200. .TP 14 .B \-v1.2 Perform only x11perf Version 1.2 tests using Version 1.2 semantics. .TP 14 .B \-v1.3 Perform only x11perf Version 1.3 tests using Version 1.3 semantics. .TP 14 .B \-su Set the save_under window attribute to True on all windows created by x11perf. Default is False. .TP 14 .B \-bs Set the backing_store window attribute to the given value on all windows created by x11perf. can be WhenMapped or Always. Default is NotUseful. .TP 14 .B \-dot Dot. .TP 14 .B \-rect1 1x1 solid-filled rectangle. .TP 14 .B \-rect10 10x10 solid-filled rectangle. .TP 14 .B \-rect100 100x100 solid-filled rectangle. .TP 14 .B \-rect500 500x500 solid-filled rectangle. .TP 14 .B \-srect1 1x1 transparent stippled rectangle, 8x8 stipple pattern. .TP 14 .B \-srect10 10x10 transparent stippled rectangle, 8x8 stipple pattern. .TP 14 .B \-srect100 100x100 transparent stippled rectangle, 8x8 stipple pattern. .TP 14 .B \-srect500 500x500 transparent stippled rectangle, 8x8 stipple pattern. .TP 14 .B \-osrect1 1x1 opaque stippled rectangle, 8x8 stipple pattern. .TP 14 .B \-osrect10 10x10 opaque stippled rectangle, 8x8 stipple pattern. .TP 14 .B \-osrect100 100x100 opaque stippled rectangle, 8x8 stipple pattern. .TP 14 .B \-osrect500 500x500 opaque stippled rectangle, 8x8 stipple pattern. .TP 14 .B \-tilerect1 1x1 tiled rectangle, 4x4 tile pattern. .TP 14 .B \-tilerect10 10x10 tiled rectangle, 4x4 tile pattern. .TP 14 .B \-tilerect100 100x100 tiled rectangle, 4x4 tile pattern. .TP 14 .B \-tilerect500 500x500 tiled rectangle, 4x4 tile pattern. .TP 14 .B \-oddsrect1 1x1 transparent stippled rectangle, 17x15 stipple pattern. .TP 14 .B \-oddsrect10 10x10 transparent stippled rectangle, 17x15 stipple pattern. .TP 14 .B \-oddsrect100 100x100 transparent stippled rectangle, 17x15 stipple pattern. .TP 14 .B \-oddsrect500 500x500 transparent stippled rectangle, 17x15 stipple pattern. .TP 14 .B \-oddosrect1 1x1 opaque stippled rectangle, 17x15 stipple pattern. .TP 14 .B \-oddosrect10 10x10 opaque stippled rectangle, 17x15 stipple pattern. .TP 14 .B \-oddosrect100 100x100 opaque stippled rectangle, 17x15 stipple pattern. .TP 14 .B \-oddosrect500 500x500 opaque stippled rectangle, 17x15 stipple pattern. .TP 14 .B \-oddtilerect1 1x1 tiled rectangle, 17x15 tile pattern. .TP 14 .B \-oddtilerect10 10x10 tiled rectangle, 17x15 tile pattern. .TP 14 .B \-oddtilerect100 100x100 tiled rectangle, 17x15 tile pattern. .TP 14 .B \-oddtilerect500 500x500 tiled rectangle, 17x15 tile pattern. .TP 14 .B \-bigsrect1 1x1 stippled rectangle, 161x145 stipple pattern. .TP 14 .B \-bigsrect10 10x10 stippled rectangle, 161x145 stipple pattern. .TP 14 .B \-bigsrect100 100x100 stippled rectangle, 161x145 stipple pattern. .TP 14 .B \-bigsrect500 500x500 stippled rectangle, 161x145 stipple pattern. .TP 14 .B \-bigosrect1 1x1 opaque stippled rectangle, 161x145 stipple pattern. .TP 14 .B \-bigosrect10 10x10 opaque stippled rectangle, 161x145 stipple pattern. .TP 14 .B \-bigosrect100 100x100 opaque stippled rectangle, 161x145 stipple pattern. .TP 14 .B \-bigosrect500 500x500 opaque stippled rectangle, 161x145 stipple pattern. .TP 14 .B \-bigtilerect1 1x1 tiled rectangle, 161x145 tile pattern. .TP 14 .B \-bigtilerect10 10x10 tiled rectangle, 161x145 tile pattern. .TP 14 .B \-bigtilerect100 100x100 tiled rectangle, 161x145 tile pattern. .TP 14 .B \-bigtilerect500 500x500 tiled rectangle, 161x145 tile pattern. .TP 14 .B \-eschertilerect1 1x1 tiled rectangle, 215x208 tile pattern. .TP 14 .B \-eschertilerect10 10x10 tiled rectangle, 215x208 tile pattern. .TP 14 .B \-eschertilerect100 100x100 tiled rectangle, 215x208 tile pattern. .TP 14 .B \-eschertilerect500 500x500 tiled rectangle, 215x208 tile pattern. .TP 14 .B \-seg1 1-pixel thin line segment. .TP 14 .B \-seg10 10-pixel thin line segment. .TP 14 .B \-seg100 100-pixel thin line segment. .TP 14 .B \-seg500 500-pixel thin line segment. .TP 14 .B \-seg100c1 100-pixel thin line segment (1 obscuring rectangle). .TP 14 .B \-seg100c2 100-pixel thin line segment (2 obscuring rectangles). .TP 14 .B \-seg100c3 100-pixel thin line segment (3 obscuring rectangles). .TP 14 .B \-dseg10 10-pixel thin dashed segment (3 on, 2 off). .TP 14 .B \-dseg100 100-pixel thin dashed segment (3 on, 2 off). .TP 14 .B \-ddseg100 100-pixel thin double-dashed segment (3 fg, 2 bg). .TP 14 .B \-hseg10 10-pixel thin horizontal line segment. .TP 14 .B \-hseg100 100-pixel thin horizontal line segment. .TP 14 .B \-hseg500 500-pixel thin horizontal line segment. .TP 14 .B \-vseg10 10-pixel thin vertical line segment. .TP 14 .B \-vseg100 100-pixel thin vertical line segment. .TP 14 .B \-vseg500 500-pixel thin vertical line segment. .TP 14 .B \-whseg10 10-pixel wide horizontal line segment. .TP 14 .B \-whseg100 100-pixel wide horizontal line segment. .TP 14 .B \-whseg500 500-pixel wide horizontal line segment. .TP 14 .B \-wvseg10 10-pixel wide vertical line segment. .TP 14 .B \-wvseg100 100-pixel wide vertical line segment. .TP 14 .B \-wvseg500 500-pixel wide vertical line segment. .TP 14 .B \-line1 1-pixel thin (width 0) line. .TP 14 .B \-line10 10-pixel thin line. .TP 14 .B \-line100 100-pixel thin line. .TP 14 .B \-line500 500-pixel thin line. .TP 14 .B \-dline10 10-pixel thin dashed line (3 on, 2 off). .TP 14 .B \-dline100 100-pixel thin dashed line (3 on, 2 off). .TP 14 .B \-ddline100 100-pixel thin double-dashed line (3 fg, 2 bg). .TP 14 .B \-wline10 10-pixel line, line width 1. .TP 14 .B \-wline100 100-pixel line, line width 10. .TP 14 .B \-wline500 500-pixel line, line width 50. .TP 14 .B \-wdline100 100-pixel dashed line, line width 10 (30 on, 20 off). .TP 14 .B \-wddline100 100-pixel double-dashed line, line width 10 (30 fg, 20 bg). .TP 14 .B \-orect10 10x10 thin rectangle outline. .TP 14 .B \-orect100 100-pixel thin vertical line segment. .TP 14 .B \-orect500 500-pixel thin vertical line segment. .TP 14 .B \-worect10 10x10 wide rectangle outline. .TP 14 .B \-worect100 100-pixel wide vertical line segment. .TP 14 .B \-worect500 500-pixel wide vertical line segment. .TP 14 .B \-circle1 1-pixel diameter thin (line width 0) circle. .TP 14 .B \-circle10 10-pixel diameter thin circle. .TP 14 .B \-circle100 100-pixel diameter thin circle. .TP 14 .B \-circle500 500-pixel diameter thin circle. .TP 14 .B \-dcircle100 100-pixel diameter thin dashed circle (3 on, 2 off). .TP 14 .B \-ddcircle100 100-pixel diameter thin double-dashed circle (3 fg, 2 bg). .TP 14 .B \-wcircle10 10-pixel diameter circle, line width 1. .TP 14 .B \-wcircle100 100-pixel diameter circle, line width 10. .TP 14 .B \-wcircle500 500-pixel diameter circle, line width 50. .TP 14 .B \-wdcircle100 100-pixel diameter dashed circle, line width 10 (30 on, 20 off). .TP 14 .B \-wddcircle100 100-pixel diameter double-dashed circle, line width 10 (30 fg, 20 bg). .TP 14 .B \-pcircle10 10-pixel diameter thin partial circle, orientation and arc angle evenly distributed. .TP 14 .B \-pcircle100 100-pixel diameter thin partial circle. .TP 14 .B \-wpcircle10 10-pixel diameter wide partial circle. .TP 14 .B \-wpcircle100 100-pixel diameter wide partial circle. .TP 14 .B \-fcircle1 1-pixel diameter filled circle. .TP 14 .B \-fcircle10 10-pixel diameter filled circle. .TP 14 .B \-fcircle100 100-pixel diameter filled circle. .TP 14 .B \-fcircle500 500-pixel diameter filled circle. .TP 14 .B \-fcpcircle10 10-pixel diameter partial filled circle, chord fill, orientation and arc angle evenly distributed. .TP 14 .B \-fcpcircle100 100-pixel diameter partial filled circle, chord fill. .TP 14 .B \-fspcircle10 10-pixel diameter partial filled circle, pie slice fill, orientation and arc angle evenly distributed. .TP 14 .B \-fspcircle100 100-pixel diameter partial filled circle, pie slice fill. .TP 14 .B \-ellipse10 10-pixel diameter thin (line width 0) ellipse, major and minor axis sizes evenly distributed. .TP 14 .B \-ellipse100 100-pixel diameter thin ellipse. .TP 14 .B \-ellipse500 500-pixel diameter thin ellipse. .TP 14 .B \-dellipse100 100-pixel diameter thin dashed ellipse (3 on, 2 off). .TP 14 .B \-ddellipse100 100-pixel diameter thin double-dashed ellipse (3 fg, 2 bg). .TP 14 .B \-wellipse10 10-pixel diameter ellipse, line width 1. .TP 14 .B \-wellipse100 100-pixel diameter ellipse, line width 10. .TP 14 .B \-wellipse500 500-pixel diameter ellipse, line width 50. .TP 14 .B \-wdellipse100 100-pixel diameter dashed ellipse, line width 10 (30 on, 20 off). .TP 14 .B \-wddellipse100 100-pixel diameter double-dashed ellipse, line width 10 (30 fg, 20 bg). .TP 14 .B \-pellipse10 10-pixel diameter thin partial ellipse. .TP 14 .B \-pellipse100 100-pixel diameter thin partial ellipse. .TP 14 .B \-wpellipse10 10-pixel diameter wide partial ellipse. .TP 14 .B \-wpellipse100 100-pixel diameter wide partial ellipse. .TP 14 .B \-fellipse10 10-pixel diameter filled ellipse. .TP 14 .B \-fellipse100 100-pixel diameter filled ellipse. .TP 14 .B \-fellipse500 500-pixel diameter filled ellipse. .TP 14 .B \-fcpellipse10 10-pixel diameter partial filled ellipse, chord fill. .TP 14 .B \-fcpellipse100 100-pixel diameter partial filled ellipse, chord fill. .TP 14 .B \-fspellipse10 10-pixel diameter partial filled ellipse, pie slice fill. .TP 14 .B \-fspellipse100 100-pixel diameter partial filled ellipse, pie slice fill. .TP 14 .B \-triangle1 Fill 1-pixel/side triangle. .TP 14 .B \-triangle10 Fill 10-pixel/side triangle. .TP 14 .B \-triangle100 Fill 100-pixel/side triangle. .TP 14 .B \-trap1 Fill 1x1 trapezoid. .TP 14 .B \-trap10 Fill 10x10 trapezoid. .TP 14 .B \-trap100 Fill 100x100 trapezoid. .TP 14 .B \-trap300 Fill 300x300 trapezoid. .TP 14 .B \-strap1 Fill 1x1 transparent stippled trapezoid, 8x8 stipple pattern. .TP 14 .B \-strap10 Fill 10x10 transparent stippled trapezoid, 8x8 stipple pattern. .TP 14 .B \-strap100 Fill 100x100 transparent stippled trapezoid, 8x8 stipple pattern. .TP 14 .B \-strap300 Fill 300x300 transparent stippled trapezoid, 8x8 stipple pattern. .TP 14 .B \-ostrap1 Fill 10x10 opaque stippled trapezoid, 8x8 stipple pattern. .TP 14 .B \-ostrap10 Fill 10x10 opaque stippled trapezoid, 8x8 stipple pattern. .TP 14 .B \-ostrap100 Fill 100x100 opaque stippled trapezoid, 8x8 stipple pattern. .TP 14 .B \-ostrap300 Fill 300x300 opaque stippled trapezoid, 8x8 stipple pattern. .TP 14 .B \-tiletrap1 Fill 10x10 tiled trapezoid, 4x4 tile pattern. .TP 14 .B \-tiletrap10 Fill 10x10 tiled trapezoid, 4x4 tile pattern. .TP 14 .B \-tiletrap100 Fill 100x100 tiled trapezoid, 4x4 tile pattern. .TP 14 .B \-tiletrap300 Fill 300x300 tiled trapezoid, 4x4 tile pattern. .TP 14 .B \-oddstrap1 Fill 1x1 transparent stippled trapezoid, 17x15 stipple pattern. .TP 14 .B \-oddstrap10 Fill 10x10 transparent stippled trapezoid, 17x15 stipple pattern. .TP 14 .B \-oddstrap100 Fill 100x100 transparent stippled trapezoid, 17x15 stipple pattern. .TP 14 .B \-oddstrap300 Fill 300x300 transparent stippled trapezoid, 17x15 stipple pattern. .TP 14 .B \-oddostrap1 Fill 10x10 opaque stippled trapezoid, 17x15 stipple pattern. .TP 14 .B \-oddostrap10 Fill 10x10 opaque stippled trapezoid, 17x15 stipple pattern. .TP 14 .B \-oddostrap100 Fill 100x100 opaque stippled trapezoid, 17x15 stipple pattern. .TP 14 .B \-oddostrap300 Fill 300x300 opaque stippled trapezoid, 17x15 stipple pattern. .TP 14 .B \-oddtiletrap1 Fill 10x10 tiled trapezoid, 17x15 tile pattern. .TP 14 .B \-oddtiletrap10 Fill 10x10 tiled trapezoid, 17x15 tile pattern. .TP 14 .B \-oddtiletrap100 Fill 100x100 tiled trapezoid, 17x15 tile pattern. .TP 14 .B \-oddtiletrap300 Fill 300x300 tiled trapezoid, 17x15 tile pattern. .TP 14 .B \-bigstrap1 Fill 1x1 transparent stippled trapezoid, 161x145 stipple pattern. .TP 14 .B \-bigstrap10 Fill 10x10 transparent stippled trapezoid, 161x145 stipple pattern. .TP 14 .B \-bigstrap100 Fill 100x100 transparent stippled trapezoid, 161x145 stipple pattern. .TP 14 .B \-bigstrap300 Fill 300x300 transparent stippled trapezoid, 161x145 stipple pattern. .TP 14 .B \-bigostrap1 Fill 10x10 opaque stippled trapezoid, 161x145 stipple pattern. .TP 14 .B \-bigostrap10 Fill 10x10 opaque stippled trapezoid, 161x145 stipple pattern. .TP 14 .B \-bigostrap100 Fill 100x100 opaque stippled trapezoid, 161x145 stipple pattern. .TP 14 .B \-bigostrap300 Fill 300x300 opaque stippled trapezoid, 161x145 stipple pattern. .TP 14 .B \-bigtiletrap1 Fill 10x10 tiled trapezoid, 161x145 tile pattern. .TP 14 .B \-bigtiletrap10 Fill 10x10 tiled trapezoid, 161x145 tile pattern. .TP 14 .B \-bigtiletrap100 Fill 100x100 tiled trapezoid, 161x145 tile pattern. .TP 14 .B \-bigtiletrap300 Fill 300x300 tiled trapezoid, 161x145 tile pattern. .TP 14 .B \-eschertiletrap1 Fill 1x1 tiled trapezoid, 216x208 tile pattern. .TP 14 .B \-eschertiletrap10 Fill 10x10 tiled trapezoid, 216x208 tile pattern. .TP 14 .B \-eschertiletrap100 Fill 100x100 tiled trapezoid, 216x208 tile pattern. .TP 14 .B \-eschertiletrap300 Fill 300x300 tiled trapezoid, 216x208 tile pattern. .TP 14 .B \-complex10 Fill 10-pixel/side complex polygon. .TP 14 .B \-complex100 Fill 100-pixel/side complex polygon. .TP 14 .B \-64poly10convex Fill 10x10 convex 64-gon. .TP 14 .B \-64poly100convex Fill 100x100 convex 64-gon. .TP 14 .B \-64poly10complex Fill 10x10 complex 64-gon. .TP 14 .B \-64poly100complex Fill 100x100 complex 64-gon. .TP 14 .B \-ftext Character in 80-char line (6x13). .TP 14 .B \-f8text Character in 70-char line (8x13). .TP 14 .B \-f9text Character in 60-char line (9x15). .TP 14 .B \-f14text16 2-byte character in 40-char line (k14). .TP 14 .B \-tr10text Character in 80-char line (Times-Roman 10). .TP 14 .B \-tr24text Character in 30-char line (Times-Roman 24). .TP 14 .B \-polytext Character in 20/40/20 line (6x13, Times-Roman 10, 6x13). .TP 14 .B \-polytext16 2-byte character in 7/14/7 line (k14, k24). .TP 14 .B \-fitext Character in 80-char image line (6x13). .TP 14 .B \-f8itext Character in 70-char image line (8x13). .TP 14 .B \-f9itext Character in 60-char image line (9x15). .TP 14 .B \-f14itext16 2-byte character in 40-char image line (k14). .TP 14 .B \-f24itext16 2-byte character in 23-char image line (k24). .TP 14 .B \-tr10itext Character in 80-char image line (Times-Roman 10). .TP 14 .B \-tr24itext Character in 30-char image line (Times-Roman 24). .TP 14 .B \-scroll10 Scroll 10x10 pixels vertically. .TP 14 .B \-scroll100 Scroll 100x100 pixels vertically. .TP 14 .B \-scroll500 Scroll 500x500 pixels vertically. .TP 14 .B \-copywinwin10 Copy 10x10 square from window to window. .TP 14 .B \-copywinwin100 Copy 100x100 square from window to window. .TP 14 .B \-copywinwin500 Copy 500x500 square from window to window. .TP 14 .B \-copypixwin10 Copy 10x10 square from pixmap to window. .TP 14 .B \-copypixwin100 Copy 100x100 square from pixmap to window. .TP 14 .B \-copypixwin500 Copy 500x500 square from pixmap to window. .TP 14 .B \-copywinpix10 Copy 10x10 square from window to pixmap. .TP 14 .B \-copywinpix100 Copy 100x100 square from window to pixmap. .TP 14 .B \-copywinpix500 Copy 500x500 square from window to pixmap. .TP 14 .B \-copypixpix10 Copy 10x10 square from pixmap to pixmap. .TP 14 .B \-copypixpix100 Copy 100x100 square from pixmap to pixmap. .TP 14 .B \-copypixpix500 Copy 500x500 square from pixmap to pixmap. .TP 14 .B \-copyplane10 Copy 10x10 1-bit deep plane. .TP 14 .B \-copyplane100 Copy 100x100 1-bit deep plane. .TP 14 .B \-copyplane500 Copy 500x500 1-bit deep plane. .TP 14 .B \-putimage10 PutImage 10x10 square. .TP 14 .B \-putimage100 PutImage 100x100 square. .TP 14 .B \-putimage500 PutImage 500x500 square. .TP 14 .B \-putimagexy10 PutImage XY format 10x10 square. .TP 14 .B \-putimagexy100 PutImage XY format 100x100 square. .TP 14 .B \-putimagexy500 PutImage XY format 500x500 square. .TP 14 .B \-shmput10 PutImage 10x10 square, MIT shared memory extension. .TP 14 .B \-shmput100 PutImage 100x100 square, MIT shared memory extension. .TP 14 .B \-shmput500 PutImage 500x500 square, MIT shared memory extension. .TP 14 .B \-shmputxy10 PutImage XY format 10x10 square, MIT shared memory extension. .TP 14 .B \-shmputxy100 PutImage XY format 100x100 square, MIT shared memory extension. .TP 14 .B \-shmputxy500 PutImage XY format 500x500 square, MIT shared memory extension. .TP 14 .B \-getimage10 GetImage 10x10 square. .TP 14 .B \-getimage100 GetImage 100x100 square. .TP 14 .B \-getimage500 GetImage 500x500 square. .TP 14 .B \-getimagexy10 GetImage XY format 10x10 square. .TP 14 .B \-getimagexy100 GetImage XY format 100x100 square. .TP 14 .B \-getimagexy500 GetImage XY format 500x500 square. .TP 14 .B \-noop X protocol NoOperation. .TP 14 .B \-atom GetAtomName. .TP 14 .B \-pointer QueryPointer. .TP 14 .B \-prop GetProperty. .TP 14 .B \-gc Change graphics context. .TP 14 .B \-create Create child window and map using MapSubwindows. .TP 14 .B \-ucreate Create unmapped window. .TP 14 .B \-map Map child window via MapWindow on parent. .TP 14 .B \-unmap Unmap child window via UnmapWindow on parent. .TP 14 .B \-destroy Destroy child window via DestroyWindow parent. .TP 14 .B \-popup Hide/expose window via Map/Unmap popup window. .TP 14 .B \-move Move window. .TP 14 .B \-umove Moved unmapped window. .TP 14 .B \-movetree Move window via MoveWindow on parent. .TP 14 .B \-resize Resize window. .TP 14 .B \-uresize Resize unmapped window. .TP 14 .B \-circulate Circulate lowest window to top. .TP 14 .B \-ucirculate Circulate unmapped window to top. .SH X DEFAULTS There are no X defaults used by this program. .SH "SEE ALSO" X(__miscmansuffix__), x11perfcomp(__appmansuffix__) .SH AUTHORS Joel McCormack .br Phil Karlton .br Susan Angebranndt .br Chris Kent .br Keith Packard .br Graeme Gill x11-apps-7.7+5+nmu1ubuntu1/x11perf/man/x11perfcomp.man0000664000000000000000000000560012514116510017071 0ustar .\" Copyright 1993, 1994, 1998 The Open Group .\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" .\" .TH X11PERFCOMP 1 __xorgversion__ .SH NAME x11perfcomp \- X11 server performance comparison program .SH SYNTAX .B x11perfcomp [ \-r | \-ro ] [ \-l label_file ] files .SH DESCRIPTION The .I x11perfcomp program merges the output of several .I x11perf(__appmansuffix__) runs into a nice tabular format. It takes the results in each file, fills in any missing test results if necessary, and for each test shows the objects/second rate of each server. If invoked with the -r or -ro options, it shows the relative performance of each server to the first server. .PP Normally, .I x11perfcomp uses the first file specified to determine which specific tests it should report on. Some (non-DEC :) servers may fail to perform all tests. In this case, .I x11perfcomp automatically substitutes in a rate of 0.0 objects/second. Since the first file determines which tests to report on, this file must contain a superset of the tests reported in the other files, else .I x11perfcomp will fail. .PP You can provide an explicit list of tests to report on by using the -l switch to specify a file of labels. You can create a label file by using the -label option in .I x11perf. .SH OPTIONS .I x11perfcomp accepts the options listed below: .TP 16 .B \-r Specifies that the output should also include relative server performance. .TP 16 .B \-ro Specifies that the output should include only relative server performance. .TP 16 .B \-l label_file Specifies a label file to use. .SH X DEFAULTS There are no X defaults used by this program. .SH "SEE ALSO" X(__miscmansuffix__), x11perf(__appmansuffix__) .SH AUTHORS Mark Moraes wrote the original scripts to compare servers. .br Joel McCormack just munged them together a bit. x11-apps-7.7+5+nmu1ubuntu1/x11perf/man/Xmark.man0000664000000000000000000000402312514116510016004 0ustar .\" This manpage was written by Richard Braakman and is licensed under the .\" XFree86 license. .TH Xmark 1 __xorgversion__ .SH NAME Xmark \- summarize x11perf results .SH SYNTAX .B Xmark datafile .SH DESCRIPTION .B Xmark is a shell script that reads the indicated datafile and compiles a benchmark which it writes to standard output. It writes three numbers: .PP .RS A weighted performance number for the .I x11perf results. .PP A weighted performance number for a standard SparcStation 1, with SunOS 4.1.2, X11R5 Xsun, and a CG3 dumb Color Frame Buffer. .\" I assume the latter is a graphics card. .PP The Xmark, which is the ratio of the two numbers above. .RE .PP The datafile must be an ordinary file, produced by x11perf in the following way: .PP .BI "x11perf -display " display " -v1.3 -rop GXcopy GXxor -all > " datafile .PP It is possible to run the GXcopy and GXxor tests separately, as long as they are concatenated to the same output file: .nf .BI "x11perf -display " display " -v1.3 -rop GXcopy -all > " datafile .BI "x11perf -display " display " -v1.3 -rop GXxor -all >> " datafile .fi or .nf .BI "x11perf -display " display " -v1.3 -rop GXxor -all > " datafile .BI "x11perf -display " display " -v1.3 -rop GXcopy -all >> " datafile .fi .SH FILES .TP .B temp.$$ Temporary file created in the current directory, deleted after use. .SH DIAGNOSTICS .TP .B Usage: Xmark datafile .I Xmark was invoked without arguments or with more than one argument, or with options. Xmark takes no options. .TP .B "Error: data file does not exist or is not ordinary." .I Xmark cannot find the datafile named on its command line, or the datafile is a special file such as a directory. .TP .BR "WARNING: datafile contains " nnn ", not 441 or 447 'trep' results;" The file named on the command line does not seem to be a file generated by x11perf in the expected way. .TP .BR "Diagnostic: ERROR: sum of weights =" nnn ", not equal to 4566.0;" There is an internal error in Xmark. .SH "SEE ALSO" X(__miscmansuffix__), x11perf(__appmansuffix__), x11perfcomp(__appmansuffix__) x11-apps-7.7+5+nmu1ubuntu1/x11perf/man/Makefile.am0000664000000000000000000000056112514116510016264 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = x11perfcomp.man x11perf.man Xmark.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_windows.c0000664000000000000000000001554112514116510016001 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "x11perf.h" static Window *parents; static Window *isolates; static int childrows, childcolumns, childwindows; static int parentrows, parentcolumns, parentwindows; static int parentwidth, parentheight; static Window popup; static void ComputeSizes(XParms xp, Parms p) { childwindows = p->objects; childrows = (childwindows + MAXCOLS - 1) / MAXCOLS; childcolumns = (childrows > 1 ? MAXCOLS : childwindows); parentwidth = (CHILDSIZE+CHILDSPACE) * childcolumns; parentheight = (CHILDSIZE+CHILDSPACE) * childrows; } int CreateParents(XParms xp, Parms p, int64_t reps) { int i; ComputeSizes(xp, p); parentcolumns = WIDTH / parentwidth; parentrows = HEIGHT / parentheight; parentwindows = parentcolumns * parentrows; /* Max reps we can fit */ if (parentwindows > reps) { parentwindows = reps; } /* We will do parentwindows sets of childwindows, in order to get better timing accuracy. Creating 4 windows at a millisecond apiece or so is a bit faster than the 60 Hz clock. */ isolates = (Window *)malloc(parentwindows * sizeof(Window)); parents = (Window *)malloc(parentwindows * sizeof(Window)); /* * Create isolation windows for the parents, and then the parents * themselves. These isolation windows ensure that parent and children * windows created/mapped in DoWins and DoWin2 all see the same local * environment...the parent is an only child, and each parent contains * the number of children we are trying to get benchmarks on. */ for (i = 0; i != parentwindows; i++) { isolates[i] = XCreateSimpleWindow(xp->d, xp->w, (i/parentrows)*parentwidth, (i%parentrows)*parentheight, parentwidth, parentheight, 0, xp->background, xp->background); parents[i] = XCreateSimpleWindow(xp->d, isolates[i], 0, 0, parentwidth, parentheight, 0, xp->background, xp->background); } XMapSubwindows(xp->d, xp->w); return parentwindows; } /* CreateParents */ void MapParents(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != parentwindows; i++) { XMapWindow(xp->d, parents[i]); } } void MapParentsCleanup(XParms xp, Parms p) { int i; for (i = 0; i != parentwindows; i++) { XMapWindow(xp->d, parents[i]); } } int InitCreate(XParms xp, Parms p, int64_t reps) { reps = CreateParents(xp, p, reps); MapParents(xp, p, reps); return reps; } static void CreateChildGroup(XParms xp, Parms p, Window parent) { int j; for (j = 0; j != childwindows; j++) { (void) XCreateSimpleWindow (xp->d, parent, (CHILDSIZE+CHILDSPACE) * (j/childrows) + CHILDSPACE/2, (CHILDSIZE+CHILDSPACE) * (j%childrows) + CHILDSPACE/2, CHILDSIZE, CHILDSIZE, 0, xp->background, xp->foreground); } if (p->special) XMapSubwindows (xp->d, parent); } void CreateChildren(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != parentwindows; i++) { CreateChildGroup(xp, p, parents[i]); } /* end i */ } void DestroyChildren(XParms xp, Parms p) { int i; for (i = 0; i != parentwindows; i++) { XDestroySubwindows(xp->d, parents[i]); } } void EndCreate(XParms xp, Parms p) { XDestroySubwindows(xp->d, xp->w); free(parents); free(isolates); } int InitMap(XParms xp, Parms p, int64_t reps) { reps = CreateParents(xp, p, reps); CreateChildren(xp, p, reps); return reps; } void UnmapParents(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != parentwindows; i++) { XUnmapWindow(xp->d, parents[i]); } } void UnmapParentsCleanup(XParms xp, Parms p) { int i; for (i = 0; i != parentwindows; i++) { XUnmapWindow(xp->d, parents[i]); } } int InitDestroy(XParms xp, Parms p, int64_t reps) { reps = CreateParents(xp, p, reps); CreateChildren(xp, p, reps); MapParents(xp, p, reps); return reps; } void DestroyParents(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != parentwindows; i++) { XDestroyWindow(xp->d, parents[i]); } } void RenewParents(XParms xp, Parms p) { int i; for (i = 0; i != parentwindows; i++) { parents[i] = XCreateSimpleWindow(xp->d, isolates[i], 0, 0, parentwidth, parentheight, 0, xp->background, xp->background); } CreateChildren(xp, p, parentwindows); MapParents(xp, p, parentwindows); } int InitPopups(XParms xp, Parms p, int64_t reps) { #ifdef CHILDROOT XWindowAttributes xwa; #endif XSetWindowAttributes xswa; Window isolate; #ifdef CHILDROOT ComputeSizes(xp, p); CreateChildGroup(xp, p, xp->w); /* Now create simple window to pop up over children */ (void) XGetWindowAttributes(xp->d, xp->w, &xwa); xswa.override_redirect = True; popup = XCreateSimpleWindow ( xp->d, DefaultRootWindow(xp->d), xwa.x + xwa.border_width, xwa.y + xwa.border_width, parentwidth, parentheight, 0, xp->foreground, xp->foreground); #else isolate = XCreateSimpleWindow( xp->d, xp->w, 0, 0, WIDTH, HEIGHT, 0, xp->background, xp->background); ComputeSizes(xp, p); CreateChildGroup(xp, p, isolate); XMapWindow(xp->d, isolate); /* Now create simple window to pop up over children */ xswa.override_redirect = True; popup = XCreateSimpleWindow ( xp->d, xp->w, 0, 0, parentwidth, parentheight, 0, xp->foreground, xp->foreground); #endif XChangeWindowAttributes (xp->d, popup, CWOverrideRedirect, &xswa); return reps; } void DoPopUps(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != reps; i++) { XMapWindow(xp->d, popup); XUnmapWindow(xp->d, popup); CheckAbort (); } } void EndPopups(XParms xp, Parms p) { XDestroySubwindows(xp->d, xp->w); #ifdef CHILDROOT XDestroyWindow(xp->d, popup); #endif } x11-apps-7.7+5+nmu1ubuntu1/x11perf/config.sub0000775000000000000000000010622312514123564015451 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-12-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/x11perf/bitmaps.c0000664000000000000000000016216412514116510015270 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "x11perf.h" #include "bitmaps.h" static const unsigned char bitmap8x8[] = { 0xCC, 0x66, 0x33, 0x99, 0xCC, 0x66, 0x33, 0x99 /* Alternate maps for testing out your stipple code. Only the above should be used for timing, though. 0x00, 0xfe, 0x92, 0x92, 0xfe, 0x92, 0x92, 0xfe 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA */ }; static const unsigned char bitmap4x4[] = { 0x03, 0x06, 0x0c, 0x09 }; #define oddbit_width 17 #define oddbit_height 15 static const unsigned char oddbit_bits[] = { 0x01, 0x00, 0x01, 0xc2, 0x87, 0x00, 0x34, 0x58, 0x00, 0x08, 0x20, 0x00, 0x38, 0x38, 0x00, 0x44, 0x44, 0x00, 0x84, 0x42, 0x00, 0x04, 0x41, 0x00, 0x84, 0x42, 0x00, 0x44, 0x44, 0x00, 0x28, 0x28, 0x00, 0x18, 0x30, 0x00, 0x34, 0x58, 0x00, 0xc2, 0x87, 0x00, 0x01, 0x00, 0x01}; /* A big bitmap */ #define mensetmanus_width 161 #define mensetmanus_height 145 static const unsigned char mensetmanus_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xdb, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x61, 0x00, 0x00, 0xc6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc3, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xe1, 0xff, 0xff, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc3, 0xf6, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x9f, 0x65, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x07, 0x80, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x9f, 0x6d, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xff, 0xff, 0xc7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x89, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0xc0, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x81, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0xc0, 0xe1, 0x5b, 0xdb, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x81, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x80, 0x83, 0x5b, 0xdb, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x81, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x00, 0xcf, 0x5b, 0x1b, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x80, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x5b, 0x1b, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x80, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x5b, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x83, 0x6d, 0x19, 0x00, 0x00, 0x00, 0x00, 0x80, 0x5b, 0x0b, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x83, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x80, 0x5b, 0x0f, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x80, 0x4b, 0x0f, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x79, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x80, 0x6b, 0xbf, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfb, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x80, 0x6d, 0xb7, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xed, 0xf7, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xed, 0xd7, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0xf8, 0xff, 0x07, 0x00, 0x00, 0x00, 0xe0, 0xfe, 0xd7, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0xe0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xd6, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xbf, 0x73, 0x80, 0x3b, 0x7c, 0x00, 0x00, 0x00, 0xf8, 0xe7, 0xd6, 0xef, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xb9, 0x73, 0xc0, 0x3b, 0xf0, 0x01, 0x00, 0x00, 0xff, 0xc3, 0xbf, 0xe7, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xb8, 0x7f, 0xe0, 0x3b, 0xc0, 0x03, 0x00, 0xc0, 0xbf, 0xc7, 0xbf, 0xe7, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xb8, 0xff, 0xf8, 0x3b, 0x80, 0x07, 0x00, 0xe0, 0x61, 0x87, 0xfd, 0xe7, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0xb8, 0xf3, 0xff, 0x3b, 0x00, 0x0f, 0x00, 0x78, 0x60, 0x8e, 0xf1, 0x67, 0xc7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xb8, 0xc3, 0x8f, 0x7b, 0x00, 0x0e, 0x00, 0x38, 0xe0, 0x8c, 0x03, 0x66, 0x87, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xb8, 0x03, 0x83, 0x7b, 0x00, 0x1e, 0x00, 0x1c, 0xe0, 0x1d, 0x03, 0x76, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0xb8, 0xe3, 0x8f, 0xbb, 0x01, 0x39, 0x00, 0x1e, 0xe0, 0x3b, 0x03, 0xf6, 0x87, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0xb8, 0xe3, 0x8f, 0x3b, 0xc6, 0x38, 0x00, 0x17, 0xe0, 0x73, 0x07, 0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0b, 0xb8, 0xe7, 0x8e, 0x3b, 0x38, 0x78, 0x00, 0x13, 0xe0, 0x77, 0x06, 0xfe, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0xe0, 0x12, 0x3c, 0xff, 0xce, 0x3b, 0x00, 0x78, 0x80, 0x13, 0x60, 0xef, 0x0e, 0xfe, 0x00, 0x00, 0x60, 0x08, 0x00, 0x00, 0x00, 0x70, 0x22, 0x3e, 0xfc, 0xfe, 0x39, 0x00, 0xe8, 0x80, 0x61, 0x60, 0xce, 0x0f, 0xfe, 0x00, 0x00, 0x60, 0xf8, 0x00, 0x00, 0x00, 0x70, 0xc2, 0x39, 0xf8, 0x7e, 0x38, 0x00, 0xc8, 0xc0, 0x81, 0x71, 0xde, 0x0f, 0xfe, 0x00, 0x00, 0x60, 0x88, 0x00, 0x00, 0x00, 0x70, 0x04, 0x38, 0xe0, 0x0e, 0x38, 0x00, 0xc4, 0xc0, 0x01, 0x7e, 0xbc, 0x1f, 0xfe, 0x00, 0x00, 0x60, 0x88, 0x00, 0x00, 0x00, 0x78, 0x04, 0x38, 0xe0, 0x0e, 0x38, 0x00, 0xc4, 0xc1, 0x01, 0x60, 0x3c, 0x1f, 0xfe, 0x00, 0x00, 0x60, 0x84, 0x0f, 0x00, 0x00, 0x78, 0x08, 0x38, 0xe0, 0x0f, 0x38, 0x00, 0x82, 0xe1, 0x01, 0x60, 0x74, 0x3e, 0xfe, 0x00, 0x00, 0x60, 0x44, 0x08, 0x00, 0x00, 0xb8, 0x10, 0x38, 0xe0, 0x0f, 0x38, 0x00, 0x81, 0xe1, 0x00, 0x60, 0xe4, 0x3e, 0xfe, 0x00, 0x00, 0x60, 0x44, 0x08, 0x00, 0x00, 0x98, 0x20, 0x38, 0xf8, 0x3f, 0x38, 0x80, 0x80, 0xe1, 0x01, 0x60, 0xc4, 0x3c, 0xfe, 0x00, 0x00, 0x60, 0x24, 0x0c, 0x00, 0x00, 0x1c, 0xc1, 0x39, 0x3c, 0x78, 0x38, 0x40, 0x80, 0x61, 0x01, 0x60, 0xc4, 0x79, 0xfe, 0x00, 0x00, 0x60, 0x22, 0x32, 0x00, 0x00, 0x1c, 0x01, 0x3e, 0x1c, 0xf0, 0x38, 0xf0, 0x9f, 0x61, 0x01, 0x60, 0x84, 0x7b, 0xee, 0x00, 0x00, 0x60, 0x12, 0x21, 0x00, 0x00, 0x1c, 0x02, 0x38, 0x0e, 0xe7, 0xf8, 0x3f, 0xe0, 0x61, 0x00, 0x60, 0x04, 0xf7, 0xce, 0x00, 0x00, 0x60, 0x92, 0x10, 0x00, 0x00, 0x1c, 0x04, 0x38, 0x06, 0xff, 0x38, 0x40, 0x80, 0x61, 0x02, 0x60, 0x04, 0xe7, 0xcf, 0x00, 0x00, 0x60, 0x8a, 0x18, 0x00, 0x00, 0x1c, 0x18, 0x38, 0x07, 0xf0, 0x38, 0x00, 0x81, 0x61, 0x02, 0x60, 0x04, 0xee, 0xcf, 0xff, 0x03, 0x60, 0x49, 0xe4, 0x00, 0x00, 0x1c, 0x70, 0x38, 0x07, 0xe7, 0x38, 0x00, 0x82, 0x61, 0x04, 0x60, 0x04, 0xdc, 0xcf, 0x01, 0x04, 0x60, 0x25, 0x42, 0x00, 0x00, 0x1c, 0xfe, 0x3f, 0x03, 0xff, 0x38, 0x00, 0x84, 0x61, 0x08, 0x60, 0x04, 0xfc, 0xcf, 0xf8, 0xff, 0x60, 0x95, 0x31, 0x00, 0x00, 0xfc, 0x01, 0xff, 0x03, 0xf0, 0xf8, 0x1f, 0x88, 0x61, 0x10, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, 0xe1, 0x53, 0x0c, 0x00, 0x00, 0x38, 0xf0, 0xff, 0x03, 0xef, 0xf8, 0x7f, 0x90, 0x61, 0x40, 0xe0, 0xff, 0xff, 0xff, 0x00, 0xff, 0xe3, 0x2b, 0xfe, 0x00, 0x00, 0x18, 0xf8, 0xff, 0x03, 0xff, 0x7c, 0xf0, 0x90, 0x61, 0x00, 0x3e, 0x36, 0xe3, 0xe1, 0x00, 0x00, 0xe3, 0x9f, 0x60, 0x00, 0x00, 0x38, 0x3c, 0x00, 0x03, 0xf0, 0x1f, 0xe0, 0xa0, 0xe1, 0x00, 0x30, 0x22, 0xe2, 0xc0, 0x00, 0xff, 0xe3, 0x7f, 0x18, 0x00, 0x00, 0x38, 0x0e, 0x00, 0x07, 0xe7, 0x07, 0xc0, 0xe1, 0xc1, 0x00, 0x18, 0x22, 0xe2, 0xc0, 0x00, 0x00, 0xe1, 0x1f, 0x07, 0x00, 0x00, 0x38, 0x06, 0x00, 0x07, 0xef, 0x01, 0xc0, 0xc1, 0xc1, 0x01, 0x16, 0x24, 0xe2, 0xc0, 0x01, 0xff, 0xe1, 0xff, 0x00, 0x00, 0x00, 0x70, 0x07, 0x00, 0x0e, 0xf8, 0x00, 0x80, 0xc3, 0xc0, 0xf1, 0x11, 0x24, 0xe4, 0xc0, 0x03, 0xe0, 0xe1, 0x7f, 0x00, 0x00, 0x00, 0x70, 0x07, 0x00, 0x1e, 0x3c, 0x00, 0x80, 0xe3, 0x80, 0x0f, 0x10, 0x24, 0xe4, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xe0, 0x03, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x63, 0x80, 0x01, 0x08, 0x44, 0xe4, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xe0, 0x03, 0x00, 0xf8, 0x07, 0x00, 0x00, 0x73, 0x80, 0x03, 0x08, 0x44, 0xe4, 0xc0, 0xfc, 0x00, 0x07, 0x0e, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x33, 0x00, 0x03, 0x08, 0x44, 0xe4, 0xe0, 0xcc, 0x00, 0x07, 0x0e, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x78, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x07, 0x04, 0x44, 0xe8, 0x70, 0xcc, 0x01, 0x87, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x3e, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x0e, 0x04, 0x44, 0xe8, 0x38, 0xcc, 0x81, 0xe7, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x1c, 0x02, 0x44, 0xf8, 0x1e, 0xcc, 0xe1, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x23, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x38, 0x01, 0x42, 0xfc, 0x0f, 0xcc, 0xf1, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0xf0, 0x39, 0x00, 0x00, 0xe0, 0x03, 0x00, 0xf0, 0x00, 0xc2, 0xff, 0x07, 0xcc, 0x7f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x7c, 0x0e, 0x00, 0x00, 0xf0, 0x01, 0x00, 0xe0, 0x03, 0xe2, 0xe7, 0x07, 0xcc, 0x1f, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xbf, 0x23, 0xe0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x1f, 0xff, 0x64, 0x06, 0xcc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x3c, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x64, 0x06, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xf8, 0x1f, 0x78, 0x7c, 0x7f, 0x00, 0x00, 0x00, 0xfc, 0x20, 0x64, 0x06, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xf8, 0x33, 0x1c, 0x38, 0x66, 0x00, 0x00, 0x00, 0x0c, 0x20, 0x6c, 0x06, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x78, 0x3e, 0x0e, 0x38, 0x76, 0x00, 0x00, 0x00, 0x0c, 0x20, 0x68, 0x06, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0xf8, 0x87, 0x0f, 0x38, 0x76, 0x00, 0x00, 0x00, 0x0c, 0x20, 0x68, 0x06, 0xcc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x78, 0xf8, 0x0f, 0x38, 0x76, 0x00, 0x00, 0x00, 0x0c, 0x10, 0x68, 0x06, 0xcc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf8, 0xff, 0x0f, 0x38, 0x76, 0x00, 0x00, 0x00, 0x0c, 0x10, 0x68, 0x06, 0xcc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xf8, 0xff, 0x0e, 0x38, 0x76, 0x00, 0x00, 0x00, 0x0c, 0x10, 0x68, 0x06, 0xcc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xf8, 0xe1, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x0c, 0x08, 0x68, 0x06, 0xcc, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x0c, 0x08, 0x68, 0x06, 0xcc, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x0c, 0x04, 0x68, 0x06, 0xcc, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x1c, 0x04, 0x68, 0x06, 0xcc, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x1c, 0x02, 0x68, 0x06, 0xcc, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x1c, 0x02, 0x68, 0x06, 0xcc, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x1c, 0x01, 0x68, 0x06, 0xcc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x18, 0x01, 0x68, 0x06, 0xcc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x98, 0x00, 0x68, 0x06, 0xcc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x98, 0x00, 0x68, 0x06, 0xcc, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x38, 0xe0, 0x0e, 0x38, 0x1e, 0x00, 0x00, 0x00, 0x58, 0x00, 0x6c, 0x0e, 0xcc, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x30, 0xe0, 0x0e, 0x38, 0x1e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x64, 0x0e, 0xcc, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x70, 0xe0, 0x0e, 0x1c, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x64, 0x1e, 0xcc, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0xe0, 0xe1, 0x0e, 0x0f, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x64, 0x3e, 0xcc, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0xef, 0xce, 0x07, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x64, 0x3e, 0xcc, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0xff, 0xfe, 0x03, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x64, 0x7e, 0xcc, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0xfc, 0xfe, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x64, 0x66, 0xcc, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0xe0, 0x1e, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x66, 0xe6, 0xcc, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0xe0, 0x0e, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x62, 0xc6, 0xcd, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x62, 0xc6, 0xcd, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0xc0, 0xff, 0xff, 0x0f, 0x0e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x62, 0x86, 0xcf, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0xf0, 0xff, 0xff, 0x0f, 0x0e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x61, 0x86, 0xcf, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0xfc, 0x00, 0x00, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x61, 0x8e, 0xcf, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x78, 0x00, 0x00, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x7f, 0xfe, 0xdf, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xf0, 0x00, 0x00, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x3f, 0xff, 0xdf, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0xe0, 0x01, 0x00, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x8f, 0x07, 0x9e, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0xe0, 0x07, 0x00, 0x0e, 0x0f, 0x00, 0x00, 0x00, 0x30, 0x00, 0xc0, 0xff, 0x3f, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0x00, 0x38, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x38, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x18, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x18, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xdc, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1c, 0x00, 0x38, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x9c, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1c, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0c, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0c, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0c, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x1c, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x1c, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x1c, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x1c, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x1c, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x06, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x06, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0c, 0x00, 0x38, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1c, 0x00, 0x38, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1c, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x18, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x18, 0x00, 0x30, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0x00, 0x30, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x3c, 0x00, 0x30, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x03, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x7e, 0x00, 0x70, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x0f, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xe7, 0x00, 0x70, 0xbc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x1e, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xe3, 0x00, 0x60, 0x1e, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xc1, 0x01, 0xe0, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x07, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x80, 0x03, 0xe0, 0x03, 0x1e, 0x00, 0x00, 0x00, 0xc0, 0x03, 0xe0, 0x1b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x78, 0x80, 0x07, 0xe0, 0x01, 0x1c, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xc0, 0x1b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0f, 0xe0, 0x01, 0x38, 0x00, 0x00, 0x00, 0xf0, 0x00, 0xc0, 0x19, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0e, 0x1e, 0xc0, 0x71, 0xf8, 0x00, 0x00, 0x00, 0x78, 0x00, 0xdc, 0x19, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x30, 0x1f, 0x1e, 0xc0, 0xf9, 0xf8, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #define escherknot_width 216 #define escherknot_height 208 static const unsigned char escherknot_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x6f, 0xf6, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x3a, 0x13, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0d, 0x02, 0x51, 0x71, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x2f, 0x20, 0xd9, 0x88, 0x9b, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x82, 0xac, 0x44, 0x4e, 0x1c, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x40, 0x02, 0x44, 0x60, 0xe2, 0xfc, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x25, 0x09, 0x90, 0x22, 0x13, 0xb7, 0x9a, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x40, 0x10, 0x89, 0x18, 0xe3, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x04, 0x08, 0x01, 0x10, 0xc8, 0xa8, 0xd5, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x80, 0x20, 0x40, 0x82, 0x00, 0x66, 0x9c, 0xec, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x08, 0x08, 0x24, 0x12, 0x93, 0x5b, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x12, 0x80, 0x04, 0x01, 0x00, 0x80, 0x19, 0x33, 0xfa, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x80, 0x80, 0x00, 0x20, 0x08, 0x12, 0xc4, 0x68, 0x26, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x04, 0x24, 0x00, 0x01, 0x40, 0x24, 0x8c, 0xcd, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x80, 0x49, 0x10, 0x90, 0x00, 0x21, 0x20, 0x08, 0x11, 0x43, 0xd9, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0xff, 0xff, 0x0b, 0x00, 0x60, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x30, 0xb9, 0xf2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x97, 0x04, 0x08, 0xfe, 0x05, 0x30, 0x10, 0x12, 0x20, 0x20, 0x04, 0x00, 0x80, 0x48, 0x0c, 0xa3, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x92, 0x20, 0x49, 0x40, 0x3e, 0x0e, 0x82, 0x00, 0x84, 0x25, 0x01, 0x80, 0x00, 0x80, 0xc8, 0x34, 0xed, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x25, 0x01, 0x04, 0x01, 0x08, 0xd0, 0x17, 0x00, 0x80, 0x25, 0x01, 0xad, 0x04, 0x12, 0x20, 0x23, 0x4c, 0x6a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x02, 0x48, 0x92, 0x20, 0x41, 0x92, 0x9e, 0x80, 0x24, 0x24, 0x29, 0x00, 0x04, 0x00, 0x10, 0x98, 0xcc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x4f, 0x10, 0x01, 0x90, 0x24, 0x40, 0x12, 0xf0, 0x00, 0x24, 0x41, 0x0b, 0xa9, 0x10, 0x00, 0x00, 0x04, 0xd9, 0x96, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x92, 0x48, 0x02, 0x04, 0x09, 0xc0, 0x84, 0x8f, 0x29, 0x2d, 0xf8, 0xa9, 0x02, 0x00, 0x00, 0x20, 0x90, 0xf4, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x24, 0x91, 0x04, 0x50, 0x22, 0x24, 0x1b, 0x12, 0x7a, 0x48, 0xca, 0x03, 0x21, 0x10, 0x00, 0x00, 0x48, 0x93, 0xff, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x24, 0x92, 0x20, 0x81, 0xda, 0x24, 0xc8, 0x16, 0xd0, 0xe7, 0x50, 0xd2, 0xbf, 0x03, 0x00, 0x80, 0x00, 0x30, 0x29, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x20, 0x80, 0x24, 0x41, 0x12, 0x2a, 0x41, 0xb2, 0x80, 0x33, 0x0e, 0x7e, 0x88, 0x1c, 0x01, 0x00, 0xa0, 0x24, 0x69, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x82, 0x44, 0x11, 0x24, 0x09, 0x90, 0xa4, 0x4d, 0xd2, 0x92, 0x9e, 0xd3, 0x83, 0x6b, 0x62, 0x00, 0x00, 0x10, 0x22, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x42, 0x04, 0x92, 0x24, 0x6b, 0x53, 0x32, 0x59, 0x90, 0x16, 0xfa, 0xb4, 0xf4, 0xff, 0x0f, 0x01, 0x00, 0x90, 0x68, 0x4a, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x90, 0x24, 0x11, 0x24, 0x49, 0xda, 0x82, 0xc5, 0x92, 0xd2, 0xd0, 0x9e, 0x1e, 0x00, 0x78, 0x0a, 0x00, 0x00, 0x05, 0xd2, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x02, 0x44, 0xb2, 0x65, 0xea, 0x49, 0x9e, 0x2c, 0x4b, 0x1a, 0xd2, 0xeb, 0xe3, 0xff, 0xc7, 0x09, 0x00, 0x20, 0x68, 0xff, 0xd6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x90, 0x40, 0x92, 0x24, 0x09, 0x5f, 0xd2, 0x64, 0x59, 0x72, 0x56, 0x7f, 0xfd, 0xdf, 0x1f, 0x12, 0x00, 0x20, 0x49, 0x92, 0xde, 0x01, 0x00, 0x00, 0x00, 0x80, 0x41, 0x92, 0x4c, 0x92, 0x24, 0x25, 0xc9, 0x8b, 0x2e, 0xcb, 0x92, 0x4b, 0x5a, 0x2f, 0x75, 0xf4, 0x04, 0x00, 0x00, 0x41, 0xf6, 0x74, 0x01, 0x00, 0x00, 0x00, 0x40, 0x49, 0x02, 0x00, 0xba, 0xb6, 0xfd, 0x49, 0xf8, 0x74, 0x6d, 0x4b, 0x72, 0xed, 0xdb, 0xff, 0xcf, 0x53, 0x00, 0x00, 0x48, 0xb6, 0xd7, 0x03, 0x00, 0x00, 0x00, 0x60, 0x48, 0x10, 0xc9, 0x93, 0x24, 0x00, 0x7b, 0xc3, 0xa6, 0x69, 0x58, 0x5a, 0xfb, 0xfa, 0xa5, 0xbe, 0x16, 0x00, 0x00, 0x92, 0xa4, 0xfd, 0x03, 0x00, 0x00, 0x00, 0x30, 0x01, 0x20, 0x5d, 0xa2, 0xfe, 0x7f, 0x01, 0x4f, 0x1a, 0xcd, 0x6b, 0x6a, 0xa9, 0x5f, 0xff, 0xf3, 0x24, 0x01, 0x40, 0xc0, 0xb4, 0xf4, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x88, 0x84, 0x89, 0xb6, 0x00, 0x24, 0x7d, 0x69, 0xf2, 0x34, 0xad, 0x99, 0x2d, 0xf7, 0xff, 0x9f, 0x4b, 0x00, 0x00, 0x92, 0xa6, 0xad, 0x07, 0x00, 0x00, 0x00, 0x06, 0x91, 0x24, 0xe9, 0xa4, 0xfd, 0xa5, 0xa9, 0x4b, 0x93, 0xe7, 0x34, 0x63, 0xf9, 0xfc, 0xd5, 0xef, 0x16, 0x00, 0x40, 0x90, 0xb4, 0xbd, 0x07, 0x00, 0x00, 0x00, 0x6a, 0x80, 0x4c, 0x96, 0xbe, 0x2d, 0xfd, 0x2f, 0x7c, 0x5e, 0x9c, 0x67, 0xad, 0xa5, 0xfd, 0xff, 0xbf, 0x29, 0x00, 0x00, 0x92, 0x76, 0xed, 0x06, 0x00, 0x00, 0x00, 0x05, 0x12, 0x48, 0x53, 0x25, 0x65, 0x25, 0xf4, 0xe5, 0xd3, 0x72, 0x9c, 0x35, 0xdf, 0xf6, 0x7f, 0xf5, 0x56, 0x00, 0x00, 0x92, 0xa4, 0xed, 0x0f, 0x00, 0x00, 0x80, 0x49, 0x20, 0x59, 0x38, 0xec, 0xff, 0xff, 0xad, 0x2f, 0x5d, 0xd3, 0x33, 0xe6, 0x24, 0xed, 0xff, 0xdf, 0x2d, 0x01, 0x40, 0x80, 0x24, 0xbd, 0x07, 0x00, 0x00, 0xc0, 0x48, 0x24, 0x49, 0x87, 0x37, 0x21, 0xa0, 0xbd, 0xf4, 0x79, 0x4f, 0xc7, 0x9c, 0xde, 0xf6, 0xff, 0xff, 0x5b, 0x08, 0x00, 0x92, 0xfc, 0xe9, 0x0e, 0x00, 0x00, 0x20, 0x89, 0x40, 0xd3, 0xf4, 0x49, 0xff, 0xff, 0xe7, 0x2f, 0xcf, 0x79, 0x9c, 0x53, 0xb2, 0x35, 0xff, 0xff, 0x37, 0x00, 0x40, 0x90, 0x24, 0xef, 0x0e, 0x00, 0x00, 0x30, 0x91, 0x49, 0x32, 0x2d, 0xff, 0x6b, 0xb7, 0xbd, 0xbc, 0x3c, 0xef, 0x79, 0xce, 0xde, 0xd6, 0xfd, 0xff, 0x9f, 0x00, 0x00, 0x92, 0xa6, 0xad, 0x0b, 0x00, 0x00, 0x30, 0x11, 0x89, 0x8c, 0xcb, 0x5b, 0xba, 0xaf, 0xf6, 0xd7, 0xe7, 0x35, 0xe7, 0x59, 0xb3, 0xfb, 0xff, 0xff, 0x7f, 0x04, 0x40, 0x80, 0xe4, 0xb9, 0x1f, 0x00, 0x00, 0x48, 0x22, 0x91, 0x66, 0x79, 0xeb, 0xff, 0xff, 0xdf, 0xbe, 0xbe, 0xe7, 0x8c, 0x75, 0x6b, 0x4a, 0xfa, 0xbf, 0x7f, 0x00, 0x00, 0x82, 0x24, 0xef, 0x0e, 0x00, 0x00, 0x4c, 0x22, 0xb2, 0x79, 0x5e, 0xfa, 0x5b, 0xa9, 0xfd, 0xeb, 0xf5, 0x9c, 0x3d, 0xc6, 0xcc, 0xee, 0xed, 0x01, 0xf8, 0x00, 0x40, 0x82, 0xb6, 0xa9, 0x1b, 0x00, 0x00, 0x94, 0x64, 0x66, 0x8e, 0xd3, 0x97, 0xfe, 0xff, 0xd7, 0xdf, 0x9f, 0x7b, 0xf3, 0x3c, 0x35, 0x59, 0x6b, 0x00, 0x70, 0x00, 0x00, 0x40, 0xe4, 0xed, 0x1e, 0x00, 0x00, 0x92, 0xc4, 0x34, 0xf3, 0xfc, 0xfd, 0x5f, 0xad, 0x7d, 0xfa, 0x7a, 0xce, 0x8e, 0xb3, 0x76, 0x2f, 0xfd, 0x00, 0xe0, 0x04, 0x00, 0x9a, 0x26, 0xaf, 0x1e, 0x00, 0x00, 0x13, 0x88, 0xcc, 0xb5, 0x3f, 0xbf, 0xff, 0xff, 0xd7, 0xef, 0xef, 0xbd, 0x79, 0x6a, 0xde, 0xec, 0xab, 0x01, 0xc0, 0x00, 0x00, 0x40, 0xb6, 0xbd, 0x1b, 0x00, 0x00, 0x05, 0x91, 0xeb, 0x5c, 0xeb, 0xeb, 0xff, 0xff, 0xff, 0x7e, 0xef, 0x6b, 0xef, 0xcd, 0x99, 0xb3, 0xe4, 0x07, 0x80, 0x00, 0x40, 0x49, 0xb2, 0xe5, 0x1a, 0x00, 0x80, 0x20, 0x32, 0xb1, 0xe7, 0x79, 0x7f, 0xf7, 0xff, 0xfd, 0xeb, 0xbd, 0xfe, 0x2c, 0x3d, 0x6b, 0xb6, 0xaf, 0x06, 0x80, 0x00, 0x00, 0x41, 0x96, 0xfe, 0x1e, 0x00, 0x80, 0x44, 0xb2, 0x9b, 0xf9, 0xde, 0xff, 0xff, 0xff, 0x7f, 0xbf, 0xf7, 0xbb, 0xb3, 0x77, 0xce, 0xce, 0xb6, 0x0d, 0x80, 0x01, 0x00, 0x49, 0xf2, 0x94, 0x1f, 0x00, 0x40, 0x49, 0x44, 0xe6, 0x9e, 0x77, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xf7, 0x7e, 0xd6, 0xbc, 0xd9, 0xba, 0x3b, 0x80, 0x00, 0x00, 0x64, 0x93, 0xf7, 0x1b, 0x00, 0x40, 0x89, 0xec, 0x7e, 0x67, 0xbd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xce, 0xdb, 0x99, 0x33, 0x37, 0xd3, 0x36, 0x80, 0x01, 0x80, 0x24, 0xda, 0xd6, 0x1e, 0x00, 0x20, 0x90, 0x99, 0x99, 0x7b, 0xef, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbd, 0x37, 0x63, 0xf3, 0x66, 0xdb, 0x7a, 0x80, 0x00, 0x00, 0x24, 0x59, 0xde, 0x1f, 0x00, 0x60, 0x12, 0xb3, 0xf7, 0xdd, 0xfb, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xf7, 0xfe, 0x6e, 0xce, 0xdd, 0x6d, 0xd7, 0x80, 0x00, 0x80, 0x20, 0xcb, 0xfb, 0x1f, 0x00, 0x10, 0x20, 0x6e, 0x66, 0x76, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xde, 0xdb, 0x9b, 0x99, 0xb3, 0x5d, 0x6b, 0x81, 0x00, 0x40, 0x96, 0x59, 0x6a, 0x1f, 0x00, 0x98, 0xc4, 0xe4, 0xdf, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7b, 0x6f, 0x7b, 0x37, 0x7f, 0xb3, 0xdd, 0x83, 0x00, 0x00, 0xb0, 0xed, 0xef, 0x1d, 0x00, 0x10, 0x88, 0x9e, 0xdd, 0xcd, 0xbd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xed, 0x6c, 0xe6, 0xcc, 0x76, 0x6d, 0xc1, 0x00, 0x40, 0x91, 0x24, 0x7b, 0x1f, 0x00, 0x08, 0xd1, 0xf1, 0x66, 0x76, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xbd, 0xbf, 0xd9, 0xdd, 0xdd, 0xb6, 0x47, 0x00, 0x00, 0xd8, 0xb4, 0xad, 0x1f, 0x00, 0x24, 0x24, 0x6f, 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0xb7, 0x9d, 0x33, 0xd9, 0x96, 0x4e, 0x00, 0x20, 0x49, 0xf7, 0xfd, 0x1e, 0x00, 0x48, 0xe4, 0xac, 0xb9, 0xdd, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xdd, 0x76, 0xb6, 0xb7, 0xfd, 0x7a, 0x00, 0x00, 0x44, 0x96, 0xb7, 0x1f, 0x00, 0x02, 0x9a, 0xbe, 0x6f, 0x77, 0xff, 0xff, 0x7f, 0x61, 0xd9, 0xff, 0xff, 0xff, 0xfd, 0xdd, 0x66, 0xed, 0x66, 0x5b, 0x37, 0x00, 0x90, 0x64, 0xb9, 0xf6, 0x1f, 0x00, 0x02, 0xc9, 0xf3, 0xee, 0xfd, 0xff, 0xff, 0x2f, 0x24, 0x4f, 0xfe, 0xff, 0xff, 0x7f, 0x37, 0xdb, 0xcd, 0x7c, 0xff, 0x3a, 0x00, 0x88, 0x24, 0xdb, 0xde, 0x1a, 0x00, 0x13, 0x31, 0x6f, 0xbb, 0xdf, 0xff, 0xff, 0x21, 0xa0, 0x64, 0xf3, 0xff, 0xff, 0xe7, 0xff, 0x96, 0xbb, 0x9b, 0xa5, 0x1d, 0x00, 0x60, 0x32, 0xe9, 0xdb, 0x0f, 0x00, 0x65, 0xe6, 0x3c, 0xfb, 0xf6, 0xff, 0x7f, 0x10, 0xa4, 0xb5, 0x9d, 0xfe, 0xdf, 0xdf, 0xdd, 0x6d, 0x32, 0xb3, 0x7d, 0x0d, 0x00, 0x0b, 0x93, 0x7c, 0x7b, 0x0f, 0x00, 0x89, 0xdc, 0xb3, 0xed, 0xfb, 0xff, 0x1f, 0x10, 0x90, 0x92, 0xd9, 0xfe, 0x7f, 0xff, 0x77, 0xdb, 0xee, 0x6e, 0xdb, 0x0e, 0x00, 0x20, 0xdd, 0x66, 0x6f, 0x0f, 0x80, 0x91, 0x5a, 0xfb, 0xbe, 0xef, 0xff, 0x0f, 0x10, 0xda, 0x92, 0xee, 0xff, 0xff, 0xff, 0xf7, 0xb7, 0xcd, 0xee, 0xde, 0x07, 0x00, 0x24, 0x49, 0xb6, 0xed, 0x0f, 0x00, 0x12, 0x6b, 0xcd, 0xf3, 0xbe, 0xff, 0x07, 0x08, 0x48, 0xda, 0x76, 0xb7, 0xff, 0xff, 0xdd, 0x6e, 0xba, 0x99, 0x65, 0x03, 0x40, 0x92, 0xe4, 0xba, 0xbd, 0x0e, 0x80, 0x62, 0xed, 0x7d, 0x5f, 0xf7, 0xff, 0x01, 0x08, 0x28, 0xc9, 0x26, 0xbb, 0xff, 0xff, 0xff, 0x99, 0xb7, 0xbb, 0x7d, 0x03, 0x00, 0x89, 0x64, 0xdb, 0xf6, 0x07, 0x40, 0x0c, 0x35, 0xe7, 0x79, 0xdd, 0xff, 0x01, 0x84, 0xa5, 0x7d, 0xba, 0xdd, 0xfe, 0x7f, 0xbf, 0xbf, 0x6d, 0x76, 0xdb, 0x01, 0x00, 0x48, 0x36, 0xdb, 0xd6, 0x07, 0xc0, 0x88, 0xb4, 0xb6, 0xbf, 0xff, 0x7f, 0x00, 0x0c, 0x24, 0x44, 0xdb, 0xed, 0xff, 0xdf, 0xef, 0x6e, 0xdb, 0x6e, 0xb7, 0x00, 0x80, 0x44, 0x93, 0xed, 0x5b, 0x07, 0x40, 0x91, 0xd2, 0xfa, 0xfc, 0xf6, 0x7f, 0x00, 0x02, 0xb4, 0x35, 0xd9, 0xef, 0xff, 0xff, 0xfb, 0xef, 0xb6, 0xc9, 0xe4, 0x00, 0x10, 0x24, 0xd9, 0x6d, 0xfb, 0x03, 0x00, 0x27, 0xfe, 0xd3, 0xd6, 0xdb, 0x3f, 0x00, 0xa2, 0x94, 0xb4, 0xdb, 0x7c, 0xff, 0xff, 0xbf, 0xd9, 0xad, 0xdb, 0x7d, 0x00, 0x40, 0x32, 0xd9, 0xb6, 0xef, 0x03, 0x60, 0xe4, 0x5a, 0x5f, 0x5f, 0xff, 0x1f, 0x00, 0x02, 0x52, 0x92, 0xec, 0xb6, 0xff, 0xff, 0xef, 0xff, 0x6d, 0xb6, 0x3b, 0x00, 0x28, 0x90, 0xcc, 0xbe, 0xfd, 0x03, 0xa0, 0x88, 0xeb, 0xf9, 0xfd, 0xf5, 0x1f, 0x00, 0x82, 0x53, 0xbb, 0x6d, 0xf7, 0xff, 0xf9, 0xff, 0x6f, 0xdb, 0x6d, 0x1b, 0x00, 0x04, 0xc9, 0x66, 0xdb, 0x57, 0x03, 0xa0, 0x52, 0xaf, 0xa7, 0x97, 0xff, 0x0f, 0x00, 0x51, 0x48, 0xda, 0x66, 0xdb, 0xff, 0xf8, 0xdf, 0xed, 0xbe, 0xed, 0x0e, 0x00, 0x92, 0x64, 0x32, 0xeb, 0xf6, 0x01, 0x20, 0x63, 0xbd, 0xbc, 0xfc, 0xfa, 0x0f, 0x00, 0x09, 0x20, 0x89, 0x3e, 0xff, 0xff, 0xe0, 0x7f, 0xdf, 0x6f, 0xdb, 0x07, 0x00, 0x01, 0x24, 0xbb, 0xed, 0xfe, 0x01, 0xa0, 0xce, 0xf5, 0xf6, 0xdb, 0xdf, 0x07, 0x00, 0x41, 0xad, 0x5f, 0xf2, 0xed, 0xff, 0xc0, 0xff, 0xbf, 0xdd, 0x92, 0x03, 0x00, 0x44, 0xb2, 0xd9, 0x7d, 0xfb, 0x01, 0xe0, 0xaa, 0xdf, 0x9b, 0x7f, 0xfb, 0x07, 0x80, 0x28, 0x21, 0x64, 0xbb, 0x7f, 0x7f, 0x80, 0xff, 0xf6, 0xbb, 0xee, 0x03, 0x80, 0x22, 0x99, 0xed, 0xb6, 0xff, 0x00, 0x90, 0xb8, 0x5e, 0x5b, 0x6b, 0xed, 0x03, 0x00, 0x01, 0xa6, 0x6d, 0xdb, 0xf6, 0x7f, 0x00, 0xff, 0xff, 0xf6, 0xcd, 0x00, 0x40, 0x10, 0xc9, 0x6c, 0xff, 0xf7, 0x00, 0xa0, 0xe3, 0x72, 0xeb, 0xef, 0xff, 0x03, 0x80, 0xe0, 0x90, 0x24, 0xdb, 0xbd, 0x3f, 0x00, 0xfe, 0xdb, 0x6f, 0xfb, 0x00, 0x00, 0x89, 0x4c, 0xb6, 0xd9, 0x7e, 0x00, 0x70, 0xaf, 0xaf, 0x6f, 0xb5, 0xde, 0x03, 0x80, 0x94, 0x92, 0xb6, 0xf9, 0xf6, 0x3f, 0x00, 0xfc, 0xbf, 0xdd, 0x7b, 0x00, 0x10, 0x48, 0x26, 0xb3, 0xdf, 0x7f, 0x00, 0x70, 0xd8, 0xae, 0xfd, 0xff, 0xf7, 0x03, 0x80, 0x00, 0xd2, 0x36, 0xcf, 0xdf, 0x3f, 0x00, 0xb8, 0x6d, 0xdf, 0x16, 0x00, 0x48, 0x44, 0xb2, 0xfb, 0x6c, 0x3f, 0x00, 0x50, 0x75, 0xfd, 0xa5, 0xd5, 0xfe, 0x01, 0x40, 0xd1, 0x12, 0xa2, 0x7d, 0xfb, 0x1f, 0x00, 0xf0, 0xff, 0xbf, 0x0d, 0x00, 0x20, 0x12, 0x9b, 0xcd, 0xf6, 0x3f, 0x00, 0x90, 0xd5, 0xa7, 0xfd, 0x77, 0xab, 0x03, 0x40, 0x1c, 0xc8, 0xbe, 0x6d, 0xfb, 0x1f, 0x00, 0xe0, 0xff, 0xee, 0x07, 0x00, 0x04, 0x91, 0xc9, 0x7e, 0xbf, 0x1f, 0x00, 0x30, 0x57, 0xbf, 0xa6, 0xde, 0xfd, 0x01, 0x40, 0x40, 0x6b, 0xd3, 0x6e, 0xef, 0x0f, 0x00, 0xc0, 0xeb, 0x7d, 0x03, 0x00, 0x90, 0xc8, 0x6c, 0x76, 0xfb, 0x0f, 0x00, 0x70, 0x5c, 0xe5, 0xf7, 0xfa, 0xeb, 0x01, 0x40, 0x50, 0x49, 0x92, 0xf4, 0xfd, 0x0f, 0x00, 0xc0, 0xff, 0xdb, 0x01, 0x80, 0x44, 0x44, 0x66, 0xbb, 0x6f, 0x0f, 0x00, 0xd0, 0xf1, 0x95, 0xf6, 0x6f, 0xad, 0x01, 0x40, 0x08, 0x78, 0xdb, 0xb6, 0xef, 0x0f, 0x00, 0x00, 0xdf, 0xd6, 0x00, 0x00, 0x20, 0x32, 0xb3, 0xdb, 0xfd, 0x0f, 0x00, 0x10, 0xd7, 0xf7, 0xb6, 0xd8, 0xeb, 0x03, 0x20, 0x43, 0x27, 0xd9, 0xb6, 0xfd, 0x0f, 0x00, 0x00, 0xff, 0x7e, 0x00, 0x40, 0x12, 0x93, 0xd9, 0xec, 0xb6, 0x07, 0x00, 0x70, 0x55, 0xdd, 0xf6, 0x6f, 0xbb, 0x01, 0x40, 0x28, 0xa1, 0x6f, 0xb6, 0xb7, 0x0f, 0x00, 0x00, 0xde, 0x1f, 0x00, 0x80, 0x88, 0xd8, 0xcc, 0x66, 0xff, 0x03, 0x00, 0x70, 0xf4, 0xf5, 0xdb, 0xaa, 0xee, 0x01, 0x60, 0x28, 0x2d, 0x49, 0xf7, 0xf6, 0x07, 0x00, 0x00, 0x7c, 0x0f, 0x00, 0x08, 0x48, 0x66, 0x6e, 0xfb, 0xef, 0x03, 0x00, 0xd0, 0xd5, 0xdf, 0x52, 0xff, 0xda, 0x03, 0x20, 0xa3, 0xa5, 0xd9, 0xb2, 0xff, 0x07, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x20, 0x22, 0x33, 0x37, 0xbf, 0xfd, 0x01, 0x00, 0x70, 0x5f, 0xf7, 0xfe, 0xab, 0x6b, 0x02, 0xa0, 0xa8, 0xb4, 0x6d, 0xdf, 0xf6, 0x07, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x12, 0x33, 0x11, 0xd9, 0xdd, 0xff, 0x01, 0x00, 0x70, 0x75, 0xd5, 0x52, 0xea, 0x8a, 0x03, 0x20, 0x84, 0x36, 0x69, 0xba, 0xdb, 0x07, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x81, 0xc8, 0xcc, 0xdd, 0xed, 0xff, 0x00, 0x00, 0x60, 0xd5, 0xdf, 0xf6, 0xae, 0x6b, 0x03, 0x00, 0xa1, 0xa4, 0x6d, 0xdf, 0xfe, 0x07, 0x00, 0x00, 0x60, 0x00, 0x40, 0x44, 0xc6, 0xcc, 0x64, 0xb7, 0xfd, 0x00, 0x00, 0xe0, 0x55, 0xf7, 0xd6, 0xea, 0xba, 0x07, 0x20, 0x94, 0x94, 0x6d, 0xfb, 0xdb, 0x07, 0x00, 0x00, 0x20, 0x00, 0x20, 0x20, 0x32, 0x76, 0x77, 0xff, 0x7f, 0x00, 0x00, 0x60, 0x7d, 0xd5, 0xb6, 0x3f, 0xaf, 0x06, 0xa0, 0xa4, 0x95, 0x6c, 0x9b, 0xee, 0x07, 0x00, 0x00, 0x18, 0x00, 0x10, 0x92, 0x15, 0x73, 0xbb, 0xd9, 0x3f, 0x00, 0x00, 0xe0, 0xf5, 0xff, 0xf7, 0x6a, 0xa9, 0x06, 0x80, 0xa2, 0xb4, 0x6d, 0xfb, 0xfb, 0x07, 0x00, 0x00, 0x04, 0x00, 0x84, 0x88, 0xc8, 0x99, 0xdd, 0xff, 0x3f, 0x00, 0x00, 0xe0, 0x8b, 0xff, 0x96, 0x6a, 0xb6, 0x0a, 0xa0, 0x94, 0x96, 0x64, 0xdb, 0xee, 0x07, 0x00, 0x00, 0x03, 0x08, 0x20, 0x60, 0x66, 0xec, 0xee, 0xb6, 0x1d, 0x00, 0x00, 0xc0, 0x7e, 0xa5, 0xf4, 0xab, 0x55, 0x0d, 0x20, 0xe7, 0xd4, 0x6d, 0xdb, 0xfb, 0x07, 0x00, 0x80, 0x00, 0x00, 0x09, 0x12, 0x33, 0x67, 0x77, 0xff, 0x0f, 0x00, 0x00, 0xc0, 0xfa, 0xff, 0xb7, 0x7a, 0x55, 0x19, 0x90, 0x91, 0xd4, 0x64, 0xdb, 0xee, 0x07, 0x00, 0x40, 0x00, 0x81, 0x04, 0x88, 0x91, 0x3b, 0xbb, 0xfd, 0x0f, 0x00, 0x00, 0xc0, 0xab, 0xbf, 0xed, 0x4e, 0xbb, 0x32, 0x20, 0x94, 0x96, 0x6c, 0xff, 0xfa, 0x03, 0x00, 0x30, 0x40, 0x20, 0x20, 0x64, 0xcc, 0xdc, 0xdd, 0xff, 0x07, 0x00, 0x00, 0xc0, 0xeb, 0xea, 0xfd, 0xd5, 0xaa, 0x2a, 0x20, 0xd7, 0xb0, 0x6d, 0x93, 0xef, 0x07, 0x00, 0x08, 0x00, 0x08, 0x01, 0x23, 0xee, 0xee, 0xee, 0xfb, 0x03, 0x00, 0x00, 0xc0, 0xfe, 0xff, 0x2d, 0xdd, 0x6a, 0x49, 0xd0, 0x90, 0x9a, 0x64, 0xdf, 0xea, 0x07, 0x00, 0x03, 0x80, 0x40, 0x8c, 0x98, 0x33, 0xb3, 0xbb, 0xff, 0x01, 0x00, 0x00, 0xc0, 0xa5, 0x7b, 0x6d, 0xa7, 0x56, 0xc5, 0xa0, 0x94, 0x94, 0x6f, 0xd3, 0xbb, 0x07, 0x80, 0x10, 0x0c, 0x12, 0x40, 0xc6, 0xb9, 0xdb, 0xfb, 0xfd, 0x01, 0x00, 0x00, 0x80, 0x97, 0xee, 0xdf, 0xba, 0x54, 0x1a, 0xa1, 0xe5, 0xd2, 0x64, 0x7e, 0xee, 0x07, 0x60, 0x02, 0x80, 0x00, 0x31, 0x62, 0xcc, 0xdc, 0xee, 0x7f, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xdb, 0xaa, 0xb5, 0x8a, 0x86, 0x98, 0x96, 0x6d, 0x9b, 0xea, 0x07, 0x98, 0x00, 0x22, 0x44, 0x88, 0x39, 0x77, 0x77, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x80, 0x7d, 0x77, 0xba, 0x7b, 0x2d, 0x55, 0x3c, 0xa6, 0xb4, 0x6c, 0xf6, 0xaf, 0x07, 0x07, 0x90, 0x88, 0x20, 0x42, 0x9c, 0xbb, 0xbb, 0xbb, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x4b, 0xbd, 0xbf, 0x55, 0x53, 0xa5, 0xb2, 0xa1, 0xb4, 0xc9, 0x9f, 0xda, 0xcf, 0x28, 0x24, 0x42, 0x08, 0x31, 0xe6, 0xcc, 0xdd, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xef, 0xb7, 0xbd, 0xde, 0x12, 0xd1, 0xac, 0x95, 0x4d, 0xf2, 0x56, 0x9f, 0x88, 0x80, 0x10, 0xc2, 0x9c, 0x73, 0x77, 0xef, 0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xbf, 0xfb, 0xed, 0xeb, 0x35, 0x95, 0x72, 0xa2, 0x35, 0xcd, 0xb6, 0xd6, 0x2f, 0x21, 0x24, 0x04, 0x31, 0xc6, 0x98, 0x33, 0xf7, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0x7f, 0x5b, 0xab, 0x2d, 0x28, 0x23, 0x65, 0xd9, 0xb6, 0x55, 0x5f, 0x88, 0x08, 0x43, 0x0c, 0x61, 0xde, 0xdd, 0xfb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x76, 0xff, 0x4d, 0xd7, 0x4d, 0x4a, 0xa5, 0x29, 0x2d, 0xdb, 0xbe, 0x55, 0x1f, 0x22, 0x42, 0x28, 0xc2, 0x39, 0xe7, 0xee, 0xee, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x7f, 0xfb, 0xb6, 0xb6, 0x95, 0x70, 0x2e, 0xa5, 0xd9, 0x24, 0x5d, 0x5f, 0x8a, 0x28, 0x88, 0x31, 0x9e, 0x39, 0x73, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xec, 0xb7, 0xdf, 0x6c, 0xb5, 0x65, 0x26, 0xa3, 0x39, 0x9b, 0xfc, 0x85, 0x5d, 0x21, 0x04, 0x63, 0x1c, 0xe6, 0xdd, 0xbd, 0xfb, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xb8, 0xfa, 0xb6, 0x6f, 0x4d, 0x9a, 0x28, 0x59, 0x4d, 0xd3, 0x2f, 0xf5, 0x3f, 0x8c, 0xd1, 0x18, 0xc6, 0x31, 0xf6, 0xdd, 0xfe, 0xff, 0xfe, 0x01, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xef, 0xb9, 0xb6, 0x25, 0xe1, 0x4d, 0x69, 0xba, 0x6c, 0xad, 0x3c, 0x41, 0x14, 0x84, 0xe9, 0x9e, 0x37, 0xf7, 0xff, 0xff, 0xfb, 0x03, 0x00, 0x00, 0x00, 0x70, 0x5d, 0x3d, 0x9f, 0x3d, 0x6d, 0x26, 0x52, 0x59, 0xb6, 0x6d, 0xab, 0x7f, 0x14, 0x82, 0xe1, 0x39, 0xe6, 0xdd, 0xfb, 0xff, 0xbf, 0xff, 0x01, 0x00, 0x00, 0x00, 0xf0, 0xf6, 0x6f, 0x77, 0xcd, 0x92, 0xd0, 0x52, 0x4b, 0xb3, 0x49, 0x0b, 0x3a, 0x41, 0x61, 0x38, 0x9e, 0x73, 0xee, 0xdc, 0xff, 0xff, 0xfd, 0x03, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xd7, 0x65, 0xda, 0x66, 0x63, 0x9d, 0xf2, 0x36, 0x7b, 0x6a, 0x7f, 0x14, 0x18, 0x8e, 0xe7, 0xd9, 0x7b, 0xff, 0xff, 0xef, 0xff, 0x03, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xdd, 0xb6, 0xc9, 0x4c, 0x46, 0x9a, 0x64, 0xcb, 0x5b, 0xed, 0x06, 0xc6, 0xe3, 0x71, 0xde, 0xbd, 0xff, 0xff, 0x7f, 0xff, 0x07, 0x00, 0x00, 0x00, 0xc0, 0x7f, 0x7f, 0xff, 0x59, 0x37, 0x75, 0xbb, 0x96, 0x66, 0xdb, 0x56, 0xf7, 0xe0, 0xf2, 0x74, 0x9e, 0x77, 0xef, 0xfd, 0xff, 0xeb, 0xed, 0x03, 0x00, 0x00, 0x00, 0xc0, 0xea, 0xdf, 0xb3, 0xdb, 0xde, 0xc6, 0x81, 0xb0, 0x6c, 0xba, 0xb4, 0xf6, 0x38, 0x18, 0x3c, 0xe7, 0x9c, 0xfb, 0xff, 0x7f, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x80, 0xff, 0xf7, 0x6e, 0x66, 0xd9, 0x99, 0xac, 0xa4, 0xcd, 0x96, 0xa5, 0xea, 0x03, 0xa7, 0xcf, 0x79, 0xef, 0xfd, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfd, 0xef, 0xdf, 0x6f, 0xef, 0x72, 0x65, 0xd9, 0xb6, 0xad, 0xe8, 0xc1, 0xe1, 0xf1, 0xbe, 0x7b, 0xef, 0xff, 0xdf, 0x7a, 0xfb, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x5f, 0xdd, 0x9d, 0xac, 0x99, 0x84, 0x29, 0xcd, 0x3c, 0x4f, 0x9d, 0x7d, 0x3c, 0x9e, 0xe7, 0xbe, 0xff, 0xff, 0xff, 0xff, 0xef, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x77, 0x7b, 0x33, 0xe7, 0x5a, 0x49, 0x9b, 0x65, 0x59, 0x75, 0x07, 0x97, 0xf7, 0xbb, 0xef, 0xff, 0xff, 0xdb, 0xfe, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf7, 0x3f, 0xe7, 0xcf, 0x9c, 0x51, 0x4d, 0xb0, 0x6d, 0x4b, 0xc9, 0xd3, 0xf5, 0x79, 0xfe, 0xfb, 0xff, 0xff, 0xdb, 0xda, 0xfe, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xef, 0xde, 0xdd, 0xf3, 0x4d, 0x52, 0x36, 0xcb, 0xd2, 0x3a, 0x7e, 0x3c, 0xde, 0xe7, 0xbe, 0xff, 0x7f, 0xda, 0xff, 0xdf, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xfb, 0xdd, 0x73, 0x8f, 0xa5, 0x9a, 0xe6, 0xd9, 0xb6, 0xe2, 0x4e, 0xc7, 0xf7, 0xfd, 0xff, 0xff, 0xff, 0xf7, 0xf6, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x7f, 0xee, 0x79, 0xb2, 0xb2, 0x2c, 0x9f, 0xb6, 0x54, 0xfe, 0xfb, 0x79, 0xbf, 0xff, 0xff, 0x5f, 0xda, 0xff, 0xfa, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xf7, 0xbf, 0xe7, 0x4b, 0xb4, 0x69, 0xd3, 0x2c, 0x25, 0xbd, 0xbc, 0xcf, 0xf7, 0xfd, 0xff, 0xd7, 0xf6, 0xfe, 0xdf, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xbf, 0x9d, 0xf1, 0x3e, 0x57, 0x25, 0xcb, 0xb6, 0x6d, 0xa9, 0xb5, 0xef, 0xfb, 0xff, 0xff, 0xff, 0xd5, 0xda, 0xd6, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xfb, 0xcf, 0xf5, 0x25, 0x65, 0xd9, 0x66, 0x5b, 0x4a, 0xfa, 0xf9, 0x7e, 0xff, 0xff, 0xff, 0xf6, 0xd6, 0xdf, 0xfa, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xef, 0x3e, 0xf7, 0x9f, 0x5b, 0x92, 0x6c, 0xdb, 0x52, 0xe5, 0xbe, 0xdf, 0xff, 0xff, 0xbf, 0x51, 0xda, 0xfa, 0x7f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7b, 0x9f, 0xe7, 0x4c, 0xb3, 0x4d, 0xd3, 0x54, 0xd9, 0xe7, 0xfb, 0xff, 0xff, 0x5f, 0xdc, 0xfa, 0xdf, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x7f, 0xe7, 0xf9, 0x3a, 0xd3, 0xa6, 0xe9, 0xb6, 0xa5, 0xca, 0xf9, 0xfd, 0xff, 0xff, 0x83, 0x42, 0xd2, 0xff, 0xfb, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xfd, 0xbf, 0xef, 0x4f, 0xd5, 0x64, 0xdb, 0x26, 0x4d, 0x30, 0x7f, 0xff, 0xff, 0xff, 0x91, 0xda, 0xdb, 0xda, 0xdf, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xbf, 0xff, 0x7d, 0xbe, 0xb5, 0x6d, 0x97, 0x6d, 0x93, 0x56, 0xdf, 0xff, 0xff, 0x7f, 0x81, 0x4a, 0xda, 0x7f, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xef, 0xeb, 0xbb, 0xa6, 0x4d, 0x73, 0xcd, 0x92, 0xaa, 0xfe, 0xff, 0xff, 0x1f, 0x01, 0x6a, 0x5b, 0xfb, 0xfb, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xbf, 0x5f, 0x3b, 0xdb, 0x36, 0xbb, 0x26, 0x4c, 0xf9, 0xff, 0xff, 0x0f, 0xa3, 0x2a, 0xe9, 0x7f, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xff, 0xff, 0xfe, 0xfe, 0xcc, 0x91, 0xec, 0x93, 0x6d, 0x93, 0xf2, 0xff, 0xff, 0x03, 0x00, 0x6a, 0x6d, 0x6f, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xf7, 0x6f, 0x76, 0xb6, 0xcd, 0x76, 0xc9, 0x2a, 0xe9, 0xff, 0xff, 0x00, 0x02, 0x24, 0xed, 0xf9, 0xed, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xdf, 0xff, 0xd9, 0x66, 0x9b, 0x6c, 0x93, 0x54, 0xc5, 0xff, 0x3f, 0x00, 0x01, 0x95, 0xb5, 0xaf, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xfd, 0xae, 0x7d, 0xde, 0x6d, 0xf6, 0xa1, 0x8a, 0xff, 0x0f, 0x00, 0x81, 0x90, 0xb4, 0xfd, 0xfd, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xcd, 0xb2, 0xdb, 0x2c, 0xcb, 0x54, 0xfe, 0x01, 0x00, 0x01, 0xd2, 0xb6, 0xb7, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x39, 0xdb, 0x76, 0xb3, 0x4b, 0xb6, 0x0a, 0xfe, 0x00, 0x00, 0x01, 0x48, 0xda, 0xfe, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xcf, 0xb9, 0x6d, 0xb6, 0xd9, 0xa5, 0x75, 0x1c, 0x00, 0x80, 0x80, 0x20, 0xdb, 0xda, 0xbe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x77, 0x96, 0xd9, 0x26, 0xb3, 0x4d, 0x82, 0x11, 0x00, 0x80, 0x80, 0x24, 0x6d, 0xff, 0xf7, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xbb, 0x67, 0xdb, 0xdd, 0x36, 0xd9, 0x54, 0x60, 0x00, 0xc0, 0x00, 0x92, 0x65, 0x6b, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x4f, 0x7d, 0x96, 0xd9, 0x6c, 0x36, 0xad, 0xc2, 0x00, 0x60, 0x00, 0xc8, 0xb6, 0x6d, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xc8, 0x76, 0xbb, 0xcb, 0x64, 0x52, 0x02, 0x03, 0x10, 0x00, 0x64, 0xda, 0xff, 0xfb, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x5f, 0xd7, 0x4d, 0x33, 0x99, 0xdd, 0x96, 0x04, 0x2c, 0x1c, 0x40, 0x22, 0xdb, 0xb6, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xdf, 0xb5, 0xed, 0xe6, 0x36, 0x9b, 0x6c, 0x29, 0xf0, 0x03, 0x00, 0x99, 0x6c, 0xfb, 0xfd, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x35, 0xbb, 0xec, 0x76, 0x33, 0x91, 0x02, 0x00, 0x00, 0x00, 0x64, 0x67, 0xdf, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xbf, 0x6f, 0x9b, 0x9d, 0xc9, 0xce, 0x36, 0x49, 0x00, 0x00, 0x00, 0x93, 0xb1, 0xdd, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xff, 0x6a, 0x76, 0xbb, 0xdd, 0xd9, 0x64, 0x12, 0x01, 0x00, 0x40, 0x98, 0xdd, 0x6d, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xdf, 0x66, 0x73, 0x33, 0xbb, 0x9d, 0x4d, 0x00, 0x00, 0x00, 0x63, 0xe6, 0xf6, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xed, 0xfd, 0xee, 0xee, 0x36, 0x73, 0x2b, 0x04, 0x00, 0xa0, 0x38, 0x75, 0xbf, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xd9, 0xec, 0xce, 0x66, 0x66, 0x66, 0x22, 0x04, 0x00, 0xc6, 0x99, 0xbb, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0xb3, 0xdb, 0xb9, 0xcd, 0xc9, 0x88, 0x89, 0x00, 0x68, 0x31, 0xee, 0xdd, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xbe, 0xbb, 0x9b, 0x3f, 0xbb, 0x33, 0x23, 0x04, 0x00, 0x8c, 0xf3, 0xee, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x67, 0x76, 0x77, 0xb2, 0x66, 0xce, 0x0c, 0xd1, 0xd6, 0xe3, 0x79, 0xf7, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfd, 0xef, 0xe6, 0xee, 0xce, 0x9c, 0x31, 0x16, 0x00, 0x3c, 0x9e, 0xfb, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x9f, 0xdb, 0xdc, 0x9d, 0x99, 0x33, 0xc6, 0xc1, 0xff, 0x8f, 0xe7, 0xbb, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf7, 0xbd, 0xbb, 0x33, 0x7b, 0xee, 0x18, 0x1e, 0x50, 0xf0, 0xf9, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7b, 0xf7, 0x77, 0xf7, 0xe6, 0x9c, 0xe3, 0xf0, 0x4d, 0xff, 0x7c, 0xef, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xdf, 0x76, 0x7f, 0xcf, 0x9e, 0x73, 0x8f, 0x07, 0xff, 0x0b, 0xdf, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xee, 0xcd, 0xdd, 0x9d, 0x7b, 0xf7, 0x7c, 0x7a, 0x00, 0xf0, 0xe7, 0xfd, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7f, 0xbf, 0xdd, 0x7b, 0x6b, 0x9e, 0xf3, 0xe1, 0xff, 0xff, 0x7d, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xb7, 0xbb, 0x7b, 0xee, 0x79, 0x8f, 0x0f, 0xfa, 0x2f, 0xff, 0xf7, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xff, 0x77, 0xef, 0xdd, 0x77, 0x7c, 0xfe, 0x02, 0xe8, 0xcf, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xef, 0xee, 0xdd, 0xb3, 0xcf, 0xf3, 0xf1, 0xff, 0xff, 0xf9, 0xfe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfb, 0xff, 0xbf, 0xef, 0xbe, 0xcf, 0x8f, 0xfe, 0x5f, 0xfe, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xbf, 0xbb, 0xf7, 0xde, 0x79, 0x3e, 0xff, 0x52, 0xd2, 0xdf, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xef, 0xef, 0xef, 0x3c, 0xef, 0xf9, 0xf8, 0xff, 0xff, 0xf7, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xee, 0xdc, 0xf7, 0xfe, 0xe7, 0x97, 0xfe, 0xff, 0xfe, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbf, 0xef, 0xbf, 0x3e, 0xff, 0xda, 0xf6, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xbf, 0xf7, 0xfe, 0xf7, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xde, 0xbd, 0xef, 0xfb, 0xd7, 0xff, 0xbf, 0xfd, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xf7, 0x7d, 0xbf, 0xff, 0xd2, 0xf6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xbf, 0xef, 0xfb, 0xfd, 0xfd, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xef, 0xbe, 0xf7, 0xef, 0xef, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfb, 0xdf, 0xbf, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xfe, 0xff, 0xfb, 0xf7, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xfd, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; # define GCBits (GCFillStyle|GCTileStipXOrigin|GCTileStipYOrigin) void SetFillStyle(XParms xp, Parms p) { int xorg = 0, yorg = 0; if (p->fillStyle == FillStippled || p->fillStyle == FillOpaqueStippled) { Pixmap stipple; XGCValues gcv; if (!p->font) { /* Little 8x8 stipple */ stipple = XCreateBitmapFromData(xp->d, xp->w, (const char *)bitmap8x8, 8, 8); } else if (!strcmp (p->font, "escherknot")) { /* Enormous stipple which is x4 bits wide */ stipple = XCreateBitmapFromData(xp->d, xp->w, (const char *)escherknot_bits, escherknot_width, escherknot_height); xorg = -3; } else if (!strcmp (p->font, "OddTile")) { /* Odd sized tile */ stipple = XCreateBitmapFromData(xp->d, xp->w, (const char *)oddbit_bits, oddbit_width, oddbit_height); } else { /* Enormous stipple. Well, pretty big. */ stipple = XCreateBitmapFromData(xp->d, xp->w, (const char *)mensetmanus_bits, mensetmanus_width, mensetmanus_height); } gcv.stipple = stipple; gcv.fill_style = p->fillStyle; gcv.ts_x_origin = xorg; gcv.ts_y_origin = yorg; XChangeGC(xp->d, xp->fggc, GCBits | GCStipple, &gcv); XChangeGC(xp->d, xp->bggc, GCBits | GCStipple, &gcv); XFreePixmap(xp->d, stipple); } else if (p->fillStyle == FillTiled) { Pixmap tile; XGCValues gcv; gcv.fill_style = FillTiled; if (!p->font) { /* Little 4x4 tile */ tile = XCreatePixmapFromBitmapData(xp->d, xp->w, (char *)bitmap4x4, 4, 4, xp->foreground, xp->background, xp->vinfo.depth); } else if (!strcmp (p->font, "escherknot")) { /* Enormous stipple which is x4 bits wide */ tile = XCreatePixmapFromBitmapData(xp->d, xp->w, (char *)escherknot_bits, escherknot_width, escherknot_height, xp->foreground, xp->background, xp->vinfo.depth); /* align tile with screen */ xorg = -3; } else if (!strcmp (p->font, "OddTile")) { /* Odd sized tile */ tile = XCreatePixmapFromBitmapData(xp->d, xp->w, (char *)oddbit_bits, oddbit_width, oddbit_height, xp->foreground, xp->background, xp->vinfo.depth); /* align tile with screen */ } else { /* Enormous tile. Well, pretty big. */ tile = XCreatePixmapFromBitmapData(xp->d, xp->w, (char *)mensetmanus_bits, mensetmanus_width, mensetmanus_height, xp->foreground, xp->background, xp->vinfo.depth); } gcv.tile = tile; gcv.ts_x_origin = xorg; gcv.ts_y_origin = yorg; XChangeGC(xp->d, xp->fggc, GCBits | GCTile, &gcv); XFreePixmap(xp->d, tile); if (!p->font) { /* Little 4x4 tile */ tile = XCreatePixmapFromBitmapData(xp->d, xp->w, (char *)bitmap4x4, 4, 4, xp->background, xp->foreground, xp->vinfo.depth); } else if (!strcmp (p->font, "escherknot")) { /* Enormous stipple which is x4 bits wide */ tile = XCreatePixmapFromBitmapData(xp->d, xp->w, (char *)escherknot_bits, escherknot_width, escherknot_height, xp->background, xp->foreground, xp->vinfo.depth); } else if (!strcmp (p->font, "OddTile")) { /* Odd sized tile */ tile = XCreatePixmapFromBitmapData(xp->d, xp->w, (char *)oddbit_bits, oddbit_width, oddbit_height, xp->background, xp->foreground, xp->vinfo.depth); } else { /* Enormous tile. Well, pretty big. */ tile = XCreatePixmapFromBitmapData(xp->d, xp->w, (char *)mensetmanus_bits, mensetmanus_width, mensetmanus_height, xp->background, xp->foreground, xp->vinfo.depth); } gcv.tile = tile; XChangeGC(xp->d, xp->bggc, GCFillStyle | GCTile, &gcv); XFreePixmap(xp->d, tile); } } x11-apps-7.7+5+nmu1ubuntu1/x11perf/Makefile.am0000664000000000000000000000432512514116510015513 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = x11perf AM_CFLAGS = $(CWARNFLAGS) $(XEXT_CFLAGS) $(XFT_CFLAGS) $(XRENDER_CFLAGS) $(X11PERF_CFLAGS) x11perf_LDADD = $(XEXT_LIBS) $(XFT_LIBS) $(XRENDER_LIBS) $(X11PERF_LIBS) -lm x11perf_SOURCES = \ bitmaps.c \ bitmaps.h \ do_arcs.c \ do_blt.c \ do_complex.c \ do_dots.c \ do_lines.c \ do_movewin.c \ do_rects.c \ do_segs.c \ do_simple.c \ do_tests.c \ do_text.c \ do_traps.c \ do_tris.c \ do_valgc.c \ do_windows.c \ x11perf.c \ x11perf.h bin_SCRIPTS = x11perfcomp CLEANFILES = $(bin_SCRIPTS) EXTRA_DIST = $(bin_SCRIPTS:=.in) DIR_SUBSTS = -e 's|@x11perfcompdir[@]|$(x11perfcompdir)|g' DIR_SUBSTS += -e 's|@MKTEMP[@]|$(MKTEMP)|g' x11perfcomp: x11perfcomp.in $(AM_V_GEN)$(SED) $(DIR_SUBSTS) < $(srcdir)/$@.in > $@ dist_x11perfcomp_SCRIPTS = \ fillblnk \ perfboth \ perfratio \ Xmark MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/x11perf/do_simple.c0000664000000000000000000000515412514116510015577 0ustar /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef VMS #include #else #include #endif #include "x11perf.h" static Atom XA_PK_TEMP; void DoNoOp(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != reps; i++) { XNoOp(xp->d); CheckAbort (); } } void DoGetAtom(XParms xp, Parms p, int64_t reps) { char *atom; int i; for (i = 0; i != reps; i++) { atom = XGetAtomName (xp->d, 1); XFree(atom); /* fix XBUG 6480 */ CheckAbort (); } } void DoQueryPointer(XParms xp, Parms p, int64_t reps) { int i; Window w; int x; unsigned int m; for (i = 0; i != reps; i++) { XQueryPointer (xp->d, xp->w, &w, &w, &x, &x, &x, &x, &m); CheckAbort (); } } int InitGetProperty(XParms xp, Parms p, int64_t reps) { long foo[4]; foo[0] = 41; foo[1] = 14; foo[2] = 37; foo[3] = 73; XA_PK_TEMP = XInternAtom (xp->d, "_PK_TEMP", False); XChangeProperty ( xp->d, xp->w, XA_PK_TEMP, XA_INTEGER, 32, PropModeReplace, (unsigned char *)foo, 4); return reps; } void DoGetProperty(XParms xp, Parms p, int64_t reps) { int i; int actual_format; unsigned long actual_length, bytes_remaining; unsigned char *prop; Atom actual_type; for (i = 0; i != reps; i++) { XGetWindowProperty ( xp->d, xp->w, XA_PK_TEMP, 0, 4, False, AnyPropertyType, &actual_type, &actual_format, &actual_length, &bytes_remaining, &prop); CheckAbort (); XFree(prop); } } x11-apps-7.7+5+nmu1ubuntu1/x11perf/missing0000755000000000000000000001533012656634617015076 0ustar #! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/x11perf/configure.ac0000664000000000000000000000527712514116510015754 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([x11perf], [1.6.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [x11perf]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS # Define the installation directory for the x11 performance compare scripts AC_SUBST([x11perfcompdir], [$libdir/X11/x11perfcomp]) # Checks for programs run by the scripts we install AC_PATH_PROG(MKTEMP, mktemp) # Checks for pkg-config packages PKG_CHECK_MODULES(X11PERF, [x11 xmuu xproto >= 7.0.17]) # Check for Xrender library PKG_CHECK_MODULES(XRENDER, xrender, [xrender_found=yes], [xrender_found=no]) case "$xrender_found" in yes) AC_DEFINE(XRENDER,1,[Xrender library available]) ;; esac # Check for Xft library PKG_CHECK_MODULES(XFT, xft, [xft_found=yes], [xft_found=no]) case "$xft_found" in yes) AC_DEFINE(XFT,1,[Xft library available]) ;; esac # Check for MIT-SHM extension PKG_CHECK_MODULES(XEXT, xext, [xext_found=yes], [xext_found=no]) case "$xext_found" in yes) save_LIBS="$LIBS" LIBS="$XEXT_LIBS $LIBS" AC_CHECK_FUNCS([XShmQueryExtension], AC_DEFINE(MITSHM, 1, [MIT-SHM extension available])) LIBS="$save_LIBS" ;; esac AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/x11perf/README0000664000000000000000000000116712514116510014340 0ustar All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/x11perf http://cgit.freedesktop.org/xorg/app/x11perf For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/x11perf/perfboth0000664000000000000000000000123512514116510015210 0ustar #!/bin/sh awk ' /^ 1/ && READY == 0 { printf (" 1 "); for (i = 2; i < NF; i++) printf (" %2d ", i); printf (" Operation\n"); next; } /^---/ { printf ("------------"); for (i = 2; i <= NF; i++) printf (" -------------------------"); printf ("\n"); READY=1; next; } READY==1 { base=$1; printf ("%12.1f", base); for (i = 2; i < '$1'; i++) { if (base == 0) printf (" %12.1f ", $i); else { rate=$i/base; printf (" %12.1f (%10.3f)", $i, rate); } } printf (" "); for (; i <= NF; i++) { printf ("%s ", $i); } printf ("\n"); next; } { print $0; } ' x11-apps-7.7+5+nmu1ubuntu1/x11perf/x11perf.c0000664000000000000000000012402212514116510015106 0ustar /**************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************************/ #include #include #include #include #ifndef VMS #include #include #else #include #endif #include "x11perf.h" #include #include #define Time_t time_t #include /* Only for working on ``fake'' servers, for hardware that doesn't exist */ static Bool drawToFakeServer = False; static Bool falsePrecision = False; static Pixmap tileToQuery = None; static char *displayName; int abortTest; typedef struct _RopNames { const char *name; int rop; } RopNameRec, *RopNamePtr; static RopNameRec ropNames[] = { { "clear", GXclear }, /* 0 */ { "and", GXand }, /* src AND dst */ { "andReverse", GXandReverse }, /* src AND NOT dst */ { "copy", GXcopy }, /* src */ { "andInverted", GXandInverted }, /* NOT src AND dst */ { "noop", GXnoop }, /* dst */ { "xor", GXxor }, /* src XOR dst */ { "or", GXor }, /* src OR dst */ { "nor", GXnor }, /* NOT src AND NOT dst */ { "equiv", GXequiv }, /* NOT src XOR dst */ { "invert", GXinvert }, /* NOT dst */ { "orReverse", GXorReverse }, /* src OR NOT dst */ { "copyInverted", GXcopyInverted }, /* NOT src */ { "orInverted", GXorInverted }, /* NOT src OR dst */ { "nand", GXnand }, /* NOT src OR NOT dst */ { "set", GXset } /* 1 */ }; static RopNameRec popNames[] = { { "Clear", PictOpClear }, { "Src", PictOpSrc }, { "Dst", PictOpDst }, { "Over", PictOpOver }, { "OverReverse", PictOpOverReverse }, { "In", PictOpIn }, { "InReverse", PictOpInReverse }, { "Out", PictOpOut }, { "OutReverse", PictOpOutReverse }, { "Atop", PictOpAtop }, { "AtopReverse", PictOpAtopReverse }, { "Xor", PictOpXor }, { "Add", PictOpAdd }, { "Saturate", PictOpSaturate }, }; static RopNameRec formatNames[] = { { "RGB24", PictStandardRGB24 }, { "ARGB32", PictStandardARGB32 }, { "A8", PictStandardA8 }, { "A4", PictStandardA4 }, { "A1", PictStandardA1 }, { "NATIVE", PictStandardNative }, }; static const char *(visualClassNames)[] = { "StaticGray", "GrayScale", "StaticColor", "PseudoColor", "TrueColor", "DirectColor" }; static Bool labels = False; static int repeat = 5; static int seconds = 5; static int delay = 0; static Window status; /* Status window and GC */ static GC tgc; static int HSx, HSy; static double syncTime = 0.0; static int saveargc; static char **saveargv; #define NUM_ROPS 16 static int numRops = 1; static int rops[NUM_ROPS] = { GXcopy }; #define NUM_POPS 14 static int numPops = 1; static int pops[NUM_POPS] = { PictOpOver }; #define NUM_FORMATS 6 static int numFormats = 1; static int formats[NUM_FORMATS] = { PictStandardNative }; static int numPlanemasks = 1; static unsigned long planemasks[256] = { (unsigned long)~0 }; static const char *foreground = NULL; static const char *background = NULL; static const char *ddbackground = NULL; static int clips = 0; static int numSubWindows = 7; static unsigned long subWindows[] = {4, 16, 25, 50, 75, 100, 200, 0}; static int fixedReps = 0; static Bool *doit; static XRectangle ws[] = { /* Clip rectangles */ {195, 195, 120, 120}, { 45, 145, 120, 120}, {345, 245, 120, 120}, { 45, 275, 120, 120}, {345, 115, 120, 120}, {195, 325, 120, 120} }; #define MAXCLIP (sizeof(ws) / sizeof(ws[0])) static Window clipWindows[MAXCLIP]; static Colormap cmap; static int depth = -1; /* -1 means use default depth */ static int vclass = -1; /* -1 means use CopyFromParent */ /* ScreenSaver state */ static XParmRec xparms; static int ssTimeout, ssInterval, ssPreferBlanking, ssAllowExposures; /* Static functions */ static int GetWords(int argi, int argc, char **argv, char **wordsp, int *nump); static int GetNumbers(int argi, int argc, char **argv, unsigned long *intsp, int *nump); static int GetRops(int argi, int argc, char **argv, int *ropsp, int *nump); static int GetPops(int argi, int argc, char **argv, int *popsp, int *nump); static int GetFormats(int argi, int argc, char **argv, int *formatsp, int *nump); static int FormatFromName (char *name); static char *NameFromFormat (int format); /************************************************ * time related stuff * ************************************************/ #ifdef VMS typedef struct _vms_time { unsigned long low; unsigned long high; }vms_time; struct timeval { long tv_sec; /* seconds since Jan. 1, 1970 */ long tv_usec; /* and microseconds */ }; struct timezone { int tz_minuteswest; /* of Greenwich */ int tz_dsttime; /* type of dst correction to apply */ }; static int firsttime = True; static vms_time basetime; int gettimeofday(tp) struct timeval *tp; { vms_time current_time, resultant; unsigned long mumble, foo; int status; if (firsttime) { sys$gettim(&basetime); firsttime = False; } sys$gettim(¤t_time); resultant.high = current_time.high - basetime.high; resultant.low = current_time.low - basetime.low; if (current_time.low < basetime.low) { resultant.high -= 1; } status = lib$ediv( &(10000000), &resultant, &tp->tv_sec, &tp->tv_usec); tp->tv_usec /= 10; return 0; } #endif static struct timeval start; static void PrintTime(void) { Time_t t; t = time((Time_t *)NULL); printf("%s\n", ctime(&t)); } static void InitTimes(void) { X_GETTIMEOFDAY(&start); } static double ElapsedTime(double correction) { struct timeval stop; X_GETTIMEOFDAY(&stop); if (stop.tv_usec < start.tv_usec) { stop.tv_usec += 1000000; stop.tv_sec -= 1; } return (double)(stop.tv_usec - start.tv_usec) + (1000000.0 * (double)(stop.tv_sec - start.tv_sec)) - correction; } static double RoundTo3Digits(double d) { /* It's kind of silly to print out things like ``193658.4/sec'' so just junk all but 3 most significant digits. */ double exponent, sign; if (falsePrecision) return d; exponent = 1.0; /* the code below won't work if d should happen to be non-positive. */ if (d < 0.0) { d = -d; sign = -1.0; } else sign = 1.0; if (d >= 1000.0) { do { exponent *= 10.0; } while (d/exponent >= 1000.0); d = (double)((int) (d/exponent + 0.5)); d *= exponent; } else { if (d != 0.0) { while (d*exponent < 100.0) { exponent *= 10.0; } } d = (double)((int) (d*exponent + 0.5)); d /= exponent; } return d * sign; } static void ReportTimes(double usecs, int64_t n, char *str, int average) { double msecsperobj, objspersec; if(usecs != 0.0) { msecsperobj = usecs / (1000.0 * (double)n); objspersec = (double) n * 1000000.0 / usecs; /* Round obj/sec to 3 significant digits. Leave msec untouched, to allow averaging results from several repetitions. */ objspersec = RoundTo3Digits(objspersec); if (average) { printf("%11lld trep @ %8.4f msec (%8.1f/sec): %s\n", (long long) n, msecsperobj, objspersec, str); } else { printf("%11lld reps @ %8.4f msec (%8.1f/sec): %s\n", (long long) n, msecsperobj, objspersec, str); } } else { printf("%6lld %sreps @ 0.0 msec (unmeasurably fast): %s\n", (long long) n, average ? "t" : "", str); } } /************************************************ * Generic X stuff * ************************************************/ static char *program_name; static void usage(void) _X_NORETURN; /* * Get_Display_Name (argc, argv) Look for -display, -d, or host:dpy (obselete) * If found, remove it from command line. Don't go past a lone -. */ static char * Get_Display_Name(int *pargc, /* MODIFIED */ char **argv) /* MODIFIED */ { int argc = *pargc; char **pargv = argv+1; char *displayname = NULL; int i; for (i = 1; i != argc; i++) { char *arg = argv[i]; if (!strcmp (arg, "-display") || !strcmp (arg, "-d")) { if (++i >= argc) usage (); displayname = argv[i]; *pargc -= 2; continue; } if (!strcmp(arg,"-")) { while (i the X server to contact\n" " -sync do the tests in synchronous mode\n" " -pack pack rectangles right next to each other\n" " -repeat do tests times (default = 5)\n" " -time do tests for seconds each (default = 5)\n" " -pause pause for seconds between each run\n" /* " -draw draw after each test -- pmax only\n" */ " -all do all tests\n" " -range [,] like all, but do to \n" " -labels generate test labels for use by fillblnk\n" " -fg the foreground color to use\n" " -bg the background color to use\n" " -clips default number of clip windows per test\n" " -ddbg the background color to use for DoubleDash\n" " -rop use the given rops to draw (default = GXcopy)\n" " -pm use the given planemasks to draw (default = ~0)\n" " -depth use a visual with planes per pixel\n" " -vclass the visual class to use (default = root)\n" " -reps fix the rep count (default = auto scale)\n" " -subs a list of the number of sub-windows to use\n" " -v1.2 perform only v1.2 tests using old semantics\n" " -v1.3 perform only v1.3 tests using old semantics\n" " -su request save unders on windows\n" " -bs WhenMapped or Always (default = NotUseful)\n" ; fflush(stdout); fprintf(stderr, "usage: %s [-options ...]\n%s", program_name, help_message); while (test[i].option != NULL) { if (test[i].versions & xparms.version ) { fprintf(stderr, " %-24s %s\n", test[i].option, test[i].label14 ? test[i].label14 : test[i].label); } i++; } fprintf(stderr, "\n"); /* Print out original command line as the above usage message is so long */ for (i = 0; i != saveargc; i++) { fprintf(stderr, "%s ", saveargv[i]); } fprintf(stderr, "\n\n"); exit (1); } void NullProc(XParms xp, Parms p) { } int NullInitProc(XParms xp, Parms p, int64_t reps) { return reps; } static void HardwareSync(XParms xp) { /* * Some graphics hardware allows the server to claim it is done, * while in reality the hardware is busily working away. So fetch * a pixel from the drawable that was drawn to, which should be * enough to make the server wait for the graphics hardware. */ XImage *image; image = XGetImage(xp->d, xp->p ? xp->p : xp->w, HSx, HSy, 1, 1, ~0, ZPixmap); if (image) XDestroyImage(image); } static void DoHardwareSync(XParms xp, Parms p, int64_t reps) { int i; for (i = 0; i != reps; i++) { HardwareSync(xp); CheckAbort (); } } static Test syncTest = { "syncTime", "Internal test for finding how long HardwareSync takes", NULL, NullInitProc, DoHardwareSync, NullProc, NullProc, V1_2FEATURE, NONROP, 0, {1} }; static Window CreatePerfWindow(XParms xp, int x, int y, int width, int height) { XSetWindowAttributes xswa; Window w; /* Screen *s; int su; s = DefaultScreenOfDisplay(xp->d); su = XDoesBackingStore(s); printf("Backing store of screen returns %d\n", su); su = XDoesSaveUnders(s); printf("Save unders of screen returns %d\n", su); su = XPlanesOfScreen(s); printf("Planes of screen returns %d\n", su); */ xswa.background_pixel = xp->background; xswa.border_pixel = xp->foreground; xswa.colormap = cmap; xswa.override_redirect = True; xswa.backing_store = xp->backing_store; xswa.save_under = xp->save_under; w = XCreateWindow(xp->d, DefaultRootWindow(xp->d), x, y, width, height, 1, xp->vinfo.depth, CopyFromParent, xp->vinfo.visual, CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect | CWBackingStore | CWSaveUnder, &xswa); XMapWindow (xp->d, w); return w; } static void CreateClipWindows(XParms xp, int clips) { int j; XWindowAttributes xwa; (void) XGetWindowAttributes(xp->d, xp->w, &xwa); if (clips > MAXCLIP) clips = MAXCLIP; for (j = 0; j != clips; j++) { clipWindows[j] = CreatePerfWindow(xp, xwa.x + ws[j].x, xwa.y + ws[j].y, ws[j].width, ws[j].height); } } /* CreateClipWindows */ static void DestroyClipWindows(XParms xp, int clips) { int j; if (clips > MAXCLIP) clips = MAXCLIP; for (j = 0; j != clips; j++) { XDestroyWindow(xp->d, clipWindows[j]); } } /* DestroyClipWindows */ static double DoTest(XParms xp, Test *test, int64_t reps) { double time; unsigned int ret_width, ret_height; /* Tell screen-saver to restart counting again. See comments below for the XSetScreenSaver call. */ XForceScreenSaver(xp->d, ScreenSaverReset); HardwareSync (xp); InitTimes (); (*test->proc) (xp, &test->parms, reps); HardwareSync(xp); time = ElapsedTime(syncTime); if (time < 0.0) time = 0.0; CheckAbort (); if (drawToFakeServer) XQueryBestSize(xp->d, TileShape, tileToQuery, 32, 32, &ret_width, &ret_height); (*test->passCleanup) (xp, &test->parms); return time; } static int64_t CalibrateTest(XParms xp, Test *test, int seconds, double *usecperobj) { #define goal 2500000.0 /* Try to get up to 2.5 seconds */ #define enough 2000000.0 /* But settle for 2.0 seconds */ #define tick 10000.0 /* Assume clock not faster than .01 seconds */ double usecs; int64_t reps, didreps; /* Reps desired, reps performed */ int exponent; /* Attempt to get an idea how long each rep lasts by getting enough reps to last more tan enough. Then scale that up to the number of seconds desired. If init call to test ever fails, return False and test will be skipped. */ if (fixedReps != 0) { return fixedReps; } reps = 1; for (;;) { XDestroySubwindows(xp->d, xp->w); XClearWindow(xp->d, xp->w); didreps = (*test->init) (xp, &test->parms, reps); CheckAbort (); if (didreps == 0) { return 0; } if ( test->clips < clips ) test->clips = clips ; /* Create clip windows if requested */ CreateClipWindows(xp, test->clips); HardwareSync(xp); InitTimes(); (*test->proc) (xp, &test->parms, reps); HardwareSync(xp); usecs = ElapsedTime(syncTime); (*test->passCleanup) (xp, &test->parms); (*test->cleanup) (xp, &test->parms); DestroyClipWindows(xp, test->clips); CheckAbort (); if (didreps != reps) { /* The test can't do the number of reps as we asked for. Give up */ *usecperobj = usecs / (double)(didreps * test->parms.objects); return didreps; } /* Did we go long enough? */ if (usecs >= enough) break; /* Don't let too short a clock make new reps wildly high */ if (usecs <= tick)reps = reps*10; else{ /* Try to get up to goal seconds. */ reps = (int) (goal * (double)reps / usecs) + 1; } } *usecperobj = usecs / (double) (reps * test->parms.objects); reps = (int) ((double)seconds * 1000000.0 * (double)reps / usecs) + 1; /* Now round reps up to 1 digit accuracy, so we don't get stupid-looking numbers of repetitions. */ reps--; exponent = 1; while (reps > 9) { reps /= 10; exponent *= 10; } reps = (reps + 1) * exponent; return reps; } /* CalibrateTest */ static void CreatePerfGCs(XParms xp, int func, unsigned long pm) { XGCValues gcvfg, gcvbg, gcvddbg,gcvddfg; unsigned long fg, bg, ddbg; fg = xp->foreground; bg = xp->background; ddbg = xp->ddbackground; gcvfg.graphics_exposures = False; gcvbg.graphics_exposures = False; gcvddfg.graphics_exposures = False; gcvddbg.graphics_exposures = False; gcvfg.plane_mask = pm; gcvbg.plane_mask = pm; gcvddfg.plane_mask = pm; gcvddbg.plane_mask = pm; gcvfg.function = func; gcvbg.function = func; gcvddfg.function = func; gcvddbg.function = func; if (func == GXxor) { /* Make test look good visually if possible */ gcvbg.foreground = gcvfg.foreground = bg ^ fg; gcvbg.background = gcvfg.background = bg; /* Double Dash GCs (This doesn't make a huge amount of sense) */ gcvddbg.foreground = gcvddfg.foreground = bg ^ fg; gcvddbg.background = gcvddfg.foreground = bg ^ ddbg; } else { gcvfg.foreground = fg; gcvfg.background = bg; gcvbg.foreground = bg; gcvbg.background = fg; gcvddfg.foreground = fg; gcvddfg.background = ddbg; gcvddbg.foreground = ddbg; gcvddbg.background = fg; } xp->fggc = XCreateGC(xp->d, xp->w, GCForeground | GCBackground | GCGraphicsExposures | GCFunction | GCPlaneMask, &gcvfg); xp->bggc = XCreateGC(xp->d, xp->w, GCForeground | GCBackground | GCGraphicsExposures | GCFunction | GCPlaneMask, &gcvbg); xp->ddfggc = XCreateGC(xp->d, xp->w, GCForeground | GCBackground | GCGraphicsExposures | GCFunction | GCPlaneMask, &gcvddfg); xp->ddbggc = XCreateGC(xp->d, xp->w, GCForeground | GCBackground | GCGraphicsExposures | GCFunction | GCPlaneMask, &gcvddbg); } static void DestroyPerfGCs(XParms xp) { XFreeGC(xp->d, xp->fggc); XFreeGC(xp->d, xp->bggc); XFreeGC(xp->d, xp->ddfggc); XFreeGC(xp->d, xp->ddbggc); } static unsigned long AllocateColor(Display *display, const char *name, unsigned long pixel) { XColor color; if (name != NULL) { /* Try to parse color name */ if (XParseColor(display, cmap, name, &color)) { if (XAllocColor(display, cmap, &color)) { pixel = color.pixel; } else { (void) fprintf(stderr, "Can't allocate colormap entry for color %s\n", name); } } else { if(*name >= '0' && *name <= '9') pixel = atoi(name); else (void) fprintf(stderr, "Can't parse color name %s\n", name); } } return pixel; } /* AllocateColor */ static void DisplayStatus(Display *d, const char *message, const char *test, int try) { char s[500]; XClearWindow(d, status); sprintf(s, "%d %s %s", try, message, test); /* We should really look at the height, descent of the font, etc. but who cares. This works. */ XDrawString(d, status, tgc, 10, 13, s, strlen(s)); } static void ProcessTest(XParms xp, Test *test, int func, unsigned long pm, char *label) { double time, totalTime; long long reps; int j; xp->planemask = pm; xp->func = func; if (test->testType == COMP) { func = GXcopy; pm = ~0L; } CreatePerfGCs(xp, func, pm); DisplayStatus(xp->d, "Calibrating", label, 0); reps = CalibrateTest(xp, test, seconds, &time); if (reps != 0) { XDestroySubwindows(xp->d, xp->w); XClearWindow(xp->d, xp->w); reps = (*test->init) (xp, &test->parms, reps); if (abortTest) AbortTest (); /* * if using fixedReps then will not have done CalibrateTest so must * check result of init for 0 here */ if(reps == 0){ DestroyPerfGCs(xp); return; } /* Create clip windows if requested */ CreateClipWindows(xp, test->clips); totalTime = 0.0; for (j = 0; j != repeat; j++) { DisplayStatus(xp->d, "Testing", label, j+1); time = DoTest(xp, test, reps); if (abortTest) AbortTest (); totalTime += time; ReportTimes (time, reps * test->parms.objects, label, False); if (delay) sleep(delay); } if (repeat > 1) { ReportTimes(totalTime, repeat * reps * test->parms.objects, label, True); } (*test->cleanup) (xp, &test->parms); DestroyClipWindows(xp, test->clips); } else { /* Test failed to initialize properly */ } printf ("\n"); fflush(stdout); DestroyPerfGCs(xp); } /* ProcessTest */ #define Strstr strstr #define LABELP(i) (test[i].label14 && (xparms.version >= VERSION1_4) \ ? test[i].label14 : test[i].label) int main(int argc, char *argv[]) { int i, j, n, skip; int numTests; /* Even though the linker knows, we don't. */ char hostname[100]; Bool foundOne = False; Bool synchronous = False; XGCValues tgcv; int screen; int rop, pm; int pop, format; int window_y, window_x; XVisualInfo *vinfolist, vinfotempl; unsigned long vmask; /* Save away argv, argc, for usage to print out */ saveargc = argc; saveargv = (char **) malloc(argc * sizeof(char *)); for (i = 0; i != argc; i++) { saveargv[i] = argv[i]; } xparms.pack = False; xparms.save_under = False; xparms.backing_store = NotUseful; /* Count number of tests */ ForEachTest(numTests); doit = (Bool *)calloc(numTests, sizeof(Bool)); /* Parse arguments */ program_name = argv[0]; displayName = Get_Display_Name (&argc, argv); xparms.version = GetVersion(&argc, argv); for (i = 1; i != argc; i++) { if (strcmp (argv[i], "-all") == 0) { ForEachTest (j) doit[j] = test[j].versions & xparms.version; foundOne = True; } else if (strcmp (argv[i], "-labels") == 0) { labels = True; } else if (strcmp(argv[i], "-range") == 0) { char *cp1; char *cp2; if (argc <= ++i) usage(); cp1 = argv[i]; if (*cp1 == '-') cp1++; for (cp2 = cp1; *cp2 != '\0' && *cp2 != ','; cp2++) {}; if (*cp2 == ',') { *cp2++ = '\0'; if (*cp2 == '-') cp2++; } else { cp2 = "-"; } ForEachTest (j) { if (strcmp (cp1, (test[j].option) + 1) == 0 && (test[j].versions & xparms.version)) { int k = j; do { doit[k] = test[j].versions & xparms.version; } while (!(strcmp(cp2, (test[k].option + 1)) == 0 && (test[k].versions & xparms.version)) && test[++k].option != NULL); if (*cp2 != '-' && test[k].option == NULL) usage(); break; } } if (test[j].option == NULL) usage(); foundOne = True; } else if (strcmp (argv[i], "-sync") == 0) { synchronous = True; } else if (strcmp (argv[i], "-pack") == 0) { xparms.pack = True; } else if (strcmp (argv[i], "-draw") == 0) { drawToFakeServer = True; } else if (strcmp (argv[i], "-falseprecision") == 0) { falsePrecision = True; } else if (strcmp (argv[i], "-repeat") == 0) { i++; if (argc <= i) usage (); repeat = atoi (argv[i]); if (repeat <= 0) usage (); } else if (strcmp (argv[i], "-time") == 0) { i++; if (argc <= i) usage (); seconds = atoi (argv[i]); if (seconds <= 0) usage (); } else if (strcmp (argv[i], "-pause") == 0) { ++i; if (argc <= i) usage (); delay = atoi (argv[i]); if (delay < 0) usage (); } else if (strcmp(argv[i], "-fg") == 0) { i++; if (argc <= i) usage (); foreground = argv[i]; } else if (strcmp(argv[i], "-bg") == 0) { i++; if (argc <= i) usage (); background = argv[i]; if(ddbackground == NULL) ddbackground = argv[i]; } else if (strcmp(argv[i], "-clips") == 0 ) { i++; if (argc <= i) usage (); clips = atoi( argv[i] ); } else if (strcmp(argv[i], "-ddbg") == 0) { if (argc <= i) usage (); i++; ddbackground = argv[i]; } else if (strcmp(argv[i], "-rop") == 0) { skip = GetRops (i+1, argc, argv, rops, &numRops); i += skip; } else if (strcmp(argv[i], "-pop") == 0) { skip = GetPops (i+1, argc, argv, pops, &numPops); i += skip; } else if (strcmp(argv[i], "-format") == 0) { skip = GetFormats (i+1, argc, argv, formats, &numFormats); i += skip; } else if (strcmp(argv[i], "-pm") == 0) { skip = GetNumbers (i+1, argc, argv, planemasks, &numPlanemasks); i += skip; } else if (strcmp(argv[i], "-xor") == 0) { numRops = 1; rops[0] = GXxor; } else if (strcmp (argv[i], "-both") == 0) { numRops = 2; rops[0] = GXcopy; rops[1] = GXxor; } else if (strcmp(argv[i], "-reps") == 0) { i++; if (argc <= i) usage (); fixedReps = atoi (argv[i]); if (fixedReps <= 0) usage (); } else if (strcmp(argv[i], "-depth") == 0) { i++; if (argc <= i) usage (); depth = atoi(argv[i]); if (depth <= 0) usage (); } else if (strcmp(argv[i], "-vclass") == 0) { i++; if (argc <= i) usage (); for (j = StaticGray; j <= DirectColor; j++) { if (strcmp(argv[i], visualClassNames[j]) == 0) { vclass = j; break; } } if (vclass < 0) usage (); } else if (strcmp(argv[i], "-subs") == 0) { skip = GetNumbers (i+1, argc, argv, subWindows, &numSubWindows); i += skip; } else if (strcmp(argv[i], "-v1.2") == 0) { xparms.version = VERSION1_2; } else if (strcmp(argv[i], "-v1.3") == 0) { xparms.version = VERSION1_3; } else if (strcmp(argv[i], "-su") == 0) { xparms.save_under = True; } else if (strcmp(argv[i], "-bs") == 0) { i++; if (argc <= i) usage (); if (strcmp(argv[i], "WhenMapped") == 0) { xparms.backing_store = WhenMapped; } else if (strcmp(argv[i], "Always") == 0) { xparms.backing_store = Always; } else usage (); } else { int len,found; ForEachTest (j) { if (strcmp (argv[i], test[j].option) == 0 && (test[j].versions & xparms.version)) { doit[j] = True; goto LegalOption; } } found = False; len = strlen(argv[i]); if(len>=3) ForEachTest (j) { if (Strstr (test[j].option, argv[i]+1) != NULL) { fprintf(stderr," -> %s %s\n", test[j].option, LABELP(j)); doit[j] = found = True; } } if(!found) ForEachTest (j) { if (Strstr (LABELP(j), argv[i]+1) != NULL) { fprintf(stderr," -> %s %s\n", test[j].option, LABELP(j)); doit[j] = found = True; } } if(!found) usage (); LegalOption: foundOne = True; } } if (labels) { /* Just print out list of tests for use with .sh programs that assemble data from different x11perf runs into a nice format */ ForEachTest (i) { int child; if (doit[i]) { switch (test[i].testType) { case NONROP: printf ("%s\n", LABELP(i)); break; case ROP: /* Run it through all specified rops and planemasks */ for (rop = 0; rop < numRops; rop++) { for (pm = 0; pm < numPlanemasks; pm++) { if (planemasks[pm] == ~0) { if (rops[rop] == GXcopy) { printf ("%s\n", LABELP(i)); } else { printf ("(%s) %s\n", ropNames[rops[rop]].name, LABELP(i)); } } else { printf ("(%s 0x%lx) %s\n", ropNames[rops[rop]].name, planemasks[pm], LABELP(i)); } } /* for pm */ } /* for rop */ break; case PLANEMASK: /* Run it through all specified planemasks */ for (pm = 0; pm < numPlanemasks; pm++) { if (planemasks[pm] == ~0) { printf ("%s\n", LABELP(i)); } else { printf ("(0x%lx) %s\n", planemasks[pm], LABELP(i)); } } /* for pm */ break; case WINDOW: for (child = 0; child != numSubWindows; child++) { printf ("%s (%ld kids)\n", LABELP(i), subWindows[child]); } break; case COMP: /* Run it through all specified pops */ for (pop = 0; pop < numPops; pop++) { if (pops[pop] == PictOpOver) { printf ("%s\n", LABELP(i)); } else { printf ("(%s) %s\n", popNames[pops[pop]].name, LABELP(i)); } } /* for pop */ break; } /* switch */ } } exit(0); } if (!foundOne) usage (); xparms.d = Open_Display (displayName); screen = DefaultScreen(xparms.d); /* get visual info of default visual */ vmask = VisualIDMask | VisualScreenMask; vinfotempl.visualid = XVisualIDFromVisual(XDefaultVisual(xparms.d, screen)); vinfotempl.screen = screen; vinfolist = XGetVisualInfo(xparms.d, vmask, &vinfotempl, &n); if (!vinfolist || n != 1) { fprintf (stderr, "%s: can't get visual info of default visual\n", program_name); exit(1); } if (depth == -1 && vclass == -1) { /* use the default visual and colormap */ xparms.vinfo = *vinfolist; cmap = XDefaultColormap(xparms.d, screen); } else { /* find the specified visual */ int errorDepth = vinfolist[0].depth; int errorClass = vinfolist[0].class; vmask = VisualScreenMask; vinfotempl.screen = screen; if (depth >= 0) { vinfotempl.depth = depth; vmask |= VisualDepthMask; errorDepth = depth; } if (vclass >= 0) { vinfotempl.class = vclass; vmask |= VisualClassMask; errorClass = vclass; } vinfolist = XGetVisualInfo(xparms.d, vmask, &vinfotempl, &n); if (!vinfolist) { fprintf (stderr, "%s: can't find a visual of depth %d and class %s\n", program_name, errorDepth, visualClassNames[errorClass]); exit(1); } xparms.vinfo = *vinfolist; /* use the first one in list */ if (xparms.vinfo.visualid == XVisualIDFromVisual(XDefaultVisual(xparms.d, screen))) { /* matched visual is same as default visual */ cmap = XDefaultColormap(xparms.d, screen); } else { cmap = XCreateColormap(xparms.d, DefaultRootWindow(xparms.d), xparms.vinfo.visual, AllocNone); /* since this is not default cmap, must force color allocation */ if (!foreground) foreground = "Black"; if (!background) background = "White"; XInstallColormap(xparms.d, cmap); } } xparms.cmap = cmap; printf("x11perf - X11 performance program, version %s\n", xparms.version & VERSION1_5 ? "1.5" : xparms.version & VERSION1_4 ? "1.4" : xparms.version & VERSION1_3 ? "1.3" : "1.2" ); XmuGetHostname(hostname, 100); printf ("%s server version %d on %s\nfrom %s\n", ServerVendor (xparms.d), VendorRelease (xparms.d), DisplayString (xparms.d), hostname); PrintTime (); /* Force screen out of screen-saver mode, grab current data, and set time to blank to 8 hours. We should just be able to turn the screen- saver off, but this causes problems on some servers. We also reset the screen-saver timer each test, as 8 hours is about the maximum time we can use, and that isn't long enough for some X terminals using a serial protocol to finish all the tests. As long as the tests run to completion, the old screen-saver values are restored. */ XForceScreenSaver(xparms.d, ScreenSaverReset); XGetScreenSaver(xparms.d, &ssTimeout, &ssInterval, &ssPreferBlanking, &ssAllowExposures); (void) signal(SIGINT, Cleanup); /* ^C */ #ifdef SIGQUIT (void) signal(SIGQUIT, Cleanup); #endif (void) signal(SIGTERM, Cleanup); #ifdef SIGHUP (void) signal(SIGHUP, Cleanup); #endif XSetScreenSaver(xparms.d, 8 * 3600, ssInterval, ssPreferBlanking, ssAllowExposures); if (drawToFakeServer) { tileToQuery = XCreatePixmap(xparms.d, DefaultRootWindow (xparms.d), 32, 32, 1); } xparms.foreground = AllocateColor(xparms.d, foreground, BlackPixel(xparms.d, screen)); xparms.background = AllocateColor(xparms.d, background, WhitePixel(xparms.d, screen)); xparms.ddbackground = AllocateColor(xparms.d, ddbackground, WhitePixel(xparms.d, screen)); window_x = 2; if (DisplayWidth(xparms.d, screen) < WIDTH + window_x + 1) window_x = -1; window_y = 2; if (DisplayHeight(xparms.d, screen) < HEIGHT + window_y + 1) window_y = -1; xparms.w = CreatePerfWindow(&xparms, window_x, window_y, WIDTH, HEIGHT); HSx = WIDTH-1; if (window_x + 1 + WIDTH > DisplayWidth(xparms.d, screen)) HSx = DisplayWidth(xparms.d, screen) - (1 + window_x + 1); HSy = HEIGHT-1; if (window_y + 1 + HEIGHT > DisplayHeight(xparms.d, screen)) HSy = DisplayHeight(xparms.d, screen) - (1 + window_y + 1); status = CreatePerfWindow(&xparms, window_x, HEIGHT+5, WIDTH, 20); tgcv.foreground = AllocateColor(xparms.d, "black", BlackPixel(xparms.d, screen)); tgcv.background = AllocateColor(xparms.d, "white", WhitePixel(xparms.d, screen)); tgc = XCreateGC(xparms.d, status, GCForeground | GCBackground, &tgcv); xparms.p = (Pixmap)0; if (synchronous) XSynchronize (xparms.d, True); /* Get mouse pointer out of the way of the performance window. On software cursor machines it will slow graphics performance. On all current MIT-derived servers it will slow window creation/configuration performance. */ XWarpPointer(xparms.d, None, status, 0, 0, 0, 0, WIDTH+32, 20+32); /* Figure out how long to call HardwareSync, so we can adjust for that in our total elapsed time */ (void) CalibrateTest(&xparms, &syncTest, 1, &syncTime); printf("Sync time adjustment is %6.4f msecs.\n\n", syncTime/1000); ForEachTest (i) { int child; char label[200]; if (doit[i] && (test[i].versions & xparms.version)) { switch (test[i].testType) { case NONROP: /* Simplest...just run it once */ strcpy (label, LABELP(i)); ProcessTest(&xparms, &test[i], GXcopy, ~0L, label); break; case ROP: /* Run it through all specified rops and planemasks */ for (rop = 0; rop < numRops; rop++) { for (pm = 0; pm < numPlanemasks; pm++) { if (planemasks[pm] == ~0) { if (rops[rop] == GXcopy) { sprintf (label, "%s", LABELP(i)); } else { sprintf (label, "(%s) %s", ropNames[rops[rop]].name, LABELP(i)); } } else { sprintf (label, "(%s 0x%lx) %s", ropNames[rops[rop]].name, planemasks[pm], LABELP(i)); } ProcessTest(&xparms, &test[i], rops[rop], planemasks[pm], label); } /* for pm */ } /* for rop */ break; case PLANEMASK: /* Run it through all specified planemasks */ for (pm = 0; pm < numPlanemasks; pm++) { if (planemasks[pm] == ~0) { sprintf (label, "%s", LABELP(i)); } else { sprintf (label, "(0x%lx) %s", planemasks[pm], LABELP(i)); } ProcessTest(&xparms, &test[i], GXcopy, planemasks[pm], label); } /* for pm */ break; case WINDOW: /* Loop through number of children array */ for (child = 0; child != numSubWindows; child++) { test[i].parms.objects = subWindows[child]; sprintf(label, "%s (%d kids)", LABELP(i), test[i].parms.objects); ProcessTest(&xparms, &test[i], GXcopy, ~0L, label); } break; case COMP: /* Loop through the composite operands */ for (pop = 0; pop < numPops; pop++) { for (format = 0; format < numFormats; format++) { if (formats[format] == PictStandardNative) { if (pops[pop] == PictOpOver) { sprintf (label, "%s", LABELP(i)); } else { sprintf (label, "(%s) %s", popNames[pops[pop]].name, LABELP(i)); } } else { char *name = NameFromFormat (formats[format]); sprintf (label, "(%s %s) %s", popNames[pops[pop]].name, name, LABELP(i)); } ProcessTest (&xparms, &test[i], pops[pop], formats[format], label); } } break; } /* switch */ } /* if doit */ } /* ForEachTest */ XFreeGC(xparms.d, tgc); XDestroyWindow(xparms.d, xparms.w); XFree(vinfolist); if (drawToFakeServer) XFreePixmap(xparms.d, tileToQuery); /* Restore ScreenSaver to original state. */ XSetScreenSaver(xparms.d, ssTimeout, ssInterval, ssPreferBlanking, ssAllowExposures); XCloseDisplay(xparms.d); free(saveargv); free(doit); exit(0); } static int GetWords (int argi, int argc, char **argv, char **wordsp, int *nump) { int count; if (argc <= argi) usage(); count = 0; while (argv[argi] && *(argv[argi]) != '-') { *wordsp++ = argv[argi]; ++argi; count++; } *nump = count; return count; } static long atox (char *s) { long v, c = 0; v = 0; while (*s) { if ('0' <= *s && *s <= '9') c = *s - '0'; else if ('a' <= *s && *s <= 'f') c = *s - 'a' + 10; else if ('A' <= *s && *s <= 'F') c = *s - 'A' + 10; v = v * 16 + c; s++; } return v; } static int GetNumbers (int argi, int argc, char **argv, unsigned long *intsp, int *nump) { char *words[256]; int count; int i; int flip; count = GetWords (argi, argc, argv, words, nump); for (i = 0; i < count; i++) { flip = 0; if (!strncmp (words[i], "~", 1)) { words[i]++; flip = ~0; } if (!strncmp (words[i], "0x", 2)) intsp[i] = atox(words[i] + 2) ^ flip; else intsp[i] = atoi (words[i]) ^ flip; } return count; } static int GetRops (int argi, int argc, char **argv, int *ropsp, int *nump) { char *words[256]; int count; int i; int rop; count = GetWords (argi, argc, argv, words, nump); for (i = 0; i < count; i++) { if (!strncmp (words[i], "GX", 2)) words[i] += 2; if (!strcmp (words[i], "all")) { for (i = 0; i < NUM_ROPS; i++) ropsp[i] = ropNames[i].rop; *nump = NUM_ROPS; break; } for (rop = 0; rop < NUM_ROPS; rop++) { if (!strcmp (words[i], ropNames[rop].name)) { ropsp[i] = ropNames[rop].rop; break; } } if (rop == NUM_ROPS) { usage (); fprintf (stderr, "unknown rop name %s\n", words[i]); } } return count; } static int GetPops (int argi, int argc, char **argv, int *popsp, int *nump) { char *words[256]; int count; int i; int pop; count = GetWords (argi, argc, argv, words, nump); for (i = 0; i < count; i++) { if (!strncmp (words[i], "PictOp", 6)) words[i] += 6; if (!strcmp (words[i], "all")) { for (i = 0; i < NUM_POPS; i++) popsp[i] = popNames[i].rop; *nump = NUM_POPS; break; } for (pop = 0; pop < NUM_POPS; pop++) { if (!strcmp (words[i], popNames[pop].name)) { popsp[i] = popNames[pop].rop; break; } } if (pop == NUM_POPS) { usage (); fprintf (stderr, "unknown picture op name %s\n", words[i]); } } return count; } static int FormatFromName (char *name) { int i; for (i = 0; i < NUM_FORMATS; i++) if (!strcmp (name, formatNames[i].name)) return formatNames[i].rop; return -1; } static char * NameFromFormat (int format) { int i; for (i = 0; i < NUM_FORMATS; i++) if (formatNames[i].rop == format) return formatNames[i].name; return NULL; } static int GetFormats (int argi, int argc, char **argv, int *formatsp, int *nump) { char *words[256]; int count; int i; int format; count = GetWords (argi, argc, argv, words, nump); for (i = 0; i < count; i++) { if (!strcmp (words[i], "all")) { for (i = 0; i < NUM_FORMATS; i++) formatsp[i] = formatNames[i].rop; *nump = NUM_FORMATS; break; } format = FormatFromName (words[i]); if (format < 0) { usage (); fprintf (stderr, "unknown format name %s\n", words[i]); } formatsp[i] = format; } return count; } x11-apps-7.7+5+nmu1ubuntu1/x11perf/perfratio0000664000000000000000000000116012514116510015367 0ustar #!/bin/sh awk ' /^ 1/ && READY == 0 { printf (" 1 "); for (i = 2; i < NF; i++) printf (" %2d ", i); printf (" Operation\n"); next; } /^---/ { printf ("------------"); for (i = 2; i < NF; i++) printf (" ----------"); printf (" ---------\n"); READY=1; next; } READY==1 { base=$1; printf ("%12.1f", base); for (i = 2; i < '$1'; i++) { if (base == 0) printf (" lots ", $i); else { rate=$i/base; printf (" %10.3f", rate); } } printf (" "); for (; i <= NF; i++) { printf ("%s ", $i); } printf ("\n"); next; } { print $0; } ' x11-apps-7.7+5+nmu1ubuntu1/x11perf/COPYING0000664000000000000000000000313612514116510014511 0ustar Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **************************************************************************** Copyright (c) 1993 by Hewlett-Packard Company Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both the copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. x11-apps-7.7+5+nmu1ubuntu1/x11perf/INSTALL0000664000000000000000000003660012514116540014514 0ustar Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/rendercheck/0000775000000000000000000000000012656635743014467 5ustar x11-apps-7.7+5+nmu1ubuntu1/rendercheck/t_tsrccoords2.c0000664000000000000000000001130012167023104017373 0ustar /* * Copyright © 2007 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include #include #include "rendercheck.h" /* Originally a bullseye, this pattern has been modified so that flipping * will result in errors as well. */ static int target_colors[5][5] = { {1, 1, 1, 1, 1}, {1, 0, 0, 0, 1}, {1, 1, 1, 0, 1}, {1, 0, 0, 1, 1}, {1, 1, 1, 1, 1}, }; static picture_info *create_target_picture(Display *dpy) { picture_info *p; int i; p = malloc(sizeof(picture_info)); p->d = XCreatePixmap(dpy, RootWindow(dpy, 0), 5, 5, 32); p->format = XRenderFindStandardFormat(dpy, PictStandardARGB32); p->pict = XRenderCreatePicture(dpy, p->d, p->format, 0, NULL); p->name = "target picture"; for (i = 0; i < 25; i++) { int x = i % 5; int y = i / 5; color4d *c = &colors[target_colors[y][x]]; argb_fill(dpy, p, x, y, 1, 1, c->a, c->r, c->g, c->b); } return p; } static void destroy_target_picture(Display *dpy, picture_info *p) { XRenderFreePicture(dpy, p->pict); XFreePixmap(dpy, p->d); free(p); } /* Test source or mask coordinates by drawing from a 5x5 picture into the 0,0 * pixel, rotated 90 degrees to the left. */ Bool trans_srccoords_test_2(Display *dpy, picture_info *win, picture_info *white, Bool test_mask) { color4d expected, tested; int i; XRenderPictureAttributes pa; Bool failed = FALSE; int tested_colors[5][5]; picture_info *src; XTransform t; src = create_target_picture(dpy); if (src == NULL) { fprintf(stderr, "couldn't allocate picture for test\n"); return FALSE; } /* Transform that rotates right from the destination coords to the * src coords. */ t.matrix[0][0] = XDoubleToFixed(0); t.matrix[0][1] = XDoubleToFixed(-1); t.matrix[0][2] = XDoubleToFixed(5); t.matrix[1][0] = XDoubleToFixed(1); t.matrix[1][1] = XDoubleToFixed(0); t.matrix[1][2] = XDoubleToFixed(0); t.matrix[2][0] = XDoubleToFixed(0); t.matrix[2][1] = XDoubleToFixed(0); t.matrix[2][2] = XDoubleToFixed(1); XRenderSetPictureTransform(dpy, src->pict, &t); if (!test_mask) { XRenderComposite(dpy, PictOpSrc, src->pict, 0, win->pict, 0, 0, 0, 0, 0, 0, 5, 5); } else { /* Using PictOpSrc, color 0 (white), and component * alpha, the mask color should be written to the * destination. */ pa.component_alpha = TRUE; XRenderChangePicture(dpy, src->pict, CPComponentAlpha, &pa); XRenderComposite(dpy, PictOpSrc, white->pict, src->pict, win->pict, 0, 0, 0, 0, 0, 0, 5, 5); pa.component_alpha = FALSE; XRenderChangePicture(dpy, src->pict, CPComponentAlpha, &pa); } for (i = 0; i < 25; i++) { char name[20]; int x = i % 5, y = i / 5, srcx, srcy; get_pixel(dpy, win, x, y, &tested); /* Map from our destination coordinates to where they are * in the source picture. Rotate right. */ srcx = 4 - y; srcy = x; expected = colors[target_colors[srcy][srcx]]; color_correct(win, &expected); if (tested.r == 1.0) { if (tested.g == 1.0 && tested.b == 1.0) tested_colors[y][x] = 0; else if (tested.g == 0.0 && tested.b == 0.0) tested_colors[y][x] = 1; else tested_colors[y][x] = 9; } else tested_colors[y][x] = 9; if (test_mask) snprintf(name, 20, "mask coords"); else snprintf(name, 20, "src coords"); if (!eval_diff(name, &expected, &tested, x, y, is_verbose)) failed = TRUE; } if (failed) { int x, y; printf("expected vs tested:\n"); for (y = 0; y < 5; y++) { for (x = 0; x < 5; x++) { int srcx = 4 - y; int srcy = x; printf("%d", target_colors[srcy][srcx]); } printf(" "); for (x = 0; x < 5; x++) printf("%d", tested_colors[y][x]); printf("\n"); } } destroy_target_picture(dpy, src); return !failed; } x11-apps-7.7+5+nmu1ubuntu1/rendercheck/doc/0000775000000000000000000000000012167023104015207 5ustar x11-apps-7.7+5+nmu1ubuntu1/rendercheck/doc/TODO0000664000000000000000000000053712167023104015704 0ustar - Check bilinear filtering - Check repeating transformed sources - Check coordinates for more different transformations - Get a useful number being produced for error values, and correct eval_diff's limit. - Check source/mask pixels falling outside the drawable. - Check trapezoids! - get_pixel equivalent that doesn't involve round-trips per call. x11-apps-7.7+5+nmu1ubuntu1/rendercheck/doc/AddingNewTests0000664000000000000000000000065712167023104020025 0ustar - Add your test to rendercheck.h TEST_* - Add command line option to main.c case 't'. - Add command line option to main.c usage() - Add your test loop to the bottom of begin_test(). Looping on ops and dests is highly recommended. - Write your test in t_testname.c and add to Makefile.am, with prototype in rendercheck.h - Add a note about your test to README - Be sure to include your MIT license boilerplate on the new file. x11-apps-7.7+5+nmu1ubuntu1/rendercheck/t_dstcoords.c0000664000000000000000000000443712167023104017145 0ustar /* * Copyright © 2005 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include #include "rendercheck.h" #define TEST_WIDTH 10 #define TEST_HEIGHT 10 /* Test destination coordinates by drawing a 3x3 picture offset one pixel. * * Note: fg must have solid 1.0 alpha, but still have an alpha channel. * Otherwise, we're likely to hit a path that maps PictOpOver -> PictOpSrc, * for example. */ Bool dstcoords_test(Display *dpy, picture_info *win, int op, picture_info *dst, picture_info *bg, picture_info *fg) { color4d expected, tested; int x, y, i; Bool failed = FALSE; for (i = 0; i < pixmap_move_iter; i++) { XRenderComposite(dpy, PictOpSrc, bg->pict, 0, dst->pict, 0, 0, 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT); XRenderComposite(dpy, op, fg->pict, 0, dst->pict, 0, 0, 0, 0, 1, 1, 3, 3); } copy_pict_to_win(dpy, dst, win, TEST_WIDTH, TEST_HEIGHT); for (x = 0; x < 5; x++) { for (y = 0; y < 5; y++) { get_pixel(dpy, dst, x, y, &tested); if ((x >= 1 && x <= 3) && (y >= 1 && y <= 3)) expected = fg->color; else expected = bg->color; color_correct(dst, &expected); if (!eval_diff("dst coords", &expected, &tested, x, y, is_verbose)) failed = TRUE; } } return !failed; } x11-apps-7.7+5+nmu1ubuntu1/rendercheck/t_triangles.c0000664000000000000000000001567212167023104017134 0ustar /* * Copyright © 2006 Eric Anholt * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Authors: * Eric Anholt * */ #include #include "rendercheck.h" #define TEST_WIDTH 10 #define TEST_HEIGHT 10 /* Test basic functionality of the triangle operations. We don't care that much * probably (nobody has used them yet), but we can trivially test by filling * doing two triangles that will exactly cover the rectangle from 2,2 to 4,4. */ Bool triangles_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *dst_color) { XTriangle triangles[2]; color4d tdst, tsrc; int x, y; Bool success = TRUE; triangles[0].p1.x = XDoubleToFixed(2); triangles[0].p1.y = XDoubleToFixed(2); triangles[0].p2.x = XDoubleToFixed(4); triangles[0].p2.y = XDoubleToFixed(2); triangles[0].p3.x = XDoubleToFixed(4); triangles[0].p3.y = XDoubleToFixed(4); triangles[1].p1.x = XDoubleToFixed(2); triangles[1].p1.y = XDoubleToFixed(2); triangles[1].p2.x = XDoubleToFixed(2); triangles[1].p2.y = XDoubleToFixed(4); triangles[1].p3.x = XDoubleToFixed(4); triangles[1].p3.y = XDoubleToFixed(4); /* Fill the dst to dst_color */ XRenderComposite(dpy, PictOpSrc, dst_color->pict, None, dst->pict, 0, 0, 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT); /* Paint the triangles with src_color */ XRenderCompositeTriangles(dpy, ops[op].op, src_color->pict, dst->pict, XRenderFindStandardFormat(dpy, PictStandardA8), 0, 0, triangles, 2); copy_pict_to_win(dpy, dst, win, TEST_WIDTH, TEST_HEIGHT); /* Color expected outside of the triangles */ tdst = dst_color->color; color_correct(dst, &tdst); /* Color expected inside of the triangles */ do_composite(ops[op].op, &src_color->color, NULL, &tdst, &tsrc, FALSE); color_correct(dst, &tsrc); for (x = 0; x < 5; x++) { for (y = 0; y < 5; y++) { color4d expected, tested; if (x >= 2 && x < 4 && y >= 2 && y < 4) { expected = tsrc; } else { expected = tdst; } get_pixel(dpy, dst, x, y, &tested); if (!eval_diff("triangles", &expected, &tested, x, y, is_verbose)) { success = FALSE; } } } if (!success) { printf("src color: %.2f %.2f %.2f %.2f\n" "dst color: %.2f %.2f %.2f %.2f\n", src_color->color.r, src_color->color.g, src_color->color.b, src_color->color.a, dst_color->color.r, dst_color->color.g, dst_color->color.b, dst_color->color.a); } return success; } Bool trifan_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *dst_color) { XPointFixed points[4]; color4d tdst, tsrc; int x, y; Bool success = TRUE; points[0].x = XDoubleToFixed(2); points[0].y = XDoubleToFixed(2); points[1].x = XDoubleToFixed(4); points[1].y = XDoubleToFixed(2); points[2].x = XDoubleToFixed(4); points[2].y = XDoubleToFixed(4); points[3].x = XDoubleToFixed(2); points[3].y = XDoubleToFixed(4); /* Fill the dst to dst_color */ XRenderComposite(dpy, PictOpSrc, dst_color->pict, None, dst->pict, 0, 0, 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT); /* Paint the triangles with src_color */ XRenderCompositeTriFan(dpy, ops[op].op, src_color->pict, dst->pict, XRenderFindStandardFormat(dpy, PictStandardA8), 0, 0, points, 4); copy_pict_to_win(dpy, dst, win, TEST_WIDTH, TEST_HEIGHT); /* Color expected outside of the triangles */ tdst = dst_color->color; color_correct(dst, &tdst); /* Color expected inside of the triangles */ do_composite(ops[op].op, &src_color->color, NULL, &tdst, &tsrc, FALSE); color_correct(dst, &tsrc); for (x = 0; x < 5; x++) { for (y = 0; y < 5; y++) { color4d expected, tested; if (x >= 2 && x < 4 && y >= 2 && y < 4) { expected = tsrc; } else { expected = tdst; } get_pixel(dpy, dst, x, y, &tested); if (!eval_diff("triangles", &expected, &tested, x, y, is_verbose)) { success = FALSE; } } } if (!success) { printf("src color: %.2f %.2f %.2f %.2f\n" "dst color: %.2f %.2f %.2f %.2f\n", src_color->color.r, src_color->color.g, src_color->color.b, src_color->color.a, dst_color->color.r, dst_color->color.g, dst_color->color.b, dst_color->color.a); } return success; } Bool tristrip_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *dst_color) { XPointFixed points[4]; color4d tdst, tsrc; int x, y; Bool success = TRUE; points[0].x = XDoubleToFixed(2); points[0].y = XDoubleToFixed(2); points[1].x = XDoubleToFixed(4); points[1].y = XDoubleToFixed(2); points[2].x = XDoubleToFixed(2); points[2].y = XDoubleToFixed(4); points[3].x = XDoubleToFixed(4); points[3].y = XDoubleToFixed(4); /* Fill the dst to dst_color */ XRenderComposite(dpy, PictOpSrc, dst_color->pict, None, dst->pict, 0, 0, 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT); /* Paint the triangles with src_color */ XRenderCompositeTriStrip(dpy, ops[op].op, src_color->pict, dst->pict, XRenderFindStandardFormat(dpy, PictStandardA8), 0, 0, points, 4); copy_pict_to_win(dpy, dst, win, TEST_WIDTH, TEST_HEIGHT); /* Color expected outside of the triangles */ tdst = dst_color->color; color_correct(dst, &tdst); /* Color expected inside of the triangles */ do_composite(ops[op].op, &src_color->color, NULL, &tdst, &tsrc, FALSE); color_correct(dst, &tsrc); for (x = 0; x < 5; x++) { for (y = 0; y < 5; y++) { color4d expected, tested; if (x >= 2 && x < 4 && y >= 2 && y < 4) { expected = tsrc; } else { expected = tdst; } get_pixel(dpy, dst, x, y, &tested); if (!eval_diff("triangles", &expected, &tested, x, y, is_verbose)) { success = FALSE; } } } if (!success) { printf("src color: %.2f %.2f %.2f %.2f\n" "dst color: %.2f %.2f %.2f %.2f\n", src_color->color.r, src_color->color.g, src_color->color.b, src_color->color.a, dst_color->color.r, dst_color->color.g, dst_color->color.b, dst_color->color.a); } return success; } x11-apps-7.7+5+nmu1ubuntu1/rendercheck/t_tsrccoords.c0000664000000000000000000001003612167023104017316 0ustar /* * Copyright © 2005 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include #include #include "rendercheck.h" static int dot_colors[5][5] = { {7, 7, 7, 7, 7}, {7, 7, 7, 7, 7}, {7, 0, 7, 7, 7}, {7, 7, 7, 7, 7}, {7, 7, 7, 7, 7}, }; static picture_info *create_dot_picture(Display *dpy) { picture_info *p; int i; p = malloc(sizeof(picture_info)); p->d = XCreatePixmap(dpy, RootWindow(dpy, 0), 5, 5, 32); p->format = XRenderFindStandardFormat(dpy, PictStandardARGB32); p->pict = XRenderCreatePicture(dpy, p->d, p->format, 0, NULL); p->name = "dot picture"; for (i = 0; i < 25; i++) { int x = i % 5; int y = i / 5; color4d *c = &colors[dot_colors[x][y]]; argb_fill(dpy, p, x, y, 1, 1, c->a, c->r, c->g, c->b); } return p; } static void destroy_dot_picture(Display *dpy, picture_info *p) { XRenderFreePicture(dpy, p->pict); XFreePixmap(dpy, p->d); free(p); } static void init_transform (XTransform *t) { int i, j; for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) t->matrix[i][j] = XDoubleToFixed((i == j) ? 1 : 0); } /* Test drawing a 5x5 source image scaled 8x, as either a source or mask. */ Bool trans_coords_test(Display *dpy, picture_info *win, picture_info *white, Bool test_mask) { color4d tested; int x, y; Bool failed = FALSE; int tested_colors[40][40], expected_colors[40][40]; XTransform t; picture_info *src; src = create_dot_picture(dpy); if (src == NULL) { fprintf(stderr, "couldn't allocate picture for test\n"); return FALSE; } init_transform(&t); t.matrix[2][2] = XDoubleToFixed(8); XRenderSetPictureTransform(dpy, src->pict, &t); if (!test_mask) XRenderComposite(dpy, PictOpSrc, src->pict, 0, win->pict, 0, 0, 0, 0, 0, 0, 40, 40); else { XRenderComposite(dpy, PictOpSrc, white->pict, src->pict, win->pict, 0, 0, 0, 0, 0, 0, 40, 40); } for (x = 0; x < 40; x++) { for (y = 0; y < 40; y++) { int src_sample_x, src_sample_y; src_sample_x = x / 8; src_sample_y = y / 8; expected_colors[x][y] = dot_colors[src_sample_x][src_sample_y]; get_pixel(dpy, win, x, y, &tested); if (tested.r == 1.0 && tested.g == 1.0 && tested.b == 1.0) { tested_colors[x][y] = 0; } else if (tested.r == 0.0 && tested.g == 0.0 && tested.b == 0.0) { tested_colors[x][y] = 7; } else { tested_colors[x][y] = 9; } if (tested_colors[x][y] != expected_colors[x][y]) failed = TRUE; } } if (failed) { printf("%s transform coordinates test failed.\n", test_mask ? "mask" : "src"); printf("expected vs tested:\n"); for (y = 0; y < 40; y++) { for (x = 0; x < 40; x++) printf("%d", expected_colors[x][y]); printf(" "); for (x = 0; x < 40; x++) printf("%d", tested_colors[x][y]); printf("\n"); } printf(" vs tested (same)\n"); for (y = 0; y < 40; y++) { for (x = 0; x < 40; x++) printf("%d", tested_colors[x][y]); printf("\n"); } } init_transform(&t); XRenderSetPictureTransform(dpy, src->pict, &t); destroy_dot_picture(dpy, src); return !failed; } x11-apps-7.7+5+nmu1ubuntu1/rendercheck/ChangeLog0000664000000000000000000006222112167023104016217 0ustar commit 16d7e5c3052f8c4e9df77f889f935ed8b8f8b326 Author: Alan Coopersmith Date: Sun Nov 21 18:55:18 2010 -0800 rendercheck 1.4 Signed-off-by: Alan Coopersmith commit 03e284e42edbec2a184e0373b0d86bdfbc109b32 Author: Alan Coopersmith Date: Sat Oct 30 13:47:22 2010 -0700 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_SED are provided by XORG_DEFAULT_OPTIONS now PKG_CONFIG_MODULES handles AC_SUBST of the CFLAGS & LIBS variables XORG_DEFAULT_OPTIONS includes XORG_STRICT_OPTION to set -Werror Assume systems have xrender.pc now - those building on older systems can set RC_LIBS="-lXrender -lXext -lX11" plus any -I/-L/-R flags they need in RC_CFLAGS & RC_LIBS. Signed-off-by: Alan Coopersmith commit db39192719bb4474264a6cc66d0a264468b56f05 Author: Alan Coopersmith Date: Sat Oct 30 13:43:30 2010 -0700 Sun's copyrights now belong to Oracle Signed-off-by: Alan Coopersmith commit 6e16e632cfd0528b0934aaadb6ef5f239e61aa9e Author: Gaetan Nadon Date: Sat Oct 30 13:41:51 2010 -0700 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon Signed-off-by: Alan Coopersmith commit e581769b5152ff8e8fdf745b66eb81479a380c32 Author: Alan Coopersmith Date: Sat Oct 30 13:41:22 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS Enables use of platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit 539d89d70ddb16fc3b98968a63276519e737a270 Author: Jesse Adkins Date: Tue Sep 28 13:29:49 2010 -0700 Purge cvs tags. Signed-off-by: Jesse Adkins commit 0d88ba2ebc5d31e7bb03a0628fd4027f1937c39b Author: Gaetan Nadon Date: Sat Mar 27 10:33:54 2010 -0400 config: remove files unnecessarily listed in EXTRA_DIST Automake always distribute those files Signed-off-by: Gaetan Nadon commit a069b6acf4026b3bfd2927c8cc936a5fa65e160b Author: Gaetan Nadon Date: Fri Mar 26 17:22:22 2010 -0400 man: build man pages the standard way Source in git is .man, the suffix may vary by platform No need to make an exception in .gitignore for rendercheck Add __xorgversion__ to rendercheck.man Signed-off-by: Gaetan Nadon commit 83a772482d3bf85eeb3f47a7456a662b3b91c1d2 Author: Gaetan Nadon Date: Thu Feb 11 10:08:06 2010 -0500 config: move CWARNFLAGS from configure.ac to Makefile.am Compiler warning flags should be explicitly set in the makefile rather than being merged with other packages compiler flags. Signed-off-by: Gaetan Nadon commit c1cf222ea8dded9832863116b7f62991088135a0 Author: Gaetan Nadon Date: Thu Nov 26 09:19:52 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit 999c99c4534a4f371076e5f85cd135483b66960d Author: Gaetan Nadon Date: Wed Oct 28 14:09:07 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit a118619650d75cf92caca2896828a1d8ef0d3e03 Author: Gaetan Nadon Date: Tue Oct 27 15:07:24 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit f76c6cb996769fe32a6dce496b5f70326feb84e8 Author: Gaetan Nadon Date: Mon Oct 26 22:08:38 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit a05c845fd67c85a775ed5d9abf75369cf5dae25b Author: Gaetan Nadon Date: Thu Oct 22 16:13:16 2009 -0400 Makefile.am: do not include autogen.sh in distribution #24183 This is a private build script that should not be distributed commit c80dce0c5beca48ee2758ca78fba59c20127215e Author: Gaetan Nadon Date: Thu Oct 22 12:34:14 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit ed91c60970a41670d6dc58f59c24c60d0dbe21fd Author: Jeremy Huddleston Date: Wed Oct 21 12:47:19 2009 -0700 This is not a GNU project, so declare it foreign. On Wed, 2009-10-21 at 13:36 +1000, Peter Hutterer wrote: > On Tue, Oct 20, 2009 at 08:23:55PM -0700, Jeremy Huddleston wrote: > > I noticed an INSTALL file in xlsclients and libXvMC today, and it > > was quite annoying to work around since 'autoreconf -fvi' replaces > > it and git wants to commit it. Should these files even be in git? > > Can I nuke them for the betterment of humanity and since they get > > created by autoreconf anyways? > > See https://bugs.freedesktop.org/show_bug.cgi?id=24206 As an interim measure, replace AM_INIT_AUTOMAKE([dist-bzip2]) with AM_INIT_AUTOMAKE([foreign dist-bzip2]). This will prevent the generation of the INSTALL file. It is also part of the 24206 solution. Signed-off-by: Jeremy Huddleston commit 37eac61e71a313df9927ca2a41ef49bda92fd9c6 Author: Ian Romanick Date: Tue Jan 20 12:04:46 2009 -0800 Make autogen.sh look like the autogen.sh in every other fd.o project Explicitly calling aclocal in autogen.sh circumvents the user's ACLOCAL environment setting and pretty much always does the wrong thing. commit 63814639cb070e34a1aa2205ff71d64e6cc884ce Author: Paulo Cesar Pereira de Andrade Date: Mon Jan 19 15:20:50 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck, all gcc 4.3 and sparse warnings, and a configure configure warning about err.h. commit 2659ac63a1b17e489cb37a44d8c26350de8c7c82 Author: Aaron Plattner Date: Wed Jan 7 18:40:50 2009 -0800 Fix build with -Wall -Werror -pedantic commit c006790eff135feb16c88e48afb12496d74930b4 Author: Aaron Plattner Date: Wed Jan 7 18:24:08 2009 -0800 Add a --version option. Print the version unconditionally. Exit immediately if --version was specified and continue otherwise. While I'm at it, use Bool instead of int for is_sync. commit 0c6aaf012b592bae818d5ce75cd41f23bd4d2cd5 Author: Eric Anholt Date: Tue Apr 15 14:01:06 2008 -0700 Add a test for rendering to source-only pictures under gradients. commit 8288fd35540d148f7900d883525b530c4923eb71 Author: Keith Packard Date: Tue Apr 15 13:27:35 2008 -0700 Remove bogus extra loop from gradient tests. Gradient tests use a single loop, not two. commit 74e2b0dffb65578360889ee7a0ef1e2a82347233 Author: Adam Jackson Date: Fri Mar 7 16:48:08 2008 -0500 rendercheck 1.3 commit 365c2d85d4bc342a3a868f5bc5e43a342f384d07 Author: James Cloos Date: Thu Dec 6 16:37:04 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit bf5275efbf45672ef8364c773cfa98ccd46ab967 Merge: 3b5b26e 70d9421 Author: Eric Anholt Date: Fri Feb 9 14:10:24 2007 -0800 Merge branch 'origin' commit 70d94216cc7b6ecd15cc628646516aef10972035 Author: Eric Anholt Date: Fri Feb 2 17:04:10 2007 -0800 Add another transformed source coordinates test. This one takes a whole image and rotates it to the left when drawing it to the destination. Reveals an off-by-one error in i915 Render acceleration. commit 160d69f593f4054d1973b27a24bf24323774c346 Author: Eric Anholt Date: Fri Feb 2 15:55:07 2007 -0800 Unbreak the dstcoords test, and test it with PictOpOver, as well. Testing on dests[0] meant an a8 picture, which doesn't capture color very well. Use the window, instead. Also, make the code match the comment about it being a 3x3 picture (previously, we drew 1x1). commit 2ae83b5c2783dbce9523ce030a50596eb6804c2b Author: Eric Anholt Date: Thu Jan 11 16:36:48 2007 -0800 Bug #9485: Fix a sign-extension issue on 64-bit platforms in pixel fetching. The result was that 32bpp pictures with a field including the top bit would result in get_pixel returning a zero in that channel. While I'm here, also fix the fact that we weren't using XGetPixel to fetch the pixel, which would have likely caused problems on big-endian systems. commit f5395a5866c4947dbfc30b8845f9400a422990ce Author: Eric Anholt Date: Thu Jan 11 16:16:27 2007 -0800 Add more gcc warning flags, and clean up the added warnings. commit 3b5b26e88dfdfc2f97cd1a239eae1865b25bbe5a Author: Eric Anholt Date: Tue Nov 28 15:05:01 2006 -0800 Bump version to 1.2 and update docs. commit 72cb2695ae1f78adef263eff779cc88541a41c87 Author: Eric Anholt Date: Thu Oct 26 16:31:43 2006 -0700 Reduce the size of the rendering done in many tests. This significantly improves test performance (~60% in blend). commit ff63516c203c0593ee08b77cc9267afe2ca5b0e3 Author: Eric Anholt Date: Thu Oct 26 16:15:55 2006 -0700 Slight cleanup of create_formats_list(). commit cadf1d2fdfc4a35662a766864d323b4097d07767 Author: Eric Anholt Date: Thu Oct 26 16:14:29 2006 -0700 Reduce the number of colors to speed up test execution. The other colors were probably not important. commit 6e809f1ee673a430c58ed486346bf482f451493e Author: Eric Anholt Date: Thu Oct 26 16:13:45 2006 -0700 Run most tests with all formats, rather than a small subset. commit 501d5fb5b354951bf8eef893824b637003beea6e Author: Eric Anholt Date: Thu Oct 26 13:27:25 2006 -0700 Add a -f flag to whitelist formats. commit 003f341cf695f66b81d21f255bd816ae825f4ab3 Author: Tilman Sauerbeck Date: Wed Sep 13 22:26:16 2006 +0200 Set the format field for the solid pictures, too. It's needed in case an error occurs at the tests where they are used, because then the picture format will be evaluated by describe_format(). commit 095d7346b2a58c48609c1c8d75e5e21e25230b73 Author: Tilman Sauerbeck Date: Wed Sep 13 22:24:25 2006 +0200 Scale the alpha channel diff, too, before calculating the final error. This makes errors that only occur in the alpha channel have a chance to be recognized. If the alpha channel diff isn't scaled, it can never be > 3.0. commit 053d4f3d0f4e271e5c868067137264756a11dbff Author: Tilman Sauerbeck Date: Tue Sep 5 20:58:22 2006 +0200 Added missing tests to usage output. commit de32ec8589b7d292dcf6e92c9f28a62b95aa2dbd Author: Tilman Sauerbeck Date: Tue Aug 29 18:17:39 2006 +0200 Bug #8062: Set up XTransforms correctly. Don't store floats directly in the matrix, but pass them through XDoubleToFixed(). That the test still passes with xorg-server's software implementation. commit ad7e07b309216e2eef30cbc718edefb79d8febe5 Author: Tilman Sauerbeck Date: Fri Aug 25 16:07:58 2006 -0700 Correct typo in usage. commit 2319fc448354c6b965132ada135d38cce8badb9d Author: Eric Anholt Date: Fri Jun 30 11:54:13 2006 +0200 Add a check for setting a filter on a source picture causing a crash. (cherry picked from f313b8c4f7bfc2910a55002ba6c8a731796e7d19 commit) commit 0b9af7ccf482fb1dafed256f21742eb2a9de56f9 Author: Eric Anholt Date: Fri Jun 30 11:57:35 2006 +0200 Actually add the tests for bug #7366, and add a couple more crash cases. commit a3c9527030127fe6dd06d1d75207b4e855b93db8 Author: Eric Anholt Date: Thu Jun 29 19:12:52 2006 +0200 Add a regression test for bug #7366 (crash on transform of source picture). commit 388f4492b3099546a2af89e59bc8807709508b53 Author: Eric Anholt Date: Mon Jun 19 17:58:45 2006 -0700 Add a -o flag to select a subset of the Render operators for testing. commit f678d50210e81941790f2db72c12563d411006d9 Author: Eric Anholt Date: Mon Jun 19 17:17:28 2006 -0700 Disable tests at low bitdepths that rendercheck isn't good enough to support. commit 29494c0526c0a1e66e947dec455de1338fad11dd Author: Eric Anholt Date: Mon Jun 19 16:49:41 2006 -0700 Note the source format in blend test error output. commit 63074a124a755ac6374d644ae7960dbd8cab6251 Author: Eric Anholt Date: Mon Jun 19 16:49:18 2006 -0700 Tell the ordering of the channel values in error output. commit 05fa6e38e8e934b74bcc3771781d05cfb3313b26 Author: Eric Anholt Date: Mon Jun 19 08:30:27 2006 -0700 Add support for checking more formats. commit 334d2203d35c27e0c0d73226ad8a58360c8b36bb Author: Eric Anholt Date: Fri Jun 16 09:49:06 2006 -0700 Add an option "--minimalrendering" which suppresses the copying of offscreen rendering results to the window, which reduces the runtime of the blend tests by 10.2% +/- 6.2% on my system. The copy remains on by default because I think it can be useful. commit b99c20783f3d77077eef2af18960db1a68d0dffd Author: Eric Anholt Date: Mon May 22 23:54:55 2006 -0700 Bump version to 1.1 and update docs. commit 47e2f49ffc5c9300097ffb217074b0cac13f1e42 Author: Eric Anholt Date: Mon May 22 23:51:39 2006 -0700 Replace autogen.sh with a more standard one from that does srcdir != builddir. commit 60d23bc0d6b8dbefa0c03949bb1637970450e58e Author: Alan Coopersmith Date: Thu May 4 21:46:39 2006 -0700 Add fallback version of errx for platforms without errx/err.h commit d51e519170bf912339afac89f25c1f7662a101a2 Author: Alan Coopersmith Date: Wed May 3 09:58:47 2006 -0700 Ignore emacs *~ backup files commit af99a26276212838da35d9fd07702e74dcbab5a1 Merge: 0410434 c1d2c66 Author: Eric Anholt Date: Wed May 3 01:32:57 2006 -0700 Merge branch 'security-implications' containing a new test for the triangles calls, which I used for tracking down the Bug #6642 (CVE-2006-1526) issue. It doesn't test much more of triangles than "we can render a couple of them". Conflicts: Makefile.am main.c rendercheck.1 rendercheck.h tests.c commit 0410434d5a10a52cb381d6713d347da759474edd Author: Eric Anholt Date: Mon May 1 22:15:14 2006 -0700 Include the format of the picture in the fill test failure output. commit 202329633d2ebc370e11b922337df7b412f8d01d Author: Eric Anholt Date: Mon May 1 22:14:24 2006 -0700 Fix describing of some more formats. commit e0aa3e6f0fe7d4f546079d3f994c4ee8aea14a19 Author: Eric Anholt Date: Mon May 1 20:35:47 2006 -0700 Correct the comment describing what fill_test does (test the filling of the pictures, not filling from the pictures). commit b7f09efcab3e85b183218438e6e87bd665541fb5 Merge: 6545649 f95ea74 Author: Alan Coopersmith Date: Mon May 1 09:49:34 2006 -0700 Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/app/rendercheck commit f95ea74cd31f28e33a0c888f9ab26a6408fb1d2e Author: Eric Anholt Date: Fri Apr 21 09:21:50 2006 -0700 Update TODO list. commit beeae5eb9b1d85d8e3b638e7927d94ad2f3c5f1d Author: Eric Anholt Date: Fri Apr 21 09:20:21 2006 -0700 Count the successes and failures of tests, printing results when finished, and returning a failure exit code if we failed any tests. commit 9d46f6e9528040416356602688d717a2bb0dd2a5 Merge: edb11cf 6cfab61 Author: Lars Knoll Date: Fri Apr 21 10:01:40 2006 +0200 Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/app/rendercheck commit 6cfab618fabcc5c4fc86aaeadcd8e6d9255cb6eb Author: Eric Anholt Date: Thu Apr 20 12:41:29 2006 -0700 Correct offsets for argb32* convenience colors, so the right colors are used in the repeat test. commit c862f6285b868435a2780b07a602f57e810e1f96 Author: Eric Anholt Date: Thu Apr 20 12:33:25 2006 -0700 Add a short doc on the things to do when adding a new test. Move TODO into the doc dir as well. Also, update README for the new tests. commit b26a0acd18aac615a2abc4df5adc888cb3e3714b Author: Eric Anholt Date: Thu Apr 20 12:27:17 2006 -0700 Add a test for various-sized repeating sources. Reveals issues with EXA Radeon render acceleration. Thanks to frederikh for the testcase that suggested the necessity here. commit e5e49a6b67e2e2919d5236583f01088fdecf347b Author: Eric Anholt Date: Thu Apr 20 11:53:51 2006 -0700 Correct a heinous memory leak in get_pixel(). commit edb11cfdda3d4d14fc1ba5f0c4bc9ce925bf970b Author: Lars Knoll Date: Thu Apr 20 08:56:37 2006 +0200 add license header commit 65456490e4511a961cdd1ce85e2b31ec791def4d Author: Alan Coopersmith Date: Wed Apr 19 18:55:10 2006 -0700 Only add -Wall flag when using gcc, not other compilers commit ccf3c74e703aacb6a3677842e14668fce0e315cc Author: Eric Anholt Date: Wed Apr 19 09:27:01 2006 -0700 Respect --iter in a couple more tests. commit d08fdf4794584f6fc0d78f27ec331a90d1ebd279 Author: Eric Anholt Date: Wed Apr 19 09:26:07 2006 -0700 Improve the wording of the -d argument, which was copied from xcompmgr.1 iirc. commit 02d1383ddae76597323655435ff0892b8d48d7f2 Author: Eric Anholt Date: Wed Apr 19 09:20:12 2006 -0700 Add gradients to the list of tests supported. commit 032ae6c6cd84503c30427857107b3b312506726c Author: Eric Anholt Date: Wed Apr 19 09:18:23 2006 -0700 Remove useless $Id$ markers. commit c1d2c663c385a4c0e2ac6ba03664cf252dff62b0 Author: Eric Anholt Date: Wed Apr 19 09:13:55 2006 -0700 Add a trivial test for Triangles, TriStrip, and TriFan, which exposed a security flaw in the server commit d5949bcc33e115f12762127093f1d5b3158c1c01 Author: Eric Anholt Date: Tue Apr 18 16:34:52 2006 -0700 Move .cvsignore to .gitignore. commit 00f788fc2785db30ee294281c027f82d09256be6 Author: Lars Knoll Date: Wed Mar 8 06:13:42 2006 +0000 add testing for linear gradients. commit 4fd03c7cf419c84b8bdfcf25745627659e794300 Author: Lars Knoll Date: Mon Mar 6 21:22:15 2006 +0000 test composition operations using solid source pictures (Created with XRenderCreateSolidFill). At least the XServer doesn't crash anymore on me trying to use them (though he might with EXA), but the i810 driver fails handling them correctly. I'm sure other drivers might have problems as well. commit 2e734bdc5e1fa6433c953e05f3608566ad75aa1d Author: Eric Anholt Date: Tue Sep 27 02:19:15 2005 +0000 Add a description of the -i flag, and alphabetize. commit 14c1dbe8d030fb5dbd63e0bbc63f256f7fc78bde Author: Eric Anholt Date: Tue Sep 27 02:08:04 2005 +0000 Add a --sync flag to set XSynchronize() (for debugging a scripting issue) and add long argument equivalents for current options. commit 7445bc2d1ccaa0f4f276b0cef159d3db4a41dd84 Author: Eric Anholt Date: Thu Sep 15 22:15:22 2005 +0000 Remove the apparently-unnecessary AC_CONFIG_AUX_DIR setting that made new automake cry. commit 227b75ebf0e468c094bcba95bd9599a5e6d687be Author: Eric Anholt Date: Thu Jan 27 03:47:37 2005 +0000 Make autogen.sh actually do its job, and add some missing files to the dist. commit 2427ac0046a8f53bea8b709c2d6e90eacb355631 Author: Eric Anholt Date: Thu Jan 27 03:12:08 2005 +0000 Allow users to specify the set of tests to be run. commit 7419df337982418ba11432c9f11a7b4056b70658 Author: Eric Anholt Date: Thu Jan 27 02:42:14 2005 +0000 - Split the tests out into separate files. - Split some of the test picture generation out into those files, too. - Add a helper function for filling things with a color. - Add -Wall to CFLAGS and clean up the ensuing carnage. commit 85a6ac04cca072a64aa13d1829ae9aa1a6a3f7e3 Author: Eric Anholt Date: Thu Jan 27 02:39:30 2005 +0000 Add an appropriate .cvsignore. commit f02f7e4cd2d2a628d59def61835ed9fa06de4c4f Author: Eric Anholt Date: Thu Jan 27 01:24:41 2005 +0000 Add a simple manpage, and add commandline options for verbosity and display. commit 56890198e02cb2d63e6ca64264a4f2252c272978 Author: Eric Anholt Date: Thu Jan 27 00:39:56 2005 +0000 Set the main window OverrideRedirect. metacity gets less confused, and things are a bit more deterministic. commit a5962dda126e7e48f51c276f907a1fbb76b8ed4d Author: Eric Anholt Date: Sun Oct 24 21:03:56 2004 +0000 Allow building without xrender.pc, by using AC_PATH_XTRA. Bump to 1.0.3. commit df85d34dd3a85a3629caa2732729ae26f268d5d0 Author: Eric Anholt Date: Mon Sep 27 01:51:42 2004 +0000 Sigh. Some day somebody will write a makefile system that isn't based on hatred for its users. Until then, shut automake up about the "lack" of a ChangeLog file. Also avoid accidentally spamming in the copy of the GPL it decided my COPYING file should be replaced with. commit 1550c69e3528653a0690f116a454a77f63bf1294 Author: Eric Anholt Date: Mon Sep 20 02:42:53 2004 +0000 Back out previous changes to the transformed coordinates test. It looks like the intention really was for pixels to be centered on (x + .5, y + .5), and this does seem more sensible. Bump the version to 1.0.2 and update docs. commit e342db6763ad3f829d1bfc14663247509677f20b Author: Eric Anholt Date: Mon Aug 30 22:07:16 2004 +0000 Correct the previous commit: Render does specify the rounding on transformed coordinates, which is "Nearest" by default. Fix the test appropriately. Note that this exposes a bug in the fb implementation. commit 2a0b03dc10470c85ab31628aad360736b1f6739a Author: Eric Anholt Date: Mon Aug 30 17:24:04 2004 +0000 Add a simple test of transformed source/mask coordinates. Add more tasks to TODO. commit 1594aadab7bc3636adbea9a990fb42547840770c Author: Eric Anholt Date: Mon Aug 30 16:54:49 2004 +0000 Kill the ChangeLog. Updating them is annoying. If you want the ChangeLog, use cvs2cl. commit 783ba8d4314ca1412e3f806cd07bfd52fb8dfc5b Author: Eric Anholt Date: Sun Jun 13 19:52:06 2004 +0000 Exercise XAA's Composite acceleration by also rendering directly to the destination window instead of only pixmaps. commit 3ee9ea7cda8fe71abc77151e1a94b4dfc06767b8 Author: Eric Anholt Date: Mon May 17 05:31:21 2004 +0000 - get_pixel was not at fault, and get destcoords_test working. - Change fill_test from being a duplication of the blend tests to a test of whether the XRenderFillRectangle()s produced the expected results. - Update TODO list. - Bump version to 1.0.1. commit 70b1be1b819b7ebacf268dfb498a3adab133916e Author: Eric Anholt Date: Mon May 10 07:21:19 2004 +0000 Initial import of rendercheck (attempt 2). commit 258f238ae94782fa1c0e1d8b6280d8d61c9c0c40 Author: Eric Anholt Date: Mon May 10 07:21:19 2004 +0000 Initial revision x11-apps-7.7+5+nmu1ubuntu1/rendercheck/t_srccoords.c0000664000000000000000000001027612167023104017140 0ustar /* * Copyright © 2005 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include #include #include "rendercheck.h" /* Originally a bullseye, this pattern has been modified so that flipping * will result in errors as well. */ static int target_colors[5][5] = { {1, 1, 1, 1, 1}, {1, 0, 0, 0, 1}, {1, 1, 1, 0, 1}, {1, 0, 0, 1, 1}, {1, 1, 1, 1, 1}, }; static picture_info *create_target_picture(Display *dpy) { picture_info *p; int i; p = malloc(sizeof(picture_info)); p->d = XCreatePixmap(dpy, RootWindow(dpy, 0), 5, 5, 32); p->format = XRenderFindStandardFormat(dpy, PictStandardARGB32); p->pict = XRenderCreatePicture(dpy, p->d, p->format, 0, NULL); p->name = "target picture"; for (i = 0; i < 25; i++) { int x = i % 5; int y = i / 5; color4d *c = &colors[target_colors[x][y]]; argb_fill(dpy, p, x, y, 1, 1, c->a, c->r, c->g, c->b); } return p; } static void destroy_target_picture(Display *dpy, picture_info *p) { XRenderFreePicture(dpy, p->pict); XFreePixmap(dpy, p->d); free(p); } /* Test source or mask coordinates by drawing from a 5x5 picture into the 0,0 * pixel. * XXX: Something besides PictOpSrc should also be used, at least in the * !test_mask case, to avoid getting CopyArea acceleration (easy to implement) * rather than a more general Composite implementation. */ Bool srccoords_test(Display *dpy, picture_info *win, picture_info *white, Bool test_mask) { color4d expected, tested; int i; XRenderPictureAttributes pa; Bool failed = FALSE; int tested_colors[5][5]; picture_info *src; src = create_target_picture(dpy); if (src == NULL) { fprintf(stderr, "couldn't allocate picture for test\n"); return FALSE; } for (i = 0; i < 25; i++) { char name[20]; int x = i % 5, y = i / 5; if (!test_mask) XRenderComposite(dpy, PictOpSrc, src->pict, 0, win->pict, x, y, 0, 0, 0, 0, 1, 1); else { /* Using PictOpSrc, color 0 (white), and component * alpha, the mask color should be written to the * destination. */ pa.component_alpha = TRUE; XRenderChangePicture(dpy, src->pict, CPComponentAlpha, &pa); XRenderComposite(dpy, PictOpSrc, white->pict, src->pict, win->pict, 0, 0, x, y, 0, 0, 1, 1); pa.component_alpha = FALSE; XRenderChangePicture(dpy, src->pict, CPComponentAlpha, &pa); } get_pixel(dpy, win, 0, 0, &tested); expected = colors[target_colors[x][y]]; color_correct(win, &expected); if (tested.r == 1.0) { if (tested.g == 1.0 && tested.b == 1.0) tested_colors[x][y] = 0; else if (tested.g == 0.0 && tested.b == 0.0) tested_colors[x][y] = 1; else tested_colors[x][y] = 9; } else tested_colors[x][y] = 9; if (test_mask) snprintf(name, 20, "mask coords"); else snprintf(name, 20, "src coords"); if (!eval_diff(name, &expected, &tested, x, y, is_verbose)) failed = TRUE; } if (failed) { int j; printf("expected vs tested:\n"); for (i = 0; i < 5; i++) { for (j = 0; j < 5; j++) printf("%d", target_colors[j][i]); printf(" "); for (j = 0; j < 5; j++) printf("%d", tested_colors[j][i]); printf("\n"); } } destroy_target_picture(dpy, src); return !failed; } x11-apps-7.7+5+nmu1ubuntu1/rendercheck/t_bug7366.c0000664000000000000000000001006612167023104016237 0ustar /* * Copyright © 2006 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include #include #include #include "rendercheck.h" static int expecting_error(Display *dpy, XErrorEvent *event) { return TRUE; } /** * Check SetPictureTransform on a source picture causing a crash. */ static Bool bug7366_test_set_picture_transform(Display *dpy) { Picture source_pict; XRenderColor color; XTransform transform; memset(&color, 0, sizeof(color)); source_pict = XRenderCreateSolidFill(dpy, &color); memset(&transform, 0, sizeof(transform)); XRenderSetPictureTransform(dpy, source_pict, &transform); XSync(dpy, FALSE); XRenderFreePicture(dpy, source_pict); return TRUE; } /** * Check setting of AlphaMap to a source picture causing a crash. */ static Bool bug7366_test_set_alpha_map(Display *dpy) { Picture source_pict, pict; XRenderColor color; Drawable pixmap; XRenderPictureAttributes pa; memset(&color, 0, sizeof(color)); source_pict = XRenderCreateSolidFill(dpy, &color); pixmap = XCreatePixmap(dpy, RootWindow(dpy, 0), 1, 1, 32); pict = XRenderCreatePicture(dpy, pixmap, XRenderFindStandardFormat(dpy, PictStandardARGB32), 0, NULL); XSetErrorHandler(expecting_error); pa.alpha_map = source_pict; XRenderChangePicture(dpy, pict, CPAlphaMap, &pa); XSync(dpy, FALSE); XSetErrorHandler(NULL); XFreePixmap(dpy, pixmap); XRenderFreePicture(dpy, pict); XRenderFreePicture(dpy, source_pict); return TRUE; } /** * Check SetPictureClipRectangles on a source potentially causing a crash. */ static Bool bug7366_test_set_picture_clip_rectangles(Display *dpy) { Picture source_pict; XRenderColor color; XRectangle rectangle; memset(&color, 0, sizeof(color)); source_pict = XRenderCreateSolidFill(dpy, &color); memset(&rectangle, 0, sizeof(rectangle)); XSetErrorHandler(expecting_error); XRenderSetPictureClipRectangles(dpy, source_pict, 0, 0, &rectangle, 1); XSync(dpy, FALSE); XSetErrorHandler(NULL); XRenderFreePicture(dpy, source_pict); return TRUE; } /** * Check SetPictureFilter on a source potentially causing a crash. */ static Bool bug7366_test_set_picture_filter(Display *dpy) { Picture source_pict; XRenderColor color; memset(&color, 0, sizeof(color)); source_pict = XRenderCreateSolidFill(dpy, &color); XRenderSetPictureFilter(dpy, source_pict, "bilinear", NULL, 0); XSync(dpy, FALSE); XSetErrorHandler(NULL); XRenderFreePicture(dpy, source_pict); return TRUE; } Bool bug7366_test(Display *dpy) { int maj, min; /* Make sure we actually have gradients available */ XRenderQueryVersion(dpy, &maj, &min); if (maj != 0 || min < 10) return TRUE; bug7366_test_set_picture_transform(dpy); bug7366_test_set_alpha_map(dpy); bug7366_test_set_picture_clip_rectangles(dpy); bug7366_test_set_picture_filter(dpy); /* If the server isn't gone, then we've succeeded. */ return TRUE; } x11-apps-7.7+5+nmu1ubuntu1/rendercheck/NEWS0000664000000000000000000000123612167023104015143 0ustar 2006-11-27: Version 1.2 released Adds test for bug #7366 Tests against more picture formats. Allows testing against a subset of the operators and formats. 2006-05-22: Version 1.1 released. Adds tests for triangles, gradients, and repeating sources. Fixes a major memory leak. Allow run-time selection of the set of tests to be run. Add a manpage. 2004-10-24: Version 1.0.3 released. Allows building on systems without xrender.pc. 2004-09-19: Version 1.0.2 released. Adds a transformed coordinates test. 2004-05-17: Version 1.0.1 released. Makes the fill test useful and adds a destination coordinates test. 2004-05-10: Initial version 1.0 imported. x11-apps-7.7+5+nmu1ubuntu1/rendercheck/t_gradient.c0000664000000000000000000002427512167023104016740 0ustar /* * Copyright © 2006 Lars Knoll * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of the copyright holders not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. The copyright holders makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include #include #include "rendercheck.h" typedef struct _stop { double x; color4d color; } stop; static const stop stop_list[][10] = { { { 0., {0, 0, 1.0, 1.0} }, { 1., {1.0, 0, 0, 1.0} }, { -1, {0, 0, 0, 0} } }, { { 0., {0, 0, 1.0, 1.0} }, { .5, {0, 1.0, 0, 1.0} }, { 1., {1.0, 0, 0, 1.0} }, { -1, {0, 0, 0, 0} } }, { { 0., {0, 0, 1.0, 0} }, { 1., {1.0, 0, 0, 1.0} }, { -1, {0, 0, 0, 0} } }, { { 0., {0, 0, 1.0, 0} }, { .5, {0, 1.0, 0, .75} }, { 1., {1.0, 0, 0, .5} }, { -1, {0, 0, 0, 0} } } }; static const int n_stop_list = sizeof(stop_list)/(10*sizeof(stop)); typedef struct _point { double x; double y; } point; static const point linear_gradient_points[] = { { -5, -5 }, { 5, 5 }, { 0, 0 }, { 10, 10 }, }; typedef struct _pixel { int x; int y; } pixel; static const pixel test_pixels [] = { {0, 0}, {0, 5}, {5, 0}, {5, 5}, {3, 7}, {7, 3}, {20, 20}, {30, 13}, {39, 39}, {-1, -1} }; static const int n_linear_gradient_points = sizeof(linear_gradient_points)/(2*sizeof(point)); static Bool got_bad_drawable; static int expecting_bad_drawable(Display *dpy, XErrorEvent *event) { if (event->error_code == BadDrawable) got_bad_drawable = TRUE; return TRUE; } /* Tests that rendering to a linear gradient returns an error as expected. */ Bool render_to_gradient_test(Display *dpy, picture_info *src) { XLinearGradient g; Picture gradient; XFixed stops[10]; XRenderColor colors[10]; const stop *stps = &stop_list[0][0]; int i, p = 0; g.p1.x = XDoubleToFixed(linear_gradient_points[p].x); g.p1.y = XDoubleToFixed(linear_gradient_points[p].y); g.p2.x = XDoubleToFixed(linear_gradient_points[p+1].x); g.p2.y = XDoubleToFixed(linear_gradient_points[p+1].y); for (i = 0; i < 10; ++i) { if (stps[i].x < 0) break; stops[i] = XDoubleToFixed(stps[i].x); colors[i].red = stps[i].color.r*65535; colors[i].green = stps[i].color.g*65535; colors[i].blue = stps[i].color.b*65535; colors[i].alpha = stps[i].color.a*65535; } gradient = XRenderCreateLinearGradient(dpy, &g, stops, colors, i); /* Clear out any failing requests before our expected to fail ones. */ XSync(dpy, FALSE); got_bad_drawable = FALSE; XSetErrorHandler(expecting_bad_drawable); /* Try a real compositing path */ XRenderComposite(dpy, PictOpOver, src->pict, 0, gradient, 0, 0, 0, 0, 0, 0, win_width, win_height); XSync(dpy, FALSE); if (!got_bad_drawable) { printf("render_to_gradient: Failed to get BadDrawable with " "Over\n"); return FALSE; } else { got_bad_drawable = FALSE; } /* Try the copy path to catch bad short-circuiting to 2d. */ XRenderComposite(dpy, PictOpSrc, src->pict, 0, gradient, 0, 0, 0, 0, 0, 0, win_width, win_height); XSync(dpy, FALSE); if (!got_bad_drawable) { printf("render_to_gradient: Failed to get BadDrawable with " "Src\n"); return FALSE; } else { got_bad_drawable = FALSE; } XSetErrorHandler(NULL); XRenderFreePicture(dpy, gradient); return TRUE; } static void gradientPixel(const stop *stops, double pos, unsigned int spread, color4d *result) { const int PRECISION = 1<<16; int ipos = pos * PRECISION - 1; int i; double frac; /* calculate the actual offset. */ if (ipos < 0 || ipos >= PRECISION) { if (spread == RepeatNormal) { ipos = ipos % PRECISION; ipos = ipos < 0 ? PRECISION + ipos : ipos; } else if (spread == RepeatReflect) { const int limit = PRECISION * 2 - 1; ipos = ipos % limit; ipos = ipos < 0 ? limit + ipos : ipos; ipos = ipos >= PRECISION ? limit - ipos : ipos; } else if (spread == RepeatPad) { if (ipos < 0) ipos = 0; else if (ipos >= PRECISION) ipos = PRECISION-1; } else { /* RepeatNone */ result->r = 0; result->g = 0; result->b = 0; result->a = 0; return; } } assert(ipos >= 0); assert(ipos < PRECISION); pos = ipos/(double)PRECISION; if (pos <= stops[0].x) { *result = stops[0].color; return; } for (i = 0; i < 10; ++i) { if (stops[i].x >= pos) break; if (stops[i].x < 0) { *result = stops[i-1].color; result->r *= result->a; result->g *= result->a; result->b *= result->a; return; } } frac = (pos - stops[i-1].x)/(stops[i].x - stops[i-1].x); result->r = (1.-frac)*stops[i-1].color.r + frac*stops[i].color.r; result->g = (1.-frac)*stops[i-1].color.g + frac*stops[i].color.g; result->b = (1.-frac)*stops[i-1].color.b + frac*stops[i].color.b; result->a = (1.-frac)*stops[i-1].color.a + frac*stops[i].color.a; result->r *= result->a; result->g *= result->a; result->b *= result->a; return; } static void calculate_linear_gradient_color(int x, int y, const point *points, const stop *stops, color4d *tgradient, int repeat) { double dx, dy, l, xrel, yrel, pos; dx = points[1].x - points[0].x; dy = points[1].y - points[0].y; l = dx*dx + dy*dy; xrel = x - points[0].x; yrel = y - points[0].y; pos = (dx*xrel + dy*yrel)/l; gradientPixel(stops, pos, repeat, tgradient); } Bool linear_gradient_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *dst_color) { color4d expected, tested, tdst, tgradient; int i, s, p, repeat; Picture gradient; char testname[40]; Bool success = True; for (s = 0; s < n_stop_list; ++s) { for (p = 0; p < n_linear_gradient_points; p += 2) { XLinearGradient g; XFixed stops[10]; XRenderColor colors[10]; const stop *stps = &stop_list[s][0]; g.p1.x = XDoubleToFixed(linear_gradient_points[p].x); g.p1.y = XDoubleToFixed(linear_gradient_points[p].y); g.p2.x = XDoubleToFixed(linear_gradient_points[p+1].x); g.p2.y = XDoubleToFixed(linear_gradient_points[p+1].y); for (i = 0; i < 10; ++i) { if (stps[i].x < 0) break; stops[i] = XDoubleToFixed(stps[i].x); colors[i].red = stps[i].color.r*65535; colors[i].green = stps[i].color.g*65535; colors[i].blue = stps[i].color.b*65535; colors[i].alpha = stps[i].color.a*65535; } gradient = XRenderCreateLinearGradient(dpy, &g, stops, colors, i); for (repeat = 1; repeat < 4; ++repeat) { const pixel *pix; XRenderPictureAttributes pa; pa.repeat = repeat; XRenderChangePicture(dpy, gradient, CPRepeat, &pa); assert (dst_color->pict > 100); XRenderComposite(dpy, PictOpSrc, dst_color->pict, 0, dst->pict, 0, 0, 0, 0, 0, 0, win_width, win_height); XRenderComposite(dpy, ops[op].op, gradient, 0, dst->pict, 0, 0, 0, 0, 0, 0, win_width, win_height); copy_pict_to_win(dpy, dst, win, win_width, win_height); pix = test_pixels; while (pix->x >= 0) { get_pixel(dpy, dst, pix->x, pix->y, &tested); calculate_linear_gradient_color(pix->x, pix->y, &linear_gradient_points[p], stps, &tgradient, repeat); tdst = dst_color->color; color_correct(dst, &tdst); do_composite(ops[op].op, &tgradient, NULL, &tdst, &expected, False); color_correct(dst, &expected); snprintf(testname, 40, "%s linear gradient", ops[op].name); if (!eval_diff(testname, &expected, &tested, 0, 0, is_verbose)) { printf("gradient: %d stops: %d repeat: %d pos: %d/%d\n" "src color: %.2f %.2f %.2f %.2f\n" "dst color: %.2f %.2f %.2f %.2f\n", p/2, s, repeat, pix->x, pix->y, tgradient.r, tgradient.g, tgradient.b, tgradient.a, dst_color->color.r, dst_color->color.g, dst_color->color.b, dst_color->color.a); success = FALSE; } else if (is_verbose) { printf("src: %d/%d, dst: %s\n", s, p, dst->name); } ++pix; } } XRenderFreePicture(dpy, gradient); } } return success; } x11-apps-7.7+5+nmu1ubuntu1/rendercheck/t_composite.c0000664000000000000000000000730612167023104017141 0ustar /* * Copyright © 2005 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include #include "rendercheck.h" #define TEST_WIDTH 10 #define TEST_HEIGHT 10 /* Test a composite of a given operation, source, mask, and destination picture. * Fills the window, and samples from the 0,0 pixel corner. */ Bool composite_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *mask_color, picture_info *dst_color, Bool componentAlpha, Bool print_errors) { color4d expected, tested, tdst, tmsk; char testname[40]; XRenderPictureAttributes pa; Bool success = TRUE; int i; if (componentAlpha) { pa.component_alpha = TRUE; XRenderChangePicture(dpy, mask_color->pict, CPComponentAlpha, &pa); } for (i = 0; i < pixmap_move_iter; i++) { XRenderComposite(dpy, PictOpSrc, dst_color->pict, 0, dst->pict, 0, 0, 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT); XRenderComposite(dpy, ops[op].op, src_color->pict, mask_color->pict, dst->pict, 0, 0, 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT); } get_pixel(dpy, dst, 0, 0, &tested); copy_pict_to_win(dpy, dst, win, TEST_WIDTH, TEST_HEIGHT); if (componentAlpha) { pa.component_alpha = FALSE; XRenderChangePicture(dpy, mask_color->pict, CPComponentAlpha, &pa); } if (componentAlpha && mask_color->format->direct.redMask == 0) { /* Ax component-alpha masks expand alpha into all color * channels. XXX: This should be located somewhere generic. */ tmsk.a = mask_color->color.a; tmsk.r = mask_color->color.a; tmsk.g = mask_color->color.a; tmsk.b = mask_color->color.a; } else tmsk = mask_color->color; tdst = dst_color->color; color_correct(dst, &tdst); do_composite(ops[op].op, &src_color->color, &tmsk, &tdst, &expected, componentAlpha); color_correct(dst, &expected); snprintf(testname, 40, "%s %scomposite", ops[op].name, componentAlpha ? "CA " : ""); if (!eval_diff(testname, &expected, &tested, 0, 0, is_verbose && print_errors)) { if (print_errors) printf("src color: %.2f %.2f %.2f %.2f\n" "msk color: %.2f %.2f %.2f %.2f\n" "dst color: %.2f %.2f %.2f %.2f\n", src_color->color.r, src_color->color.g, src_color->color.b, src_color->color.a, mask_color->color.r, mask_color->color.g, mask_color->color.b, mask_color->color.a, dst_color->color.r, dst_color->color.g, dst_color->color.b, dst_color->color.a); printf("src: %s, mask: %s, dst: %s\n", src_color->name, mask_color->name, dst->name); success = FALSE; } else if (is_verbose) { printf("src: %s, mask: %s, dst: %s\n", src_color->name, mask_color->name, dst->name); } return success; } x11-apps-7.7+5+nmu1ubuntu1/rendercheck/config.guess0000664000000000000000000012776412167023104017000 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. timestamp='2010-08-21' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' HUP INT TERM # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-tilera-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/rendercheck/ops.c0000664000000000000000000001520712167023104015414 0ustar /* * Copyright © 2004 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include #include "rendercheck.h" #define mult_chan(src, dst, Fa, Fb) \ min((double)(src) * (double)(Fa) + (double)(dst) * (double)(Fb), 1.0) static double calc_op(int op, double src, double dst, double srca, double dsta) { double Fa, Fb; switch (op) { case PictOpClear: case PictOpDisjointClear: case PictOpConjointClear: return mult_chan(src, dst, 0.0, 0.0); case PictOpSrc: case PictOpDisjointSrc: case PictOpConjointSrc: return mult_chan(src, dst, 1.0, 0.0); case PictOpDst: case PictOpDisjointDst: case PictOpConjointDst: return mult_chan(src, dst, 0.0, 1.0); case PictOpOver: return mult_chan(src, dst, 1.0, 1.0 - srca); case PictOpOverReverse: return mult_chan(src, dst, 1.0 - dsta, 1.0); case PictOpIn: return mult_chan(src, dst, dsta, 0.0); case PictOpInReverse: return mult_chan(src, dst, 0.0, srca); case PictOpOut: return mult_chan(src, dst, 1.0 - dsta, 0.0); case PictOpOutReverse: return mult_chan(src, dst, 0.0, 1.0 - srca); case PictOpAtop: return mult_chan(src, dst, dsta, 1.0 - srca); case PictOpAtopReverse: return mult_chan(src, dst, 1.0 - dsta, srca); case PictOpXor: return mult_chan(src, dst, 1.0 - dsta, 1.0 - srca); case PictOpAdd: return mult_chan(src, dst, 1.0, 1.0); break; case PictOpSaturate: case PictOpDisjointOverReverse: if (srca == 0.0) Fa = 1.0; else Fa = min(1.0, (1.0 - dsta) / srca); return mult_chan(src, dst, Fa, 1.0); case PictOpDisjointOver: if (dsta == 0.0) Fb = 1.0; else Fb = min(1.0, (1.0 - srca) / dsta); return mult_chan(src, dst, 1.0, Fb); case PictOpDisjointIn: if (srca == 0.0) Fa = 0.0; else Fa = max(0.0, 1.0 - (1.0 - dsta) / srca); return mult_chan(src, dst, Fa, 0.0); case PictOpDisjointInReverse: if (dsta == 0.0) Fb = 0.0; else Fb = max(0.0, 1.0 - (1.0 - srca) / dsta); return mult_chan(src, dst, 0.0, Fb); case PictOpDisjointOut: if (srca == 0.0) Fa = 1.0; else Fa = min(1.0, (1.0 - dsta) / srca); return mult_chan(src, dst, Fa, 0.0); case PictOpDisjointOutReverse: if (dsta == 0.0) Fb = 1.0; else Fb = min(1.0, (1.0 - srca) / dsta); return mult_chan(src, dst, 0.0, Fb); case PictOpDisjointAtop: if (srca == 0.0) Fa = 0.0; else Fa = max(0.0, 1.0 - (1.0 - dsta) / srca); if (dsta == 0.0) Fb = 1.0; else Fb = min(1.0, (1.0 - srca) / dsta); return mult_chan(src, dst, Fa, Fb); case PictOpDisjointAtopReverse: if (srca == 0.0) Fa = 1.0; else Fa = min(1.0, (1.0 - dsta) / srca); if (dsta == 0.0) Fb = 0.0; else Fb = max(0.0, 1.0 - (1.0 - srca) / dsta); return mult_chan(src, dst, Fa, Fb); case PictOpDisjointXor: if (srca == 0.0) Fa = 1.0; else Fa = min(1.0, (1.0 - dsta) / srca); if (dsta == 0.0) Fb = 1.0; else Fb = min(1.0, (1.0 - srca) / dsta); return mult_chan(src, dst, Fa, Fb); case PictOpConjointOver: if (dsta == 0.0) Fb = 0.0; else Fb = max(0.0, 1.0 - srca / dsta); return mult_chan(src, dst, 1.0, Fb); case PictOpConjointOverReverse: if (srca == 0.0) Fa = 0.0; else Fa = max(0.0, 1.0 - dsta / srca); return mult_chan(src, dst, Fa, 1.0); case PictOpConjointIn: if (srca == 0.0) Fa = 1.0; else Fa = min(1.0, dsta / srca); return mult_chan(src, dst, Fa, 0.0); case PictOpConjointInReverse: if (dsta == 0.0) Fb = 1.0; else Fb = min(1.0, srca / dsta); return mult_chan(src, dst, 0.0, Fb); case PictOpConjointOut: if (srca == 0.0) Fa = 0.0; else Fa = max(0.0, 1.0 - dsta / srca); return mult_chan(src, dst, Fa, 0.0); case PictOpConjointOutReverse: if (dsta == 0.0) Fb = 0.0; else Fb = max(0.0, 1.0 - srca / dsta); return mult_chan(src, dst, 0.0, Fb); case PictOpConjointAtop: if (srca == 0.0) Fa = 1.0; else Fa = min(1.0, dsta / srca); if (dsta == 0.0) Fb = 0.0; else Fb = max(0.0, 1.0 - srca / dsta); return mult_chan(src, dst, Fa, Fb); case PictOpConjointAtopReverse: if (srca == 0.0) Fa = 0.0; else Fa = max(0.0, 1.0 - dsta / srca); if (dsta == 0.0) Fb = 1.0; else Fb = min(1.0, srca / dsta); return mult_chan(src, dst, Fa, Fb); case PictOpConjointXor: if (srca == 0.0) Fa = 0.0; else Fa = max(0.0, 1.0 - dsta / srca); if (dsta == 0.0) Fb = 0.0; else Fb = max(0.0, 1.0 - srca / dsta); return mult_chan(src, dst, Fa, Fb); default: abort(); } } void do_composite(int op, color4d *src, color4d *mask, color4d *dst, color4d *result, Bool componentAlpha) { color4d srcval, srcalpha; if (mask != NULL && componentAlpha) { srcval.r = src->r * mask->r; srcval.g = src->g * mask->g; srcval.b = src->b * mask->b; srcval.a = src->a * mask->a; srcalpha.r = src->a * mask->r; srcalpha.g = src->a * mask->g; srcalpha.b = src->a * mask->b; srcalpha.a = src->a * mask->a; } else if (mask != NULL) { srcval.r = src->r * mask->a; srcval.g = src->g * mask->a; srcval.b = src->b * mask->a; srcval.a = src->a * mask->a; srcalpha.r = src->a * mask->a; srcalpha.g = src->a * mask->a; srcalpha.b = src->a * mask->a; srcalpha.a = src->a * mask->a; } else { srcval = *src; srcalpha.r = src->a; srcalpha.g = src->a; srcalpha.b = src->a; srcalpha.a = src->a; } result->r = calc_op(op, srcval.r, dst->r, srcalpha.r, dst->a); result->g = calc_op(op, srcval.g, dst->g, srcalpha.g, dst->a); result->b = calc_op(op, srcval.b, dst->b, srcalpha.b, dst->a); result->a = calc_op(op, srcval.a, dst->a, srcalpha.a, dst->a); } x11-apps-7.7+5+nmu1ubuntu1/rendercheck/tests.c0000664000000000000000000005337212167023104015762 0ustar /* * Copyright © 2004 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include #include #include #include #include "rendercheck.h" static XRenderPictFormat **format_list; static int nformats; static int argb32index; /* Note: changing the order of these colors may disrupt tests that depend on * specific colors. Just add to the end if you need. These are * not premultiplied, but will be in main(). */ color4d colors[] = { {1.0, 1.0, 1.0, 1.0}, {1.0, 0, 0, 1.0}, {0, 1.0, 0, 1.0}, {0, 0, 1.0, 1.0}, {0.5, 0, 0, .5}, }; /* Convenience pointers to 1x1 repeating colors */ picture_info *argb32white, *argb32red, *argb32green, *argb32blue; int num_colors = sizeof(colors) / sizeof(colors[0]); struct op_info ops[] = { {PictOpClear, "Clear"}, {PictOpSrc, "Src"}, {PictOpDst, "Dst"}, {PictOpOver, "Over"}, {PictOpOverReverse, "OverReverse"}, {PictOpIn, "In"}, {PictOpInReverse, "InReverse"}, {PictOpOut, "Out"}, {PictOpOutReverse, "OutReverse"}, {PictOpAtop, "Atop"}, {PictOpAtopReverse, "AtopReverse"}, {PictOpXor, "Xor"}, {PictOpAdd, "Add"}, {PictOpSaturate, "Saturate"}, {PictOpDisjointClear, "DisjointClear"}, {PictOpDisjointSrc, "DisjointSrc"}, {PictOpDisjointDst, "DisjointDst"}, {PictOpDisjointOver, "DisjointOver"}, {PictOpDisjointOverReverse, "DisjointOverReverse"}, {PictOpDisjointIn, "DisjointIn"}, {PictOpDisjointInReverse, "DisjointInReverse"}, {PictOpDisjointOut, "DisjointOut"}, {PictOpDisjointOutReverse, "DisjointOutReverse"}, {PictOpDisjointAtop, "DisjointAtop"}, {PictOpDisjointAtopReverse, "DisjointAtopReverse"}, {PictOpDisjointXor, "DisjointXor"}, {PictOpConjointClear, "ConjointClear"}, {PictOpConjointSrc, "ConjointSrc"}, {PictOpConjointDst, "ConjointDst"}, {PictOpConjointOver, "ConjointOver"}, {PictOpConjointOverReverse, "ConjointOverReverse"}, {PictOpConjointIn, "ConjointIn"}, {PictOpConjointInReverse, "ConjointInReverse"}, {PictOpConjointOut, "ConjointOut"}, {PictOpConjointOutReverse, "ConjointOutReverse"}, {PictOpConjointAtop, "ConjointAtop"}, {PictOpConjointAtopReverse, "ConjointAtopReverse"}, {PictOpConjointXor, "ConjointXor"}, }; int num_ops = sizeof(ops) / sizeof(ops[0]); #define round_pix(pix, mask) \ ((double)((int)(pix * (mask ) + .5)) / (double)(mask)) void color_correct(picture_info *pi, color4d *color) { if (!pi->format->direct.redMask) { color->r = 0.0; color->g = 0.0; color->b = 0.0; } else { color->r = round_pix(color->r, pi->format->direct.redMask); color->g = round_pix(color->g, pi->format->direct.greenMask); color->b = round_pix(color->b, pi->format->direct.blueMask); } if (!pi->format->direct.alphaMask) color->a = 1.0; else color->a = round_pix(color->a, pi->format->direct.alphaMask); } void get_pixel(Display *dpy, picture_info *pi, int x, int y, color4d *color) { XImage *image; unsigned long val; unsigned long rm, gm, bm, am; XRenderDirectFormat *layout = &pi->format->direct; image = XGetImage(dpy, pi->d, x, y, 1, 1, 0xffffffff, ZPixmap); val = XGetPixel(image, 0, 0); rm = (unsigned long)layout->redMask << layout->red; gm = (unsigned long)layout->greenMask << layout->green; bm = (unsigned long)layout->blueMask << layout->blue; am = (unsigned long)layout->alphaMask << layout->alpha; if (am != 0) color->a = (double)(val & am) / (double)am; else color->a = 1.0; if (rm != 0) { color->r = (double)(val & rm) / (double)rm; color->g = (double)(val & gm) / (double)gm; color->b = (double)(val & bm) / (double)bm; } else { color->r = 0.0; color->g = 0.0; color->b = 0.0; } XDestroyImage(image); } int eval_diff(char *name, color4d *expected, color4d *test, int x, int y, Bool verbose) { double rscale, gscale, bscale, ascale; double rdiff, gdiff, bdiff, adiff, diff; /* XXX: Need to be provided mask shifts so we can produce useful error * values. */ rscale = 1.0 * (1 << 5); gscale = 1.0 * (1 << 6); bscale = 1.0 * (1 << 5); ascale = 1.0 * 32; rdiff = fabs(test->r - expected->r) * rscale; bdiff = fabs(test->g - expected->g) * gscale; gdiff = fabs(test->b - expected->b) * bscale; adiff = fabs(test->a - expected->a) * ascale; /*rdiff = log2(1.0 + rdiff); gdiff = log2(1.0 + gdiff); bdiff = log2(1.0 + bdiff); adiff = log2(1.0 + adiff);*/ diff = max(max(max(rdiff, gdiff), bdiff), adiff); if (diff > 3.0) { printf("%s test error of %.4f at (%d, %d) --\n" " R G B A\n" "got: %.2f %.2f %.2f %.2f\n" "expected: %.2f %.2f %.2f %.2f\n", name, diff, x, y, test->r, test->g, test->b, test->a, expected->r, expected->g, expected->b, expected->a); return FALSE; } else if (verbose) { printf("%s test succeeded at (%d, %d) with %.4f: " "%.2f %.2f %.2f %.2f\n", name, x, y, diff, expected->r, expected->g, expected->b, expected->a); } return TRUE; } void argb_fill(Display *dpy, picture_info *p, int x, int y, int w, int h, float a, float r, float g, float b) { XRenderColor rendercolor; rendercolor.red = r * 65535; rendercolor.green = g * 65535; rendercolor.blue = b * 65535; rendercolor.alpha = a * 65535; XRenderFillRectangle(dpy, PictOpSrc, p->pict, &rendercolor, x, y, w, h); } #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) /* Create a set of direct format XRenderPictFormats for later use. This lets * us get more formats than just the standard required set, and lets us attach * names to them. */ static void create_formats_list(Display *dpy) { int i; int nformats_allocated = 5; XRenderPictFormat templ; memset(&templ, 0, sizeof(templ)); templ.type = PictTypeDirect; format_list = malloc(sizeof(XRenderPictFormat *) * nformats_allocated); if (format_list == NULL) errx(1, "malloc error"); nformats = 0; argb32index = -1; for (i = 0; ; i++) { char name[20]; int alphabits, redbits; if (nformats + 1 == nformats_allocated) { nformats_allocated *= 2; format_list = realloc(format_list, sizeof(XRenderPictFormat *) * nformats_allocated); if (format_list == NULL) errx(1, "realloc error"); } format_list[nformats] = XRenderFindFormat(dpy, PictFormatType, &templ, i); if (format_list[nformats] == NULL) break; alphabits = bit_count(format_list[nformats]->direct.alphaMask); redbits = bit_count(format_list[nformats]->direct.redMask); /* Our testing code isn't all that hot, so don't bother trying at * the low depths yet. */ if ((redbits >= 1 && redbits <= 4) || (alphabits >= 1 && alphabits <= 4)) { continue; } describe_format(name, 20, format_list[nformats]); if (format_whitelist_len != 0) { Bool ok = FALSE; int j; for (j = 0; j < format_whitelist_len; j++) { if (strcmp(format_whitelist[j], name) == 0) { ok = TRUE; break; } } if (!ok) { printf("Ignoring server-supported format: %s\n", name); continue; } } if (format_list[nformats] == XRenderFindStandardFormat(dpy, PictStandardARGB32)) { argb32index = nformats; } printf("Found server-supported format: %s\n", name); nformats++; } if (argb32index == -1) { errx(1, "required ARGB32 format not found"); } } Bool do_tests(Display *dpy, picture_info *win) { int i, j, src, dst = 0, mask; int num_dests; picture_info *dests, *pictures_1x1, *pictures_10x10, picture_3x3, *pictures_solid; int success_mask = 0, tests_passed = 0, tests_total = 0; int num_tests; create_formats_list(dpy); num_dests = nformats; dests = (picture_info *)malloc(num_dests * sizeof(dests[0])); if (dests == NULL) errx(1, "malloc error"); for (i = 0; i < num_dests; i++) { dests[i].format = format_list[i]; dests[i].d = XCreatePixmap(dpy, RootWindow(dpy, 0), win_width, win_height, dests[i].format->depth); dests[i].pict = XRenderCreatePicture(dpy, dests[i].d, dests[i].format, 0, NULL); dests[i].name = (char *)malloc(20); if (dests[i].name == NULL) errx(1, "malloc error"); describe_format(dests[i].name, 20, dests[i].format); } pictures_1x1 = (picture_info *)malloc(num_colors * nformats * sizeof(picture_info)); if (pictures_1x1 == NULL) errx(1, "malloc error"); for (i = 0; i < num_colors * nformats; i++) { XRenderPictureAttributes pa; color4d *c = &colors[i / nformats]; /* The standard PictFormat numbers go from 0 to 4 */ pictures_1x1[i].format = format_list[i % nformats]; pictures_1x1[i].d = XCreatePixmap(dpy, RootWindow(dpy, 0), 1, 1, pictures_1x1[i].format->depth); pa.repeat = TRUE; pictures_1x1[i].pict = XRenderCreatePicture(dpy, pictures_1x1[i].d, pictures_1x1[i].format, CPRepeat, &pa); pictures_1x1[i].name = (char *)malloc(20); if (pictures_1x1[i].name == NULL) errx(1, "malloc error"); sprintf(pictures_1x1[i].name, "1x1R "); describe_format(pictures_1x1[i].name + strlen(pictures_1x1[i].name), 20 - strlen(pictures_1x1[i].name), pictures_1x1[i].format); argb_fill(dpy, &pictures_1x1[i], 0, 0, 1, 1, c->a, c->r, c->g, c->b); pictures_1x1[i].color = *c; color_correct(&pictures_1x1[i], &pictures_1x1[i].color); } argb32white = &pictures_1x1[0 * nformats + argb32index]; argb32red = &pictures_1x1[1 * nformats + argb32index]; argb32green = &pictures_1x1[2 * nformats + argb32index]; argb32blue = &pictures_1x1[3 * nformats + argb32index]; pictures_10x10 = (picture_info *)malloc(num_colors * nformats * sizeof(picture_info)); if (pictures_10x10 == NULL) errx(1, "malloc error"); for (i = 0; i < num_colors * nformats; i++) { XRenderPictureAttributes pa; color4d *c = &colors[i / nformats]; /* The standard PictFormat numbers go from 0 to 4 */ pictures_10x10[i].format = format_list[i % nformats]; pictures_10x10[i].d = XCreatePixmap(dpy, RootWindow(dpy, 0), 10, 10, pictures_10x10[i].format->depth); pa.repeat = TRUE; pictures_10x10[i].pict = XRenderCreatePicture(dpy, pictures_10x10[i].d, pictures_10x10[i].format, 0, NULL); pictures_10x10[i].name = (char *)malloc(20); if (pictures_10x10[i].name == NULL) errx(1, "malloc error"); sprintf(pictures_10x10[i].name, "10x10 "); describe_format(pictures_10x10[i].name + strlen(pictures_10x10[i].name), 20 - strlen(pictures_10x10[i].name), pictures_10x10[i].format); argb_fill(dpy, &pictures_10x10[i], 0, 0, 10, 10, c->a, c->r, c->g, c->b); pictures_10x10[i].color = *c; color_correct(&pictures_10x10[i], &pictures_10x10[i].color); } picture_3x3.d = XCreatePixmap(dpy, RootWindow(dpy, 0), 3, 3, 32); picture_3x3.format = XRenderFindStandardFormat(dpy, PictStandardARGB32); picture_3x3.pict = XRenderCreatePicture(dpy, picture_3x3.d, picture_3x3.format, 0, NULL); picture_3x3.name = "3x3 sample picture"; for (i = 0; i < 9; i++) { int x = i % 3; int y = i / 3; color4d *c = &colors[i % num_colors]; argb_fill(dpy, &picture_3x3, x, y, 1, 1, c->a, c->r, c->g, c->b); } pictures_solid = malloc(num_colors * sizeof(picture_info)); for (i = 0; i < num_colors; i++) { XRenderColor c; pictures_solid[i].color = colors[i]; c.alpha = (int)(colors[i].a*65535); c.red = (int)(colors[i].r*65535); c.green = (int)(colors[i].g*65535); c.blue = (int)(colors[i].b*65535); pictures_solid[i].pict = XRenderCreateSolidFill(dpy, &c); pictures_solid[i].format = format_list[argb32index]; pictures_solid[i].name = "Solid"; } #define RECORD_RESULTS() \ do { \ group_ok = group_ok && ok; \ if (ok) \ tests_passed++; \ tests_total++; \ } while (0) num_tests = num_colors * nformats; if (enabled_tests & TEST_FILL) { Bool ok, group_ok = TRUE; printf("Beginning testing of filling of 1x1R pictures\n"); for (i = 0; i < num_tests; i++) { ok = fill_test(dpy, win, &pictures_1x1[i]); RECORD_RESULTS(); } printf("Beginning testing of filling of 10x10 pictures\n"); for (i = 0; i < num_tests; i++) { ok = fill_test(dpy, win, &pictures_10x10[i]); RECORD_RESULTS(); } if (group_ok) success_mask |= TEST_FILL; } if (enabled_tests & TEST_DSTCOORDS) { Bool ok, group_ok = TRUE; printf("Beginning dest coords test\n"); for (i = 0; i < 2; i++) { ok = dstcoords_test(dpy, win, i == 0 ? PictOpSrc : PictOpOver, win, argb32white, argb32red); RECORD_RESULTS(); } if (group_ok) success_mask |= TEST_DSTCOORDS; } if (enabled_tests & TEST_SRCCOORDS) { Bool ok, group_ok = TRUE; printf("Beginning src coords test\n"); ok = srccoords_test(dpy, win, argb32white, FALSE); RECORD_RESULTS(); if (group_ok) success_mask |= TEST_SRCCOORDS; } if (enabled_tests & TEST_MASKCOORDS) { Bool ok, group_ok = TRUE; printf("Beginning mask coords test\n"); ok = srccoords_test(dpy, win, argb32white, TRUE); RECORD_RESULTS(); if (group_ok) success_mask |= TEST_MASKCOORDS; } if (enabled_tests & TEST_TSRCCOORDS) { Bool ok, group_ok = TRUE; printf("Beginning transformed src coords test\n"); ok = trans_coords_test(dpy, win, argb32white, FALSE); RECORD_RESULTS(); printf("Beginning transformed src coords test 2\n"); ok = trans_srccoords_test_2(dpy, win, argb32white, FALSE); RECORD_RESULTS(); if (group_ok) success_mask |= TEST_TSRCCOORDS; } if (enabled_tests & TEST_TMASKCOORDS) { Bool ok, group_ok = TRUE; printf("Beginning transformed mask coords test\n"); ok = trans_coords_test(dpy, win, argb32white, TRUE); RECORD_RESULTS(); printf("Beginning transformed mask coords test 2\n"); ok = trans_srccoords_test_2(dpy, win, argb32white, TRUE); RECORD_RESULTS(); if (group_ok) success_mask |= TEST_TMASKCOORDS; } if (enabled_tests & TEST_BLEND) { Bool ok, group_ok = TRUE; for (i = 0; i < num_ops; i++) { if (ops[i].disabled) continue; for (j = 0; j <= num_dests; j++) { picture_info *pi; if (j != num_dests) pi = &dests[j]; else pi = win; printf("Beginning %s blend test on %s\n", ops[i].name, pi->name); for (src = 0; src < num_tests; src++) { for (dst = 0; dst < num_tests; dst++) { ok = blend_test(dpy, win, pi, i, &pictures_1x1[src], &pictures_1x1[dst]); RECORD_RESULTS(); ok = blend_test(dpy, win, pi, i, &pictures_10x10[src], &pictures_1x1[dst]); RECORD_RESULTS(); } } for (src = 0; src < num_colors; src++) { for (dst = 0; dst < num_colors; dst++) { ok = blend_test(dpy, win, pi, i, &pictures_solid[src], &pictures_1x1[dst]); RECORD_RESULTS(); } } } } if (group_ok) success_mask |= TEST_BLEND; } if (enabled_tests & TEST_COMPOSITE) { Bool ok, group_ok = TRUE; for (i = 0; i < num_ops; i++) { if (ops[i].disabled) continue; for (j = 0; j <= num_dests; j++) { picture_info *pi; if (j != num_dests) pi = &dests[j]; else pi = win; printf("Beginning %s composite mask test on %s\n", ops[i].name, pi->name); for (src = 0; src < num_tests; src++) { for (mask = 0; mask < num_tests; mask++) { for (dst = 0; dst < num_tests; dst++) { ok = composite_test(dpy, win, pi, i, &pictures_10x10[src], &pictures_10x10[mask], &pictures_1x1[dst], FALSE, TRUE); RECORD_RESULTS(); ok = composite_test(dpy, win, pi, i, &pictures_1x1[src], &pictures_10x10[mask], &pictures_1x1[dst], FALSE, TRUE); RECORD_RESULTS(); ok = composite_test(dpy, win, pi, i, &pictures_10x10[src], &pictures_1x1[mask], &pictures_1x1[dst], FALSE, TRUE); RECORD_RESULTS(); ok = composite_test(dpy, win, pi, i, &pictures_1x1[src], &pictures_1x1[mask], &pictures_1x1[dst], FALSE, TRUE); RECORD_RESULTS(); } } } } } if (group_ok) success_mask |= TEST_COMPOSITE; } if (enabled_tests & TEST_CACOMPOSITE) { Bool ok, group_ok = TRUE; for (i = 0; i < num_ops; i++) { if (ops[i].disabled) continue; for (j = 0; j <= num_dests; j++) { picture_info *pi; if (j != num_dests) pi = &dests[j]; else pi = win; printf("Beginning %s composite CA mask test on %s\n", ops[i].name, pi->name); for (src = 0; src < num_tests; src++) { for (mask = 0; mask < num_tests; mask++) { for (dst = 0; dst < num_tests; dst++) { ok = composite_test(dpy, win, pi, i, &pictures_10x10[src], &pictures_10x10[mask], &pictures_1x1[dst], TRUE, TRUE); RECORD_RESULTS(); ok = composite_test(dpy, win, pi, i, &pictures_1x1[src], &pictures_10x10[mask], &pictures_1x1[dst], TRUE, TRUE); RECORD_RESULTS(); ok = composite_test(dpy, win, pi, i, &pictures_10x10[src], &pictures_1x1[mask], &pictures_1x1[dst], TRUE, TRUE); RECORD_RESULTS(); ok = composite_test(dpy, win, pi, i, &pictures_1x1[src], &pictures_1x1[mask], &pictures_1x1[dst], TRUE, TRUE); RECORD_RESULTS(); } } } } } if (group_ok) success_mask |= TEST_CACOMPOSITE; } if (enabled_tests & TEST_GRADIENTS) { Bool ok, group_ok = TRUE; printf("Beginning render to linear gradient test\n"); ok = render_to_gradient_test(dpy, &pictures_1x1[0]); RECORD_RESULTS(); for (i = 0; i < num_ops; i++) { if (ops[i].disabled) continue; for (j = 0; j <= num_dests; j++) { picture_info *pi; if (j != num_dests) pi = &dests[j]; else pi = win; printf("Beginning %s linear gradient test on %s\n", ops[i].name, pi->name); for (src = 0; src < num_tests; src++) { ok = linear_gradient_test(dpy, win, pi, i, &pictures_1x1[src]); RECORD_RESULTS(); } } } if (group_ok) success_mask |= TEST_GRADIENTS; } if (enabled_tests & TEST_REPEAT) { Bool ok, group_ok = TRUE; for (i = 0; i < num_ops; i++) { if (ops[i].disabled) continue; for (j = 0; j <= num_dests; j++) { picture_info *pi; if (j != num_dests) pi = &dests[j]; else pi = win; printf("Beginning %s src repeat test on %s\n", ops[i].name, pi->name); /* Test with white dest, and generated repeating src * consisting of colors 1 and 2 (r, g). */ ok = repeat_test(dpy, win, pi, i, argb32white, argb32red, argb32green, FALSE); RECORD_RESULTS(); printf("Beginning %s mask repeat test on %s\n", ops[i].name, pi->name); /* Test with white dest, translucent red src, and generated * repeating mask consisting of colors 1 and 2 (r, g). */ ok = repeat_test(dpy, win, pi, i, argb32white, argb32red, argb32green, TRUE); RECORD_RESULTS(); } } if (group_ok) success_mask |= TEST_REPEAT; } if (enabled_tests & TEST_TRIANGLES) { Bool ok, group_ok = TRUE; for (i = 0; i < num_ops; i++) { if (ops[i].disabled) continue; for (j = 0; j <= num_dests; j++) { picture_info *pi; if (j != num_dests) pi = &dests[j]; else pi = win; printf("Beginning %s Triangles test on %s\n", ops[i].name, pi->name); ok = triangles_test(dpy, win, pi, i, argb32red, argb32white); RECORD_RESULTS(); printf("Beginning %s TriStrip test on %s\n", ops[i].name, pi->name); ok = tristrip_test(dpy, win, pi, i, argb32red, argb32white); RECORD_RESULTS(); printf("Beginning %s TriFan test on %s\n", ops[i].name, pi->name); ok = trifan_test(dpy, win, pi, i, argb32red, argb32white); RECORD_RESULTS(); } } if (group_ok) success_mask |= TEST_TRIANGLES; } if (enabled_tests & TEST_BUG7366) { Bool ok, group_ok = TRUE; ok = bug7366_test(dpy); RECORD_RESULTS(); if (group_ok) success_mask |= TEST_BUG7366; } printf("%d tests passed of %d total\n", tests_passed, tests_total); return tests_passed == tests_total; } /** * \brief copies the contents of a picture to the window. * * This is used in tests so that the user sees flashing colors indicating that * rendercheck is really doing things. The minimalrendering commandline option * indicates that this behavior should be disabled. */ void copy_pict_to_win(Display *dpy, picture_info *pict, picture_info *win, int width, int height) { if (pict == win || minimalrendering) return; XRenderComposite(dpy, PictOpSrc, pict->pict, 0, win->pict, 0, 0, 0, 0, 0, 0, width, height); } x11-apps-7.7+5+nmu1ubuntu1/rendercheck/t_fill.c0000664000000000000000000000322512167023104016061 0ustar /* * Copyright © 2005 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include #include #include "rendercheck.h" /* Test that filling of the 1x1 repeating pictures worked as expected. This is * pretty basic to most of the tests. */ Bool fill_test(Display *dpy, picture_info *win, picture_info *src) { color4d tested; char name[20]; get_pixel(dpy, src, 0, 0, &tested); copy_pict_to_win(dpy, src, win, win_width, win_height); strcpy(name, "fill "); describe_format(name, 20 - strlen(name), src->format); return eval_diff(name, &src->color, &tested, 0, 0, is_verbose); } x11-apps-7.7+5+nmu1ubuntu1/rendercheck/autogen.sh0000775000000000000000000000030412167023104016440 0ustar #! /bin/sh srcdir=`dirname $0` test -z "$srcdir" && srcdir=. ORIGDIR=`pwd` cd $srcdir autoreconf -v --install || exit 1 cd $ORIGDIR || exit $? $srcdir/configure --enable-maintainer-mode "$@" x11-apps-7.7+5+nmu1ubuntu1/rendercheck/t_blend.c0000664000000000000000000000534412167023104016223 0ustar /* * Copyright © 2005 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include #include "rendercheck.h" #define TEST_WIDTH 10 #define TEST_HEIGHT 10 /* Test a composite of a given operation, source, and destination picture. * Fills the window, and samples from the 0,0 pixel corner. */ Bool blend_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *dst_color) { color4d expected, tested, tdst; char testname[20]; int i; for (i = 0; i < pixmap_move_iter; i++) { XRenderComposite(dpy, PictOpSrc, dst_color->pict, 0, dst->pict, 0, 0, 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT); XRenderComposite(dpy, ops[op].op, src_color->pict, 0, dst->pict, 0, 0, 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT); } get_pixel(dpy, dst, 0, 0, &tested); copy_pict_to_win(dpy, dst, win, TEST_WIDTH, TEST_HEIGHT); tdst = dst_color->color; color_correct(dst, &tdst); do_composite(ops[op].op, &src_color->color, NULL, &tdst, &expected, FALSE); color_correct(dst, &expected); snprintf(testname, 20, "%s blend", ops[op].name); if (!eval_diff(testname, &expected, &tested, 0, 0, is_verbose)) { char srcformat[20]; describe_format(srcformat, 20, src_color->format); printf("src color: %.2f %.2f %.2f %.2f (%s)\n" "dst color: %.2f %.2f %.2f %.2f\n", src_color->color.r, src_color->color.g, src_color->color.b, src_color->color.a, srcformat, dst_color->color.r, dst_color->color.g, dst_color->color.b, dst_color->color.a); printf("src: %s, dst: %s\n", src_color->name, dst->name); return FALSE; } else if (is_verbose) { printf("src: %s, dst: %s\n", src_color->name, dst->name); } return TRUE; } x11-apps-7.7+5+nmu1ubuntu1/rendercheck/AUTHORS0000664000000000000000000000011412167023104015506 0ustar Written in 2004 by Eric Anholt. Additional tests contributed by Lars Knoll. x11-apps-7.7+5+nmu1ubuntu1/rendercheck/man/0000775000000000000000000000000012656635743015242 5ustar x11-apps-7.7+5+nmu1ubuntu1/rendercheck/man/rendercheck.man0000664000000000000000000000370012167023104020167 0ustar .ds q \N'34' .TH rendercheck 1 __xorgversion__ .SH NAME rendercheck \- simple tests of the X Render extension. .SH SYNOPSIS .nf .B rendercheck [\-d|\-\-display display] [\-i|\-\-iter] [\-\-sync] \ [\-t|\-\-tests test1,test2,test3,...] [\-o|\-\-ops op1,op2,op3,...] [\-v|\-\-verbose] [\-\-minimalrendering] .fi .SH DESCRIPTION .B rendercheck is a set of simple tests of the X Render extension. It is designed for authors of Render implementations in X Servers. .SH OPTIONS .TP .BI \-d|\-\-display\ display Specifies the display to test against. .TP .BI \-i|\-\-iter\ iterations Specifies the number of times to repeat each operation before sampling results. Some X Servers may behave differently (hardware vs software rendering paths) depending on the previous operations done, so this may be used to influence the server's choices. .TP .BI \-\-sync Enables synchronous xlib operation, for debugging. .TP .BI \-t|\-\-tests\ test1,test2,test3... Enables only a specific subset of the possible tests. Test names include fill, dcoords, scoords, mcoords, tscoords, tmcoords, blend, composite, cacomposite, gradients, repeat, triangles, and bug7366. Names must be separated by commas and have no spaces. .TP .BI \-f|\-\-formats\ format1,format2,format3... Enables only a specific subset of the possible formats. Only formats listed in the server-supported format list are available. Names must be separated by commas and have no spaces. .TP .BI \-o|\-\-ops Enables only a specific subset of the Render operators. .TP .BI \-v|\-\-verbose Enables verbose printing of information on tests run, and successes and failures. .TP .BI \-\-minimalrendering Disables copying of offscreen destinations to the window, which is on by default to provide the user with visual feedback. .SH BUGS Several limitations are documented in the TODO file accompanying the source. Please report any further bugs you find to http://bugs.freedesktop.org/. .SH AUTHORS Eric Anholt, with help from Keith Packard. x11-apps-7.7+5+nmu1ubuntu1/rendercheck/man/Makefile.am0000664000000000000000000000275512167023104017262 0ustar # # Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice (including the next # paragraph) shall be included in all copies or substantial portions of the # Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. # appmandir = $(APP_MAN_DIR) appman_PRE = rendercheck.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/rendercheck/config.sub0000664000000000000000000010437612167023104016435 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. timestamp='2010-09-11' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile-* | tilegx-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; # This must be matched before tile*. tilegx*) basic_machine=tilegx-unknown os=-linux-gnu ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/rendercheck/Makefile.am0000664000000000000000000000110512167023104016473 0ustar SUBDIRS = man bin_PROGRAMS = rendercheck rendercheck_SOURCES = \ main.c \ ops.c \ rendercheck.h \ tests.c \ t_blend.c \ t_bug7366.c \ t_composite.c \ t_dstcoords.c \ t_fill.c \ t_gradient.c \ t_repeat.c \ t_srccoords.c \ t_tsrccoords.c \ t_tsrccoords2.c \ t_triangles.c AM_CFLAGS = $(RC_CFLAGS) $(CWARNFLAGS) rendercheck_LDADD = $(RC_LIBS) MAINTAINERCLEANFILES = ChangeLog INSTALL EXTRA_DIST = \ doc/AddingNewTests \ doc/TODO \ autogen.sh .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/rendercheck/t_repeat.c0000664000000000000000000001131612167023104016413 0ustar /* * Copyright © 2006 Eric Anholt * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Authors: * Eric Anholt * */ #include #include #include "rendercheck.h" /* We choose some sizes larger than win_width/height because AAs like to turn * off repeating when it's unnecessary and we want to make sure that those paths * are sane. */ static const int sizes[] = {1, 2, 4, 8, 10, 16, 20, 32, 64, 100}; /* Sets up a repeating picture at various sizes, with the upper-left corner * filled with a different color than the rest. It tiles this over the whole * destination, then samples the result to see if it tiled appropriately. If * test_mask is set, the repeating picture is used as a component-alpha mask, * with argb32white as the source. */ Bool repeat_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *dst_color, picture_info *c1, picture_info *c2, Bool test_mask) { int wi, hi; Bool failed = FALSE; for (wi = 0; wi < sizeof(sizes) / sizeof(int); wi++) { int w = sizes[wi]; for (hi = 0; hi < sizeof(sizes) / sizeof(int); hi++) { picture_info src; int h = sizes[hi]; int c2w = w / 2; int c2h = h / 2; int x, y, i; char name[40]; color4d tdst, c1expected, c2expected; XRenderPictureAttributes pa; pa.component_alpha = test_mask; pa.repeat = TRUE; src.d = XCreatePixmap(dpy, RootWindow(dpy, 0), w, h, 32); src.format = XRenderFindStandardFormat(dpy, PictStandardARGB32); src.pict = XRenderCreatePicture(dpy, src.d, src.format, CPComponentAlpha | CPRepeat, &pa); src.name = "repeat picture"; /* Fill to the first color */ XRenderComposite(dpy, PictOpSrc, c1->pict, None, src.pict, 0, 0, 0, 0, 0, 0, w, h); /* And set the upper-left to the second color */ XRenderComposite(dpy, PictOpSrc, c2->pict, None, src.pict, 0, 0, 0, 0, 0, 0, c2w, c2h); for (i = 0; i < pixmap_move_iter; i++) { /* Fill to dst_color */ XRenderComposite(dpy, PictOpSrc, dst_color->pict, None, dst->pict, 0, 0, 0, 0, 0, 0, win_width, win_height); /* Composite the repeat picture in. */ if (!test_mask) { XRenderComposite(dpy, ops[op].op, src.pict, None, dst->pict, 0, 0, 0, 0, 0, 0, win_width, win_height); } else { /* Using PictOpSrc, color 0 (white), and * component alpha, the mask color should be * written to the destination. */ XRenderComposite(dpy, ops[op].op, argb32white->pict, src.pict, dst->pict, 0, 0, 0, 0, 0, 0, win_width, win_height); } } copy_pict_to_win(dpy, dst, win, win_width, win_height); tdst = dst_color->color; color_correct(dst, &tdst); if (!test_mask) { do_composite(ops[op].op, &c1->color, NULL, &tdst, &c1expected, FALSE); do_composite(ops[op].op, &c2->color, NULL, &tdst, &c2expected, FALSE); } else { do_composite(ops[op].op, &argb32white->color, &c1->color, &tdst, &c1expected, TRUE); do_composite(ops[op].op, &argb32white->color, &c2->color, &tdst, &c2expected, TRUE); } color_correct(dst, &c1expected); color_correct(dst, &c2expected); snprintf(name, 40, "%dx%d %s %s-repeat", w, h, ops[op].name, test_mask ? "mask" : "src"); for (x = 0; x < win_width; x++) { for (y = 0; y < win_height; y++) { int samplex = x % w; int sampley = y % h; color4d *expected, tested; if (samplex < c2w && sampley < c2h) { expected = &c2expected; } else { expected = &c1expected; } get_pixel(dpy, dst, x, y, &tested); if (!eval_diff(name, expected, &tested, x, y, is_verbose)) failed = TRUE; } } XRenderFreePicture(dpy, src.pict); XFreePixmap(dpy, src.d); } } return !failed; } x11-apps-7.7+5+nmu1ubuntu1/rendercheck/main.c0000664000000000000000000002127712167023104015543 0ustar /* * Copyright © 2004 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include "rendercheck.h" #include #include #include #include extern int num_ops; extern int num_colors; Bool is_verbose = FALSE, minimalrendering = FALSE; int enabled_tests = ~0; /* Enable all tests by default */ int format_whitelist_len = 0; char **format_whitelist; /* Number of times to repeat operations so that pixmaps will tend to get moved * into offscreen memory and allow hardware acceleration. */ int pixmap_move_iter = 1; int win_width = 40; int win_height = 40; int bit_count(int i) { int count; count = (i >> 1) & 033333333333; count = i - count - ((count >> 1) & 033333333333); count = (((count + (count >> 3)) & 030707070707) % 077); /* HAKMEM 169 */ return count; } /* This is not complete, but decent enough for now.*/ void describe_format(char *desc, int len, XRenderPictFormat *format) { char ad[4] = "", rd[4] = "", gd[4] = "", bd[4] = ""; int ac, rc, gc, bc; int ashift; ac = bit_count(format->direct.alphaMask); rc = bit_count(format->direct.redMask); gc = bit_count(format->direct.greenMask); bc = bit_count(format->direct.blueMask); if (ac != 0) { snprintf(ad, 4, "a%d", ac); ashift = format->direct.alpha; } else if (rc + bc + gc < format->depth) { /* There are bits that are not part of A,R,G,B. Mark them with * an x. */ snprintf(ad, 4, "x%d", format->depth - rc - gc - bc); if (format->direct.red == 0 || format->direct.blue == 0) ashift = format->depth; else ashift = 0; } else ashift = 0; if (rc != 0) snprintf(rd, 4, "r%d", rc); if (gc != 0) snprintf(gd, 4, "g%d", gc); if (bc != 0) snprintf(bd, 4, "b%d", bc); if (ashift > format->direct.red) { if (format->direct.red > format->direct.blue) snprintf(desc, len, "%s%s%s%s", ad, rd, gd, bd); else snprintf(desc, len, "%s%s%s%s", ad, bd, gd, rd); } else { if (format->direct.red > format->direct.blue) snprintf(desc, len, "%s%s%s%s", rd, gd, bd, ad); else snprintf(desc, len, "%s%s%s%s", bd, gd, rd, ad); } } static void usage (char *program) { fprintf(stderr, "usage: %s [-d|--display display] [-v|--verbose]\n" "\t[-t test1,test2,...] [-o op1,op2,...] [-f format1,format2,...]\n" "\t[--sync] [--minimalrendering] [--version]\n" "\tAvailable tests: fill,dcoords,scoords,mcoords,tscoords,\n" "\t\ttmcoords,blend,composite,cacomposite,gradients,repeat,triangles,\n" "\t\tbug7366\n", program); exit(1); } int main(int argc, char **argv) { Display *dpy; XEvent ev; int i, o, maj, min; static Bool is_sync = FALSE, print_version = FALSE; XWindowAttributes a; XSetWindowAttributes as; picture_info window; char *display = NULL; char *test, *format, *opname, *nextname; static struct option longopts[] = { { "display", required_argument, NULL, 'd' }, { "iterations", required_argument, NULL, 'i' }, { "formats", required_argument, NULL, 'f' }, { "tests", required_argument, NULL, 't' }, { "ops", required_argument, NULL, 'o' }, { "verbose", no_argument, NULL, 'v' }, { "sync", no_argument, &is_sync, TRUE}, { "minimalrendering", no_argument, &minimalrendering, TRUE}, { "version", no_argument, &print_version, TRUE }, { NULL, 0, NULL, 0 } }; while ((o = getopt_long(argc, argv, "d:i:f:t:o:v", longopts, NULL)) != -1) { switch (o) { case 'd': display = optarg; break; case 'i': pixmap_move_iter = atoi(optarg); break; case 'o': for (i = 0; i < num_ops; i++) ops[i].disabled = TRUE; nextname = optarg; while ((opname = strsep(&nextname, ",")) != NULL) { for (i = 0; i < num_ops; i++) { if (strcasecmp(ops[i].name, opname) != 0) continue; ops[i].disabled = FALSE; break; } if (i == num_ops) usage(argv[0]); } break; case 'f': nextname = optarg; for (format_whitelist_len = 0;;format_whitelist_len++) { if ((format = strsep(&nextname, ",")) == NULL) break; } format_whitelist = malloc(sizeof(char *) * format_whitelist_len); if (format_whitelist == NULL) errx(1, "malloc"); /* Now the list is separated by \0s, so use strlen to * step between entries. */ format = optarg; for (i = 0; i < format_whitelist_len; i++) { format_whitelist[i] = strdup(format); format += strlen(format) + 1; } break; case 't': nextname = optarg; /* disable all tests */ enabled_tests = 0; while ((test = strsep(&nextname, ",")) != NULL) { if (strcmp(test, "fill") == 0) { enabled_tests |= TEST_FILL; } else if (strcmp(test, "dcoords") == 0) { enabled_tests |= TEST_DSTCOORDS; } else if (strcmp(test, "scoords") == 0) { enabled_tests |= TEST_SRCCOORDS; } else if (strcmp(test, "mcoords") == 0) { enabled_tests |= TEST_MASKCOORDS; } else if (strcmp(test, "tscoords") == 0) { enabled_tests |= TEST_TSRCCOORDS; } else if (strcmp(test, "tmcoords") == 0) { enabled_tests |= TEST_TMASKCOORDS; } else if (strcmp(test, "blend") == 0) { enabled_tests |= TEST_BLEND; } else if (strcmp(test, "composite") == 0) { enabled_tests |= TEST_COMPOSITE; } else if (strcmp(test, "cacomposite") == 0) { enabled_tests |= TEST_CACOMPOSITE; } else if (strcmp(test, "gradients") == 0) { enabled_tests |= TEST_GRADIENTS; } else if (strcmp(test, "repeat") == 0) { enabled_tests |= TEST_REPEAT; } else if (strcmp(test, "triangles") == 0) { enabled_tests |= TEST_TRIANGLES; } else if (strcmp(test, "bug7366") == 0) { enabled_tests |= TEST_BUG7366; } else { usage(argv[0]); } } break; case 'v': is_verbose = TRUE; break; case 0: break; default: usage(argv[0]); break; } } /* Print the version string. Bail out if --version was requested and * continue otherwise. */ puts(PACKAGE_STRING); if (print_version) return 0; dpy = XOpenDisplay(display); if (dpy == NULL) errx(1, "Couldn't open display."); if (is_sync) XSynchronize(dpy, 1); if (!XRenderQueryExtension(dpy, &i, &i)) errx(1, "Render extension missing."); XRenderQueryVersion(dpy, &maj, &min); if (maj != 0 || min < 1) errx(1, "Render extension version too low (%d.%d).", maj, min); printf("Render extension version %d.%d\n", maj, min); /* Conjoint/Disjoint were added in version 0.2, so disable those ops if * the server doesn't support them. */ if (min < 2) { printf("Server doesn't support conjoint/disjoint ops, disabling.\n"); num_ops = PictOpSaturate; } window.d = XCreateSimpleWindow(dpy, RootWindow(dpy, 0), 0, 0, win_width, win_height, 0, 0, WhitePixel(dpy, 0)); as.override_redirect = True; XChangeWindowAttributes(dpy, window.d, CWOverrideRedirect, &as); XGetWindowAttributes(dpy, window.d, &a); window.format = XRenderFindVisualFormat(dpy, a.visual); window.pict = XRenderCreatePicture(dpy, window.d, window.format, 0, NULL); window.name = (char *)malloc(20); if (window.name == NULL) errx(1, "malloc error"); describe_format(window.name, 20, window.format); printf("Window format: %s\n", window.name); strncat(window.name, " window", 20); XSelectInput(dpy, window.d, ExposureMask); XMapWindow(dpy, window.d); /* We have to premultiply the alpha into the r, g, b values of the * sample colors. Render colors are premultiplied with alpha, so r,g,b * can never be greater than alpha. */ for (i = 0; i < num_colors; i++) { colors[i].r *= colors[i].a; colors[i].g *= colors[i].a; colors[i].b *= colors[i].a; } while (XNextEvent(dpy, &ev) == 0) { if (ev.type == Expose && !ev.xexpose.count) { if (do_tests(dpy, &window)) exit(0); else exit(1); } } XCloseDisplay(dpy); return 0; } x11-apps-7.7+5+nmu1ubuntu1/rendercheck/rendercheck.h0000664000000000000000000001225112167023104017071 0ustar /* * Copyright © 2004 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include #include #if HAVE_ERR_H # include #else # include # include # include static inline void errx(int eval, const char *fmt, ...) { va_list args; va_start(args, fmt); fprintf(stderr, "Fatal Error: "); fprintf(stderr, fmt, args); fprintf(stderr, "\n", args); va_end(args); exit(eval); } #endif #define min(a, b) (a < b ? a : b) #define max(a, b) (a > b ? a : b) #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif typedef struct _color4d { double r, g, b, a; } color4d; typedef struct _picture_info { Drawable d; Picture pict; XRenderPictFormat *format; char *name; /* Possibly, some descriptive name. */ color4d color; /* If a 1x1R pict, the (corrected) color.*/ } picture_info; struct op_info { int op; char *name; Bool disabled; }; #define TEST_FILL 0x0001 #define TEST_DSTCOORDS 0x0002 #define TEST_SRCCOORDS 0x0004 #define TEST_MASKCOORDS 0x0008 #define TEST_TSRCCOORDS 0x0010 #define TEST_TMASKCOORDS 0x0020 #define TEST_BLEND 0x0040 #define TEST_COMPOSITE 0x0080 #define TEST_CACOMPOSITE 0x0100 #define TEST_GRADIENTS 0x0200 #define TEST_REPEAT 0x0400 #define TEST_TRIANGLES 0x0800 #define TEST_BUG7366 0x1000 extern int pixmap_move_iter; extern int win_width, win_height; extern struct op_info ops[]; extern Bool is_verbose, minimalrendering; extern color4d colors[]; extern int enabled_tests; extern int format_whitelist_len; extern char **format_whitelist; extern picture_info *argb32white, *argb32red, *argb32green, *argb32blue; extern int num_ops; extern int num_colors; /* main.c */ void describe_format(char *desc, int len, XRenderPictFormat *format); int bit_count(int i); /* tests.c */ void color_correct(picture_info *pi, color4d *color); void get_pixel(Display *dpy, picture_info *pi, int x, int y, color4d *color); int eval_diff(char *name, color4d *expected, color4d *test, int x, int y, Bool verbose); void argb_fill(Display *dpy, picture_info *p, int x, int y, int w, int h, float a, float r, float g, float b); Bool do_tests(Display *dpy, picture_info *win); void copy_pict_to_win(Display *dpy, picture_info *pict, picture_info *win, int width, int height); /* ops.c */ void do_composite(int op, color4d *src, color4d *mask, color4d *dst, color4d *result, Bool componentAlpha); /* The tests */ Bool blend_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *dst_color); Bool composite_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *mask_color, picture_info *dst_color, Bool componentAlpha, Bool print_errors); Bool dstcoords_test(Display *dpy, picture_info *win, int op, picture_info *dst, picture_info *bg, picture_info *fg); Bool fill_test(Display *dpy, picture_info *win, picture_info *src); Bool srccoords_test(Display *dpy, picture_info *win, picture_info *white, Bool test_mask); Bool trans_coords_test(Display *dpy, picture_info *win, picture_info *white, Bool test_mask); Bool trans_srccoords_test_2(Display *dpy, picture_info *win, picture_info *white, Bool test_mask); Bool render_to_gradient_test(Display *dpy, picture_info *src); Bool linear_gradient_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *dst_color); Bool repeat_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *dst_color, picture_info *c1, picture_info *c2, Bool test_mask); Bool linear_gradient_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *dst_color); Bool triangles_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *dst_color); Bool tristrip_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *dst_color); Bool trifan_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *dst_color); Bool bug7366_test(Display *dpy); x11-apps-7.7+5+nmu1ubuntu1/rendercheck/configure.ac0000664000000000000000000000150012167023104016724 0ustar # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.60) AC_INIT([rendercheck], [1.4], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [rendercheck]) AC_CONFIG_SRCDIR([Makefile.am]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([err.h]) # Checks for pkg-config packages PKG_CHECK_MODULES(RC, [xrender x11]) AC_CONFIG_FILES([Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/rendercheck/README0000664000000000000000000000101612167023104015320 0ustar rendercheck is a program to test a Render extension implementation against separate calculations of expected output. Tests currently include: - Destination coordinates correctness - Source coordinates correctness - Transformed (FilterNearest) source coordinates correctness. - Composite with and without mask (with/without component alpha), with 1x1 repeating Pictures and 10x10 Pictures. - Linear gradients - Repeating sources/masks at POT and non-POT sizes - Some regression tests for bugs from freedesktop.org bugzilla. x11-apps-7.7+5+nmu1ubuntu1/rendercheck/COPYING0000664000000000000000000000207512167023104015501 0ustar Copyright 2004 Eric Anholt Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Eric Anholt not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Eric Anholt makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. x11-apps-7.7+5+nmu1ubuntu1/rendercheck/INSTALL0000664000000000000000000002622212167023104015477 0ustar Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 6. Often, you can also type `make uninstall' to remove the installed files again. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *Note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xcalc/0000775000000000000000000000000012656635743013304 5ustar x11-apps-7.7+5+nmu1ubuntu1/xcalc/xcalc.c0000664000000000000000000002552712457363403014543 0ustar /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * xcalc.c - a hand calculator for the X Window system * * Original Author: John H. Bradley, University of Pennsylvania * (bradley@cis.upenn.edu) March, 1987 * RPN mode added and port to X11 by Mark Rosenstein, MIT Project Athena * Rewritten to be an Xaw and Xt client by Donna Converse, MIT X Consortium */ #include #include #include #include #include #include #include #include #include #include #include #include #include "xcalc.h" static Boolean convert(Widget w, Atom *selection, Atom *target, Atom *type, XtPointer *value, unsigned long *length, int *format); static void create_keypad(Widget parent); static void create_display(Widget parent); static void create_calculator(Widget shell); static void done(Widget w, Atom *selection, Atom *target); static void lose(Widget w, Atom *selection); static void Syntax(int argc, char **argv); /* * global data */ int rpn = 0; /* Reverse Polish Notation (HP mode) flag */ char dispstr[LCD_STR_LEN]; /* string to show up in the LCD */ Atom wm_delete_window; /* see ICCCM section 5.2.2 */ /* * local data */ static Display *dpy = NULL; /* connection to the X server */ static Widget toplevel=NULL; /* top level shell widget */ static Widget calculator=NULL; /* an underlying form widget */ static Widget LCD = NULL; /* liquid crystal display */ static Widget ind[6]; /* mode indicators in the screen */ static char selstr[LCD_STR_LEN]; /* storage for selections from the LCD */ /* checkerboard used in mono mode */ static XtAppContext xtcontext; /* Toolkit application context */ #define check_width 16 #define check_height 16 static unsigned char check_bits[] = { 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa}; /* command line options specific to the application */ static XrmOptionDescRec Options[] = { {"-rpn", "rpn", XrmoptionNoArg, (XtPointer)"on"}, {"-stipple", "stipple", XrmoptionNoArg, (XtPointer)"on"} }; /* resources specific to the application */ static struct resources { Boolean rpn; /* reverse polish notation (HP mode) */ Boolean stipple; /* background stipple */ Cursor cursor; } appResources; #define offset(field) XtOffsetOf(struct resources, field) static XtResource Resources[] = { {"rpn", "Rpn", XtRBoolean, sizeof(Boolean), offset(rpn), XtRImmediate, (XtPointer) False}, {"stipple", "Stipple", XtRBoolean, sizeof(Boolean), offset(stipple), XtRImmediate, (XtPointer) False}, {"cursor", "Cursor", XtRCursor, sizeof(Cursor), offset(cursor), XtRCursor, (XtPointer)NULL} }; #undef offset int main(int argc, char **argv) { Arg args[3]; XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); toplevel = XtAppInitialize(&xtcontext, "XCalc", Options, XtNumber(Options), &argc, argv, NULL, NULL, 0); if (argc != 1) Syntax(argc, argv); XtSetArg(args[0], XtNinput, True); XtSetValues(toplevel, args, ONE); XtGetApplicationResources(toplevel, (XtPointer)&appResources, Resources, XtNumber(Resources), (ArgList) NULL, ZERO); create_calculator(toplevel); XtAppAddActions(xtcontext, Actions, ActionsCount); XtOverrideTranslations(toplevel, XtParseTranslationTable("WM_PROTOCOLS: quit()\n")); XtRealizeWidget(toplevel); dpy = XtDisplay(toplevel); wm_delete_window = XInternAtom(dpy, "WM_DELETE_WINDOW", False); (void) XSetWMProtocols(dpy, XtWindow(toplevel), &wm_delete_window, 1); XDefineCursor(dpy, XtWindow(toplevel), appResources.cursor); if (appResources.stipple || (CellsOfScreen(XtScreen(toplevel)) <= 2)) { Screen *screen = XtScreen(toplevel); Pixmap backgroundPix; backgroundPix = XCreatePixmapFromBitmapData (dpy, XtWindow(toplevel), (char *)check_bits, check_width, check_height, WhitePixelOfScreen(screen), BlackPixelOfScreen(screen), DefaultDepthOfScreen(screen)); XtSetArg(args[0], XtNbackgroundPixmap, backgroundPix); XtSetValues(calculator, args, ONE); } #ifndef IEEE signal(SIGFPE,fperr); signal(SIGILL,illerr); #endif ResetCalc(); XtAppMainLoop(xtcontext); return 0; } static void create_calculator(Widget shell) { rpn = appResources.rpn; calculator = XtCreateManagedWidget(rpn ? "hp" : "ti", formWidgetClass, shell, (ArgList) NULL, ZERO); create_display(calculator); create_keypad(calculator); XtSetKeyboardFocus(calculator, LCD); } /* * Do the calculator data display widgets. */ static void create_display(Widget parent) { Widget bevel, screen; static Arg args[] = { {XtNborderWidth, (XtArgVal)0}, {XtNjustify, (XtArgVal)XtJustifyRight} }; /* the frame surrounding the calculator display */ bevel = XtCreateManagedWidget("bevel", formWidgetClass, parent, (ArgList) NULL, ZERO); /* the screen of the calculator */ screen = XtCreateManagedWidget("screen", formWidgetClass, bevel, (ArgList) NULL, ZERO); /* M - the memory indicator */ ind[XCalc_MEMORY] = XtCreateManagedWidget("M", labelWidgetClass, screen, args, XtNumber(args)); /* liquid crystal display */ LCD = XtCreateManagedWidget("LCD", toggleWidgetClass, screen, args, XtNumber(args)); /* INV - the inverse function indicator */ ind[XCalc_INVERSE] = XtCreateManagedWidget("INV", labelWidgetClass, screen, args, XtNumber(args)); /* DEG - the degrees switch indicator */ ind[XCalc_DEGREE] = XtCreateManagedWidget("DEG", labelWidgetClass, screen, args, XtNumber(args)); /* RAD - the radian switch indicator */ ind[XCalc_RADIAN] = XtCreateManagedWidget("RAD", labelWidgetClass, screen, args, XtNumber(args)); /* GRAD - the grad switch indicator */ ind[XCalc_GRADAM] = XtCreateManagedWidget("GRAD", labelWidgetClass, screen, args, XtNumber(args)); /* () - the parenthesis indicator */ ind[XCalc_PAREN] = XtCreateManagedWidget("P", labelWidgetClass, screen, args, XtNumber(args)); } /* * Do all the buttons. The application defaults file will give the * default button placement, default button labels, and default * actions connected to the buttons. The user can change any of * these defaults in an environment-specific resource file. */ static void create_keypad(Widget parent) { static const char *Keyboard[] = { "button1", "button2", "button3", "button4", "button5", "button6", "button7", "button8", "button9", "button10", "button11","button12","button13","button14","button15", "button16","button17","button18","button19","button20", "button21","button22","button23","button24","button25", "button26","button27","button28","button29","button30", "button31","button32","button33","button34","button35", "button36","button37","button38","button39","button40" }; register int i; int n = XtNumber(Keyboard); if (appResources.rpn) n--; /* HP has 39 buttons, TI has 40 */ for (i=0; i < n; i++) XtCreateManagedWidget(Keyboard[i], commandWidgetClass, parent, (ArgList) NULL, ZERO); } /* * Miscellaneous utility routines that interact with the widgets. */ /* * called by math routines to write to the liquid crystal display. */ void draw(char *string) { Arg args[1]; XtSetArg(args[0], XtNlabel, string); XtSetValues(LCD, args, ONE); } /* * called by math routines to turn on and off the display indicators. */ void setflag(int indicator, Boolean on) { if (on) XtMapWidget(ind[indicator]); else XtUnmapWidget(ind[indicator]); } /* * ring the bell. */ void ringbell(void) { XBell(dpy, 0); } /* * die. */ void Quit(void) { XtDestroyApplicationContext(xtcontext); exit(0); } /* * recite and die. */ static void Syntax(int argc, char **argv) { register int i; (void) fprintf(stderr, "%s: unknown options:", argv[0]); for (i=1; i #include #include "xcalc.h" #ifndef IEEE #define XCALC_PRE_OP(keynum) { if (pre_op(keynum)) return; \ if (setjmp (env)) {fail_op(); return;}} #else #define XCALC_PRE_OP(keynum) if (pre_op(keynum)) return; #endif static void add(Widget w, XEvent *ev, String *vector, Cardinal *count); static void back(Widget w, XEvent *ev, String *vector, Cardinal *count); static void bell(Widget w, XEvent *ev, String *vector, Cardinal *count); static void clearit(Widget w, XEvent *ev, String *vector, Cardinal *count); static void cosine(Widget w, XEvent *ev, String *vector, Cardinal *count); static void decimal(Widget w, XEvent *ev, String *vector, Cardinal *count); static void degree(Widget w, XEvent *ev, String *vector, Cardinal *count); static void digit(Widget w, XEvent *ev, String *vector, Cardinal *count); static void divide(Widget w, XEvent *ev, String *vector, Cardinal *count); static void e(Widget w, XEvent *ev, String *vector, Cardinal *count); static void enter(Widget w, XEvent *ev, String *vector, Cardinal *count); static void epower(Widget w, XEvent *ev, String *vector, Cardinal *count); static void equal(Widget w, XEvent *ev, String *vector, Cardinal *count); static void exchange(Widget w, XEvent *ev, String *vector, Cardinal *count); static void factorial(Widget w, XEvent *ev, String *vector, Cardinal *count); static void inverse(Widget w, XEvent *ev, String *vector, Cardinal *count); static void leftParen(Widget w, XEvent *ev, String *vector, Cardinal *count); static void logarithm(Widget w, XEvent *ev, String *vector, Cardinal *count); static void multiply(Widget w, XEvent *ev, String *vector, Cardinal *count); static void naturalLog(Widget w, XEvent *ev, String *vector, Cardinal *count); static void negate(Widget w, XEvent *ev, String *vector, Cardinal *count); static void nop(Widget w, XEvent *ev, String *vector, Cardinal *count); static void off(Widget w, XEvent *ev, String *vector, Cardinal *count); static void pi(Widget w, XEvent *ev, String *vector, Cardinal *count); static void power(Widget w, XEvent *ev, String *vector, Cardinal *count); static void quit(Widget w, XEvent *ev, String *vector, Cardinal *count); static void recall(Widget w, XEvent *ev, String *vector, Cardinal *count); static void reciprocal(Widget w, XEvent *ev, String *vector, Cardinal *count); static void rightParen(Widget w, XEvent *ev, String *vector, Cardinal *count); static void roll(Widget w, XEvent *ev, String *vector, Cardinal *count); static void scientific(Widget w, XEvent *ev, String *vector, Cardinal *count); static void selection(Widget w, XEvent *ev, String *vector, Cardinal *count); static void sine(Widget w, XEvent *ev, String *vector, Cardinal *count); static void square(Widget w, XEvent *ev, String *vector, Cardinal *count); static void squareRoot(Widget w, XEvent *ev, String *vector, Cardinal *count); static void store(Widget w, XEvent *ev, String *vector, Cardinal *count); static void subtract(Widget w, XEvent *ev, String *vector, Cardinal *count); static void sum(Widget w, XEvent *ev, String *vector, Cardinal *count); static void tangent(Widget w, XEvent *ev, String *vector, Cardinal *count); static void tenpower(Widget w, XEvent *ev, String *vector, Cardinal *count); static void XexchangeY(Widget w, XEvent *ev, String *vector, Cardinal *count); /* * calculator action table */ XtActionsRec Actions[] = { {"add", add}, /* addition */ {"back", back}, /* HP-specific backspace */ {"bell", bell}, /* ring bell */ {"clear", clearit}, /* TI-specific clear calculator state */ {"cosine", cosine}, /* trigonometric function cosine */ {"decimal", decimal}, /* decimal point */ {"degree", degree}, /* degree, radian, grad switch */ {"digit", digit}, /* numeric key */ {"divide", divide}, /* division */ {"e", e}, /* the natural number e */ {"enter", enter}, /* HP-specific enter */ {"epower", epower}, /* e raised to a power */ {"equal", equal}, /* TI-specific = */ {"exchange", exchange}, /* TI-specific exchange memory and display */ {"factorial", factorial}, /* factorial function */ {"inverse", inverse}, /* inverse */ {"leftParen", leftParen}, /* TI-specific left parenthesis */ {"logarithm", logarithm}, /* logarithm base 10 */ {"multiply", multiply}, /* multiplication */ {"naturalLog", naturalLog}, /* natural logarithm base e */ {"negate", negate}, /* change sign */ {"nop", nop}, /* no operation, rings bell */ {"off", off}, /* clear state */ {"pi", pi}, /* the number pi */ {"power", power}, /* raise to an arbitrary power */ {"quit", quit}, /* quit */ {"recall", recall}, /* memory recall */ {"reciprocal", reciprocal}, /* reciprocal function */ {"rightParen", rightParen}, /* TI-specific left parenthesis */ {"roll", roll}, /* HP-specific roll stack */ {"scientific", scientific}, /* scientfic notation (EE) */ {"selection", selection}, /* copy selection */ {"sine", sine}, /* trigonometric function sine */ {"square", square}, /* square */ {"squareRoot", squareRoot}, /* square root */ {"store", store}, /* memory store */ {"subtract", subtract}, /* subtraction */ {"sum", sum}, /* memory summation */ {"tangent", tangent}, /* trigonometric function tangent */ {"tenpower", tenpower}, /* 10 raised to to an arbitrary power */ {"XexchangeY", XexchangeY} /* HP-specific exchange X and Y registers */ }; int ActionsCount = XtNumber(Actions); /*ARGSUSED*/ static void add(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kADD); rpn ? twof(kADD) : twoop(kADD); post_op(); } /*ARGSUSED*/ static void back(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kBKSP); bkspf(); post_op(); } /*ARGSUSED*/ static void bell(Widget w, XEvent *ev, String *vector, Cardinal *count) { ringbell(); } /*ARGSUSED*/ static void clearit(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kCLR); clearf(); post_op(); } /*ARGSUSED*/ static void cosine(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kCOS); oneop(kCOS); post_op(); } /*ARGSUSED*/ static void decimal(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kDEC); decf(); post_op(); } /*ARGSUSED*/ static void degree(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kDRG); drgf(); post_op(); } /*ARGSUSED*/ static void digit(Widget w, XEvent *ev, String *vector, Cardinal *count) { switch (vector[0][0]) { case '1': XCALC_PRE_OP(kONE); numeric(kONE); break; case '2': XCALC_PRE_OP(kTWO); numeric(kTWO); break; case '3': XCALC_PRE_OP(kTHREE); numeric(kTHREE); break; case '4': XCALC_PRE_OP(kFOUR); numeric(kFOUR); break; case '5': XCALC_PRE_OP(kFIVE); numeric(kFIVE); break; case '6': XCALC_PRE_OP(kSIX); numeric(kSIX); break; case '7': XCALC_PRE_OP(kSEVEN); numeric(kSEVEN); break; case '8': XCALC_PRE_OP(kEIGHT); numeric(kEIGHT); break; case '9': XCALC_PRE_OP(kNINE); numeric(kNINE); break; case '0': XCALC_PRE_OP(kZERO); numeric(kZERO); break; } post_op(); } /*ARGSUSED*/ static void divide(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kDIV); rpn ? twof(kDIV) : twoop(kDIV); post_op(); } /*ARGSUSED*/ static void e(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kE); oneop(kE); post_op(); } /*ARGSUSED*/ static void enter(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kENTR); entrf(); post_op(); } /*ARGSUSED*/ static void epower(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kEXP); oneop(kEXP); post_op(); } /*ARGSUSED*/ static void equal(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kEQU); equf(); post_op(); } /*ARGSUSED*/ static void exchange(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kEXC); oneop(kEXC); post_op(); } /*ARGSUSED*/ static void factorial(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kFACT); oneop(kFACT); post_op(); } /*ARGSUSED*/ static void inverse(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kINV); invf(); post_op(); } /*ARGSUSED*/ static void leftParen(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kLPAR); lparf(); post_op(); } /*ARGSUSED*/ static void logarithm(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kLOG); oneop(kLOG); post_op(); } /*ARGSUSED*/ static void multiply(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kMUL); rpn ? twof(kMUL) : twoop(kMUL); post_op(); } /*ARGSUSED*/ static void naturalLog(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kLN); oneop(kLN); post_op(); } /*ARGSUSED*/ static void negate(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kNEG); negf(); post_op(); } /*ARGSUSED*/ static void nop(Widget w, XEvent *ev, String *vector, Cardinal *count) { ringbell(); } /*ARGSUSED*/ static void off(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kOFF); offf(); post_op(); } /*ARGSUSED*/ static void pi(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kPI); oneop(kPI); post_op(); } /*ARGSUSED*/ static void power(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kPOW); rpn ? twof(kPOW) : twoop(kPOW); post_op(); } /*ARGSUSED*/ static void quit(Widget w, XEvent *ev, String *vector, Cardinal *count) { if (ev->type == ClientMessage && ev->xclient.data.l[0] != wm_delete_window) ringbell(); else Quit(); } /*ARGSUSED*/ static void recall(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kRCL); rpn ? memf(kRCL) : oneop(kRCL); post_op(); } /*ARGSUSED*/ static void reciprocal(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kRECIP); oneop(kRECIP); post_op(); } /*ARGSUSED*/ static void rightParen(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kRPAR); rparf(); post_op(); } /*ARGSUSED*/ static void roll(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kROLL); rollf(); post_op(); } /*ARGSUSED*/ static void scientific(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kEE); eef(); post_op(); } /*ARGSUSED*/ static void selection(Widget w, XEvent *ev, String *vector, Cardinal *count) { do_select(((XButtonReleasedEvent *)ev)->time); } /*ARGSUSED*/ static void sine(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kSIN); oneop(kSIN); post_op(); } /*ARGSUSED*/ static void square(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kSQR); oneop(kSQR); post_op(); } /*ARGSUSED*/ static void squareRoot(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kSQRT); oneop(kSQRT); post_op(); } /*ARGSUSED*/ static void store(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kSTO); rpn ? memf(kSTO) : oneop(kSTO); post_op(); } /*ARGSUSED*/ static void subtract(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kSUB); rpn ? twof(kSUB) : twoop(kSUB); post_op(); } /*ARGSUSED*/ static void sum(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kSUM); rpn ? memf(kSUM) : oneop(kSUM); post_op(); } /*ARGSUSED*/ static void tangent(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kTAN); oneop(kTAN); post_op(); } /*ARGSUSED*/ static void tenpower(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(k10X); oneop(k10X); post_op(); } /*ARGSUSED*/ static void XexchangeY(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kXXY); twof(kXXY); post_op(); } x11-apps-7.7+5+nmu1ubuntu1/xcalc/xcalc.h0000664000000000000000000001112512457363403014535 0ustar /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * xcalc.h - symbolic constants for xcalc * * Author: Donna Converse, MIT X Consortium */ #ifndef _XCALC_H_ #define _XCALC_H_ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #if !defined(IEEE) && defined(SVR4) #include #endif #include #include #include #define kRECIP 0 /* reciprocal */ #define kSQR 1 /* square */ #define kSQRT 2 /* square root */ #define kCLR 3 /* clear */ #define kOFF 4 /* clear and quit */ #define kINV 5 /* inverse */ #define kSIN 6 /* sine */ #define kCOS 7 /* cosine */ #define kTAN 8 /* tangent */ #define kDRG 9 /* degree radian grad */ #define kE 10 /* the natural number e */ #define kEE 11 /* scientific notation */ #define kLOG 12 /* logarithm */ #define kLN 13 /* natural logarithm */ #define kPOW 14 /* power */ #define kPI 15 /* pi */ #define kFACT 16 /* factorial */ #define kLPAR 17 /* left paren */ #define kRPAR 18 /* right paren */ #define kDIV 19 /* division */ #define kSTO 20 /* store */ #define kSEVEN 21 /* 7 */ #define kEIGHT 22 /* 8 */ #define kNINE 23 /* 9 */ #define kMUL 24 /* multiplication */ #define kRCL 25 /* recall */ #define kFOUR 26 /* 4 */ #define kFIVE 27 /* 5 */ #define kSIX 28 /* 6 */ #define kSUB 29 /* subtraction */ #define kSUM 30 /* summation */ #define kONE 31 /* 1 */ #define kTWO 32 /* 2 */ #define kTHREE 33 /* 3 */ #define kADD 34 /* addition */ #define kEXC 35 /* exchange display and memory */ #define kZERO 36 /* 0 */ #define kDEC 37 /* decimal point */ #define kNEG 38 /* negation */ #define kEQU 39 /* equals */ #define kENTR 40 /* enter */ #define kXXY 41 /* exchange X and Y registers */ #define kEXP 42 /* exponent */ #define k10X 43 /* 10 raised to a power */ #define kROLL 44 /* roll stack */ #define kNOP 45 /* no operation */ #define kBKSP 46 /* backspace */ #define XCalc_MEMORY 0 /* memory indicator */ #define XCalc_INVERSE 1 /* inverse function indicator */ #define XCalc_DEGREE 2 /* degree indicator */ #define XCalc_RADIAN 3 /* radian indicator */ #define XCalc_GRADAM 4 /* grad indicator */ #define XCalc_PAREN 5 /* parenthesis indicator */ /* actions.c */ extern XtActionsRec Actions[]; extern int ActionsCount; /* math.c */ extern void fperr(int sig) _X_NORETURN; extern void illerr(int sig) _X_NORETURN; extern void fail_op(void); extern int pre_op(int keynum); extern void post_op(void); extern void numeric(int keynum); extern void bkspf(void); extern void decf(void); extern void eef(void); extern void clearf(void); extern void negf(void); extern void twoop(int keynum); extern void twof(int keynum); extern void entrf(void); extern void equf(void); extern void lparf(void); extern void rollf(void); extern void rparf(void); extern void drgf(void); extern void invf(void); extern void memf(int keynum); extern void oneop(int keynum); extern void offf(void); extern void ResetCalc(void); #ifndef IEEE extern jmp_buf env; #endif /* xcalc.c */ extern void do_select(Time time); extern void draw(char *string); extern void Quit(void) _X_NORETURN; extern void ringbell(void); extern void setflag(int indicator, Boolean on); extern int rpn; #define LCD_STR_LEN 32 extern char dispstr[LCD_STR_LEN]; extern Atom wm_delete_window; #endif x11-apps-7.7+5+nmu1ubuntu1/xcalc/compile0000755000000000000000000001624512656634627014670 0ustar #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xcalc/app-defaults/0000775000000000000000000000000012520516632015652 5ustar x11-apps-7.7+5+nmu1ubuntu1/xcalc/app-defaults/XCalc-color0000664000000000000000000002412512457363403017714 0ustar #include "XCalc" XCalc*ti.backgroundPixmap: gray3?foreground=gray70&background=gray85 XCalc*.bevel.background: gray80 XCalc*.bevel.displayList: foreground gray90;lines -1,0,0,0,0,-1;lines 3,-4,-4,-4,-4,3 XCalc*.bevel.borderColor: gray60 XCalc*.bevel.borderWidth: 1 XCalc*.bevel.vertDistance: 4 XCalc*.bevel.defaultDistance: 4 XCalc*.bevel.screen.vertDistance: 4 XCalc*.bevel.screen.horizDistance: 4 XCalc*.bevel.screen*left: chainLeft XCalc*.bevel.screen*right: chainRight XCalc*.bevel.screen*top: chainTop XCalc*.bevel.screen*bottom: chainBottom XCalc*.bevel.screen*background: rgb:9/a/9 XCalc*.bevel.screen.borderColor: gray50 XCalc*.bevel.screen*LCD.foreground: gray20 XCalc*.bevel.screen*INV.vertDistance: 2 ! T e x a s I n s t r u m e n t s T I - 3 0 XCalc*ti.Command.shapeStyle: roundedRectangle XCalc*ti.Command.displayList: foreground rgb:a/b/c;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.Command.borderColor: rgb:8/9/a XCalc*ti.Command.background: rgb:c/d/e XCalc*ti.Command.foreground: gray5 XCalc*ti.button20.foreground: gray5 XCalc*ti.button20.background: rgb:e/d/c XCalc*ti.button20.displayList: foreground rgb:a/9/8;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button20.borderColor: rgb:9/8/7 XCalc*ti.button25.foreground: gray5 XCalc*ti.button25.background: rgb:e/d/c XCalc*ti.button25.displayList: foreground rgb:a/9/8;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button25.borderColor: rgb:9/8/7 XCalc*ti.button30.foreground: gray5 XCalc*ti.button30.background: rgb:e/d/c XCalc*ti.button30.displayList: foreground rgb:a/9/8;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button30.borderColor: rgb:9/8/7 XCalc*ti.button35.foreground: gray5 XCalc*ti.button35.background: rgb:e/d/c XCalc*ti.button35.displayList: foreground rgb:a/9/8;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button35.borderColor: rgb:9/8/7 XCalc*ti.button40.foreground: gray5 XCalc*ti.button40.background: rgb:e/d/c XCalc*ti.button40.displayList: foreground rgb:a/9/8;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button40.borderColor: rgb:9/8/7 XCalc*ti.button22.background: gray95 XCalc*ti.button22.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button22.borderColor: gray65 XCalc*ti.button23.background: gray95 XCalc*ti.button23.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button23.borderColor: gray65 XCalc*ti.button24.background: gray95 XCalc*ti.button24.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button24.borderColor: gray65 XCalc*ti.button27.background: gray95 XCalc*ti.button27.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button27.borderColor: gray65 XCalc*ti.button28.background: gray95 XCalc*ti.button28.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button28.borderColor: gray65 XCalc*ti.button29.background: gray95 XCalc*ti.button29.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button29.borderColor: gray65 XCalc*ti.button32.background: gray95 XCalc*ti.button32.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button32.borderColor: gray65 XCalc*ti.button33.background: gray95 XCalc*ti.button33.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button33.borderColor: gray65 XCalc*ti.button34.background: gray95 XCalc*ti.button34.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button34.borderColor: gray65 XCalc*ti.button37.background: gray95 XCalc*ti.button37.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button37.borderColor: gray65 XCalc*ti.button38.background: gray95 XCalc*ti.button38.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button38.borderColor: gray65 XCalc*ti.button39.background: gray95 XCalc*ti.button39.displayList: foreground gray75;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 XCalc*ti.button39.borderColor: gray65 ! H e w l e t t - P a c k a r d 1 0 C XCalc*hp.Command.shapeStyle: roundedRectangle XCalc*hp.background: wheat XCalc*hp.Command.background: peru XCalc*hp.Command.foreground: white ! Unused buttons. (Make invisible.) XCalc*hp.button21.background: wheat XCalc*hp.button22.background: wheat ! ON button XCalc*hp.button31.background: goldenrod XCalc*hp.button31.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 !XCalc*hp.button31.foreground: white ! SQRT XCalc*hp.button1.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! e^x XCalc*hp.button2.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! 10^x XCalc*hp.button3.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! y^x XCalc*hp.button4.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! 1/c XCalc*hp.button5.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! CHS XCalc*hp.button6.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! x! XCalc*hp.button11.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! pi XCalc*hp.button12.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! sin XCalc*hp.button13.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! cos XCalc*hp.button14.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! tan XCalc*hp.button15.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! EEX XCalc*hp.button16.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! Rv XCalc*hp.button23.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! x:y XCalc*hp.button24.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! <- XCalc*hp.button25.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! ENTER XCalc*hp.button26.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! DRG XCalc*hp.button32.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! INV XCalc*hp.button33.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! STO XCalc*hp.button34.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 !RCL XCalc*hp.button35.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! "Operator" keys. ! Divide key XCalc*hp.button10.background: SteelBlue XCalc*hp.button10.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! Multiply key XCalc*hp.button20.background: SteelBlue XCalc*hp.button20.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! Minus key XCalc*hp.button30.background: SteelBlue XCalc*hp.button30.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! SUM XCalc*hp.button38.background: SteelBlue XCalc*hp.button38.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! Plus key XCalc*hp.button39.background: SteelBlue XCalc*hp.button39.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! "Number" keys. ! "7" XCalc*hp.button7.background: white XCalc*hp.button7.foreground: black XCalc*hp.button7.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! "8" XCalc*hp.button8.background: white XCalc*hp.button8.foreground: black XCalc*hp.button8.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! "9" XCalc*hp.button9.background: white XCalc*hp.button9.foreground: black XCalc*hp.button9.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! "4" XCalc*hp.button17.background: white XCalc*hp.button17.foreground: black XCalc*hp.button17.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! "5" XCalc*hp.button18.background: white XCalc*hp.button18.foreground: black XCalc*hp.button18.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! "6" XCalc*hp.button19.background: white XCalc*hp.button19.foreground: black XCalc*hp.button19.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! "1" XCalc*hp.button27.background: white XCalc*hp.button27.foreground: black XCalc*hp.button27.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! "2" XCalc*hp.button28.background: white XCalc*hp.button28.foreground: black XCalc*hp.button28.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! "3" XCalc*hp.button29.background: white XCalc*hp.button29.foreground: black XCalc*hp.button29.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! "0" XCalc*hp.button36.background: white XCalc*hp.button36.foreground: black XCalc*hp.button36.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 ! "." XCalc*hp.button37.background: white XCalc*hp.button37.foreground: black XCalc*hp.button37.displayList: foreground rgb:b/b/b;segments 8,-4,-9,-4,-4,-9,-4,8;draw-arc -14,-14,-4,-4,270,90 x11-apps-7.7+5+nmu1ubuntu1/xcalc/app-defaults/XCalc0000664000000000000000000004557712457363403016616 0ustar ! XCalc application class resource file XCalc.Title: Calculator XCalc.IconName: Calc XCalc.IconPixmap: calculator XCalc*Cursor: hand2 XCalc*Font: 8x13 XCalc*ShapeStyle: rectangle XCalc*Command.horizDistance: 2 XCalc*Command.vertDistance: 2 XCalc*Command.width: 40 XCalc*Command.height: 26 XCalc*Command.internalWidth: 1 XCalc*bevel.background: black XCalc*bevel.horizDistance: 4 XCalc*bevel.vertDistance: 2 XCalc*bevel.screen.horizDistance: 6 XCalc*bevel.screen.vertDistance: 2 XCalc*bevel.screen.defaultDistance: 0 XCalc*bevel.screen.Label.horizDistance: 4 XCalc*bevel.screen.Label.vertDistance: 2 XCalc*bevel.screen.Label.internalHeight: 1 XCalc*bevel.screen.Label.internalWidth: 1 XCalc*bevel.screen.LCD.label: 88888888888 XCalc*bevel.screen.LCD.fromHoriz: M XCalc*bevel.screen.LCD.horizDistance: 4 XCalc*bevel.screen.LCD.vertDistance: 2 XCalc*bevel.screen.INV.fromVert: LCD XCalc*bevel.screen.INV.vertDistance: 4 XCalc*bevel.screen.DEG.fromHoriz: INV XCalc*bevel.screen.DEG.fromVert: LCD XCalc*bevel.screen.DEG.horizDistance: 1 XCalc*bevel.screen.RAD.fromHoriz: DEG XCalc*bevel.screen.RAD.fromVert: LCD XCalc*bevel.screen.GRAD.fromHoriz: RAD XCalc*bevel.screen.GRAD.fromVert: LCD XCalc*bevel.screen.P.label: () XCalc*bevel.screen.P.fromHoriz: GRAD XCalc*bevel.screen.P.fromVert: LCD XCalc*bevel.screen.P.horizDistance: 2 !XCalc*ti.Geometry: 171x252 XCalc*ti.bevel.screen.LCD.width: 186 XCalc*ti.bevel.screen.LCD.translations: #replace\n\ Ctrlc:quit()\n\ Ctrlh:clear()\n\ None0:digit(0)\n\ None1:digit(1)\n\ None2:digit(2)\n\ None3:digit(3)\n\ None4:digit(4)\n\ None5:digit(5)\n\ None6:digit(6)\n\ None7:digit(7)\n\ None8:digit(8)\n\ None9:digit(9)\n\ KP_0:digit(0)\n\ KP_1:digit(1)\n\ KP_2:digit(2)\n\ KP_3:digit(3)\n\ KP_4:digit(4)\n\ KP_5:digit(5)\n\ KP_6:digit(6)\n\ KP_7:digit(7)\n\ KP_8:digit(8)\n\ KP_9:digit(9)\n\ KP_Enter:equal()\n\ KP_Equal:equal()\n\ KP_Multiply:multiply()\n\ KP_Add:add()\n\ KP_Subtract:subtract()\n\ KP_Decimal:decimal()\n\ KP_Separator:decimal()\n\ KP_Divide:divide()\n\ KP_Tab:equal()\n\ Clear:clear()\n\ :.:decimal()\n\ :+:add()\n\ :-:subtract()\n\ :*:multiply()\n\ :/:divide()\n\ :(:leftParen()\n\ :):rightParen()\n\ :!:factorial()\n\ e:e()\n\ :^:power()\n\ p:pi()\n\ i:inverse()\n\ s:sine()\n\ c:cosine()\n\ t:tangent()\n\ d:degree()\n\ l:naturalLog()\n\ :=:equal()\n\ n:negate()\n\ r:squareRoot()\n\ space:clear()\n\ q:quit()\n\ Delete:clear()\n\ BackSpace:clear()\n\ ,:toggle()selection()\n XCalc*ti.button1.label: 1/x XCalc*ti.button1.translations: #override,:reciprocal()unset() XCalc*ti.button2.label: x\262 XCalc*ti.button2.translations: #override,:square()unset() XCalc*ti.button3.font: -adobe-symbol-*-*-*-*-*-120-*-*-*-*-*-* XCalc*ti.button3.label: \326\140 XCalc*ti.button3.translations: #override,:squareRoot()unset() XCalc*ti.button4.label: CE/C XCalc*ti.button4.translations: #override,:clear()unset() XCalc*ti.button5.label: AC XCalc*ti.button5.translations: #override,:off()unset()\n\ ,:quit() XCalc*ti.button6.label: INV XCalc*ti.button6.translations: #override,:inverse()unset() XCalc*ti.button7.label: sin XCalc*ti.button7.translations: #override,:sine()unset() XCalc*ti.button8.label: cos XCalc*ti.button8.translations: #override,:cosine()unset() XCalc*ti.button9.label: tan XCalc*ti.button9.translations: #override,:tangent()unset() XCalc*ti.button10.label: DRG XCalc*ti.button10.translations: #override,:degree()unset() XCalc*ti.button11.label: e XCalc*ti.button11.translations: #override,:e()unset() XCalc*ti.button12.label: EE XCalc*ti.button12.translations: #override,:scientific()unset() XCalc*ti.button13.label: log XCalc*ti.button13.translations: #override,:logarithm()unset() XCalc*ti.button14.label: ln XCalc*ti.button14.translations: #override,:naturalLog()unset() XCalc*ti.button15.label: y^x XCalc*ti.button15.translations: #override,:power()unset() XCalc*ti.button16.font: -adobe-symbol-*-*-*-*-*-120-*-*-*-*-*-* XCalc*ti.button16.label: \160 XCalc*ti.button16.translations: #override,:pi()unset() XCalc*ti.button17.label: x! XCalc*ti.button17.translations: #override,:factorial()unset() XCalc*ti.button18.label: ( XCalc*ti.button18.translations: #override,:leftParen()unset() XCalc*ti.button19.label: ) XCalc*ti.button19.translations: #override,:rightParen()unset() XCalc*ti.button20.font: -adobe-symbol-*-*-*-*-*-120-*-*-*-*-*-* XCalc*ti.button20.label: \270 XCalc*ti.button20.translations: #override,:divide()unset() XCalc*ti.button21.label: STO XCalc*ti.button21.translations: #override,:store()unset() XCalc*ti.button22.label: 7 XCalc*ti.button22.translations: #override,:digit(7)unset() XCalc*ti.button23.label: 8 XCalc*ti.button23.translations: #override,:digit(8)unset() XCalc*ti.button24.label: 9 XCalc*ti.button24.translations: #override,:digit(9)unset() XCalc*ti.button25.label: * XCalc*ti.button25.translations: #override,:multiply()unset() XCalc*ti.button26.label: RCL XCalc*ti.button26.translations: #override,:recall()unset() XCalc*ti.button27.label: 4 XCalc*ti.button27.translations: #override,:digit(4)unset() XCalc*ti.button28.label: 5 XCalc*ti.button28.translations: #override,:digit(5)unset() XCalc*ti.button29.label: 6 XCalc*ti.button29.translations: #override,:digit(6)unset() XCalc*ti.button30.label: - XCalc*ti.button30.translations: #override,:subtract()unset() XCalc*ti.button31.label: SUM XCalc*ti.button31.translations: #override,:sum()unset() XCalc*ti.button32.label: 1 XCalc*ti.button32.translations: #override,:digit(1)unset() XCalc*ti.button33.label: 2 XCalc*ti.button33.translations: #override,:digit(2)unset() XCalc*ti.button34.label: 3 XCalc*ti.button34.translations: #override,:digit(3)unset() XCalc*ti.button35.label: + XCalc*ti.button35.translations: #override,:add()unset() XCalc*ti.button36.label: EXC XCalc*ti.button36.translations: #override,:exchange()unset() XCalc*ti.button37.label: 0 XCalc*ti.button37.translations: #override,:digit(0)unset() XCalc*ti.button38.label: . XCalc*ti.button38.translations: #override,:decimal()unset() XCalc*ti.button39.label: +/- XCalc*ti.button39.translations: #override,:negate()unset() XCalc*ti.button40.label: = XCalc*ti.button40.translations: #override,:equal()unset() XCalc*ti.button1.horizDistance: 4 XCalc*ti.button1.vertDistance: 12 XCalc*ti.button1.fromVert: bevel XCalc*ti.button2.fromHoriz: button1 XCalc*ti.button2.fromVert: bevel XCalc*ti.button2.vertDistance: 12 XCalc*ti.button3.fromHoriz: button2 XCalc*ti.button3.fromVert: bevel XCalc*ti.button3.vertDistance: 12 XCalc*ti.button4.fromHoriz: button3 XCalc*ti.button4.fromVert: bevel XCalc*ti.button4.vertDistance: 12 XCalc*ti.button5.fromHoriz: button4 XCalc*ti.button5.fromVert: bevel XCalc*ti.button5.vertDistance: 12 XCalc*ti.button6.horizDistance: 4 XCalc*ti.button6.fromVert: button1 XCalc*ti.button7.fromHoriz: button6 XCalc*ti.button7.fromVert: button2 XCalc*ti.button8.fromHoriz: button7 XCalc*ti.button8.fromVert: button3 XCalc*ti.button9.fromHoriz: button8 XCalc*ti.button9.fromVert: button4 XCalc*ti.button10.fromHoriz: button9 XCalc*ti.button10.fromVert: button5 XCalc*ti.button11.horizDistance: 4 XCalc*ti.button11.fromVert: button6 XCalc*ti.button12.fromHoriz: button11 XCalc*ti.button12.fromVert: button7 XCalc*ti.button13.fromHoriz: button12 XCalc*ti.button13.fromVert: button8 XCalc*ti.button14.fromHoriz: button13 XCalc*ti.button14.fromVert: button9 XCalc*ti.button15.fromHoriz: button14 XCalc*ti.button15.fromVert: button10 XCalc*ti.button16.horizDistance: 4 XCalc*ti.button16.fromVert: button11 XCalc*ti.button17.fromHoriz: button16 XCalc*ti.button17.fromVert: button12 XCalc*ti.button18.fromHoriz: button17 XCalc*ti.button18.fromVert: button13 XCalc*ti.button19.fromHoriz: button18 XCalc*ti.button19.fromVert: button14 XCalc*ti.button20.fromHoriz: button19 XCalc*ti.button20.fromVert: button15 XCalc*ti.button21.horizDistance: 4 XCalc*ti.button21.fromVert: button16 XCalc*ti.button22.fromHoriz: button21 XCalc*ti.button22.fromVert: button17 XCalc*ti.button23.fromHoriz: button22 XCalc*ti.button23.fromVert: button18 XCalc*ti.button24.fromHoriz: button23 XCalc*ti.button24.fromVert: button19 XCalc*ti.button25.fromHoriz: button24 XCalc*ti.button25.fromVert: button20 XCalc*ti.button26.horizDistance: 4 XCalc*ti.button26.fromVert: button21 XCalc*ti.button27.fromHoriz: button26 XCalc*ti.button27.fromVert: button22 XCalc*ti.button28.fromHoriz: button27 XCalc*ti.button28.fromVert: button23 XCalc*ti.button29.fromHoriz: button28 XCalc*ti.button29.fromVert: button24 XCalc*ti.button30.fromHoriz: button29 XCalc*ti.button30.fromVert: button25 XCalc*ti.button31.horizDistance: 4 XCalc*ti.button31.fromVert: button26 XCalc*ti.button32.fromHoriz: button31 XCalc*ti.button32.fromVert: button27 XCalc*ti.button33.fromHoriz: button32 XCalc*ti.button33.fromVert: button28 XCalc*ti.button34.fromHoriz: button33 XCalc*ti.button34.fromVert: button29 XCalc*ti.button35.fromHoriz: button34 XCalc*ti.button35.fromVert: button30 XCalc*ti.button36.horizDistance: 4 XCalc*ti.button36.fromVert: button31 XCalc*ti.button37.fromHoriz: button36 XCalc*ti.button37.fromVert: button32 XCalc*ti.button38.fromHoriz: button37 XCalc*ti.button38.fromVert: button33 XCalc*ti.button39.fromHoriz: button38 XCalc*ti.button39.fromVert: button34 XCalc*ti.button40.fromHoriz: button39 XCalc*ti.button40.fromVert: button35 !XCalc*hp.Geometry: 336x164 XCalc*hp.bevel.screen.LCD.width: 186 XCalc*hp.bevel.screen.LCD.translations: #replace\n\ Ctrlc:quit()\n\ Ctrlh:back()\n\ None0:digit(0)\n\ None1:digit(1)\n\ None2:digit(2)\n\ None3:digit(3)\n\ None4:digit(4)\n\ None5:digit(5)\n\ None6:digit(6)\n\ None7:digit(7)\n\ None8:digit(8)\n\ None9:digit(9)\n\ KP_0:digit(0)\n\ KP_1:digit(1)\n\ KP_2:digit(2)\n\ KP_3:digit(3)\n\ KP_4:digit(4)\n\ KP_5:digit(5)\n\ KP_6:digit(6)\n\ KP_7:digit(7)\n\ KP_8:digit(8)\n\ KP_9:digit(9)\n\ KP_Enter:enter()\n\ KP_Multiply:multiply()\n\ KP_Add:add()\n\ KP_Subtract:subtract()\n\ KP_Decimal:decimal()\n\ KP_Divide:divide()\n\ :.:decimal()\n\ :+:add()\n\ :-:subtract()\n\ :*:multiply()\n\ :/:divide()\n\ :!:factorial()\n\ e:e()\n\ :^:power()\n\ p:pi()\n\ i:inverse()\n\ s:sine()\n\ c:cosine()\n\ t:tangent()\n\ d:degree()\n\ l:naturalLog()\n\ n:negate()\n\ r:squareRoot()\n\ space:clear()\n\ q:quit()\n\ Delete:back()\n\ Return:enter()\n\ Linefeed:enter()\n\ x:XexchangeY()\n\ BackSpace:back()\n\ ,:toggle()selection()\n XCalc*hp.button1.font: -adobe-symbol-*-*-*-*-*-120-*-*-*-*-*-* XCalc*hp.button1.label: \326\140 XCalc*hp.button1.translations: #override,:squareRoot()unset() XCalc*hp.button2.label: e^x XCalc*hp.button2.translations: #override,:epower()unset() XCalc*hp.button3.label: 10^x XCalc*hp.button3.translations: #override,:tenpower()unset() XCalc*hp.button4.label: y^x XCalc*hp.button4.translations: #override,:power()unset() XCalc*hp.button5.label: 1/x XCalc*hp.button5.translations: #override,:reciprocal()unset() XCalc*hp.button6.label: CHS XCalc*hp.button6.translations: #override,:negate()unset() XCalc*hp.button7.label: 7 XCalc*hp.button7.translations: #override,:digit(7)unset() XCalc*hp.button8.label: 8 XCalc*hp.button8.translations: #override,:digit(8)unset() XCalc*hp.button9.label: 9 XCalc*hp.button9.translations: #override,:digit(9)unset() XCalc*hp.button10.font: -adobe-symbol-*-*-*-*-*-120-*-*-*-*-*-* XCalc*hp.button10.label: \270 XCalc*hp.button10.translations: #override,:divide()unset() XCalc*hp.button11.label: x! XCalc*hp.button11.translations: #override,:factorial()unset() XCalc*hp.button12.font: -adobe-symbol-*-*-*-*-*-120-*-*-*-*-*-* XCalc*hp.button12.label: \160 XCalc*hp.button12.translations: #override,:pi()unset() XCalc*hp.button13.label: sin XCalc*hp.button13.translations: #override,:sine()unset() XCalc*hp.button14.label: cos XCalc*hp.button14.translations: #override,:cosine()unset() XCalc*hp.button15.label: tan XCalc*hp.button15.translations: #override,:tangent()unset() XCalc*hp.button16.label: EEX XCalc*hp.button16.translations: #override,:scientific()unset() XCalc*hp.button17.label: 4 XCalc*hp.button17.translations: #override,:digit(4)unset() XCalc*hp.button18.label: 5 XCalc*hp.button18.translations: #override,:digit(5)unset() XCalc*hp.button19.label: 6 XCalc*hp.button19.translations: #override,:digit(6)unset() XCalc*hp.button20.label: * XCalc*hp.button20.translations: #override,:multiply()unset() XCalc*hp.button21.mappedWhenManaged: False XCalc*hp.button22.mappedWhenManaged: False XCalc*hp.button23.label: Rv XCalc*hp.button23.translations: #override,:roll()unset() XCalc*hp.button24.label: x:y XCalc*hp.button24.translations: #override,:XexchangeY()unset() XCalc*hp.button25.label: <- XCalc*hp.button25.translations: #override,:back()unset() XCalc*hp.button26.label: E\nN\nT\nE\nR XCalc*hp.button26.translations: #override,:enter()unset() XCalc*hp.button27.label: 1 XCalc*hp.button27.translations: #override,:digit(1)unset() XCalc*hp.button28.label: 2 XCalc*hp.button28.translations: #override,:digit(2)unset() XCalc*hp.button29.label: 3 XCalc*hp.button29.translations: #override,:digit(3)unset() XCalc*hp.button30.label: - XCalc*hp.button30.translations: #override,:subtract()unset() XCalc*hp.button31.label: ON XCalc*hp.button31.translations: #override,:off()unset()\n\ ,:quit() XCalc*hp.button32.label: DRG XCalc*hp.button32.translations: #override,:degree()unset() XCalc*hp.button33.label: INV XCalc*hp.button33.translations: #override,:inverse()unset() XCalc*hp.button34.label: STO XCalc*hp.button34.translations: #override,:store()unset() XCalc*hp.button35.label: RCL XCalc*hp.button35.translations: #override,:recall()unset() XCalc*hp.button36.label: 0 XCalc*hp.button36.translations: #override,:digit(0)unset() XCalc*hp.button37.label: . XCalc*hp.button37.translations: #override,:decimal()unset() XCalc*hp.button38.label: SUM XCalc*hp.button38.translations: #override,:sum()unset() XCalc*hp.button39.label: + XCalc*hp.button39.translations: #override,:add()unset() XCalc*hp.button1.horizDistance: 4 XCalc*hp.button1.vertDistance: 12 XCalc*hp.button1.fromVert: bevel XCalc*hp.button2.fromHoriz: button1 XCalc*hp.button2.fromVert: bevel XCalc*hp.button2.vertDistance: 12 XCalc*hp.button3.fromHoriz: button2 XCalc*hp.button3.fromVert: bevel XCalc*hp.button3.vertDistance: 12 XCalc*hp.button4.fromHoriz: button3 XCalc*hp.button4.fromVert: bevel XCalc*hp.button4.vertDistance: 12 XCalc*hp.button5.fromHoriz: button4 XCalc*hp.button5.fromVert: bevel XCalc*hp.button5.vertDistance: 12 XCalc*hp.button6.fromHoriz: button5 XCalc*hp.button6.fromVert: bevel XCalc*hp.button6.vertDistance: 12 XCalc*hp.button7.fromHoriz: button6 XCalc*hp.button7.fromVert: bevel XCalc*hp.button7.vertDistance: 12 XCalc*hp.button8.fromHoriz: button7 XCalc*hp.button8.fromVert: bevel XCalc*hp.button8.vertDistance: 12 XCalc*hp.button9.fromHoriz: button8 XCalc*hp.button9.fromVert: bevel XCalc*hp.button9.vertDistance: 12 XCalc*hp.button10.fromHoriz: button9 XCalc*hp.button10.fromVert: bevel XCalc*hp.button10.vertDistance: 12 XCalc*hp.button11.horizDistance: 4 XCalc*hp.button11.fromVert: button1 XCalc*hp.button12.fromHoriz: button11 XCalc*hp.button12.fromVert: button2 XCalc*hp.button13.fromHoriz: button12 XCalc*hp.button13.fromVert: button3 XCalc*hp.button14.fromHoriz: button13 XCalc*hp.button14.fromVert: button4 XCalc*hp.button15.fromHoriz: button14 XCalc*hp.button15.fromVert: button5 XCalc*hp.button16.fromHoriz: button15 XCalc*hp.button16.fromVert: button6 XCalc*hp.button17.fromHoriz: button16 XCalc*hp.button17.fromVert: button7 XCalc*hp.button18.fromHoriz: button17 XCalc*hp.button18.fromVert: button8 XCalc*hp.button19.fromHoriz: button18 XCalc*hp.button19.fromVert: button9 XCalc*hp.button20.fromHoriz: button19 XCalc*hp.button20.fromVert: button10 XCalc*hp.button21.horizDistance: 4 XCalc*hp.button21.fromVert: button11 XCalc*hp.button22.fromHoriz: button21 XCalc*hp.button22.fromVert: button12 XCalc*hp.button23.fromHoriz: button22 XCalc*hp.button23.fromVert: button13 XCalc*hp.button24.fromHoriz: button23 XCalc*hp.button24.fromVert: button14 XCalc*hp.button25.fromHoriz: button24 XCalc*hp.button25.fromVert: button15 XCalc*hp.button26.fromHoriz: button25 XCalc*hp.button26.fromVert: button16 XCalc*hp.button26.font: 6x12 XCalc*hp.button26.height: 56 XCalc*hp.button27.fromHoriz: button26 XCalc*hp.button27.fromVert: button17 XCalc*hp.button28.fromHoriz: button27 XCalc*hp.button28.fromVert: button18 XCalc*hp.button29.fromHoriz: button28 XCalc*hp.button29.fromVert: button19 XCalc*hp.button30.fromHoriz: button29 XCalc*hp.button30.fromVert: button20 XCalc*hp.button31.horizDistance: 4 XCalc*hp.button31.fromVert: button21 XCalc*hp.button32.fromHoriz: button31 XCalc*hp.button32.fromVert: button22 XCalc*hp.button33.fromHoriz: button32 XCalc*hp.button33.fromVert: button23 XCalc*hp.button34.fromHoriz: button33 XCalc*hp.button34.fromVert: button24 XCalc*hp.button35.fromHoriz: button34 XCalc*hp.button35.fromVert: button25 XCalc*hp.button36.fromHoriz: button26 XCalc*hp.button36.fromVert: button27 XCalc*hp.button37.fromHoriz: button36 XCalc*hp.button37.fromVert: button28 XCalc*hp.button38.fromHoriz: button37 XCalc*hp.button38.fromVert: button29 XCalc*hp.button39.fromHoriz: button38 XCalc*hp.button39.fromVert: button30 x11-apps-7.7+5+nmu1ubuntu1/xcalc/ChangeLog0000664000000000000000000005571012457363426015061 0ustar commit 0fba659f91bebe1f92f4de2660bf806fd049350b Author: Alan Coopersmith Date: Mon Jan 19 21:26:22 2015 -0800 xcalc 1.0.6 Signed-off-by: Alan Coopersmith commit a647c9bd255c136f9e6e3e274ecf4253e9ead6d6 Author: Alan Coopersmith Date: Thu Aug 7 19:20:44 2014 -0700 Replace index() call with strchr() Signed-off-by: Alan Coopersmith commit a91574fe283263a3f9d91fb257ecb2c5b0a97541 Author: Alan Coopersmith Date: Mon Jun 2 22:10:55 2014 -0700 autogen.sh: Honor NOCONFIGURE=1 See http://people.gnome.org/~walters/docs/build-api.txt Signed-off-by: Alan Coopersmith commit 6387133e231ec16da4204fddaffafe70d077e5d8 Author: Alan Coopersmith Date: Mon Jun 2 22:10:55 2014 -0700 configure: Drop AM_MAINTAINER_MODE Signed-off-by: Alan Coopersmith commit 8afe5270310698d24fff370276c7fd91eb816720 Author: Gaetan Nadon Date: Tue Dec 17 08:24:45 2013 -0500 Replace signal_t with void Now that Imake SIGNALRETURNSINT has been removed, the signal handler function return type can only be void. Reviewed-by: Alan Coopersmith Signed-off-by: Gaetan Nadon commit 40911339c45a880abbe6ad60dac4718a402d88ab Author: Gaetan Nadon Date: Mon Dec 16 10:04:46 2013 -0500 Assume signal handlers return void, as C89 requires Drops use of Imake's obsolete SIGNALRETURNSINT. Reviewd-by: Mark Kettenis Signed-off-by: Gaetan Nadon commit 25454313c637f2b6983ba289deed96141cec8000 Author: Alan Coopersmith Date: Tue Jul 9 23:01:23 2013 -0700 Mark functions noreturn as suggested by gcc -Wmissing-noreturn Signed-off-by: Alan Coopersmith commit de0e13ada857191a59c0e8f985d2317a7c41f43b Author: Alan Coopersmith Date: Tue Jul 9 22:56:02 2013 -0700 Rename "e" arguments to "ev" to avoid shadowing e() function Resolves many gcc warnings of the form: actions.c: In function ‘add’: actions.c:142:35: warning: declaration of ‘e’ shadows a global declaration actions.c:57:13: warning: shadowed declaration is here [-Wshadow] Signed-off-by: Alan Coopersmith commit 40da34202dffa96197c6248a9d80894611e27921 Author: Alan Coopersmith Date: Tue Jul 9 22:53:07 2013 -0700 Remove redundant redeclaration of ‘factorial’ Signed-off-by: Alan Coopersmith commit 1de8253f0ede02ec87d28b028de97da79adc12e2 Author: Alan Coopersmith Date: Tue Jul 9 22:49:21 2013 -0700 Replace sprintf & strcpy calls with snprintf & strlcpy Signed-off-by: Alan Coopersmith commit 3d58c22c4c2729d52b5278c0e6350c0f9f44cfa8 Author: Alan Coopersmith Date: Sat Jul 6 20:45:40 2013 -0700 Remove unused min & max macros from math.c Flagged by clang: math.c:33:9: warning: macro is not used [-Wunused-macros] #define min(a,b) ((a) < (b) ? (a) : (b)) ^ math.c:34:9: warning: macro is not used [-Wunused-macros] #define max(a,b) ((a) > (b) ? (a) : (b)) ^ Signed-off-by: Alan Coopersmith commit 3e6d23bb9d57ae3d19e9eb47ced654669fca4d7c Author: Stéphane Aulery Date: Sun Jul 7 02:02:46 2013 +0200 Use the new M_E symbol from math.h Use the new M_E symbol from math.h and fix and a value of the same accuracy if it's necessary to redefine M_E. Signed-off-by: Stéphane Aulery Reviewed-by: Alan Coopersmith Signed-off-by: Alan Coopersmith commit f3b065f03a7b68310b489d5d97b11985ef36e977 Author: Stéphane Aulery Date: Sun Jul 7 02:02:38 2013 +0200 Use the new M_PI symbol from math.h Use the new M_PI symbol from math.h and fix and a value of the same accuracy if it's necessary to redefine M_PI. Signed-off-by: Stéphane Aulery Reviewed-by: Alan Coopersmith Signed-off-by: Alan Coopersmith commit b9a89876666a42ad8692e8384a5a826456e6ae56 Author: Stéphane Aulery Date: Sat Jul 6 15:39:07 2013 +0200 Drop CRAY support Signed-off-by: Stéphane Aulery Signed-off-by: Alan Coopersmith commit 7e67bcb9563302f4e89be7a2afb1ae30c185689e Author: Alan Coopersmith Date: Mon Jan 14 23:08:54 2013 -0800 xcalc 1.0.5 Signed-off-by: Alan Coopersmith commit fa70ea30be4c1a13d553785da8f6e920471655d4 Author: Eric S. Raymond Date: Thu Aug 23 06:12:20 2012 -0400 Use table markup rather than tab stops. Aids DocBook translation. commit 1e885381028c2e94a7f83a6489f11ed00f18b530 Author: Alan Coopersmith Date: Wed Sep 28 20:28:31 2011 -0700 Strip trailing whitespace Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' git diff -w & git diff -b show no diffs from this change Signed-off-by: Alan Coopersmith commit cad47868c99d4eac0ae2ad305399143a9aed3b2d Author: Alan Coopersmith Date: Wed Sep 28 20:27:03 2011 -0700 Add const to parse_double() args to fix gcc -Wwrite-strings warnings Signed-off-by: Alan Coopersmith commit c8ef1bb20266365a46ea82dfff79c78b6c61337d Author: Gaetan Nadon Date: Wed Jan 19 10:06:55 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit c9c8030e71d2a3d6663f177963d8dcf148a46067 Author: Gaetan Nadon Date: Thu Jan 13 17:15:36 2011 -0500 man: replace hard coded man page section with substitution strings Signed-off-by: Gaetan Nadon commit 8cc897e03ff972d2f2addf54ed54d014845cc9bb Author: Gaetan Nadon Date: Thu Jan 13 11:15:47 2011 -0500 man: remove trailing spaces and tabs Using s/[ \t]*$// Signed-off-by: Gaetan Nadon commit d1dac5141b2398d5490453e0ff150b3db836a15f Author: Gaetan Nadon Date: Wed Jan 12 15:29:49 2011 -0500 config: replace deprecated AC_HELP_STRING with AS_HELP_STRING This silences an Automake warning. Signed-off-by: Gaetan Nadon commit 2755eae3be5fc239da792c46a10426281ee77b85 Author: Alan Coopersmith Date: Fri Nov 26 13:53:42 2010 -0800 xcalc 1.0.4.1 Just respinning the tarballs with the correct install-sh instead of the broken copy accidentally included in the 1.0.4 tarballs. Signed-off-by: Alan Coopersmith commit 8245b9f8451b92a1aaa7a3520114a4afdd37c2e8 Author: Alan Coopersmith Date: Wed Nov 24 15:58:04 2010 -0800 xcalc 1.0.4 Signed-off-by: Alan Coopersmith commit 4ac002703c8bda62f768f581e1ec81bbf7446365 Author: Alan Coopersmith Date: Sat Nov 20 11:12:55 2010 -0800 create_keypad: declare list of button name strings as const Signed-off-by: Alan Coopersmith commit 0d7aa29c6209391cf8307c19b5cf84528f8c2184 Author: Alan Coopersmith Date: Sat Nov 20 10:55:58 2010 -0800 Purge RCS/CVS version tags Signed-off-by: Alan Coopersmith commit 9ede32efd5f840b7728e28e24efe2759e2c3917b Author: Alan Coopersmith Date: Sat Nov 20 10:41:45 2010 -0800 config: Explicitly check for xt & x11 pkgs, since xcalc calls those directly Signed-off-by: Alan Coopersmith commit 4be6d1bd7b6293ff4af1042098a6164aa9639595 Author: Alan Coopersmith Date: Sat Nov 20 10:37:40 2010 -0800 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS Regroup AC statements under the Autoconf initialization section. Regroup AM statements under the Automake initialization section. Add missing AC_CONFIG_SRCDIR Signed-off-by: Alan Coopersmith commit 30e01e9b012c7191c28946a73c2ff5b969d9eec7 Author: Alan Coopersmith Date: Sat Nov 20 10:35:57 2010 -0800 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now PKG_CONFIG_MODULES handles AC_SUBST of the CFLAGS & LIBS variables Signed-off-by: Alan Coopersmith commit 5505a663714c71aa3545889633f36079522edcb5 Author: Alan Coopersmith Date: Sat Nov 20 10:34:33 2010 -0800 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS Enables use of platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit 6919c12a985abd335b4890005d572107f833c3ec Author: Gaetan Nadon Date: Sat Nov 20 10:31:43 2010 -0800 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon Signed-off-by: Alan Coopersmith commit 8180d8ea42cfdda9ed3828fb28d1a6cd24d951db Author: Gaetan Nadon Date: Thu Feb 11 10:08:06 2010 -0500 config: move CWARNFLAGS from configure.ac to Makefile.am Compiler warning flags should be explicitly set in the makefile rather than being merged with other packages compiler flags. Signed-off-by: Gaetan Nadon commit 04d8b9bfcd40eee452ba080b654dac9281251115 Author: Gaetan Nadon Date: Sat Dec 19 20:48:47 2009 -0500 configure.ac: use backticks rather than $() for cmd subs Use "$PKG_CONFIG" rather than hard coded "pkg-config" Signed-off-by: Gaetan Nadon commit 6c21e467c805d62593d34da9e83a2fa2f01798a6 Author: Alan Coopersmith Date: Thu Dec 17 19:51:44 2009 -0800 xcalc 1.0.3 Signed-off-by: Alan Coopersmith commit 146b1da64e575d330c2599161938140a4233cb6a Author: Alan Coopersmith Date: Thu Dec 17 19:21:22 2009 -0800 Apply automake silencer to man page generation rule Signed-off-by: Alan Coopersmith commit abb1bf5b74642f8d40ca5fbf87490c5186f41590 Author: Gaetan Nadon Date: Thu Nov 26 09:19:52 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit 109d08574cf3d951d73668a5a23c97dad94d6e75 Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit dc35d949925e76e74403b4aea02c2ff198bf0ec6 Author: Gaetan Nadon Date: Tue Oct 27 15:07:24 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit 31a1d8fc1486e6dd0cb9c5ba569c820b3b79d890 Author: Gaetan Nadon Date: Mon Oct 26 22:08:38 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit befb756a62a11a857f20f903b8b892768a58e229 Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit eab3461ac8e9e809094f45ca2084ddf7b4485035 Author: Gaetan Nadon Date: Sun Sep 27 15:37:25 2009 -0400 Makefile.am: do not include autogen.sh in distribution #24183 This is a private build script that should not be distributed commit b685a52aa117e9c7841fdb9b9e6b44fe898cd929 Author: Alan Coopersmith Date: Thu Oct 1 14:54:20 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit dd6ca812a9e540ade4afd5db9dd13ea7ed3ea3ab Author: Paulo Cesar Pereira de Andrade Date: Mon Jan 12 20:09:07 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings. commit fd75efe1d9b57c483f7cedd9e2dce34b97eef75e Author: James Cloos Date: Wed Aug 20 10:32:49 2008 -0400 xaw8 is gone, use xaw7 commit e8360958ef3dba1e7ab8282c5055b0ccf5650f1c Author: Julien Cristau Date: Fri May 16 14:20:03 2008 +0200 $(builddir) is the current directory Apparently automake doesn't always export the builddir variable. This fixes my previous commit. commit d3849e5474e65d2cf4212118896883330752c763 Author: Julien Cristau Date: Sun Apr 20 19:42:48 2008 +0200 Fix build with builddir != srcdir commit 18db0ddc3a18317585172374d0157dbdc76146aa Author: Jeremy Huddleston Date: Thu Mar 27 20:07:34 2008 -0700 Build fix for file systems that are not case sensitive commit 9f76a0d8684da6dfad67282be213139b6f87a05a Author: Matthieu Herrb Date: Sat Mar 8 22:09:59 2008 +0100 Makefile.am: nuke RCS Id commit 19fad31ddef4c1063ee2315dfee94e4ebb5f0ff0 Author: Alan Coopersmith Date: Tue Aug 21 11:23:52 2007 -0700 Version bump: 1.0.2 commit c4ada4a7ee46f8ab0dfeb2cd311758d9197a59a8 Author: Alan Coopersmith Date: Tue Aug 21 11:19:09 2007 -0700 Fill in COPYING with copyright/license notices from source files commit 5ee182a964d0ba16315935ec9bfd91779ed4a2a1 Author: Alan Coopersmith Date: Tue Aug 21 11:15:50 2007 -0700 Replace static changelog with dist-hook to generate from git log commit 3c9230230e88f6421ea3549f813eabceb4120734 Author: Alan Coopersmith Date: Tue Aug 21 11:03:07 2007 -0700 renamed: .cvsignore -> .gitignore commit b2c489924708b202f33f6528d3269911662f906c Author: Alan Coopersmith Date: Tue Aug 21 11:02:19 2007 -0700 Change xcalc_CFLAGS to AM_CFLAGS to make automake-1.10 happier commit b586f35824d7c3bc061ba96e82b48744041dac59 Author: Mike Markowski Date: Wed Jul 12 11:28:40 2006 -0700 Bug #4914: Add HP mode resources to XCalc-color app-defaults X.Org bug #4914 Patch #3658 commit 322a3bd493b99164925e852df5ffa8e1a650f496 Author: Kevin E Martin Date: Wed Dec 21 02:29:48 2005 +0000 Update package version for X11R7 release. commit 8b7933c8192364e55b863b3e88ad64dbd6004bcc Author: Adam Jackson Date: Mon Dec 19 16:22:42 2005 +0000 Stub COPYING files commit 543045f1c5effcafe60ee86ab02663ea5253d7b1 Author: Kevin E Martin Date: Thu Dec 15 00:24:05 2005 +0000 Update package version number for final X11R7 release candidate. commit ffb4bc9e1bbff3648d9a60d29c8efe8292b2e6d2 Author: Kevin E Martin Date: Wed Dec 7 16:17:58 2005 +0000 Change to use the app-defaults default dir configured in libXt. commit f8c6b6ee02de9f4991e4894386fd1f914e71f295 Author: Kevin E Martin Date: Tue Dec 6 22:48:19 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit db75d5541e32a82c1a200f5db94258c55144aee9 Author: Kevin E Martin Date: Sat Dec 3 05:49:18 2005 +0000 Update package version number for X11R7 RC3 release. commit 217c43175b253fb436dfe2c17c258440efbf1b4d Author: Alan Coopersmith Date: Mon Nov 28 22:01:39 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit 35347991b10472019e814b4346f9f55f33fa6850 Author: Eric Anholt Date: Mon Nov 21 10:34:58 2005 +0000 Another pass at .cvsignores for apps. commit ec23a703b3dd3ca07bcb67599d2aa20186b812db Author: Eric Anholt Date: Sun Nov 20 22:08:50 2005 +0000 Add/improve .cvsignore files for apps. commit 4b974526a94abe02297f7ecf427cb78681c9bfb3 Author: Kevin E Martin Date: Wed Oct 19 02:47:52 2005 +0000 Update package version number for RC1 release. commit b0d618388ae24bb2bbcfbb43b313306b3b8d342f Author: Alan Coopersmith Date: Tue Oct 18 00:32:54 2005 +0000 Change default install dir for app-default files from $(sysconfdir)/X11/app-defaults to $(libdir)/X11/app-defaults to match the monolith & allow localization commit 933a86b8c6d64e974b314c5e3617fa2cbb213cce Author: Alan Coopersmith Date: Mon Oct 17 23:56:21 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 203bc6e49653660050a874508da2c57e089c3c54 Author: Alan Coopersmith Date: Fri Oct 14 00:25:43 2005 +0000 Use sed to fill in variables in man page commit e70773cb5c4269627e0d8750f7852ed865fd8eaf Author: Alan Coopersmith Date: Thu Oct 13 20:11:00 2005 +0000 Fix app-default files to install under the same names as in the monolith instead of their short names used only for 14-character filename length limited ancient filesystems commit 9648bcddee6779eed395d60f17a13bcf13fa9042 Author: Alan Coopersmith Date: Mon Aug 1 20:25:29 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit cdd93a4e3c1dac5f23ad21c5fac4fbc054e0a42d Author: Kevin E Martin Date: Fri Jul 29 21:22:31 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit 2347df01911fc8061071cb80018963b79514e4b4 Author: Alan Coopersmith Date: Tue Jul 26 15:44:01 2005 +0000 Replace more GNU make-ism's with more portable macros commit b7161f370dbabeb536e9dc078f05e1ffd67847fb Author: Adam Jackson Date: Wed Jul 20 19:31:51 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit 526ab098fe73f9dde13b651ae8c70fbec56594c2 Author: Matthieu Herrb Date: Sun Jul 17 20:11:02 2005 +0000 fix rules to work with non-GNU make and outside of $srcdir commit 392f5dd1907a5110c89b308ef51122b39b23dde5 Author: Søren Sandmann Pedersen Date: Wed Jun 29 23:12:07 2005 +0000 Build system for Xcalc commit a72c79567a4f550dfafb532b03be79339c5a4a30 Author: Alexander Gottwald Date: Tue Jul 6 09:24:58 2004 +0000 Bugzilla #665: bugs in xcalc -rpn mode decimal_point is a const char* not char. the patch uses strcmp instead of plain char == char operator and allows decimal_point to be of any length. localeconv() is only called if X_LOCALE is _not_ defined commit bbcc481006d4b5f4e8d1276db2220cf96a355985 Author: Alan Coopersmith Date: Sun May 23 20:03:49 2004 +0000 xc/programs/xcalc/math.c xcalc -rpn mode errors (Geoffery Coram) commit ed6ab3f1b45a5101a4cddfca754291b4523520a1 Author: Egbert Eich Date: Fri Apr 23 19:54:38 2004 +0000 Merging XORG-CURRENT into trunk commit bb536859850357b05511068fab838dd3a1436ef6 Author: Egbert Eich Date: Sun Mar 14 08:35:00 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit fecd81156f60db136eaf9cf79a34b7d076bbae06 Author: Egbert Eich Date: Wed Mar 3 12:12:55 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit 3acc8a33b8eec4fe9164e12507cafb3c161d3cbe Author: Egbert Eich Date: Thu Feb 26 13:36:16 2004 +0000 readding XFree86's cvs IDs commit 70f4b224345cc7c43d1960858c27a11541ea55c4 Author: Egbert Eich Date: Thu Feb 26 09:23:58 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit c61023614eb9182293f5c26c22a3babf65f1dee1 Author: Kaleb Keithley Date: Tue Nov 25 19:29:03 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit c538606166a71ab7b711de7394cc61add265a209 Author: Kaleb Keithley Date: Fri Nov 14 16:48:58 2003 +0000 XFree86 4.3.0.1 commit 411b0e9e319550a394b0a5945543f39a5affc6a6 Author: Kaleb Keithley Date: Fri Nov 14 16:48:58 2003 +0000 Initial revision x11-apps-7.7+5+nmu1ubuntu1/xcalc/depcomp0000755000000000000000000005601612656634627014667 0ustar #! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xcalc/config.guess0000775000000000000000000012367212514123564015621 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-11-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xcalc/math.c0000664000000000000000000004553212457363403014400 0ustar /* * math.c - mathematics functions for a hand calculator under X * * Author: John H. Bradley, University of Pennsylvania * (bradley@cis.upenn.edu) * March, 1987 * * RPN mode added and port to X11 by Mark Rosenstein, MIT Project Athena * * Modified to be a client of the Xt toolkit and the Athena widget set by * Donna Converse, MIT X Consortium. This is all that remains of the * original calculator, and it still needs to be rewritten. The HP * functionality should be separated from the TI functionality. * Beware the HP functions: there are still errors here. * * Geoffrey Coram fixed most of the HP mode bugs. */ #include "xcalc.h" #ifndef M_PI /* sometimes defined in math.h */ #define M_PI 3.14159265358979323846 #endif #ifndef M_E /* sometimes defined in math.h */ #define M_E 2.7182818284590452354 #endif #define MAXDISP 11 #define DEG 0 /* DRG mode. used for trig calculations */ #define RAD 1 #define GRAD 2 #define True 1 #define False 0 #ifndef IEEE jmp_buf env; #endif /* This section is all of the state machine that implements the calculator * functions. Much of it is shared between the infix and rpn modes. */ static int flagINV, flagPAREN, flagM, drgmode; /* display flags */ static double drg2rad=M_PI/180.0; /* Conversion factors for trig funcs */ static double rad2drg=180.0/M_PI; static int entered=1; /* true if display contains a valid number. if==2, then use 'dnum', rather than the string stored in the display. (for accuracy) if==3, then error occurred, only CLR & AC work */ /* entered seems to be overloaded - dmc */ static int lift_enabled = 0; /* for rpn mode only */ static int CLR =0; /* CLR clears display. if 1, clears acc, also */ static int Dpoint=0; /* to prevent using decimal pt twice in a # */ static int clrdisp=1; /* if true clears display before entering # */ static int lastop =kCLR; static int memop =kCLR; static int exponent=0; static double acc =0.0; static double dnum=0.0; #define XCALC_MEMORY 10 static double mem[XCALC_MEMORY] = { 0.0 }; static void DrawDisplay(void); static void PushOp(int op); static int PopOp(void); static int isopempty(void); #ifdef DEBUG static void showstack(char *string); #endif static void PushNum(double num); static double PopNum(void); static void RollNum(int dir); static void ClearStacks(void); static int priority(int op); #ifndef HAVE_STRLCPY /* Close enough for the short strings copied in xcalc */ static inline size_t strlcpy(char *dst, const char *src, size_t size) { strncpy(dst, src, size); dst[size - 1] = '\0'; return strlen(src); } #endif /* * The following is to deal with the unfortunate assumption that if errno * is non-zero then an error has occurred. On some systems (e.g. Ultrix), * sscanf will call lower level routines that will set errno. */ static void parse_double (const char *src, const char *fmt, double *dp) { int olderrno = errno; (void) sscanf (src, fmt, dp); errno = olderrno; return; } /*********************************/ int pre_op(int keynum) { if (keynum==-1) return(0); errno = 0; /* for non-IEEE machines */ if ( (entered==3) && !(keynum==kCLR || keynum==kOFF)) { if (rpn) { clrdisp++; } else { ringbell(); return(1); /* the intent was probably not to do the operation */ } } if (keynum != kCLR) CLR=0; return(0); } #ifndef IEEE /* cannot assign result of setjmp under ANSI C, use global instead */ static volatile int SignalKind; void fail_op(void) { if (SignalKind == SIGFPE) strlcpy(dispstr, "math error", sizeof(dispstr)); else if (SignalKind == SIGILL) strlcpy(dispstr, "illegal operand", sizeof(dispstr)); entered=3; DrawDisplay(); return; } /*ARGSUSED*/ void fperr(int sig) { #if defined(SYSV) || defined(SVR4) || defined(linux) signal(SIGFPE, fperr); #endif SignalKind = sig; longjmp(env,1); } /* for VAX BSD4.3 */ /*ARGSUSED*/ void illerr(int sig) { /* not reset when caught? */ signal(SIGILL, illerr); SignalKind = sig; longjmp(env,1); } #endif /* not IEEE */ void post_op(void) { #ifdef DEBUG showstack("\0"); #endif #ifndef IEEE if (errno) { strlcpy(dispstr, "error", sizeof(dispstr)); DrawDisplay(); entered=3; errno=0; } #endif } /*-------------------------------------------------------------------------*/ static void DrawDisplay(void) { if (strlen(dispstr) > 12) { /* strip out some decimal digits */ char *estr = strchr(dispstr,'e'); /* search for exponent part */ if (!estr) dispstr[12]='\0'; /* no exp, just trunc. */ else { char tmp[32]; if (strlen(estr) <= 4) /* leftmost 8 chars plus exponent */ snprintf(tmp, sizeof(tmp), "%.8s%s", dispstr, estr); else /* leftmost 7 chars plus exponent */ snprintf(tmp, sizeof(tmp), "%.7s%s", dispstr, estr); strlcpy(dispstr, tmp, sizeof(dispstr)); } } draw(dispstr); setflag(XCalc_MEMORY, (flagM)); setflag(XCalc_INVERSE, (flagINV)); setflag(XCalc_DEGREE, (drgmode==DEG)); setflag(XCalc_RADIAN, (drgmode==RAD)); setflag(XCalc_GRADAM, (drgmode==GRAD)); setflag(XCalc_PAREN, (flagPAREN)); } /*-------------------------------------------------------------------------*/ void numeric(int keynum) { char st[2]; int cell = 0; flagINV=0; if (rpn && (memop == kSTO || memop == kRCL || memop == kSUM)) { switch (keynum) { case kONE: cell = 1; break; case kTWO: cell = 2; break; case kTHREE: cell = 3; break; case kFOUR: cell = 4; break; case kFIVE: cell = 5; break; case kSIX: cell = 6; break; case kSEVEN: cell = 7; break; case kEIGHT: cell = 8; break; case kNINE: cell = 9; break; case kZERO: cell = 0; break; } switch (memop) { case kSTO: mem[cell] = dnum; lift_enabled = 1; entered = 2; clrdisp++; break; case kRCL: PushNum(dnum); dnum = mem[cell]; snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); lift_enabled = 1; entered = 1; clrdisp++; break; case kSUM: mem[cell] += dnum; lift_enabled = 1; entered = 2; clrdisp++; break; } memop = kCLR; DrawDisplay(); return; } if (clrdisp) { dispstr[0]='\0'; exponent=Dpoint=0; /* if (rpn && entered==2) PushNum(dnum); */ if (rpn & lift_enabled) PushNum(dnum); } if ((int) strlen(dispstr) >= MAXDISP) return; switch (keynum){ case kONE: st[0] = '1'; break; case kTWO: st[0] = '2'; break; case kTHREE: st[0] = '3'; break; case kFOUR: st[0] = '4'; break; case kFIVE: st[0] = '5'; break; case kSIX: st[0] = '6'; break; case kSEVEN: st[0] = '7'; break; case kEIGHT: st[0] = '8'; break; case kNINE: st[0] = '9'; break; case kZERO: st[0] = '0'; break; } st[1] = '\0'; strcat(dispstr,st); DrawDisplay(); if (clrdisp && keynum != kZERO) clrdisp=0; /*no leading 0s*/ memop = keynum; entered=1; lift_enabled = 0; } void bkspf(void) { lift_enabled = 0; if (! flagINV) { if (entered!=1) { clearf(); return; } if (clrdisp) return; if ((int) strlen(dispstr) > 0) { #ifndef X_LOCALE const char *dp = localeconv()->decimal_point; size_t dp_len = strlen(dp); size_t ds_len = strlen(dispstr); if (ds_len >= dp_len && strcmp(dispstr + ds_len - dp_len, dp) == 0) Dpoint=0; #else if (dispstr[strlen(dispstr)-1] == '.') Dpoint=0; #endif dispstr[strlen(dispstr)-1] = 0; } if (strlen(dispstr) == 0) { strcat(dispstr, "0"); clrdisp++; } } else { strlcpy(dispstr, "0", sizeof(dispstr)); dnum = 0.0; clrdisp++; flagINV = 0; } DrawDisplay(); } void decf(void) { flagINV=0; if (clrdisp) { if (rpn && lift_enabled) PushNum(dnum); strlcpy(dispstr, "0", sizeof(dispstr)); } if (!Dpoint) { #ifndef X_LOCALE strcat(dispstr, localeconv()->decimal_point); #else strcat(dispstr, "."); #endif DrawDisplay(); Dpoint++; } clrdisp=0; entered=1; } void eef(void) { flagINV=0; if (clrdisp) { if (rpn && lift_enabled) PushNum(dnum); strlcpy(dispstr, rpn ? "1" : "0", sizeof(dispstr)); } if (!exponent) { strcat(dispstr,"E+"); DrawDisplay(); exponent=strlen(dispstr)-1; /* where the '-' goes */ } clrdisp=0; entered=1; } void clearf(void) { flagINV=0; if (CLR && !rpn) { /* clear all */ ClearStacks(); flagPAREN=0; } CLR++; exponent=Dpoint=0; clrdisp=1; entered=1; strlcpy(dispstr, "0", sizeof(dispstr)); DrawDisplay(); } void negf(void) { flagINV=0; if (exponent) { /* neg the exponent */ if (dispstr[exponent]=='-') dispstr[exponent]='+'; else dispstr[exponent]='-'; DrawDisplay(); return; } if (strcmp("0",dispstr)==0) return; /* don't neg a zero */ if (dispstr[0]=='-') /* already neg-ed */ strcpy(dispstr,dispstr+1); /* move str left once */ else { /* not neg-ed. add a '-' */ char tmp[32]; snprintf(tmp, sizeof(tmp), "-%s", dispstr); strlcpy(dispstr, tmp, sizeof(dispstr)); } if (entered==2) dnum = -1.0 * dnum; DrawDisplay(); } /* Two operand functions for infix calc */ void twoop(int keynum) { if (flagINV) { flagINV=0; DrawDisplay(); } if (!entered) { /* something like "5+*" */ if (!isopempty()) (void) PopOp(); /* replace the prev op */ PushOp(keynum); /* with the new one */ return; } if (entered==1) parse_double(dispstr,"%lf",&dnum); clrdisp=CLR=1; entered=Dpoint=exponent=0; if (!isopempty()) { /* there was a previous op */ lastop=PopOp(); /* get it */ if (lastop==kLPAR) { /* put it back */ PushOp(kLPAR); PushOp(keynum); PushNum(dnum); return; } /* now, if the current op (keynum) is of higher priority than the lastop, the current op and number are just pushed on top Priorities: (Y^X) > *,/ > +,- */ if (priority(keynum) > priority(lastop)) { PushNum(dnum); PushOp(lastop); PushOp(keynum); } else { /* execute lastop on lastnum and dnum, push result and current op on stack */ acc=PopNum(); switch (lastop) { /* perform the operation */ case kADD: acc += dnum; break; case kSUB: acc -= dnum; break; case kMUL: acc *= dnum; break; case kDIV: acc /= dnum; break; case kPOW: acc = pow(acc,dnum); break; } PushNum(acc); PushOp(keynum); snprintf(dispstr, sizeof(dispstr), "%.8g", acc); DrawDisplay(); dnum=acc; } } else { /* op stack is empty, push op and num */ PushOp(keynum); PushNum(dnum); } } /* Two operand functions for rpn calc */ void twof(int keynum) { if (flagINV) { flagINV=0; DrawDisplay(); } if (!entered) return; if (entered==1) parse_double(dispstr, "%lf", &dnum); acc = PopNum(); switch(keynum) { case kADD: acc += dnum; break; case kSUB: acc -= dnum; break; case kMUL: acc *= dnum; break; case kDIV: acc /= dnum; break; case kPOW: acc = pow(acc,dnum); break; case kXXY: PushNum(dnum); } snprintf(dispstr, sizeof(dispstr), "%.8g", acc); DrawDisplay(); clrdisp++; Dpoint = exponent = 0; entered = 2; lift_enabled = 1; dnum = acc; } void entrf(void) { flagINV=0; if (!entered) return; clrdisp=CLR=1; Dpoint=exponent=0; if (entered==1) parse_double(dispstr,"%lf",&dnum); entered=2; memop = kENTR; PushNum(dnum); lift_enabled = 0; } void equf(void) { flagINV=0; if (!entered) return; clrdisp=CLR=1; Dpoint=exponent=0; if (entered==1) parse_double(dispstr,"%lf",&dnum); entered=2; PushNum(dnum); while (!isopempty()) { /* do all pending ops */ dnum=PopNum(); acc=PopNum(); lastop=PopOp(); switch (lastop) { case kADD: acc += dnum; break; case kSUB: acc -= dnum; break; case kMUL: acc *= dnum; break; case kDIV: acc /= dnum; break; case kPOW: acc = pow(acc,dnum); break; case kLPAR: flagPAREN--; PushNum(acc); break; } dnum=acc; PushNum(dnum); } snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); DrawDisplay(); } void lparf(void) { flagINV=0; PushOp(kLPAR); flagPAREN++; DrawDisplay(); } void rollf(void) { if (!entered) return; if (entered==1) parse_double(dispstr, "%lf", &dnum); entered = 2; lift_enabled = 1; RollNum(flagINV); flagINV=0; clrdisp++; snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); DrawDisplay(); } void rparf(void) { flagINV=0; if (!entered) return; if (!flagPAREN) return; clrdisp++; Dpoint=exponent=0; if (entered==1) parse_double(dispstr,"%lf",&dnum); entered=2; PushNum(dnum); while (!isopempty() && (lastop=PopOp())!=kLPAR) { /* do all pending ops, back to left paren */ dnum=PopNum(); acc=PopNum(); switch (lastop) { case kADD: acc += dnum; break; case kSUB: acc -= dnum; break; case kMUL: acc *= dnum; break; case kDIV: acc /= dnum; break; case kPOW: acc = pow(acc,dnum); break; } dnum=acc; PushNum(dnum); } (void) PopNum(); flagPAREN--; entered=2; snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); DrawDisplay(); } void drgf(void) { if (flagINV) { if (entered==1) parse_double(dispstr,"%lf",&dnum); switch (drgmode) { case DEG: dnum=dnum*M_PI/180.0; break; case RAD: dnum=dnum*200.0/M_PI; break; case GRAD: dnum=dnum*90.0/100.0; break; } entered=2; clrdisp=1; flagINV=0; snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); } flagINV=0; drgmode = (drgmode + 1) % 3; switch (drgmode) { case DEG: drg2rad=M_PI / 180.0; rad2drg=180.0 / M_PI; break; case RAD: drg2rad=1.0; rad2drg=1.0; break; case GRAD: drg2rad=M_PI / 200.0; rad2drg=200.0 / M_PI; break; } DrawDisplay(); } void invf(void) { flagINV = ~flagINV; DrawDisplay(); } void memf(int keynum) { memop = keynum; if (entered==1) parse_double(dispstr,"%lf",&dnum); entered = 2; clrdisp++; lift_enabled = 0; } void oneop(int keynum) { int i,j; double dtmp; if (entered==1) parse_double(dispstr,"%lf",&dnum); entered = 2; switch (keynum) { /* do the actual math fn. */ case kE: if (rpn && memop != kENTR) PushNum(dnum); dnum=M_E; break; case kPI: if (rpn && memop != kENTR) PushNum(dnum); dnum=M_PI; break; case kRECIP: dnum=1.0/dnum; break; case kSQR: flagINV = !flagINV; /* fall through to */ case kSQRT: if (flagINV) dnum=dnum*dnum; else dnum=sqrt(dnum); break; case k10X: flagINV = !flagINV; /* fall through to */ case kLOG: if (flagINV) dnum=pow(10.0,dnum); else dnum=log10(dnum); break; case kEXP: flagINV = !flagINV; /* fall through to */ case kLN: if (flagINV) dnum=exp(dnum); else dnum=log(dnum); break; case kSIN: if (flagINV) dnum=asin(dnum)*rad2drg; else dnum=sin(dnum*drg2rad); break; case kCOS: if (flagINV) dnum=acos(dnum)*rad2drg; else dnum=cos(dnum*drg2rad); break; case kTAN: if (flagINV) dnum=atan(dnum)*rad2drg; else dnum=tan(dnum*drg2rad); break; case kSTO: mem[0]=dnum; flagM=!(mem[0]==0.0); break; case kRCL: if (rpn && lift_enabled) PushNum(dnum); dnum=mem[0]; flagM=!(mem[0]==0.0); break; case kSUM: mem[0]+=dnum; flagM=!(mem[0]==0.0); break; case kEXC: dtmp=dnum; dnum=mem[0]; mem[0]=dtmp; flagM=!(mem[0]==0.0); break; case kFACT: if (floor(dnum)!=dnum || dnum<0.0 || dnum>500.0) { strlcpy(dispstr, "error", sizeof(dispstr)); entered=3; break; } dtmp = floor(dnum); i = dtmp; for (j=1,dnum=1.0; j<=i; j++) dnum*=(float) j; break; } if (entered==3) { /* error */ DrawDisplay(); return; } memop = keynum; entered=2; clrdisp=1; flagINV=0; lift_enabled = 1; snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); DrawDisplay(); } void offf(void) { /* full reset */ int i; ResetCalc(); entered=clrdisp=1; lift_enabled = 0; dnum=mem[0]=0.0; if (rpn) for (i=1; i < XCALC_MEMORY; i++) mem[i]=0.0; exponent=Dpoint=0; DrawDisplay(); } #define STACKMAX 32 static int opstack[STACKMAX]; static int opsp; static double numstack[STACKMAX]; static int numsp; /*******/ static void PushOp(int op) /*******/ { if (opsp==STACKMAX) { strlcpy(dispstr, "stack error", sizeof(dispstr)); entered=3; } else opstack[opsp++]=op; } /*******/ static int PopOp(void) /*******/ { if (opsp==0) { strlcpy(dispstr, "stack error", sizeof(dispstr)); entered=3; return(kNOP); } else return(opstack[--opsp]); } /*******/ static int isopempty(void) /*******/ { return( opsp ? 0 : 1 ); } #ifdef DEBUG static void showstack(char *string) { fprintf(stderr, "%s: %lf %lf %lf\n", string, numstack[0], numstack[1], numstack[2]); } #endif /*******/ static void PushNum(double num) /*******/ { if (rpn) { numstack[2] = numstack[1]; numstack[1] = numstack[0]; numstack[0] = num; return; } if (numsp==STACKMAX) { strlcpy(dispstr, "stack error", sizeof(dispstr)); entered=3; } else numstack[numsp++]=num; } /*******/ static double PopNum(void) /*******/ { if (rpn) { double tmp = numstack[0]; numstack[0] = numstack[1]; numstack[1] = numstack[2]; return(tmp); } if (numsp==0) { strlcpy(dispstr, "stack error", sizeof(dispstr)); entered=3; return 0.0; } else return(numstack[--numsp]); } /*******/ static void RollNum(int dir) /*******/ { double tmp; if (dir) { /* roll up */ tmp = dnum; dnum = numstack[2]; numstack[2] = numstack[1]; numstack[1] = numstack[0]; numstack[0] = tmp; } else { /* roll down */ tmp = dnum; dnum = numstack[0]; numstack[0] = numstack[1]; numstack[1] = numstack[2]; numstack[2] = tmp; } } /*******/ static void ClearStacks(void) /*******/ { if (rpn) numstack[0] = numstack[1] = numstack[2] = 0.; opsp=numsp=0; } /*******/ static int priority(int op) /*******/ { switch (op) { case kPOW: return(2); case kMUL: case kDIV: return(1); case kADD: case kSUB: return(0); } return 0; } /********/ void ResetCalc(void) /********/ { flagM=flagINV=flagPAREN=0; drgmode=DEG; setflag(XCalc_MEMORY, False); setflag(XCalc_INVERSE, False); setflag(XCalc_PAREN, False); setflag(XCalc_RADIAN, False); setflag(XCalc_GRADAM, False); setflag(XCalc_DEGREE, True); strlcpy(dispstr, "0", sizeof(dispstr)); draw(dispstr); ClearStacks(); drg2rad=M_PI/180.0; rad2drg=180.0/M_PI; } x11-apps-7.7+5+nmu1ubuntu1/xcalc/config.h.in0000664000000000000000000000326312656634627015333 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION x11-apps-7.7+5+nmu1ubuntu1/xcalc/man/0000775000000000000000000000000012656635743014057 5ustar x11-apps-7.7+5+nmu1ubuntu1/xcalc/man/xcalc.man0000664000000000000000000003555712457363403015653 0ustar .\" t .\" Copyright (c) 1994 X Consortium .\" .\" Permission is hereby granted, free of charge, to any person obtaining .\" a copy of this software and associated documentation files (the .\" "Software"), to deal in the Software without restriction, including .\" without limitation the rights to use, copy, modify, merge, publish, .\" distribute, sublicense, and/or sell copies of the Software, and to .\" permit persons to whom the Software is furnished to do so, subject to .\" the following conditions: .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of the X Consortium shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from the X Consortium. .\" .\" .de EX \"Begin example .ne 5 .if n .sp 1 .if t .sp .5 .nf .in +.5i .. .de EE .fi .in -.5i .if n .sp 1 .if t .sp .5 .. .TH XCALC 1 __xorgversion__ .SH NAME xcalc \- scientific calculator for X .SH SYNOPSIS .B xcalc [-stipple] [-rpn] [-\fItoolkitoption...\fP] .SH DESCRIPTION .I xcalc is a scientific calculator desktop accessory that can emulate a TI-30 or an HP-10C. .SH OPTIONS .PP \fIxcalc\fP accepts all of the standard toolkit command line options along with two additional options: .PP .TP 8 .B \-stipple This option indicates that the background of the calculator should be drawn using a stipple of the foreground and background colors. On monochrome displays improves the appearance. .PP .TP 8 .B \-rpn This option indicates that Reverse Polish Notation should be used. In this mode the calculator will look and behave like an HP-10C. Without this flag, it will emulate a TI-30. .SH OPERATION .PP .I Pointer Usage: Operations may be performed with pointer button 1, or in some cases, with the keyboard. Many common calculator operations have keyboard accelerators. To quit, press pointer button 3 on the AC key of the TI calculator, or the ON key of the HP calculator. .PP .I Calculator Key Usage (TI mode): The numbered keys, the +/- key, and the +, -, *, /, and = keys all do exactly what you would expect them to. It should be noted that the operators obey the standard rules of precedence. Thus, entering "3+4*5=" results in "23", not "35". The parentheses can be used to override this. For example, "(1+2+3)*(4+5+6)=" results in "6*15=90". .PP The entire number in the calculator display can be selected, in order to paste the result of a calculation into text. .PP The action procedures associated with each function are given below. These are useful if you are interested in defining a custom calculator. The action used for all digit keys is \fBdigit(\fIn\fP)\fR, where \fIn\fR is the corresponding digit, 0..9. .TP 10 .B 1/x Replaces the number in the display with its reciprocal. The corresponding action procedure is \fBreciprocal()\fR. .TP 10 .B x^2 Squares the number in the display. The corresponding action procedure is \fBsquare()\fR. .TP 10 .B SQRT Takes the square root of the number in the display. The corresponding action procedure is \fBsquareRoot()\fR. .TP 10 .B CE/C When pressed once, clears the number in the display without clearing the state of the machine. Allows you to re-enter a number if you make a mistake. Pressing it twice clears the state, also. The corresponding action procedure for TI mode is \fBclear()\fR. .TP 10 .B AC Clears the display, the state, and the memory. Pressing it with the third pointer button turns off the calculator, in that it exits the program. The action procedure to clear the state is \fBoff()\fR; to quit, \fBquit()\fR. .TP 10 .B INV Invert function. See the individual function keys for details. The corresponding action procedure is \fBinverse()\fR. .TP 10 .B sin Computes the sine of the number in the display, as interpreted by the current DRG mode (see DRG, below). If inverted, it computes the arcsine. The corresponding action procedure is \fBsine()\fR. .TP 10 .B cos Computes the cosine, or arccosine when inverted. The corresponding action procedure is \fBcosine()\fP. .TP 10 .B tan Computes the tangent, or arctangent when inverted. The corresponding action procedure is \fBtangent()\fP. .TP 10 .B DRG Changes the DRG mode, as indicated by 'DEG', 'RAD', or 'GRAD' at the bottom of of the calculator ``liquid crystal'' display. When in 'DEG' mode, numbers in the display are taken as being degrees. In 'RAD' mode, numbers are in radians, and in 'GRAD' mode, numbers are in grads. When inverted, the DRG key has a feature of converting degrees to radians to grads and vice-versa. Example: put the calculator into 'DEG' mode, and enter "45 INV DRG". The display should now show something along the lines of ".785398", which is 45 degrees converted to radians. The corresponding action procedure is \fBdegree()\fP. .TP 10 .B e The constant 'e'. (2.7182818...). The corresponding action procedure is \fBe()\fR. .TP 10 .B EE Used for entering exponential numbers. For example, to get "-2.3E-4" you'd enter "2 . 3 +/- EE 4 +/-". The corresponding action procedure is \fBscientific()\fR. .TP 10 .B log Calculates the log (base 10) of the number in the display. When inverted, it raises "10.0" to the number in the display. For example, entering "3 INV log" should result in "1000". The corresponding action procedure is \fBlogarithm()\fP. .TP 10 .B ln Calculates the log (base e) of the number in the display. When inverted, it raises "e" to the number in the display. For example, entering "e ln" should result in "1". The corresponding action procedure is \fBnaturalLog()\fR. .TP 10 .B y^x Raises the number on the left to the power of the number on the right. For example "2 y^x 3 =" results in "8", which is 2^3. For a further example, "(1+2+3) y^x (1+2) =" equals "6 y^x 3" which equals "216". The corresponding action procedure is \fBpower()\fR. .TP 10 .B PI The constant 'pi'. (3.1415927....) The corresponding action procedure is \fBpi()\fR. .TP 10 .B x! Computes the factorial of the number in the display. The number in the display must be an integer in the range 0-500, though, depending on your math library, it might overflow long before that. The corresponding action procedure is \fBfactorial()\fR. .TP 10 .B ( Left parenthesis. The corresponding action procedure for TI calculators is \fBleftParen()\fR. .TP 10 .B ) Right parenthesis. The corresponding action procedure for TI calculators is \fBrightParen()\fR. .TP 10 .B / Division. The corresponding action procedure is \fBdivide()\fR. .TP 10 .B * Multiplication. The corresponding action procedure is \fBmultiply()\fR. .TP 10 .B - Subtraction. The corresponding action procedure is \fBsubtract()\fR. .TP 10 .B + Addition. The corresponding action procedure is \fBadd()\fR. .TP 10 .B = Perform calculation. The TI-specific action procedure is \fBequal()\fR. .TP 10 .B STO Copies the number in the display to the memory location. The corresponding action procedure is \fBstore()\fR. .TP 10 .B RCL Copies the number from the memory location to the display. The corresponding action procedure is \fBrecall()\fR. .TP 10 .B SUM Adds the number in the display to the number in the memory location. The corresponding action procedure is \fBsum()\fR. .TP 10 .B EXC Swaps the number in the display with the number in the memory location. The corresponding action procedure for the TI calculator is \fBexchange()\fR. .TP 10 .B +/- Negate; change sign. The corresponding action procedure is \fBnegate()\fR. .TP 10 .B . Decimal point. The action procedure is \fBdecimal()\fP. .sp .PP .I Calculator Key Usage (RPN mode): The number keys, CHS (change sign), +, -, *, /, and ENTR keys all do exactly what you would expect them to do. Many of the remaining keys are the same as in TI mode. The differences are detailed below. The action procedure for the ENTR key is \fBenter()\fR. .sp .TP 10 .B <- This is a backspace key that can be used if you make a mistake while entering a number. It will erase digits from the display. (See BUGS). Inverse backspace will clear the X register. The corresponding action procedure is \fBback()\fR. .TP 10 .B ON Clears the display, the state, and the memory. Pressing it with the third pointer button turns off the calculator, in that it exits the program. To clear state, the action procedure is \fBoff\fR; to quit, \fBquit()\fR. .TP 10 .B INV Inverts the meaning of the function keys. This would be the \fIf\fR key on an HP calculator, but \fIxcalc\fR does not display multiple legends on each key. See the individual function keys for details. .TP 10 .B 10^x Raises "10.0" to the number in the top of the stack. When inverted, it calculates the log (base 10) of the number in the display. The corresponding action procedure is \fBtenpower()\fR. .TP 10 .B e^x Raises "e" to the number in the top of the stack. When inverted, it calculates the log (base e) of the number in the display. The action procedure is \fBepower()\fR. .TP 10 .B STO Copies the number in the top of the stack to a memory location. There are 10 memory locations. The desired memory is specified by following this key with a digit key. .TP 10 .B RCL Pushes the number from the specified memory location onto the stack. .TP 10 .B SUM Adds the number on top of the stack to the number in the specified memory location. .TP 10 .B x:y Exchanges the numbers in the top two stack positions, the X and Y registers. The corresponding action procedure is \fBXexchangeY()\fR. .TP 10 .B R v Rolls the stack downward. When inverted, it rolls the stack upward. The corresponding action procedure is \fBroll()\fR. .TP 10 .I blank These keys were used for programming functions on the HP-10C. Their functionality has not been duplicated in \fIxcalc\fR. .PP Finally, there are two additional action procedures: \fBbell()\fR, which rings the bell; and \fBselection()\fR, which performs a cut on the entire number in the calculator's ``liquid crystal'' display. .SH ACCELERATORS .PP Accelerators are shortcuts for entering commands. \fIxcalc\fP provides some sample keyboard accelerators; also users can customize accelerators. The numeric keypad accelerators provided by \fIxcalc\fP should be intuitively correct. The accelerators defined by \fIxcalc\fP on the main keyboard are given below: .PP .TS l l l l l. TI Key HP Key Keyboard Accelerator TI Function HP Function _ SQRT SQRT r squareRoot() squareRoot() AC ON space clear() clear() AC <- Delete clear() back() AC <- Backspace clear() back() AC <- Control-H clear() back() AC Clear clear() AC ON q quit() quit() AC ON Control-C quit() quit() INV i i inverse() inverse() sin s s sine() sine() cos c c cosine() cosine() tan t t tangent() tangent() DRG DRG d degree() degree() e e e() ln ln l naturalLog() naturalLog() y^x y^x ^ power() power() PI PI p pi() pi() x! x! ! factorial() factorial() ( ( leftParen() ) ) rightParen() / / / divide() divide() * * * multiply() multiply() - - - subtract() subtract() + + + add() add() \&= \&= equal() 0..9 0..9 0..9 digit() digit() . . . decimal() decimal() +/- CHS n negate() negate() x:y x XexchangeY() ENTR Return enter() ENTR Linefeed enter() .TE .PP .SH CUSTOMIZATION The application class name is XCalc. .PP \fIxcalc\fP has an enormous application defaults file which specifies the position, label, and function of each key on the calculator. It also gives translations to serve as keyboard accelerators. Because these resources are not specified in the source code, you can create a customized calculator by writing a private application defaults file, using the Athena Command and Form widget resources to specify the size and position of buttons, the label for each button, and the function of each button. .PP The foreground and background colors of each calculator key can be individually specified. For the TI calculator, a classical color resource specification might be: .sp .br XCalc.ti.Command.background: gray50 .br XCalc.ti.Command.foreground: white .sp For each of buttons 20, 25, 30, 35, and 40, specify: .br XCalc.ti.button20.background: black .br XCalc.ti.button20.foreground: white .sp For each of buttons 22, 23, 24, 27, 28, 29, 32, 33, 34, 37, 38, and 39: .br XCalc.ti.button22.background: white .br XCalc.ti.button22.foreground: black .SH WIDGET HIERARCHY In order to specify resources, it is useful to know the hierarchy of the widgets which compose \fIxcalc\fR. In the notation below, indentation indicates hierarchical structure. The widget class name is given first, followed by the widget instance name. .nf .ft CW XCalc xcalc Form ti \fIor\fR hp \fI(the name depends on the mode)\fR Form bevel Form screen Label M Toggle LCD Label INV Label DEG Label RAD Label GRAD Label P Command button1 Command button2 Command button3 \fIand so on, ...\fR Command button38 Command button39 Command button40 .ft .fi .SH APPLICATION RESOURCES .PP .TP 8 \fBrpn\fR (Class \fBRpn\fR) Specifies that the rpn mode should be used. The default is TI mode. .TP 8 \fBstipple\fR (Class \fBStipple\fR) Indicates that the background should be stippled. The default is ``on'' for monochrome displays, and ``off'' for color displays. .TP 8 \fBcursor\fR (Class \fBCursor\fR) The name of the symbol used to represent the pointer. The default is ``hand2''. .fi .SH COLORS If you would like xcalc to use its ti colors, include the following in the #ifdef COLOR section of the file you read with xrdb: .sp 1 *customization: -color .sp 1 .br This will cause xcalc to pick up the colors in the app-defaults color customization file: .IR __apploaddir__/XCalc-color . .fi .SH "SEE ALSO" X(__miscmansuffix__), xrdb(__appmansuffix__), the Athena Widget Set .SH BUGS .PP HP mode is not completely debugged. In particular, the stack is not handled properly after errors. .SH COPYRIGHT Copyright 1994 X Consortium .br See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHORS John Bradley, University of Pennsylvania .br Mark Rosenstein, MIT Project Athena .br Donna Converse, MIT X Consortium .\" -------------------------------------------------------------------- .\" Emacs settings .\" -------------------------------------------------------------------- .\" Local Variables: .\" mode: nroff .\" tab-width: 15 .\" End: x11-apps-7.7+5+nmu1ubuntu1/xcalc/man/Makefile.am0000664000000000000000000000052312457363403016101 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = xcalc.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/xcalc/config.sub0000775000000000000000000010622312514123564015255 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-12-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xcalc/Makefile.am0000664000000000000000000000326212457363403015331 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = xcalc AM_CFLAGS = $(XCALC_CFLAGS) $(CWARNFLAGS) xcalc_LDADD = $(XCALC_LIBS) -lm xcalc_SOURCES = \ actions.c \ math.c \ xcalc.c \ xcalc.h # App default files (*.ad) DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ dist_appdefault_DATA = \ app-defaults/XCalc \ app-defaults/XCalc-color MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xcalc/missing0000755000000000000000000001533012656634627014703 0ustar #! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xcalc/configure.ac0000664000000000000000000000431712457363403015565 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xcalc], [1.0.6], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xcalc]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS AC_CHECK_FUNCS([strlcpy]) # Checks for pkg-config packages PKG_CHECK_MODULES(XCALC, [xaw7 xt x11 xproto >= 7.0.17]) PKG_CHECK_MODULES(APPDEFS, xt) xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` AC_ARG_WITH(appdefaultdir, AS_HELP_STRING([--with-appdefaultdir=], [specify directory for app-defaults files (default is autodetected)]), [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xcalc/README0000664000000000000000000000130612457363403014152 0ustar xcalc is a scientific calculator X11 client that can emulate a TI-30 or an HP-10C. All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xcalc http://cgit.freedesktop.org/xorg/app/xcalc For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xcalc/COPYING0000664000000000000000000000457612457363403014341 0ustar Copyright (c) 1989, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ------------------------------------------------------------------------------ Copyright 2005 Red Hat, Inc. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Red Hat not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Red Hat makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. x11-apps-7.7+5+nmu1ubuntu1/xcalc/INSTALL0000664000000000000000000003660012457363426014335 0ustar Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/debian/0000775000000000000000000000000012656636250013426 5ustar x11-apps-7.7+5+nmu1ubuntu1/debian/changelog0000664000000000000000000005165112656636245015314 0ustar x11-apps (7.7+5+nmu1ubuntu1) xenial; urgency=medium * Build using -O2 on ppc64el; working around a -Werror=array-bounds build error. LP: #1544053. -- Matthias Klose Wed, 10 Feb 2016 14:31:09 +0100 x11-apps (7.7+5+nmu1) unstable; urgency=medium * Non-maintainer upload. * Change libpng12-dev build-dependency to libpng-dev, to ease libpng transition. (Closes: #662554) -- Gianfranco Costamagna Thu, 21 Jan 2016 18:42:28 +0100 x11-apps (7.7+5) unstable; urgency=medium * bitmap 1.0.8. * x11perf 1.6.0. * xcalc 1.0.6. * xditview 1.0.4. * xedit 1.2.2. * xgc 1.0.5. * xmag 1.0.6. * xman 1.1.4. * Remove cpp from Depends (closes: #778804). * Bump debhelper compat level to 9. -- Julien Cristau Thu, 30 Apr 2015 23:57:18 +0200 x11-apps (7.7+4) unstable; urgency=medium * Use man -l instead of trying to do man's job badly, and failing to find zsoelim because it's been moved out of $PATH (closes: #764792). Thanks to Lee Cremeans for the report and to Colin Watson for suggesting a fix. * Start using dh-autoreconf since we need to patch the build system. -- Julien Cristau Sat, 08 Nov 2014 11:21:37 +0000 x11-apps (7.7+3) unstable; urgency=medium * Delete debian/xsfbs/, not used anymore. * Update debian/copyright. * Allow uscan (through debian/rules get-tarballs) to verify tarball signatures by adding the pgpsigurlmangle option to watch files and shipping debian/upstream/signing-key.asc. * xcursorgen 1.0.6. -- Julien Cristau Sat, 12 Jul 2014 18:13:40 +0200 x11-apps (7.7+2) unstable; urgency=medium * xclipboard 1.1.3 * xclock 1.0.7 * xman 1.1.3 * Use dh. * Disable silent build rules. * Remove Cyril from Uploaders. -- Julien Cristau Wed, 25 Dec 2013 18:39:25 +0100 x11-apps (7.7+1) unstable; urgency=low [ Robert Hooker ] * Add transset to conflicts/replaces to fix upgrades. * Add rendercheck to x11-apps. * ico 1.0.4 * xcalc 1.0.5 * xconsole 1.0.5 * xditview 1.0.3 * xedit 1.2.1 * xgc 1.0.4 * xmag 1.0.5 * bitmap 1.0.7 * transset 1.0.1 * Add an update-copyright target to refresh debian/copyright using upstream's COPYING files, thanks to Julien Cristau. * Refresh copyright. [ Julien Cristau ] * xconsole 1.0.6. * xload 1.1.2. * xwd 1.0.6 * Add build-dep on bison to make xgc's configure happy. -- Julien Cristau Tue, 13 Aug 2013 12:50:41 +0200 x11-apps (7.7~2) unstable; urgency=low * Team upload. * Add transset 1.0.0 * Bump Standards-Version to 3.9.3 (no changes). -- Arnaud Fontaine Thu, 07 Jun 2012 19:23:30 +0900 x11-apps (7.7~1) unstable; urgency=low [ Robert Hooker ] * Fix recommends. Previously it was recommending xbitmap which didn't exist, the package is xbitmaps. * oclock 1.0.3 * x11perf 1.5.4 * xclipboard 1.1.2 * xclock 1.0.6 * xwd 1.0.5 * bitmap 1.0.6 * xcursorgen 1.0.5 * xload 1.1.1 * xlogo 1.0.4 * xwud 1.0.4 * Drop oclock-ftbfs.diff, upstream. [ Julien Cristau ] * Update build-dep list and comments. * Drop dh_testroot from debian/rules clean. -- Julien Cristau Mon, 30 Apr 2012 16:35:36 +0200 x11-apps (7.6+5) unstable; urgency=low [ Julien Viard de Galbert ] * Fix oclock build by linking against against libXt explicitly. * Updating package description & recommends (#550308). [ Cyril Brulebois ] * xman 1.1.2 * Bump Standards-Version to 3.9.2 (no changes). -- Cyril Brulebois Sat, 02 Jul 2011 20:19:56 +0200 x11-apps (7.6+4) unstable; urgency=low * debian/rules::get-tarballs: pass "--destdir ." to uscan * xbiff 1.0.3. * Remove Brice Goglin and David Nusinow from Uploaders. Thanks for your work! * Drop Pre-Depends on x11-common. * Bump Standards-Version to 3.9.1. * Upload to unstable. -- Julien Cristau Wed, 09 Feb 2011 18:15:58 +0100 x11-apps (7.6+3) experimental; urgency=low * New upstream releases: - x11perf 1.5.3 - xcalc 1.0.4.1 - xeyes 1.1.1 -- Cyril Brulebois Wed, 12 Jan 2011 16:13:38 +0100 x11-apps (7.6+2) experimental; urgency=low [ Julien Cristau ] * Drop 03_xconsole_implicit_pointer_conversion.diff, doesn't seem needed anymore. * 02_xedit_manpage_typos.diff was applied upstream in 1.2.0, drop it from the source package (it wasn't getting applied anyway). [ Cyril Brulebois ] * xclipboard 1.1.1 * xwd 1.0.4 * xwud 1.0.3 -- Cyril Brulebois Fri, 12 Nov 2010 17:29:48 +0100 x11-apps (7.6+1) experimental; urgency=low [ Robert Hooker ] * New upstream releases: - bitmap 1.0.5 - ico 1.0.3 - oclock 1.0.2 - x11perf 1.5.2 - xclock 1.0.5 - xconsole 1.0.4 - xcursorgen 1.0.4 - xditview 1.0.2 - xedit 1.2.0 - xgc 1.0.3 - xload 1.1.0 - xlogo 1.0.3 - xmag 1.0.4 - xman 1.1.1 - xmore 1.0.2 [ Cyril Brulebois ] * Add xutils-dev build-dep for the macros. * Update debian/copyright from upstream's COPYING files. * Drop --with-sysmanpath and --disable-xprint, they're gone. * Stop setting RSH=rsh, it's not used anymore apparently. * Add myself to Uploaders. -- Cyril Brulebois Tue, 02 Nov 2010 22:45:08 +0100 x11-apps (7.5+5) unstable; urgency=low [ Julien Cristau ] * Autoreconf xedit with the patch from 7.5+3 applied. Really closes: #569430. [ Brice Goglin ] * Add missing file renames to 01_xedit_mkdir_races.diff. * Bump Standards-Version to 3.8.4, no changes. -- Brice Goglin Sun, 21 Mar 2010 10:18:52 +0100 x11-apps (7.5+4) unstable; urgency=low [ Steve Langasek ] * Since we have xedit again, drop the conffile removal handling from the maintainer scripts. LP: #518045. -- Julien Cristau Sat, 13 Mar 2010 00:25:15 +0100 x11-apps (7.5+3) unstable; urgency=low * Add 01_xedit_mkdir_races.diff to fix FTBFS, closes: #569430. -- Brice Goglin Tue, 23 Feb 2010 21:51:06 +0100 x11-apps (7.5+2) unstable; urgency=low [ Brice Goglin ] * Update debian/copyright and package description according to ico and xedit additions. * x11pref 1.5.1. * xbiff 1.0.2. * xcalc 1.0.3. * xeyes 1.1.0. * xlogo 1.0.2. [ Julien Cristau ] * Rename the build directory to not include DEB_BUILD_GNU_TYPE for no good reason. Thanks, Colin Watson! * Remove myself from Uploaders -- Brice Goglin Sun, 07 Feb 2010 11:22:59 +0100 x11-apps (7.5+1) unstable; urgency=low [ Julien Cristau ] * Update xload config.{guess,sub}, adding avr32 support (closes: #536410) * Improve the long description using patch from Justin B Rye (closes: #549457). Thanks! [ Brice Goglin ] * Add ico 1.0.2, closes: #518383. * bitmap 1.0.4. * xclipboard 1.1.0. + Add UTF8 support, closes: #489998. * xclock 1.0.4. + Drop 06_xclock_geometry.diff, applied upstream. * xcursorgen 1.0.3. * xeyes 1.0.991. * xgc 1.0.2. * xmag 1.0.3. * xman 1.1.0. * xwd 1.0.3. + Drop 01_xwd_do_not_spew_usage_on_connection_error.diff, applied upstream. * xwud 1.0.2. * Refresh patches. -- Brice Goglin Sun, 06 Dec 2009 12:23:46 +0100 x11-apps (7.4+2) unstable; urgency=low * Add xedit 1.1.2, closes: #499085, #505064. * Bump Standards-Version to 3.8.2, no changes. -- Brice Goglin Mon, 27 Jul 2009 18:55:03 +0200 x11-apps (7.4+1) unstable; urgency=low [ Brice Goglin ] * xwd 1.0.2. [ Julien Cristau ] * Add support for parallel=n in DEB_BUILD_OPTIONS, and for actually building the apps in parallel. Install is still sequential, at least for now. * xload 1.0.2 + drop patch 04_SECURITY_setuid.diff, included upstream. * Add README.source, bump Standards-Version to 3.8.1. * Fix patches to apply with -p1; silences lintian. -- Julien Cristau Wed, 10 Jun 2009 15:30:56 +0200 x11-apps (7.3+4) unstable; urgency=low * Remove xedit from the package, it's unmaintained and broken (closes: #321434). * Remove xedit's conffiles on upgrade. -- Julien Cristau Tue, 23 Sep 2008 00:24:45 +0200 x11-apps (7.3+3) unstable; urgency=low * xclock: Fix geometry computation (closes: #443227). * debian/rules, xsfbs: fix rules dependencies. -- Julien Cristau Sat, 02 Aug 2008 18:45:33 +0200 x11-apps (7.3+2) unstable; urgency=low [ Julien Cristau ] * Re-add bitmap (closes: #445097). * x11perf 1.5 * drop -1 debian revisions from build-deps * bump Standards-Version to 3.7.3 * don't call dh_makeshlibs * drop XS- prefix from Vcs-* control fields [ Brice Goglin ] * Re-add xgc (closes: #460453). -- Julien Cristau Tue, 10 Jun 2008 16:35:24 +0200 x11-apps (7.3+1) unstable; urgency=low [ Julien Cristau ] * xclock 1.0.3. + adds documentation for the -face command-line option (closes: #224402) * xman 1.0.3. * xmag 1.0.2. + manpage fixed (closes: #180712). * Pass --with-sysmanpath option to configure so xman looks for manpages in the right place (closes: #156497). [ Brice Goglin ] * Add upstream URL to debian/copyright. * Add menu entries for oclock, xbiff, xcalc, xclipboard, xclock, xconsole, xditview, xeyes, xedit, xload, xlogo, xmag, xman and xwd. * xcalc 1.0.2. * xconsole 1.0.3. * xcursorgen 1.0.2. * Add myself to Uploaders, and remove Branden with his permission. -- Brice Goglin Fri, 14 Sep 2007 23:14:57 +0200 x11-apps (0.1) experimental; urgency=low [ Timo Aaltonen ] * Split xbase-clients, new versioning. * Included packages: - oclock 1.0.1 - x11perf 1.4.1 - xbiff 1.0.1 - xcalc 1.0.1 - xclipboard 1.0.1 - xclock 1.0.2 - xconsole 1.0.2 - xcursorgen 1.0.1 - xditview 1.0.1 - xedit 1.0.2 - xeyes 1.0.1 - xload 1.0.1 - xlogo 1.0.1 - xmag 1.0.1 - xman 1.0.2 - xmore 1.0.1 - xwd 1.0.1 - xwud 1.0.1 * debian/control: - Rename Package and Source. - Remove unnecessary Build-Deps. - Split the Build-Dep line into multiple lines - Clean up the description. - Replaces: xbase-clients (<= 1:7.2.ds2-3) to make upgrades smoother. - C/R: to work around old Ubuntu packaging. * debian/copyright: Leave only copyright notices that affect this package. * debian/x11-apps.dirs: Remove. * debian/x11-apps.install, rules: Edit to reflect new packaging. * debian/local/: Remove. * debian/patches: - Delete patches which do not concern this package. - Edit 01_xwd_do_not_spew_usage_on_connection_error.diff to patch only xwd. -- Julien Cristau Sun, 27 May 2007 19:30:49 +0200 xbase-clients (1:7.2.ds2-3) unstable; urgency=low * Add patch to xsm's configure.ac to not override the user-provided RSH variable, so we can drop the openssh build-dep (closes: #362787). -- Julien Cristau Wed, 09 May 2007 16:26:06 +0200 xbase-clients (1:7.2.ds2-2) unstable; urgency=low [ Julien Cristau ] * Autoreconf with patches applied. * Add build-dep on libxinerama-dev, so xdpyinfo is built with support for the xinerama extension. * Add patch 17_xmodmap_manpage.diff to make xmodmap(1) refer to /usr/share/X11/XKeysymDB instead of /usr/lib/X11/XKeysymDB (closes: #394077). Thanks, Joachim Breitner! * Document each app's build-dependencies in debian/control for reference. * Update long description: XKB configuration data is in xkb-data, bitmap images in xbitmaps. * Add XS-Vcs-* in debian/control. * Upload to unstable. [ Brice Goglin ] * Restore Depends: on cpp (got lost during modularization) since xrdb needs it to process .Xdefaults. Thanks Marcus C. Gottwald (closes: #413298). * Remove mention of xf86cfg in package description. Thanks Daniel Leidert (really closes: #362066). -- Julien Cristau Fri, 20 Apr 2007 22:00:14 +0200 xbase-clients (1:7.2.ds2-1) experimental; urgency=low * Update to xrandr 1.2.0. * Build-dep on libxrandr 1.2.0. * New patch to install beforelight's app-defaults file correctly. -- Julien Cristau Mon, 19 Feb 2007 10:46:11 +0100 xbase-clients (1:7.2.ds1-2) experimental; urgency=low * Build-dep on libpng12-dev instead of libpng-dev. xcursorgen requires libpng12.pc, which is not available in libpng14-dev, despite it providing libpng-dev and libpng12-dev, *sigh*. -- Julien Cristau Mon, 12 Feb 2007 05:35:18 +0100 xbase-clients (1:7.2.ds1-1) experimental; urgency=low * Patch setxkbmap(1) to refer to the correct location for xkb files, thanks to Celejar for noticing. * Update to appres 1.0.1. * Update to beforelight 1.0.2. * Update to bitmap 1.0.3. * Update to editres 1.0.3. * Update to setxkbmap 1.0.3. * Update to xauth 1.0.2. * Update to xdbedizzy 1.0.2. + patch 16_xdbedizzy_fix_crash.diff dropped, included upstream. + patch pkgconfig_naughtiness dropped, now unnecessary. * Update to xedit 1.0.2. * Update to xev 1.0.2. * Update to xf86dga 1.0.2. + relevant part dropped from 14_SECURITY_setuid.diff. * Update to xfontsel 1.0.2. * Update to xinit 1.0.3. + relevant part dropped from 14_SECURITY_setuid.diff. * Update to xkbcomp 1.0.3. * Update to xlsfonts 1.0.2. * Update to xmodmap 1.0.2. * Update to xprop 1.0.2. * Update to xrdb 1.0.3. * Update to xsetpointer 1.0.1. + Add build-dep on x11proto-input-dev >= 1.4. * Update to xtrap 1.0.2. * Modify patch 08_xlsfonts_do_not_spew_usage_on_connection_error.diff to apply to xprop, xwd and xwininfo as well, since they all use a copy of dsimple.c. * Change my email address in debian/control. -- Julien Cristau Sun, 11 Feb 2007 15:42:54 +0100 xbase-clients (1:7.1.ds1-2) unstable; urgency=low * Add patch by Eugene Konev to fix xdbedizzy crash (closes: #365291). -- Julien Cristau Fri, 12 Jan 2007 17:54:07 +0100 xbase-clients (1:7.1.ds1-1) unstable; urgency=low * Add patch by Eugene Konev to fix xmore crash (closes: #365292). * Remove version string from subdirectory names, thus new tarball, and update patches to match. * Define MANCONF when configuring xman, to make it look for man pages in the right path instead of in /usr/man (closes: 404757). * Remove Fabio from Uploaders with his permission, and add myself. -- Julien Cristau Mon, 8 Jan 2007 00:50:31 +0100 xbase-clients (1:7.1.ds-3) unstable; urgency=low [ Branden Robinson ] * Patch xprop to stop segfaulting when deleted atoms are requested. Committed upstream as git 47514347db811d002e7f3ca05d390565bc3ee5e5. (Closes: #197526) [ Denis Barbier ] * Acknowledge NMU, thanks dann frazier. (closes: #363198) * The rsh program is required to build xsm. Replace Build-Depends: ssh | rsh by Build-Depends: openssh-client | ssh * Fix debian/rules so that xkbcomp look for XKB files in /usr/share/X11/xkb. Thanks Steinar H. Gunderson (closes: #381884) All XKB related programs share now the same build system, so factor commands in debian/rules. -- Denis Barbier Sat, 12 Aug 2006 15:08:47 +0200 xbase-clients (1:7.1.ds-2.1) unstable; urgency=low * Non-maintainer upload. * Fix implicit pointer conversion in xconsole.c (closes: #363198) (Was fixed in 1:7.1.ds-1.1 NMU, but silently dropped in 1:7.1.ds-2 MU) -- dann frazier Sat, 29 Jul 2006 13:59:40 -0600 xbase-clients (1:7.1.ds-2) unstable; urgency=high * Security update. Fix for setuid privledge escalation vulernabilities in xinit, xf86dga, and xload. See http://lists.freedesktop.org/archives/xorg/2006-June/016146.html for the full advisory. This package applies the patches for the 7.0 release of those apps. -- David Nusinow Fri, 30 Jun 2006 01:10:17 -0400 xbase-clients (1:7.1.ds-1) unstable; urgency=low [ Steve Langasek ] * Drop broken build-dependency on xprint-utils, no thanks to anonymous someone. * Pass --disable-xprint to invocations of configure instead, which is the real fix for the symptoms described: we want the xbase-clients package to consistently build *without* xprint support, instead of autodetecting (and possibly failing) based on whether libxp-dev is installed. Properly closes: #366275. * Also call PKG_PROG_PKG_CONFIG explicitly from xdbebizzy's configure.ac, since otherwise --disable-xprint leaves us without PKG_CONFIG defined. [ David Nusinow ] * This update should include all the apps released with X11R7.1. Version the package to match this. * Update bitmap to 1.0.2 * Update xcursorgen to 1.0.1 * Autoreconf everything in order to ensure that manpages have the proper section * Update 11_xkb_documentation_updates.diff to not use __manpagesuffix__ imakeism * Bump standards version to 3.7.2.0 * Bump debhelper compat to 5 -- David Nusinow Sun, 11 Jun 2006 21:51:54 -0400 xbase-clients (1:7.0.1-2) unstable; urgency=low * Add xprint-utils to build-depends. Thanks anonymous someone. (closes: #366275) -- David Nusinow Sun, 14 May 2006 22:57:13 -0400 xbase-clients (1:7.0.1-1) unstable; urgency=low * Move xserverrc back to this package from xserver-xorg-core. Thanks Benjamin Mesing. (closes: #365022) * Update smproxy to version 1.0.2 * Update xhost to version 1.0.1 * Update fstobdf to version 1.0.2 * Update xdriinfo to version 1.0.1 * Update xinit to version 1.0.2 * Remove obsolete patch 03_startx_dummy.diff * Update xkbevd to version 1.0.2 * Update xman to version 1.0.2 * Update xrefresh to version 1.0.2 * Update xwininfo to version 1.0.2 * Update xclock to version 1.0.2 * Update xconsole to version 1.0.2 * Update xkbcomp to version 1.0.2 * Update xmodmap to version 1.0.1 * Update xrandr to version 1.0.2 * Update xrdb to version 1.0.2 * Update xset to version 1.0.2 -- David Nusinow Tue, 2 May 2006 22:58:57 -0400 xbase-clients (1:7.0.0-5) unstable; urgency=low * Patch startx so that it points to /etc/X11/xinit for xserverrc and xinitrc. Thanks Vasilis Vasaitis and Bastian Kleineidam. * Move xserverrc back to /etc/X11/xinit * Use --list-missing with dh_install -- David Nusinow Tue, 25 Apr 2006 21:37:22 -0400 xbase-clients (1:7.0.0-4) unstable; urgency=low * Add quilt to build-depends. -- David Nusinow Sat, 15 Apr 2006 19:49:02 -0400 xbase-clients (1:7.0.0-3) unstable; urgency=low * Remove mention of xorgconfig and xorgcfg in package description. Thanks Daniel Leidert. (closes: #362066) * Add 12_startx_paths.diff to use X11R7 paths for startx and xinit. Thanks Arjan Opmeer. (closes: #357713) * Add libxi-dev to build-depends * Make xbase-clients explicitly pre-depend on x11-common >= 1:7.0.0, rather than implicitly. Thanks Vasilis Vasaitis. (closes: #357713) -- David Nusinow Thu, 13 Apr 2006 22:39:46 -0400 xbase-clients (1:7.0.0-2) unstable; urgency=low * Upload to unstable * Add build-depends on libgl1-mesa-dev, versioned build-depneds on libdrender-dev, and re-version build-depend on libxft-dev. Thanks Frank Lichtenheld. (closes: #361821) -- David Nusinow Mon, 10 Apr 2006 19:49:23 -0400 xbase-clients (1:7.0.0-1) experimental; urgency=low [ Denis Barbier ] * Set XKB base path to /usr/share/X11/xkb. [ David Nusinow ] * Update to x11perf 1.4.1 and setxkbmap 1.0.2 upstream releases * Bump version number to match upstream's current katamari release -- David Nusinow Thu, 16 Mar 2006 23:06:15 -0500 xbase-clients (1:1.0.1-2) experimental; urgency=low * Add an empty /var/lib/xkb directory so that the server loads the correct keymaps. Thanks Silvestre Zabala, Eugene Konev, and Daniel Stone. (closes: #354130) * Port patches from trunk + general/014_startx_hostname_fix.diff + general/015_startx_dummy_fix.diff + general/073_xev_flush_standard_output.diff + general/025c_bitmap_manpage_typo.diff + general/025d_xedit_manpage_typos.diff + general/025e_xvinfo_manpage_typo.diff + general/099r_xlsfonts_do_not_spew_usage_on_connection_error.diff + debian/902_debian_startx_manpage.diff + debian/916_add_XKBPATH_env_variable.diff + general/051_xkb_documentation_updates.diff * Suggest mesa-utils, where glxinfo and glxgears have been moved. Thanks Mike Hommey. (closes: #354246) -- David Nusinow Sat, 4 Mar 2006 18:59:20 -0500 xbase-clients (1:1.0.1-1) experimental; urgency=low [ David Nusinow ] * First modular upload to Debian [ Eugene Konev ] * Divide packages that we process in debian/rules by category so we can pass the xkb packages the proper configure flags -- David Nusinow Sun, 19 Feb 2006 19:46:46 -0500 x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xmag0000664000000000000000000000024612360256363015407 0ustar #git=git://anongit.freedesktop.org/xorg/app/xmag version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xmag-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xditview0000664000000000000000000000025612360256363016317 0ustar #git=git://anongit.freedesktop.org/xorg/app/xditview version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xditview-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xcalc0000664000000000000000000000025012360256363015540 0ustar #git=git://anongit.freedesktop.org/xorg/app/xcalc version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xcalc-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xconsole0000664000000000000000000000025612360256363016306 0ustar #git=git://anongit.freedesktop.org/xorg/app/xconsole version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xconsole-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/upstream/0000775000000000000000000000000012360256453015261 5ustar x11-apps-7.7+5+nmu1ubuntu1/debian/upstream/signing-key.asc0000664000000000000000000002035512520515513020173 0ustar -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1 mQGiBEab+moRBACDH5yKqS3wcc5bdxY7PBNuwKvF5TKMfagmSvuRDtZjjIIWaA/n Z1KboV9Gq5g7kP7+Kfu+Qgd8u65eVsWwmPW10fXvj3aCU53glx2EdGdrHcgiyH2g EQfPiyBw+trIppWFRV0IDXSLMA1FNC92t2nSG/VFHaPTVwcgkIRSfcXDvwCglGdE a6f4uLqoNHP+m4yYnzapFuMD/R4+2AJDAvEWKDdYCGZzlawjAmmWyXrmT7/C/mx9 8qUR473l4buXjHgDkkXXlHqdzil1vK85PhrKzNJDCCmlHUJNz+QwiAMOLwpD+kwV Pb57RG7y+a5JQ5+jtVw4RlUxZIk/wj2An9YBO3A5vR7PdjM32ZJCN2+aM4dYfNzQ xQKTA/47icvBaBVTl9rztjg2pd2Aqpc1P/GsIYLGj7XjnnJvGAENBHSH1QjpZMJG CTS9oJ+B0/wrIr+pA+MdFgYAb6ojMQJOO6UChjWWSGjMFcs/CeXhxlLBido3DtAE TbNTwO6OEfAvdosvTdhJFnwvZlJ+zZGGy5CrF2Fd9PUe9tmASbQoQWxhbiBDb29w ZXJzbWl0aCA8YWxhbmNAZnJlZWRlc2t0b3Aub3JnPohoBBMRAgAoAhsDBgsJCAcD AgYVCAIJCgsEFgIDAQIeAQIXgAUCUXnRYgUJFEPYeAAKCRCi+54IHy0TDonxAKCP cAgXNojuujUg5Wqi6v0RBFVSUgCggq1SsVEdq9NDWvXvkeGyNaBivSK0K0FsYW4g Q29vcGVyc21pdGggPGFsYW4uY29vcGVyc21pdGhAc3VuLmNvbT6IZgQTEQIAJgIb AwYLCQgHAwIEFQIIAwQWAgMBAh4BAheABQJRedFiBQkUQ9h4AAoJEKL7nggfLRMO 6sUAn0jl3h9rY4OJ13Lu7nsKclyhDpOqAKCFgTmaDGRuDRxloLg9jftrn7a7vrQu QWxhbiBDb29wZXJzbWl0aCA8YWxhbi5jb29wZXJzbWl0aEBvcmFjbGUuY29tPohr BBMRAgArAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAIZAQUCUXnRYgUJFEPY eAAKCRCi+54IHy0TDtBZAJ9IgVVNoFIPRjTsNjcSFaLznuDRJgCcC/WgV312IrxS Q8PRAyEgozSB9Ke5Ag0ERpv6bxAIAJp5aUlho5rUhpS6ik7spsAQFPRuycPKMNu0 J4F0v/OoPz085soV8ytLj4HqCGk2Zamh1jSgliZwuk9m7V7Wgxx+nBJawpWDX/eK LObErfDwQ4dfOFvjbXLQMmNnQNaUGIWLPP3l8GuBOHMq60Bu+TPgh627vUntL5RE QEQqTXIzWC6U10QsDblLwIvdOVSdGF5xl/N1myXzSKvrsZwWtoFc8G9v9hcCjhtN 1sm9b7Ojc51iZXvcetcvPy5RA6AUW3yEExaedUdLnvIF9sjFYIfJWFVYh2AgavnG re6fF+NV2v3zfx3wRT7H9//m4YIDYJmgZgyQccXegTwfGBIq3osAAwYH/1FiMUMM ES5Ilz2nDqId+DCWECAU6wgvIFRcXrZWxDxB+ZrnmTCXoAD0xedpfOkRHp8XTVc/ 9MU+wQ+lZRx2OQ6MJW0XGuFvHm94KZF/8HzWA2Ah7U4n0+3sLpk6zWceZq2zZNF0 yVTjwD98+xNK1Q9sP8aOKdtg8yMH3hisKR6rdW+mfX5q0Q8Gol2hZsFH/qyIhnPz hXDknuOh8E5iMkzrejVXUEn++Yzj23XjP59SObLznVkyxI+kBI9qvVEPfFBDybjH WqLcgRcCpXAzjizEi+/d31iDa2ErJHV4R42obecFqiPnoDtiX3IiP7z9fmxM4aWP ZZRqvq+1ht5wkn+ISQQYEQIACQUCRpv6bwIbDAAKCRCi+54IHy0TDoLoAKCHYRpw /XfyEunw1YL/uMZzl78qIQCdFVcXNbqD83qVhW4Ly7hyDL8o0aK5Ag0EUXnVIQEQ AKHpjOmY056n0tsZoW9q5egsMcl5tKC8uimrhO05nnq+5/60/YedC++V9c9b/3/X 7O28LyBkAtBgD0xJZSDQ0DhTzKAp6AzjQtBvI68uinGwxSjT+oQpPMxqhA1I0kzo EDCdEqV+HsVOAEdbAi/tP9bbdTDzwVc8MWDriamBUqc53Rb00Mffy9435UgTS4gA hMwANhy6XZmOMBhITOzxFJUEDTDJtLbE0b1jPRQS7NHQgak1inmuvPMc3wAuoEcS CSt1xupbYsBoXOjK5wC/eE1LIdZoRyW2OkT140DqDZ8zfRID860hnirnYgb09TPN tj93pudUAUt6T9+tcLN4/rxhxHOwse66KGHO4bQ1rZ6mfco6SYd9V60cL6hC2eMe cyxZliMu17lj7EX8lxUH+omIgHc7HGoyUR6V+WB60cxWj5v05zdeLeZ2aLBcPFhx lfDESm8f4ezdJSDS1QZmC0P5h3RJfhhfmdBr8kHzr7111D1/O71Av1VV5FyJ9YxU Sxp4IPuzK7JbbgVHcA6PvXrDzWUslmZgPADpKH4hTmG/NdCqhEXcufvY6s5yNksB 8X3ReNvuSSyfGnRz3kvtyK0XzC7KRX2PquLI6A8KJprHwZGqEB1NDG8b2iaYnghO jyfIYEVQF3nGfaBwv4lrCPEoZSUaK8f/NQZjNU8NQyTnABEBAAGJAm0EGBEKAA8F AlF51SECGwIFCQlmAYACKQkQovueCB8tEw7BXSAEGQEKAAYFAlF51SEACgkQz98U iCjGQqfW5g//dOdJHt23cdMyz5VADaE7u+L0E+eX9GtHF4J649eXsui59EtbHh2n XdGhd5SqQ8FDi9GCEKaQ4S31n/YBLEBCkj7R0IMikW2o78/JxDovB8+aL606hgma fNVx1aIshIglrl8Xlu3sjeAvG48W6YjdL2mfrIDHjIVwOZsMihbOJvST6Q3upHdn mjDtM5HCQmI5NEXDWYj6IZuhJnnrDWwNsyYV4KPoUBxAcqIyCeZbVssuWWnHPXX8 VavVq98vpVynfGzGYpJbDj19C/utMjKGI5dcvbVaucA7X/oktxrxS6SBDhuIaAE9 4ZHlbxqfyHfETI/La2Z/ALDAtYdhJR2gSkTHyKSW1QqYlulSfB//lnna44mmTuRO NbDNgb0FGSvtsBMZ80iHDqPgUfS60kxCfFrsSGfTFU+X4QAzpTtUJEcr+J4HULDe MfwOgghVfmKxFXWfud8xDaCXuywLTtVgMCZp4P7MAyuJlaxsFTu+c1Vly94grk4U MtALLMqCXSosA490gLTSdg3HSwxt2Q/LJdy427ZIMvjGXIruns8U/OmL9dVgWu3b JHsL68Skx8Ts63qTN9QXM/PB+8VwOaC7PJ+g6t40DleOmdsS8cN31yf5KB8rsL4u n4u1yrMJfpnSblPMu5wJi3kjoA+Dd5ZFqx9nTi4wBjfVYGCPsleq59K8kQCYx1Cn lZcq630ITy9dB/aHCQry2gCbBwZ2Rsf9kr05S8uLhlwW3vRSvRs= =tc6G -----END PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1 mQINBE6HVy4BEADACp0EU6HZ4KyFx/qfhzNarCfnlyEoCFY08k516UaHrUOrYWPp ukoahcceA/M3H/xM0CGIn6uiuG/Cq7+qODAZNBsr6haIbDaqSUt+953b5qCSbD65 LBR8TXvW+9KkXPhXTKi/osYBdmsbFLeVLqU5Kd4QJqWKRLtuo0ENbFkQPVypEJk8 Ozg2zZ2yeSQAy0pgeFh8lezI7A23yj229kFq0EEfeqHpgifIzR2hNIhS5pTSOt8V RDapO3FpOmxPPUMsaJ1KATD92+SgbZW8evW7ffz4QUiQiFsfTSOTCaTFu8qpu6Fb a9u/u6mTrJQGRdqDcFp3iWjEUOVr0gUdLSr3zey152PBRaC26/eLqH8PFgCerBkn o9vso0Vr+Kh63OOQeDHATZGy7tMHbWW5AEXVkTpNoSRYr48pd6u9Z1TfWVcovNAZ tWiFVKKxniTa4MZY2czOSyh2YahCbEt3P0DoNihy3YHhTvW1k0Os2x5yCsfpGzp3 U8x1apfQqAyRNIa9SptLpQ7xF+lv52D9kp3XdkWXw1BFY+nmm/FqoC4tKU8AmbuB n3SX/sYjq3Z6aLoBOmZ849G0Zp1xEYHCbfWBxvqhIc6dlPc3Y9uYV01+FlTzX9Mh THa8p6oABrXbWRJpkOvaVbdDhXON+02Jlvawy3T3rwVkuEfEZu8akv7miwARAQAB tCBNYXR0IFR1cm5lciA8bWF0dHN0ODhAZ21haWwuY29tPokCQQQTAQIAKwIbAwUJ BaOagAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AFAk6HWL4CGQEACgkQD91oLZdM pyorzA//VdiX712S2MeQH/xdv2xpHPuUXsgdOo03rggxIYQ8HQ16wUKCRZw7G2hh OuLWde3uWB7ojWU8MifjaDlcm6csSD2YXmDz3YnpPJuwuwQtVyazns9QrgTMWU0j t92TGMYH1xDq99KNPpFPvtsHm83AtE37RY0ptssGzxAi83Ehk4tEnWM8qDlWDs/v 4MEgDzBC+T1vkbVHd1/gXPrz23nFxb0NVx2wKw+9NZFv4q87ptYbK2tz2w4LNKFg 6AvZe5da6xoBeeFbbQSegzBsBwC1zXGn0praqAYsqJC086JISKNW3uZdMrZ+UXaV +Ci3+qzNxTejgcbe8KgAjnYMLl8V+VB5Y2PEol1yqGOhRg6uTEiR79Jkap8fW5+S z/asVHqT1KZ8O4ln8s5GsPBrV/3ZHOpws5y0Y7kRXvwf+jLWIoRdpQRbT9DCeW3V Qk8plm3/HgBwGSUq7bUSbsISE0O1amcZmoIH7sb9986LWHEiGLrZjcHFovLee0EN nJC0AB+MVp6ZJifnLNwQePAR5R1Mo4Q5UUbUP3u/lgBMB6V3ASoV2nqynFVYVwku eZhyqlc63h7JdcW36svFiU8XqJ2/ea8wG3dFcrLnaqyFP4kov5C2k2h44jCH3Ox/ srzUqozHOA3sqUNCFUBt6QyC0CV61eNA0lwUxU/H1pr4zMGjqGO0IU1hdHQgVHVy bmVyIDxtYXR0c3Q4OEBnZW50b28ub3JnPokCPgQTAQIAKAUCTodYtgIbAwUJBaOa gAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQD91oLZdMpyr5fg/+NM7FTXfz IgeOxGTvchCHQSCP//bRN2OjWeeVmNbz52mTcMv1BT8cW7dRa0uooKkKJ+xcxKmk sDcAsdssgBd4XS2ZDzOCyUHu7r2u5M22/X0ER4Cds1vGozYvxD7dsxAC2PRiJT/G LPivV+zbDbQ5Sea/Ts2AuSpqoCmqCUJZxScFCBLkYjZFfwYm9xVoLmxwGp76KL43 ia+WFX/bjyDWAZ8nbSHF1s/cvgaVKmiIK3icLOWTQbHy4waM42ZcDJBdsew1kygV JelMkIeBmRt7av5sYDmFkxYUi1idVu8g9Ab9PZ9DfWVCTgcRLyTcL0a7JScNwvoV wy/la0H88455SBP8IkqTVk4wTeR6rXe7rmz0Lt8vzwDQDjl35AL2wcHm3gp2AOBc i708KDecjkxCsHINwkz60965eiEF3yJMTpR5LqDCSYKOZPxl1rQ++KNNmAUaCeg5 43aHwklJgiK3V3P3qf8+kksLTr9wP9gdrgD1cVt8RpzI0ggbkgFmcCmNm6OeIyMz tx+bsbISltzHU9u0Tt7EbQAOWNkcY5t04E4lNlKEkHCC/hDjWyw5domUeKOAFyNE ZziVk74srDLWDUPdtvB3dErjxMxMF+aIJ9+GjqYsPA+GuPzv+WTYUBV8ftsVzNGF ubwj0M4FJ+/zNHD+h8b1smWu9WWq/1mM0bm0I01hdHQgVHVybmVyIDxtYXR0LnR1 cm5lckBpbnRlbC5jb20+iQI/BBMBAgApBQJRV+IZAhsDBQkFo5qABwsJCAcDAgEG FQgCCQoLBBYCAwECHgECF4AACgkQD91oLZdMpypbQxAAkJpcJrYClnOHrnbsOWeD HwA7aVxoEAIlNSNBeWd2kAWl0v0NwWkTqu0rEG5Kno/V+ErQdLB4QTQGpbu2oYjZ DUmdLB27MVXv9K7ztoE0WuyqriiF7xLLYqVwgbzkl2yRInawL4l92K/01Fft3GQj 4amXyLph+9+FdOhdJzmMFLiEeC6/FYWtGrllosGoL22qc4/RDo9/UE6clFR0PYu0 KZ391bMTOBKPg0SmgSMDr8hh//N4rLxHSANDi/bTjfmuE2JBvesbNkV7prBIwkqW 8a6enRkG9173TKVQ1KS9gpmXi7Vnvg263OWRqVr47BZ0ZlIrtc3WVig7JAO+ZnI5 KBKk82HiiEgm6mIh2bDmBDMfNekkfheEK8jJiz6dhaHG0nkb0tOwiyS0TUITI9DY PfsAuSSS6haDAj5rxHHPpm3mxq7PwfWef0et0qmRtk8nWldJ79cLCvQfloYWzqU+ b5mBdiBkVWBfPiSaSANAgeJYgiNLGnhEgavkkucsQQmnCQV9t/MCvXWTdfydNpCa B7VgOEdWSPbkA2K4FvYzsin/AnNq/52kqmjtiZrTUaynJpuqukraFCizHRKmuym5 P9LGAqDyhJ8a4cFizIkyxdxiX2wlvkd37fKDQxd6u7BjuBdczT1FWg5pHwB5A9Wx NUOz4ERINDSchljoR2V/kwK5Ag0ETodXLgEQAKvlwepeqGbkmKOTHchHY1cnO95B HnlOBbiflU+abvKSzR4zm/QIMccn7E0hGsAvrDSndtD2vSsVHGbCDIkl0WNrr+z8 aIP5FrOkDyLIO8rCNr+CxKt4cl7vpxQ0CP/Erq/M6jeGvBwFfbyQcM1M/P6xVJAk 1AAj0ts38c2DUOz11FQmMDy0Zwb832mfXO6lMznKkWdAl9Qql1vO4cH5XWn45V97 nqnsg1fIK8sTov3Dr29RiW5VKuPuQgT1pIzvPCsN9Of/1Eb8nwgHSP9x2CqUHSso mBQbvZoJIwbeWW2cziy2/jKlbsBnG/9d4X2KyS9jOIgnPULf0NoEk6qghqZeh1Ec cegbq6VdKwz4TI3lcX9pEnU9nyAeIAcvERLbNWwWIAMd6JcriJ/SBklBUFEn9on4 Qf7ex63KoOxDjj5ze2TYuy7dqZrcIq0qmosMV8OcaY1bz7eFQdnFT6Hg1q+yOfKp tnnt0AJNdgRL/72hMU5a3CrF1stXMgtlLfz28i81+UI9wmRBFNuvFffTtS8M6sRy bbbq1WHJ0nC5XSdOfjTRRjHLoyNoJydVRMLacU8RSpdRP7r+xYjDpaUmImuzi+ZY F/Ym/Pt7RiKgrjtXqjyS7F9dkmE7Vt3xjPn45lwfkkYum+16FQTPIhNWbmqnFs3W b7pN6M/gc8VbXzkPABEBAAGJAiUEGAECAA8FAk6HVy4CGwwFCQWjmoAACgkQD91o LZdMpyq3Jg//RWiOpPn8smxwYJ3iICTQmD+HMJNL/tSsRAnCSwGsUfTnuurdPMrX ho4+J1TKqtNBtunfIAL1RujeC6SeISIOK434DIzQZVsotSV6Cxr3vv+sWNcuEQTj lKnCXNR+RcoPliMvn/K9UupLPuqTNm1HR7aKO+aeWlV+3la2QjLYQliBmrS54sQk AihI1xt08fxnGh5W3InPI/R/7Bz59fqOL3HH2wykui4PrFZsw43GH7o5VDGyMFAk F9P8JHVPaoVSRRqezYKe3lp2odOghl89Hy2qRlY7rks6j5tyewYDX07zZmwPRPpw c+V2tSEMLOm1822G98yVtVtFC7N9EcyhlpWfGf+mnJDgDem8xDuTYTzSfQv60HVE jW9kxTQu6y1oeLI4wbq6v3q+tumvIqSFu6wZsOqtPFX03ENuJqQM+elDdrihX9iZ n31T34Li8kNgM5F0nqqpSJxDfXj5UJu69n49jEgQN2HZZXQtIb6qg9XLeVEthHp6 AwC4Y1HlYpb6WdbZpUVz1cEwdBol4e77UrRtwwdG9/vezsrRYgXb7HJ/WzVuIqa4 /Fh7Mup+2yKW7Pr8r4S38uuIHpY0O5i6RKJz381Azq8Hu8XRwVHRM1rwpsliDcT8 hoID4uYlyTG9vjMsYgnDG9BhJMWiBQAyoUJZVxkU/PpmXg85HRyyNaQ= =KIBm -----END PGP PUBLIC KEY BLOCK----- x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xwud0000664000000000000000000000024612360256363015442 0ustar #git=git://anongit.freedesktop.org/xorg/app/xwud version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xwud-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.oclock0000664000000000000000000000025212360256363015722 0ustar #git=git://anongit.freedesktop.org/xorg/app/oclock version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ oclock-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xman0000664000000000000000000000024612360256363015416 0ustar #git=git://anongit.freedesktop.org/xorg/app/xman version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xman-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xedit0000664000000000000000000000025012360256363015563 0ustar #git=git://anongit.freedesktop.org/xorg/app/xedit version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xedit-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/compat0000664000000000000000000000000212520521456014613 0ustar 9 x11-apps-7.7+5+nmu1ubuntu1/debian/watch.rendercheck0000664000000000000000000000024612360256363016730 0ustar # Compulsory line, this is a version 3 file version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/archive/individual/app/rendercheck-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xload0000664000000000000000000000025012360256363015555 0ustar #git=git://anongit.freedesktop.org/xorg/app/xload version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xload-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/x11-apps.install0000664000000000000000000000023312167023104016347 0ustar usr/bin/* usr/share/man/man1/* usr/share/X11/xman.help usr/include/X11/bitmaps/* usr/lib/X11/x11perfcomp/* usr/lib/X11/xedit/lisp/* etc/X11/app-defaults/* x11-apps-7.7+5+nmu1ubuntu1/debian/copyright0000664000000000000000000014503112256615167015365 0ustar The contents of this package were downloaded from http://xorg.freedesktop.org/releases/individual/app/ It contains the bitmap, ico, oclock, transset, x11perf, xbiff, xcalc, xclipboard, xclock, xcursorgen, xconsole, xditview, xedit, xeyes, xgc, xload, xlogo, xmag, xman, xmore, xmd, rendercheck, and xwd applications. bitmap: Copyright 1988, 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ico: Copyright (c) 1987, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ------------------------------------------------------------------------------ Copyright 2005 Red Hat, Inc. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Red Hat not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Red Hat makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. oclock: Copyright 1989, 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright (C) 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other deal- ings in this Software without prior written authorization from the X Consor- tium. rendercheck: Copyright 2004 Eric Anholt Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Eric Anholt not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Eric Anholt makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. transset: Copyright © 2003-2004 Matthew Hawn Copyright © 2003-2004 Andreas Kohn Copyright © 2003-2004 Roman Divacky Copyright © 2003-2004 Keith Packard Copyright © 2005-2007 Daniel Forchheimer Copyright © 2011-2012 Arnaud Fontaine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. x11perf: Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **************************************************************************** Copyright (c) 1993 by Hewlett-Packard Company Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both the copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. xbiff: Copyright (c) 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. xcalc: Copyright (c) 1989, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ------------------------------------------------------------------------------ Copyright 2005 Red Hat, Inc. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Red Hat not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Red Hat makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. xclipboard: Copyright 1989, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. xclock: Copyright 1987, 1988, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ------------------------------------------------------------ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ------------------------------------------------------------ Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. xconsole: Copyright 1990, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. xcursorgen: Copyright (C) 2002 Manish Singh Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Manish Singh not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Manish Singh makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. MANISH SINGH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL MANISH SINGH BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. xditview: Copyright (c) 1991, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. xedit: Copyright (c) 2003 Constantin S. Svintsoff Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright (c) 1987, 1993 The Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright (c) 1987 Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. COPYRIGHT 1987 DIGITAL EQUIPMENT CORPORATION MAYNARD, MASSACHUSETTS ALL RIGHTS RESERVED. THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN ADDITION TO THAT SET FORTH ABOVE. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital Equipment Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Copyright 2004 Roland Mainz Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright (c) 1999-2002 by The XFree86 Project, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the XFree86 Project shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project. Copyright (c) 2007 Paulo Cesar Pereira de Andrade Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. xeyes: Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. xgc: Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. xload: Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ---------------------------------------- Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ---------------------------------------- get_rload.c (rwhod support) was added in 2001 by the XFree86 Project without a copyright notice, and is thus covered by this general notice: XFree86 code without an explicit copyright is covered by the following copy- right/license: Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is fur- nished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the XFree86 Project shall not be used in advertising or otherwise to promote the sale, use or other deal- ings in this Software without prior written authorization from the XFree86 Project. xlogo: Copyright 1988, 1990, 1993 1994, 1998 The Open Group Copyright 2004 Roland Mainz Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. xmag: Copyright 1989, 1990, 1991, 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright (C) 1999 The XFree86 Project, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the XFree86 Project shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project. xman: Copyright (c) 1987, 1988, 1989, 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. xmore: This is a stub file. This package has not yet had its complete licensing information compiled. Please see the individual source files for details on your rights to use and modify this software. Please submit updated COPYING files to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg All licensing questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg xwd: Copyright 1987, 1988, 1993, 1994, 1996, 1998 The Open Group Copyright 1994 Hewlett-Packard Co. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 2007 Kim woelders Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the copyright holders not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The copyright holders make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. xwud: Copyright 1985, 1986, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. x11-apps-7.7+5+nmu1ubuntu1/debian/watch.ico0000664000000000000000000000024412360256363015223 0ustar #git=git://anongit.freedesktop.org/xorg/app/ico version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ ico-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xlogo0000664000000000000000000000025012360256363015576 0ustar #git=git://anongit.freedesktop.org/xorg/app/xlogo version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xlogo-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.transset0000664000000000000000000000025612360256363016317 0ustar #git=git://anongit.freedesktop.org/xorg/app/transset version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ transset-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/patches/0000775000000000000000000000000012427367637015063 5ustar ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootx11-apps-7.7+5+nmu1ubuntu1/debian/patches/0001-If-we-have-man-db-don-t-try-and-emulate-man-s-pipeli.patchx11-apps-7.7+5+nmu1ubuntu1/debian/patches/0001-If-we-have-man-db-don-t-try-and-emulate-man-s-pipeli.0000664000000000000000000000346312427367637027012 0ustar From 438763b6e231410b95b5e352feb65c63cd54de6a Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Fri, 7 Nov 2014 16:19:57 +0000 Subject: [PATCH] If we have man-db, don't try and emulate man's pipeline Just let man itself do the formatting / zsoelim / ... dance. Debian bug#764792 Signed-off-by: Julien Cristau --- xman/configure.ac | 5 +++++ xman/misc.c | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/xman/configure.ac b/xman/configure.ac index 9a80cbb..8bb44f2 100644 --- a/xman/configure.ac +++ b/xman/configure.ac @@ -44,6 +44,11 @@ if test "x$GROFF" = "xfound" ; then AC_DEFINE([HAS_GROFF], 1, [Define to 1 if you have the groff package.]) fi +AC_CHECK_PROG([MANDB], [mandb], [yes], [no]) +if test x"$MANDB" = xyes; then + AC_DEFINE([HAVE_MANDB], 1, [Define if the man implementation is man-db]) +fi + AC_CHECK_FUNCS([mkstemp]) AC_ARG_WITH(helpdir, diff --git a/xman/misc.c b/xman/misc.c index 06891cd..da8744a 100644 --- a/xman/misc.c +++ b/xman/misc.c @@ -661,6 +661,13 @@ static Boolean ConstructCommand(char *cmdbuf, const char *path, const char *filename, const char *tempfile) { +#ifdef HAVE_MANDB + int used = snprintf(cmdbuf, BUFSIZ, "man -l %s > %s 2>/dev/null", + filename, tempfile); + if (used >= BUFSIZ - 1) + return FALSE; + return TRUE; +#else /* The original code did the following to produce a command line: * sprintf(cmdbuf,"cd %s ; %s %s %s > %s %s", path, TBL, * filename, FORMAT, man_globals->tempfile, "2> /dev/null"); @@ -783,6 +790,7 @@ ConstructCommand(char *cmdbuf, const char *path, return (FALSE); return (TRUE); +#endif /* man-db */ } #endif /* HANDLE_ROFFSEQ */ -- 2.1.1 x11-apps-7.7+5+nmu1ubuntu1/debian/patches/series0000664000000000000000000000010012427170705016253 0ustar 0001-If-we-have-man-db-don-t-try-and-emulate-man-s-pipeli.patch x11-apps-7.7+5+nmu1ubuntu1/debian/copyright.head0000664000000000000000000000047612167023104016251 0ustar The contents of this package were downloaded from http://xorg.freedesktop.org/releases/individual/app/ It contains the bitmap, ico, oclock, transset, x11perf, xbiff, xcalc, xclipboard, xclock, xcursorgen, xconsole, xditview, xedit, xeyes, xgc, xload, xlogo, xmag, xman, xmore, xmd, rendercheck, and xwd applications. x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xbiff0000664000000000000000000000025012360256363015544 0ustar #git=git://anongit.freedesktop.org/xorg/app/xbiff version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xbiff-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/autogen.sh0000775000000000000000000000014012427173653015421 0ustar #!/bin/sh set -e SUBDIRS="$@" for dir in ${SUBDIRS}; do (cd ${dir} && autoreconf -vfi) done x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xmore0000664000000000000000000000025012360256363015600 0ustar #git=git://anongit.freedesktop.org/xorg/app/xmore version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xmore-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xclipboard0000664000000000000000000000026212360256363016600 0ustar #git=git://anongit.freedesktop.org/xorg/app/xclipboard version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xclipboard-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xwd0000664000000000000000000000024412360256363015253 0ustar #git=git://anongit.freedesktop.org/xorg/app/xwd version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xwd-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xeyes0000664000000000000000000000025012360256363015603 0ustar #git=git://anongit.freedesktop.org/xorg/app/xeyes version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xeyes-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xclock0000664000000000000000000000025212360256363015733 0ustar #git=git://anongit.freedesktop.org/xorg/app/xclock version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xclock-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/control0000664000000000000000000000734412650214200015016 0ustar Source: x11-apps Section: x11 Priority: optional Maintainer: Debian X Strike Force Build-Depends: debhelper (>= 9), pkg-config, dh-autoreconf, # XXX bison build-dep is to work around a bug in xgc's configure, remove as # soon as that's fixed. bison, libpng-dev, libx11-dev (>= 2:1.0.0), libxaw7-dev (>= 1:1.0.1), libxcursor-dev (>= 1.1.5.2), libxext-dev (>= 1:1.0.0), libxft-dev (>= 2.1.8.2-6), libxkbfile-dev (>= 1:1.0.1), libxmuu-dev (>= 1:1.0.1), libxrender-dev (>= 1:0.9.0.2-2), libxt-dev (>= 1:1.1.0), libxmu-dev, xbitmaps, x11proto-core-dev (>= 7.0.17), quilt, xutils-dev (>= 1:7.5+4), man-db, # Reasons for build-depends: # debhelper for the packaging, pkg-config needed by configure scripts # xutils-dev for xorg macros # Individual apps: # bitmap: libx11-dev, libxmu-dev, xbitmaps, libxt-dev # ico: libx11-dev # oclock: libx11-dev, libxmu-dev, libxext-dev, libxkbfile-dev # transset: libx11-dev, x11proto-core-dev # x11perf: libx11-dev, libxmuu-dev, libxrender-dev, libxft-dev, libxext-dev # xbiff: xbitmaps, libxext-dev # xcalc: libxt-dev, libxaw7-dev # xclipboard: libxt-dev # xclock: libx11-dev, libxaw7-dev, libxft-dev, libxkbfile-dev, libxt-dev # xconsole: libxt-dev, libxaw7-dev # xcursorgen: libx11-dev, libxcursor-dev, libpng-dev # xditview: libxaw7-dev, libxt-dev # xedit: libxaw7-dev, libxt-dev # xeyes: libx11-dev, libxt-dev, libxext-dev, libxmu-dev # xgc: libxt-dev, libxmu-dev # xload: libxaw7-dev, libxt-dev # xlogo: libxaw7-dev, libxrender-dev, libxft-dev, libxext-dev, libxt-dev # xmag: libxaw7-dev, libxt-dev # xman: libxaw7-dev, libxt-dev, man-db # xmore: libxaw7-dev, libxt-dev # xwd: libx11-dev, x11proto-core-dev # xwud: libx11-dev Standards-Version: 3.9.3 Vcs-Git: git://git.debian.org/git/pkg-xorg/app/x11-apps Vcs-Browser: http://git.debian.org/?p=pkg-xorg/app/x11-apps.git Package: x11-apps Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, man-db Recommends: xbitmaps Suggests: mesa-utils Conflicts: bitmap, oclock, x11perf, xbiff, xcalc, xclipboard, xclock, xconsole, xcursorgen, xditview, xeyes, xgc, xload, xlogo, xmag, xman, xmore, xwd, xwud, transset Replaces: xbase-clients (<= 1:7.2.ds2-3), bitmap, oclock, x11perf, xbiff, xcalc, xclipboard, xclock, xconsole, xcursorgen, xditview, xeyes, xgc, xload, xlogo, xmag, xman, xmore, xwd, xwud, transset Description: X applications This package provides a miscellaneous assortment of X applications that ship with the X Window System, including: - atobm, bitmap, and bmtoa, tools for manipulating bitmap images; - ico, a demo program animating polyhedrons; - oclock and xclock, graphical clocks; - rendercheck, a program to test render extension implementations; - transset, a tool to set opacity property on a window; - xbiff, a tool which tells you when you have new email; - xcalc, a scientific calculator desktop accessory; - xclipboard, a tool to manage cut-and-pasted text selections; - xconsole, which monitors system console messages; - xcursorgen, a tool for creating X cursor files from PNGs; - xditview, a viewer for ditroff output; - xedit, a simple text editor for X; - xeyes, a demo program in which a pair of eyes track the pointer; - xgc, a graphics demo; - xload, a monitor for the system load average; - xlogo, a demo program that displays the X logo; - xmag, which magnifies parts of the X screen; - xman, a manual page browser; - xmore, a text pager; - xwd, a utility for taking window dumps ("screenshots") of the X session; - xwud, a viewer for window dumps created by xwd; - Xmark, x11perf, and x11perfcomp, tools for benchmarking graphical operations under the X Window System; . The xbiff, xcalc, xconsole, xedit and xman programs use bitmap images provided by the xbitmaps package. x11-apps-7.7+5+nmu1ubuntu1/debian/rules0000775000000000000000000000472512656634515014520 0ustar #!/usr/bin/make -f # debian/rules for the Debian xutils package. # Copyright © 2004 Scott James Remnant # Copyright © 2005 Daniel Stone # Copyright © 2005 David Nusinow # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 ifeq ($(DEB_HOST_ARCH),ppc64el) export DEB_CFLAGS_MAINT_STRIP = -O3 export DEB_CXXFLAGS_MAINT_STRIP = -O3 export DEB_CFLAGS_MAINT_APPEND = -O2 export DEB_CXXFLAGS_MAINT_APPEND = -O2 endif STAMP_DIR = stampdir # This package contains multiple modules as shipped by upstream. Each module is # contained in a subdirectory in the root dir of the package. You must list each # subdirectory explicitly so that the build system knows what to build DEF_SUBDIRS=bitmap ico oclock rendercheck transset x11perf xbiff xcalc xclipboard xclock xconsole xcursorgen xditview xedit xeyes xgc xload xlogo xmag xman xmore xwd xwud SUBDIRS=$(DEF_SUBDIRS) CONFIG_STAMPS = $(addprefix $(STAMP_DIR)/configure-, $(SUBDIRS)) BUILD_STAMPS = $(addprefix $(STAMP_DIR)/build-,$(SUBDIRS)) %: dh $@ --with quilt,autoreconf --parallel override_dh_autoreconf: chmod +x debian/autogen.sh dh_autoreconf debian/autogen.sh -- $(SUBDIRS) override_dh_auto_configure: $(CONFIG_STAMPS) $(STAMP_DIR)/configure-%: mkdir -p $(STAMP_DIR) dh_auto_configure -D$* -B$*-build -- \ --libdir=\$${prefix}/lib \ --disable-silent-rules \ MANCONF="/etc/manpath.config" >$@ override_dh_auto_build: $(BUILD_STAMPS) $(STAMP_DIR)/build-%: mkdir -p $(STAMP_DIR) dh_auto_build -D$* -B$*-build >$@ override_dh_auto_clean: $(addprefix clean-, $(SUBDIRS)) rm -rf stampdir clean-%: dh_auto_clean -D$* -B$*-build override_dh_auto_install: for FILE in $(SUBDIRS); do \ cd "$$FILE"-build && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install ; \ cd ..; \ done override_dh_install: dh_install --list-missing .PHONY: get-tarballs get-tarballs: $(addprefix get-tarball-,$(SUBDIRS)) .PHONY: get-tarball-% get-tarball-%: uscan --no-conf --destdir . --download --no-symlink --package $* --upstream-version $(shell awk -F = '/^PACKAGE_VERSION=/ { print $$2 }' < $*/configure ) --watchfile debian/watch.$* || test $$? = 1 .PHONY: update-copyright update-copyright: $(addsuffix /COPYING, $(SUBDIRS)) debian/copyright.head cp debian/copyright.head debian/copyright for subdir in $(SUBDIRS); do \ echo >> debian/copyright && \ echo $$subdir: >> debian/copyright && \ sed -e 's/^./ &/' < $$subdir/COPYING >> debian/copyright \ || exit; done x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xgc0000664000000000000000000000024412360256363015232 0ustar #git=git://anongit.freedesktop.org/xorg/app/xgc version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xgc-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.xcursorgen0000664000000000000000000000026212360256363016650 0ustar #git=git://anongit.freedesktop.org/xorg/app/xcursorgen version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ xcursorgen-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/watch.x11perf0000664000000000000000000000025412360256363015740 0ustar #git=git://anongit.freedesktop.org/xorg/app/x11perf version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ x11perf-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/debian/x11-apps.menu0000664000000000000000000000501712167023104015652 0ustar ?package(x11-apps):\ needs="x11"\ section="Games/Toys"\ hints="Clocks"\ longtitle="Oclock: analog clock for X"\ title="Oclock"\ command="oclock" ?package(x11-apps):\ needs="x11"\ section="Applications/Network/Communication"\ hints="Mail"\ longtitle="Xbiff: mailbox flag for X"\ title="Xbiff"\ command="xbiff" ?package(x11-apps):\ needs="x11"\ section="Applications/Science/Mathematics"\ hints="Calculators"\ longtitle="Xcalc: scientific calculator for X"\ title="Xcalc"\ command="xcalc" ?package(x11-apps):\ needs="x11"\ section="Applications/System/Administration"\ longtitle="Xclipboard: clipboard for text cut and paste operations in X"\ title="Xclipboard"\ command="xclipboard" ?package(x11-apps):\ needs="x11"\ section="Games/Toys"\ hints="Clocks"\ longtitle="Xclock (analog): analog clock for X"\ title="Xclock (analog)"\ command="xclock -analog" ?package(x11-apps):\ needs="x11"\ section="Games/Toys"\ hints="Clocks"\ longtitle="Xclock (digital): digital clock for X"\ title="Xclock (digital)"\ command="xclock -digital -update 1" ?package(x11-apps):\ needs="x11"\ section="Applications/System/Monitoring"\ longtitle="Xconsole: monitor system console messages with X"\ title="Xconsole"\ command="xconsole -file /dev/xconsole" ?package(x11-apps):\ needs="x11"\ section="Applications/Viewers"\ hints="Troff"\ longtitle="Xditview: a ditroff file viewer for X"\ title="Xditview"\ command="xditview" ?package(x11-apps):\ needs="x11"\ section="Applications/Editors"\ longtitle="Xedit: a simple text editor for X"\ title="Xedit"\ command="xedit" ?package(x11-apps):\ needs="x11"\ section="Games/Toys"\ longtitle="Xeyes: demo in which a pair of eyes follow the mouse pointer in X"\ title="Xeyes"\ command="xeyes" ?package(x11-apps):\ needs="x11"\ section="Applications/System/Monitoring"\ longtitle="Xload: system load average display for X"\ title="Xload"\ command="xload" ?package(x11-apps):\ needs="x11"\ section="Games/Toys"\ longtitle="Xlogo: demo which displays the X logo"\ title="Xlogo"\ command="xlogo" ?package(x11-apps):\ needs="x11"\ section="Applications/Accessibility"\ longtitle="Xmag: magnify parts of the X screen"\ title="Xmag"\ command="xmag" ?package(x11-apps):\ needs="x11"\ section="Help"\ longtitle="Xman: manual page browser for X"\ title="Xman"\ command="xman" ?package(x11-apps):\ needs="x11"\ section="Applications/Graphics"\ hints="Screenshot"\ longtitle="X Window Snapshot: take snapshot of any X window (xwd|xwud)"\ title="X Window Snapshot"\ command="xwd | xwud" x11-apps-7.7+5+nmu1ubuntu1/debian/watch.bitmap0000664000000000000000000000025212360256363015724 0ustar #git=git://anongit.freedesktop.org/xorg/app/bitmap version=3 opts="pgpsigurlmangle=s/$/.sig/" \ http://xorg.freedesktop.org/releases/individual/app/ bitmap-(.*)\.tar\.gz x11-apps-7.7+5+nmu1ubuntu1/xmore/0000775000000000000000000000000012656635743013344 5ustar x11-apps-7.7+5+nmu1ubuntu1/xmore/xmore.c0000664000000000000000000001450312167023104014620 0ustar /* * $Xorg: xmore.c,v 1.1 2004/04/30 02:05:54 gisburn Exp $ * Copyright 2004 Roland Mainz Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ /* Force ANSI C prototypes from X11 headers */ #ifndef FUNCPROTO #define FUNCPROTO 15 #endif /* !FUNCPROTO */ #include #include #include #include #include #include #include #include #include "xmore.h" #include #include #include /* Turn a NULL pointer string into an empty string */ #define NULLSTR(x) (((x)!=NULL)?(x):("")) #define Error(x) { printf x ; exit(EXIT_FAILURE); } #define Assertion(expr, msg) { if (!(expr)) { Error msg } } #define Log(x) { if (userOptions.verbose) printf x; } /* Global vars */ static Widget toplevel = NULL; static Widget text = NULL; static const char *ProgramName; /* program name (from argv[0]) */ static const char *viewFileName; /* file to browse (from argv[1]) */ /* prototypes */ static void quitAction(Widget w, XEvent *event, String *params, Cardinal *num_params); static void quitXtProc(Widget w, XtPointer client_data, XtPointer callData); static XrmOptionDescRec options[] = { { "-v", "*verbose", XrmoptionNoArg, (XPointer) "on" }, }; static XtActionsRec actions[] = { { "quit", quitAction }, }; /* See xmore.h */ static XMoreResourceData userOptions; #define Offset(field) XtOffsetOf(XMoreResourceData, field) static XtResource resources[] = { {"verbose", "Verbose", XtRBoolean, sizeof(Boolean), Offset(verbose), XtRImmediate, (XtPointer)False}, {"textfont", XtCFont, XtRFontSet, sizeof(XFontSet), Offset(textfont), XtRString, STANDARDFONT}, }; static String fallback_resources[] = { #ifdef NOTYET "*iconPixmap: xmore32", "*iconMask: xmore32", #endif /* NOTYET */ "*textfont: " STANDARDFONT, "*international: True", /* set this globally for ALL widgets to avoid wiered crashes */ "*text.Translations: #override \\n\\" "\tCtrlS: no-op(RingBell)\\n\\" "\tCtrlR: no-op(RingBell)\\n\\" "\tspace: next-page()\\n\\" "\tF: next-page()\\n\\" "\tCtrlB: previous-page()\\n\\" "\tB: previous-page()\\n\\" "\tK: scroll-one-line-down()\\n\\" "\tY: scroll-one-line-down()\\n\\" "\tReturn: scroll-one-line-up()\\n\\" "\tJ: scroll-one-line-up()\\n\\" "\tE: scroll-one-line-up()\\n\\" "\tq: quit()\\n", "*text.baseTranslations: #override \\n\\" "\tspace: next-page()\\n\\" "\tF: next-page()\\n\\" "\tCtrlB: previous-page()\\n\\" "\tK: scroll-one-line-down()\\n\\" "\tY: scroll-one-line-down()\\n\\" "\tReturn: scroll-one-line-up()\\n\\" "\tJ: scroll-one-line-up()\\n\\" "\tE: scroll-one-line-up()\\n\\" "\tq: quit()\\n", NULL, }; static void quitAction(Widget w, XEvent *event, String *params, Cardinal *num_params) { XtAppSetExitFlag(XtWidgetToApplicationContext(w)); } static void quitXtProc(Widget w, XtPointer client_data, XtPointer callData) { XtCallActionProc(w, "quit", NULL, NULL, 0); } int main( int argc, char *argv[] ) { XtAppContext app; Widget form; Widget quitbutton; int n; Arg args[8]; ProgramName = argv[0]; XtSetLanguageProc(NULL, NULL, NULL); toplevel = XtOpenApplication(&app, "XMore", options, XtNumber(options), &argc, argv, fallback_resources, sessionShellWidgetClass, NULL, ZERO); if (argc != 2) { printf("usage: %s [ x options ] filename\n", argv[0]); exit(EXIT_FAILURE); } XtGetApplicationResources(toplevel, (XtPointer)&userOptions, resources, XtNumber(resources), NULL, 0); XtAppAddActions(app, actions, XtNumber(actions)); viewFileName = argv[1]; form = XtCreateManagedWidget("form", formWidgetClass, toplevel, NULL, 0); n = 0; XtSetArg(args[n], XtNtype, XawAsciiFile); n++; XtSetArg(args[n], XtNstring, viewFileName); n++; XtSetArg(args[n], XtNwidth, 700); n++; XtSetArg(args[n], XtNheight, 300); n++; XtSetArg(args[n], XtNscrollHorizontal, XawtextScrollAlways); n++; XtSetArg(args[n], XtNscrollVertical, XawtextScrollAlways); n++; XtSetArg(args[n], XtNfontSet, userOptions.textfont); n++; text = XtCreateManagedWidget("text", asciiTextWidgetClass, form, args, n); n = 0; XtSetArg(args[n], XtNfromHoriz, NULL); n++; XtSetArg(args[n], XtNfromVert, text); n++; XtSetArg(args[n], XtNlabel, "Quit"); n++; quitbutton = XtCreateManagedWidget("quit", commandWidgetClass, form, args, n); XtAddCallback(quitbutton, XtNcallback, quitXtProc, NULL); XtRealizeWidget(toplevel); XtAppMainLoop(app); return EXIT_SUCCESS; } x11-apps-7.7+5+nmu1ubuntu1/xmore/xmore.h0000664000000000000000000000302212167023104014617 0ustar /* * $Xorg: xmore.h,v 1.1 2004/04/30 02:05:54 gisburn Exp $ * Copyright 2004 Roland Mainz Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ #ifndef XMORE_XMORE_H #define XMORE_XMORE_H 1 #include typedef struct { Boolean verbose; XFontSet textfont; } XMoreResourceData, *XMoreResourceDataPtr; #define STANDARDFONT "-adobe-courier-medium-r-normal--12-*-*-*-*-*," \ "-*-*-*-*-*-*-12-*-*-*-*-*" #endif /* !XMORE_XMORE_H */ x11-apps-7.7+5+nmu1ubuntu1/xmore/app-defaults/0000775000000000000000000000000012167023104015704 5ustar x11-apps-7.7+5+nmu1ubuntu1/xmore/app-defaults/XMore0000664000000000000000000000212312167023104016657 0ustar ! XMore.ad ! keyboard translations *text.Translations: #override\n\ CtrlS: no-op(RingBell)\n\ CtrlR: no-op(RingBell)\n\ space: next-page()\n\ F: next-page()\n\ CtrlB: previous-page()\n\ B: previous-page()\n\ K: scroll-one-line-down()\n\ Y: scroll-one-line-down()\n\ Return: scroll-one-line-up()\n\ J: scroll-one-line-up()\n\ E: scroll-one-line-up()\n\ q: quit()\n *text.baseTranslations: #override\n\ space: next-page()\n\ F: next-page()\n\ CtrlB: previous-page()\n\ K: scroll-one-line-down()\n\ Y: scroll-one-line-down()\n\ Return: scroll-one-line-up()\n\ J: scroll-one-line-up()\n\ E: scroll-one-line-up()\n\ q: quit()\n ! tip messages *quit.tip: Quit application *international: True ! EOF. x11-apps-7.7+5+nmu1ubuntu1/xmore/ChangeLog0000664000000000000000000004234412167023104015100 0ustar commit 999895eddb00cb535802409a46795c363b8d2422 Author: Alan Coopersmith Date: Fri Jul 23 15:51:09 2010 -0700 xmore 1.0.2 Signed-off-by: Alan Coopersmith commit 4772e37779221c32cd9aedf253c5d0097551b63e Author: Alan Coopersmith Date: Fri Jul 23 14:14:06 2010 -0700 Remove several unnecessary macros from configure.ac PKG_CHECK_MODULES automatically calls AC_SUBST on the CFLAGS & LIBS variables it sets XORG_STRICT_OPTION from XORG_DEFAULT_OPTIONS calls AC_PROG_C_C99. This sets gcc with -std=gnu99. If AC_PROG_CC macro is called afterwards, it resets CC to gcc. AM_PROG_CC_C_O is not needed since we are not compiling multiple targets with differing CFLAGS. Signed-off-by: Alan Coopersmith commit d5ee44e818b58ad7b2eba005a024cc60720787d8 Author: Alan Coopersmith Date: Fri Jul 23 14:08:38 2010 -0700 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz (Copied from commits to other modules by Gaetan Nadon ) Signed-off-by: Alan Coopersmith commit 0c2c7bb1951b258b61ec0cd9990adfad32814a52 Author: Alan Coopersmith Date: Fri Jul 23 14:04:11 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS The existing statement can now be removed from the configuration file. Use automake provided $(AM_V_GEN) and XORG_DEFAULT_OPTIONS provided $(SED) Enables silent rule and use platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit 4a4187b8ce272e96b760e1e59da980644e99aa0b Author: Gaetan Nadon Date: Thu Feb 11 10:08:07 2010 -0500 config: move CWARNFLAGS from configure.ac to Makefile.am Compiler warning flags should be explicitly set in the makefile rather than being merged with other packages compiler flags. Signed-off-by: Gaetan Nadon commit 47a2b341aeb6182dc3288850c7a27f36fb436863 Author: Gaetan Nadon Date: Sat Dec 19 20:48:48 2009 -0500 configure.ac: use backticks rather than $() for cmd subs Use "$PKG_CONFIG" rather than hard coded "pkg-config" Signed-off-by: Gaetan Nadon commit 7cf288c20a86151592d62e037cb196b190bf50be Author: Gaetan Nadon Date: Thu Nov 26 09:19:54 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit 561a214d1399ba661fc873e310a1ec8cfdf0fd95 Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit 1c5982f33817afbc8d004e97ca803f995f9f9473 Author: Gaetan Nadon Date: Tue Oct 27 15:07:25 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit 3d5641c03c3d7fe2eeb5980f8a13bdb450be947e Author: Gaetan Nadon Date: Mon Oct 26 22:08:39 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit b80c24ac28999a1d760eee75e2173ff7e8f8e885 Author: Gaetan Nadon Date: Thu Oct 22 12:34:16 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit 1ed0b44715c812c7d067841d68e2057944341d5f Author: Alan Coopersmith Date: Thu Oct 1 14:54:28 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit ab8110b8978cb965d49e0c2e9c1cb7e7608c185e Author: Paulo Cesar Pereira de Andrade Date: Thu Jan 22 16:49:25 2009 -0200 Correct make distcheck and sparse warnings. commit 747f76737a8e7a7f50bd06fd111e5ada8305884d Author: Julien Cristau Date: Sun Nov 16 21:49:56 2008 +0100 More xprint pruning commit d9b5448a77ff3ee06f6128faa69f43066cd16fe1 Author: Julien Cristau Date: Thu Aug 21 00:46:51 2008 +0200 Fix build outside of source dir commit 7739b19df6a7eba2c35fc34688c40d64a65b79f5 Author: Julien Cristau Date: Thu Aug 21 00:42:51 2008 +0200 Build fix: remove xprint remnants commit 56ff9e213249bbdc0ecd3b5e7e4cffee60f46ef4 Author: James Cloos Date: Wed Aug 20 10:32:52 2008 -0400 xaw8 is gone, use xaw7 commit a85334f153e05119f237ff412a2ff15dce95878d Author: Jeremy Huddleston Date: Thu Mar 27 20:29:51 2008 -0700 Added missing AM_PROG_CC_C_O commit 8bd714835159aa32a64343a8dc41684d7c36ab43 Author: Jeremy Huddleston Date: Thu Mar 27 20:07:52 2008 -0700 Build fix for file systems that are not case sensitive commit 851f5e3eaedeb6a5bcc4d1f1b669e4b11dbf3687 Author: James Cloos Date: Thu Dec 6 16:37:25 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit 8c718d9c360963defae4d056555394fc4d53c81a Author: James Cloos Date: Mon Sep 3 05:51:38 2007 -0400 Add *~ to .gitignore to skip patch/emacs droppings commit 4a01239ff7c89c56f5dfd5ec5c963422b6dd7184 Author: James Cloos Date: Thu Aug 23 19:25:02 2007 -0400 Rename .cvsignore to .gitignore commit b9d4d0d8877d3c1c69752e0ff4215cdb3d0742d5 Author: Kevin E Martin Date: Wed Dec 21 02:29:52 2005 +0000 Update package version for X11R7 release. commit bdc49004296438983d568e0e1bfc3e70e6cadac4 Author: Adam Jackson Date: Mon Dec 19 16:22:46 2005 +0000 Stub COPYING files commit 5adf875ac8a1b27b512a796a85f0ed65119385ee Author: Kevin E Martin Date: Thu Dec 15 00:24:09 2005 +0000 Update package version number for final X11R7 release candidate. commit 94c9195eb246474480643c62dd4c5e9e3d610a39 Author: Kevin E Martin Date: Wed Dec 7 16:18:01 2005 +0000 Change to use the app-defaults default dir configured in libXt. commit f427001cd1f3efdafa06c381c38fd5a4449b76f2 Author: Kevin E Martin Date: Tue Dec 6 22:48:24 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit 5c4880cca850794b05539c21a3a6dfe1531b801b Author: Kevin E Martin Date: Sat Dec 3 05:49:26 2005 +0000 Update package version number for X11R7 RC3 release. commit 6805b1f303fad5c194fd76b9208a981c80b7c7fc Author: Alan Coopersmith Date: Mon Nov 28 22:01:45 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit adbc0b1f5584ecbce974446419deb9f76fd486d2 Author: Eric Anholt Date: Mon Nov 21 10:35:05 2005 +0000 Another pass at .cvsignores for apps. commit 320a3eb6449b73b2963c3e63ef1a8078b194c992 Author: Eric Anholt Date: Sun Nov 20 22:08:54 2005 +0000 Add/improve .cvsignore files for apps. commit 508f26ba0ba5de6936cf9aec782c2f36114be43b Author: Alan Coopersmith Date: Sun Nov 20 04:13:45 2005 +0000 Add dependency on xp module when building with Xprint support. commit 5789d54ef03c4dc59faff86084ba7b0eaf79cda5 Author: Kevin E Martin Date: Wed Oct 19 02:47:56 2005 +0000 Update package version number for RC1 release. commit b6bc1985f3241a1e8bf4896ddc0ba62cc8d52bbb Author: Alan Coopersmith Date: Tue Oct 18 00:32:55 2005 +0000 Change default install dir for app-default files from $(sysconfdir)/X11/app-defaults to $(libdir)/X11/app-defaults to match the monolith & allow localization commit 8a0d8f1a09e3f9f81cd3a254bf129dfb194631c0 Author: Alan Coopersmith Date: Mon Oct 17 23:56:24 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 339f76a32a41635dda213807baaf163e80305a49 Author: Alan Coopersmith Date: Fri Oct 14 00:25:47 2005 +0000 Use sed to fill in variables in man page commit 6b9309358a8f2901e30cf4dab5d91d405ee44ff4 Author: Kevin E Martin Date: Wed Oct 5 00:01:35 2005 +0000 Add xmore.sgml to EXTRA_DIST commit 634f48bc62e069913e64ded9e068a9fab03f9cb9 Author: Alan Coopersmith Date: Mon Aug 1 20:25:31 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit 9c8de9a0c760ce9d06b8593182e0fab89890d229 Author: Kevin E Martin Date: Fri Jul 29 21:22:36 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit 3aa8309ba62e1a445663c458c0132d0b70c66d66 Author: Alan Coopersmith Date: Tue Jul 26 15:44:03 2005 +0000 Replace more GNU make-ism's with more portable macros commit eaae9a052fc7eec785e6fc8cf2011ea963030a5b Author: Matthieu Herrb Date: Sat Jul 23 16:56:33 2005 +0000 fix GNU-make only app-defaults rule commit f63f6eb288ab5b518525e31407f1be1514cf72e7 Author: Matthieu Herrb Date: Sat Jul 23 16:56:07 2005 +0000 fix remaining DEP_{CFLAGS,LIBS} refenences commit f9a60649a815c42cd5ebd9e24dbbb12d62fd90de Author: Adam Jackson Date: Wed Jul 20 19:32:03 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit bf280e7bc5d6e2c65ea0235fde208274a714d13b Author: Søren Sandmann Pedersen Date: Tue Jul 5 22:51:11 2005 +0000 Add build systems for xlogo, xlsatoms, xlsclients, xmag, xman, xmessage, xmh, xmore. lib/Xaw/xaw.m4: Add an AM_CONDITIONAL and a shell variable xaw_use_xprint symlink.sh: add some extra files for xgc, xinit, xkbcomp, xlogo, xmb, and xmodmap xc/programs/xmore/xmore.c: Conditionalize use of xprint commit 8b721c45d8f8681e59ca145d1ed3839d1b312a99 Author: Roland Mainz Date: Mon Apr 11 01:06:15 2005 +0000 xc/programs/Xserver/Xprint/attributes.c xc/programs/glxgears/glxgears.c xc/programs/xdbedizzy/xdbedizzy.c xc/programs/xedit/Imakefile xc/programs/xedit/Xedit-xprint.ad xc/programs/xedit/util.c xc/programs/xedit/xedit.h xc/programs/xlogo/print.c xc/programs/xlogo/xlogo.c xc/programs/xlogo/xlogo.h xc/programs/xman/Imakefile xc/programs/xman/print.h xc/programs/xmore/Imakefile xc/programs/xmore/print.c xc/programs/xmore/print.h xc/programs/xmore/printdialog.c xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c xc/programs/xphelloworld/xphelloworld/xphelloworld.c xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c //bugs.freedesktop.org/show_bug.cgi?id=790) attachment #2379 (https://bugs.freedesktop.org/attachment.cgi?id=2379) Implement support client+Xserver support for passing output (stdout+stderr) of the spooler command started by the Xprint server back to the application using the "xp-spooler-command-results" XPJobAttr attribute (applications can fetch the attribute value after the XPEndJobNotify event was received; more details can be found in http://xprint.mozdev.org/docs/dtprint_fspec.ps). commit 3d9fdcb47537e924e7426d64d838c00414ec58ff Author: Roland Mainz Date: Tue Feb 1 23:00:50 2005 +0000 xc/programs/xmore/xmore.man //bugs.freedesktop.org/show_bug.cgi?id=2410) attachment #1786 (https://bugs.freedesktop.org/attachment.cgi?id=1786): Fix formatting problem in the xmore(1x) manual page. Patch by Matthieu Herrb and Roland Mainz . Approved in the 2005-01-31 Xorg release-wranglers phone call (the xmore.man diff is an automatic update from the DocBook--->man conversion). commit 550802b584f89279d8af35ee8a9221dc24ea1f27 Author: Roland Mainz Date: Mon Jan 3 01:06:36 2005 +0000 xc/lib/XprintAppUtil/xpapputil.c xc/lib/XprintAppUtil/xpapputil.h xc/lib/XprintUtil/xprintutil.c xc/lib/XprintUtil/xprintutil.h xc/programs/glxgears/glxgears.c xc/programs/xdbedizzy/xdbedizzy.c xc/programs/xedit/Xedit-xprint.ad xc/programs/xedit/commands.c xc/programs/xlogo/print.c xc/programs/xlsfonts/xlsfonts.c xc/programs/xlsfonts/xlsfonts.man xc/programs/xlsfonts/xlsfonts.sgml xc/programs/xman/Xman-xprint.ad xc/programs/xman/handler.c xc/programs/xman/print.c xc/programs/xman/print.h xc/programs/xmore/XMore.ad xc/programs/xmore/print.c xc/programs/xmore/print.h xc/programs/xmore/printdialog.c xc/programs/xmore/printdialog.h xc/programs/xmore/printdialogprivates.h xc/programs/xmore/xmore.c xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c xc/programs/xphelloworld/xphelloworld/xphelloworld.c xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c xc/programs/xphelloworld/xpxthelloworld/xpxthelloworld.c xc/programs/xplsprinters/xplsprinters.c //bugs.freedesktop.org/show_bug.cgi?id=1706) attachment #1615 (https://bugs.freedesktop.org/attachment.cgi?id=1615): XprintUtils 2004/Q3 update. This adds various new features to the XprintUtils library including support for page resolutions where X_resolution!=Y_resolution, listfonts-mode control and initial framework for the COLORSPACE extension. Patch by Roland Mainz and Julien Lafon . commit 11d508e4bfec3ecd749123e043768ea3fb21ce12 Author: Roland Mainz Date: Tue Oct 12 22:46:40 2004 +0000 Fix for https://freedesktop.org/bugzilla/show_bug.cgi?id=1601 - Fix problems with wrong page counts in xedit&co. when a global "*geometry" resource was overriding the internal geometry management used by XawPrintShell(=usually adjust to current page size, the resource was turning this into a static value). (Original patch by Felix Schulte ) commit 71eb560c323df9e78e1381eff41002f1df9cb44b Author: Roland Mainz Date: Thu Jul 29 00:40:35 2004 +0000 Fix for https://freedesktop.org/bugzilla/show_bug.cgi?id=938 - Update XawPrintShell per feedback and review comments. commit a5c5bd828d0a89ab979ad122c40073e8985e5e6e Author: Roland Mainz Date: Tue Jun 8 02:44:35 2004 +0000 Fix for http://freedesktop.org/bugzilla/show_bug.cgi?id=668 - Add print support to xman commit b041343bcf05fdf5ce4234655c869251b3f8fafa Author: Roland Mainz Date: Sun May 30 22:44:01 2004 +0000 Fix for http://freedesktop.org/bugzilla/show_bug.cgi?id=695 - Add print support to Xedit commit 7b5bbd9057eba74e53ec0ed9a306e78a15bd96a8 Author: Roland Mainz Date: Sun May 30 00:52:30 2004 +0000 Fix for http://freedesktop.org/bugzilla/show_bug.cgi?id=693 - XMore and XawPrintDialog work-in-progress, fixing various problems and adding framework for i18n. commit 62ad6298a589dd16820c7d0bbfcd2b5381a2589e Author: Roland Mainz Date: Mon May 24 03:17:44 2004 +0000 Fix for http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=611 - Adding simple text viewer (xmore) x11-apps-7.7+5+nmu1ubuntu1/xmore/config.guess0000775000000000000000000012761512167023104015653 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. timestamp='2009-11-20' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xmore/config.h.in0000664000000000000000000000315012656634713015362 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION x11-apps-7.7+5+nmu1ubuntu1/xmore/xmore.man0000664000000000000000000000062712167023104015153 0ustar .\" -*- coding: us-ascii -*- .TH xmore __appmansuffix__ "1 February 2005" .SH NAME xmore \- plain text display program for the X Window System .SH SYNOPSIS .ad l \fBxmore\fR \kx .if (\nxu > (\n(.lu / 2)) .nr x (\n(.lu / 5) 'in \n(.iu+\nxu [\fB\fBfilename\fR\fR] 'in \n(.iu-\nxu .ad b .SH DESCRIPTION xmore is a plain text browser. .SH "SEE ALSO" \fBX11\fR(__miscmansuffix__), \fBxman\fR(__appmansuffix__) x11-apps-7.7+5+nmu1ubuntu1/xmore/config.sub0000775000000000000000000010316712167023104015312 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. timestamp='2009-11-20' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xmore/Makefile.am0000664000000000000000000000372212167023104015357 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. bin_PROGRAMS = xmore AM_CFLAGS = $(XMORE_CFLAGS) -DXMORE $(CWARNFLAGS) xmore_LDADD = $(XMORE_LIBS) xmore_SOURCES = \ xmore.c \ xmore.h appman_PRE = \ xmore.man # App default files DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ dist_appdefault_DATA = \ app-defaults/XMore EXTRA_DIST = xmore.sgml appmandir = $(APP_MAN_DIR) appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) EXTRA_DIST += $(appman_PRE) MAINTAINERCLEANFILES = ChangeLog INSTALL CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xmore/configure.ac0000664000000000000000000000411412167023104015605 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. AC_PREREQ([2.60]) AC_INIT([xmore], [1.0.2], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xmore]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS AM_CONFIG_HEADER(config.h) AC_PROG_INSTALL # Checks for pkg-config packages PKG_CHECK_MODULES(XMORE, xaw7) PKG_CHECK_MODULES(APPDEFS, xt) xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` AC_ARG_WITH(appdefaultdir, AC_HELP_STRING([--with-appdefaultdir=], [specify directory for app-defaults files (default is autodetected)]), [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) AC_OUTPUT([Makefile]) x11-apps-7.7+5+nmu1ubuntu1/xmore/README0000664000000000000000000000125612167023104014203 0ustar xmore - plain text display program for the X Window System All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xmore http://cgit.freedesktop.org/xorg/app/xmore For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xmore/COPYING0000664000000000000000000000071212167023104014352 0ustar This is a stub file. This package has not yet had its complete licensing information compiled. Please see the individual source files for details on your rights to use and modify this software. Please submit updated COPYING files to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg All licensing questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg x11-apps-7.7+5+nmu1ubuntu1/xmore/INSTALL0000664000000000000000000002622212167023104014354 0ustar Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 6. Often, you can also type `make uninstall' to remove the installed files again. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *Note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xmore/xmore.sgml0000664000000000000000000000361212167023104015337 0ustar xmore __appmansuffix__ xmore plain text display program for the X Window System xmore DESCRIPTION xmore is a plain text browser. SEE ALSO X11__miscmansuffix__ xman__appmansuffix__ x11-apps-7.7+5+nmu1ubuntu1/xmag/0000775000000000000000000000000012656635743013146 5ustar x11-apps-7.7+5+nmu1ubuntu1/xmag/Scale.h0000664000000000000000000001105012514127176014330 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _XawScale_h #define _XawScale_h /*********************************************************************** * * Scale Widget * ***********************************************************************/ #include #include /* Resources: All the SimpleWidget resources plus... Name Class RepType Default Value ---- ----- ------- ------------- aspectRatio AspectRatio Float 1.0 autoscale Autoscale Boolean True bufferSize BufferSize Cardinal 1024 foreground Foreground Pixel XtDefaultForeground gravity Gravity XtGravity ForgetGravity image Image XImage* NULL internalHeight Height Dimension 2 internalWidth Width Dimension 2 pasteBuffer PasteBuffer Boolean False precision Precision Float 0.001 proportional Proportional Boolean False resize Resize Boolean True scaleX ScaleValue Float 1.0 scaleY ScaleValue Float 1.0 userData UserData XtPointer NULL visual Visual Visual* CopyFromParent */ #ifndef _XtStringDefs_h_ #define XtNforeground "foreground" #define XtNinternalWidth "internalWidth" #define XtNinternalHeight "internalHeight" #define XtNresize "resize" #define XtCResize "Resize" #endif #define XtNaspectRatio "aspectRatio" #define XtCAspectRatio "AspectRatio" #define XtNbufferSize "bufferSize" #define XtCBufferSize "BufferSize" #define XtNscaleX "scaleX" #define XtNscaleY "scaleY" #define XtCScaleFactor "ScaleFactor" #define XtNautoscale "autoscale" #define XtCAutoscale "Autoscale" #define XtNproportional "proportional" #define XtCProportional "Proportional" #define XtNprecision "precision" #define XtCPrecision "Precision" #define XtNgravity "gravity" #define XtCGravity "Gravity" #define XtNpasteBuffer "pasteBuffer" #define XtCPasteBuffer "PasteBuffer" #define XtNimage "image" #define XtCImage "image" #define XtNexponent "exponent" #define XtCExponent "Exponent" #define XtNuserData "userData" #define XtCuserData "UserData" #define XtRuserData "UserData" #define XtRImage "Image" #ifndef XtNvisual #define XtNvisual "visual" #endif #define XtCvisual "Visual" #define XtRvisual "Visual" /* Class record constants */ extern WidgetClass scaleWidgetClass; typedef struct _ScaleClassRec *ScaleWidgetClass; typedef struct _ScaleRec *ScaleWidget; extern int SWGetImagePixel ( Widget w, Position x, Position y, Position *img_x, Position *img_y, Pixel *img_pixel ); extern void SWUnscale ( Widget w, XEvent *event, String *params, Cardinal *num_params ); extern void SWAutoscale ( Widget w, XEvent *event, String *params, Cardinal *num_params ); extern void SWInitialSize ( Widget w, XEvent *event, String *params, Cardinal *num_params ); extern void SWSetImage ( Widget w, XImage *image ); extern void RequestSelection ( Widget w, XEvent *event, String *params, Cardinal *num_params ); extern void GrabSelection ( Widget w, XEvent *event, String *params, Cardinal *num_params ); extern Pixmap SWGetPixmap ( Widget w ); #endif /* _XawScale_h */ x11-apps-7.7+5+nmu1ubuntu1/xmag/CutPaste.c0000664000000000000000000000730412514127176015033 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Davor Matic, MIT X Consortium */ #include #include #include #include #include "ScaleP.h" /* This file should be part of the Scale widget */ #include "Scale.h" #include "CutPaste.h" #include /*ARGSUSED*/ static Boolean ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, XtPointer *value, unsigned long *length, int *format) { Boolean success; if (*target == XA_PIXMAP || *target == XA_BITMAP) { ScaleWidget sw = (ScaleWidget) w; Pixmap *pixmap = (Pixmap *) XtMalloc(sizeof(Pixmap)); *pixmap = XCreatePixmap(XtDisplay(w), XtWindow(w), sw->scale.image->width, sw->scale.image->height, sw->scale.image->depth); XPutImage(XtDisplay(w), *pixmap, sw->scale.gc, sw->scale.image, 0, 0, 0, 0, sw->scale.image->width, sw->scale.image->height); *type = XA_PIXMAP; *value = (XtPointer) pixmap; *length = 1; *format = 32; success = True; } else { /* Xt will always respond to selection requests for the TIMESTAMP target, so we can pass a bogus time to XmuConvertStandardSelection. In addition to the targets provided by XmuConvertStandardSelection, Xt converts MULTIPLE, and we convert PIXMAP and BITMAP. */ success = XmuConvertStandardSelection(w, (Time)0, selection, target, type, (XPointer *)value, length, format); if (success && *target == XA_TARGETS(XtDisplay(w))) { Atom* tmp; tmp = (Atom *) XtRealloc(*value, (*length + 3) * sizeof(Atom)); tmp[(*length)++] = XInternAtom(XtDisplay(w), "MULTIPLE", False); tmp[(*length)++] = XA_PIXMAP; tmp[(*length)++] = XA_BITMAP; *value = (XtPointer) tmp; } } return success; } void SWGrabSelection(Widget w, Time time) { (void) XtOwnSelection(w, XA_PRIMARY, time, ConvertSelection, NULL, NULL); } /*ARGSUSED*/ static void SelectionCallback(Widget w, XtPointer client_data, Atom *selection, Atom *type, XtPointer value, unsigned long *length, int *format) { if (*type == XA_PIXMAP) { Pixmap *pixmap; XImage *image; Window root; int x, y; unsigned int width, height, border_width, depth; pixmap = (Pixmap *) value; XGetGeometry(XtDisplay(w), *pixmap, &root, &x, &y, &width, &height, &border_width, &depth); image = XGetImage(XtDisplay(w), *pixmap, 0, 0, width, height, AllPlanes, ZPixmap); SWAutoscale(w, NULL, NULL, NULL); SWSetImage(w, image); XtFree(value); XDestroyImage(image); } } void SWRequestSelection(Widget w, Time time) { XtGetSelectionValue(w, XA_PRIMARY, XA_PIXMAP, SelectionCallback, NULL, time); } x11-apps-7.7+5+nmu1ubuntu1/xmag/compile0000755000000000000000000001624512656634704014526 0ustar #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xmag/app-defaults/0000775000000000000000000000000012520517125015512 5ustar x11-apps-7.7+5+nmu1ubuntu1/xmag/app-defaults/Xmag0000664000000000000000000000133212514127176016336 0ustar *Font: fixed *pane2*orientation: horizontal *pane2*showGrip: False *allowShellResize: on *Scale.baseTranslations:#augment\ : set-colors()\n\ : unset-colors()\n\ :popup-pixel()\n\ Button1:popup-pixel()\n\ :update-pixel()\n\ :popdown-pixel()\n\ :popdown-pixel()\n\ n:new()\n\ q:close()\n\ Ctrlc:close()\n\ space:replace() *close.accelerators:#augment\ q:set()notify()unset()\n\ Ctrlc:set()notify()unset() *replace.accelerators:#augment\ space:set()notify()unset()\n\ :set()notify()unset()\n\ :set()notify()unset() *helpLabel.font: 8x13bold *helpLabel.label: xmag x11-apps-7.7+5+nmu1ubuntu1/xmag/ChangeLog0000664000000000000000000005073212514127224014706 0ustar commit 011bec331e11d306c1811376e4de4d84ab2996ce Author: Alan Coopersmith Date: Thu Apr 16 23:55:52 2015 -0700 xmag 1.0.6 Signed-off-by: Alan Coopersmith commit 975b6bcad6de9f57d46efc7bddb691a40703ae1e Author: Alan Coopersmith Date: Fri Jul 11 20:00:49 2014 -0700 Delete trailing whitespace from *.[ch] files Signed-off-by: Alan Coopersmith commit ec3e612fadfbdf60dc30bc8f155d5fb6a5fd501f Author: Alan Coopersmith Date: Fri Jul 11 19:58:18 2014 -0700 Convert sprintf to snprintf Signed-off-by: Alan Coopersmith commit b23149c5cda460d8ff932e891eb23df897d10dc0 Author: Alan Coopersmith Date: Fri Jul 11 19:56:19 2014 -0700 Fix typos & wording issues in source comments Signed-off-by: Alan Coopersmith commit 2be3155114bfcd0c0071a8c8f5973d499eba8736 Author: Alan Coopersmith Date: Sat May 31 23:29:53 2014 -0700 autogen.sh: Honor NOCONFIGURE=1 See http://people.gnome.org/~walters/docs/build-api.txt Signed-off-by: Alan Coopersmith commit 47ea99fc84c3067eea428cadc0cd33941bd9b04c Author: Alan Coopersmith Date: Sat May 31 23:29:53 2014 -0700 configure: Drop AM_MAINTAINER_MODE Signed-off-by: Alan Coopersmith commit b40365c8650d58e9f0a3ba35cba20f7ece38cdd6 Author: Alan Coopersmith Date: Sat May 31 23:29:38 2014 -0700 config: Add missing AC_CONFIG_SRCDIR Regroup AC statements under the Autoconf initialization section. Regroup AM statements under the Automake initialization section. Signed-off-by: Alan Coopersmith commit 8c4b91ea40088bc80de9cc2695f77a27ce78b0d9 Author: Alan Coopersmith Date: Sat Jan 12 22:16:24 2013 -0800 xmag 1.0.5 Signed-off-by: Alan Coopersmith commit 50ed4f69a5f5e535128c5e2d1abc252b093dff06 Author: Alan Coopersmith Date: Tue Dec 20 20:40:06 2011 -0800 Use lrint() from math library if available Moves -lm from being hardcoded in Makefile.am to being added via AC_SEARCH_LIBS in configure.ac setting it in $(LIBS) Using lrint() [returns long int] instead of rint() [returns double] clears a bunch of gcc warnings of the form: "cast from function call of type ‘double’ to non-matching type ‘short int’" Signed-off-by: Alan Coopersmith Reviewed-by: James Cloos commit 43ffa427238cdfb132205375624a25c5c28e9f86 Author: Alan Coopersmith Date: Fri Feb 18 00:26:59 2011 -0800 Remove obsolete ISC support Signed-off-by: Alan Coopersmith commit e81168403132afe71b38e41cd368d0d9869bd320 Author: Gaetan Nadon Date: Wed Jan 19 10:06:56 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 857e73cfd8d79c8f81712fae8b4fa2d7e8565796 Author: Gaetan Nadon Date: Thu Jan 13 11:15:47 2011 -0500 man: remove trailing spaces and tabs Using s/[ \t]*$// Signed-off-by: Gaetan Nadon commit 4c3bfeaa40aaf817bffcf7b4e4adaab45ec0ca13 Author: Gaetan Nadon Date: Wed Jan 12 16:28:02 2011 -0500 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS This silences an Autoconf warning commit 4c741b8945c886ce1cfaaeb57c3ce726b77b6ae1 Author: Gaetan Nadon Date: Wed Jan 12 15:29:50 2011 -0500 config: replace deprecated AC_HELP_STRING with AS_HELP_STRING This silences an Automake warning. Signed-off-by: Gaetan Nadon commit 63cee7f38dc37fda89dc5aa689634bd8aeffabda Author: Alan Coopersmith Date: Sat Oct 30 17:22:41 2010 -0700 xmag 1.0.4 Signed-off-by: Alan Coopersmith commit d41f3ae0b0e383ba2e622e3dd9999d3c09f90091 Author: Alan Coopersmith Date: Sat Oct 30 17:20:18 2010 -0700 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now Signed-off-by: Alan Coopersmith commit 9475bf19a6544f522357f59bd1b04ec7685e3eb8 Author: Alan Coopersmith Date: Sat Oct 30 17:19:07 2010 -0700 Purge CVS version tags Signed-off-by: Alan Coopersmith commit cc7172d187ad35a1b851961cc9c588e56c3894fa Author: Gaetan Nadon Date: Sat Oct 30 17:17:49 2010 -0700 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon Signed-off-by: Alan Coopersmith commit 36ac8aaf057d0ae35d63e568667f1aebcfa2e56e Author: Alan Coopersmith Date: Fri Aug 6 15:04:26 2010 -0700 Fill in COPYING file with copyright notices from source code Signed-off-by: Alan Coopersmith commit e9a1886d9e2a89995c2094b37000e12da4791cbf Author: Alan Coopersmith Date: Thu Jul 1 18:29:03 2010 -0700 Xmu functions are called directly, so include it in PKG_CHECK_MODULES Signed-off-by: Alan Coopersmith commit b7544beaad218b5799018fe1dca84815a14bbfa4 Author: Alan Coopersmith Date: Wed Jun 30 23:25:03 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS The existing statement can now be removed from the configuration file. Use automake provided $(AM_V_GEN) and XORG_DEFAULT_OPTIONS provided $(SED) Enables silent rule and use platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit f7ef4087a4bf87618e9b84ff7726f3f08fd018ca Author: Gaetan Nadon Date: Thu Feb 11 10:08:07 2010 -0500 config: move CWARNFLAGS from configure.ac to Makefile.am Compiler warning flags should be explicitly set in the makefile rather than being merged with other packages compiler flags. Signed-off-by: Gaetan Nadon commit b20bf366aa045549221c6b0fb3aa7b7fda43b3a5 Author: Gaetan Nadon Date: Sat Dec 19 20:48:48 2009 -0500 configure.ac: use backticks rather than $() for cmd subs Use "$PKG_CONFIG" rather than hard coded "pkg-config" Signed-off-by: Gaetan Nadon commit 3e597fcfe489f9eb9057b0b8a7fe3f75925b23d2 Author: Gaetan Nadon Date: Thu Nov 26 09:19:54 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit a060a628982782ca24e2a4cfa5654b068b935e61 Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit c1642cd3036e03c8f42c833d2f321b51a62083df Author: Gaetan Nadon Date: Tue Oct 27 15:07:25 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit 91ce3b21ef889d857bfb898bbd85f774721bb26b Author: Gaetan Nadon Date: Mon Oct 26 22:08:39 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit 6802cc3ec6357529605ec994c9d531f3ca9e3561 Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit de39a50709190e16a6f357e0be673db04d26b4a6 Author: Alan Coopersmith Date: Thu Oct 1 14:54:26 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit f1f2af7a65d6531814a06b292a28bdc46580e590 Author: Alan Coopersmith Date: Mon Aug 3 11:19:07 2009 -0700 Version bump: 1.0.3 Signed-off-by: Alan Coopersmith commit 90ccae7efc5fca9c0f4e45b84806df01332dd869 Author: Paulo Cesar Pereira de Andrade Date: Mon Jan 12 20:41:14 2009 -0200 Correct problems in make distcheck. commit ae94046d8654b9f65df871502de0f08a36aa5d38 Author: Julien Cristau Date: Tue Aug 19 01:04:40 2008 +0200 xaw8 is gone, use xaw7 commit 7ac72ce2e262bf78cb2e8ff50ef932d29e4b65f7 Author: Julien Cristau Date: Tue Aug 19 01:04:27 2008 +0200 allow build outside of source tree commit a3e1a9b4cb732b86b84375013e3fa531395b45cf Author: Paulo Cesar Pereira de Andrade Date: Tue Jul 29 14:18:10 2008 -0300 Properly handle multiple depth windows. This patch will not cause X Errors when magnifying windows with portions offscreen, or windows with a dimension smaller than the default 64x64. A common case where this patch is required is when Composite is enabled, the default depth has a value other than 24, and some application is using the Composite argb visual; example is WindowMaker, that will choose the "best" available visual, unless the visual-id option is used. commit cb21acd94353c82c4b49a7ddef99309b31b07500 Author: Jeremy Huddleston Date: Thu Mar 27 20:08:04 2008 -0700 Build fix for file systems that are not case sensitive commit a6b0036a082a947b89bdbb27128e20079799857c Author: Alan Coopersmith Date: Wed Aug 15 18:04:12 2007 -0700 Version bump: 1.0.2 commit e4cd84139d155bf0ce7b42de65e2a5bfcc471a46 Author: Alan Coopersmith Date: Wed Aug 15 17:59:30 2007 -0700 Change xmag_CFLAGS to AM_CFLAGS to make automake-1.10 happier Makefile.am:27: compiling `CutPaste.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.ac' commit d990122dafcde5d22c8f1aa40e8f9dc213f79e17 Author: Alan Coopersmith Date: Wed Aug 1 13:22:35 2007 -0700 Make fix for Sun bug 6359959 more portable - use nanosleep, poll or select commit eb12c1f539cebbd7481711d1dc97e3e29b594389 Author: Alan Coopersmith Date: Tue Dec 13 00:00:00 2005 -0800 Sun bug 6359959: xmag overconsumes CPU due to its selection box The fix for Sun bug 1166559 changed the HLINTERVAL from 10 to 0.5 to fix a problem that the selection box wasn't being seen. The problem is that this parameter is used in an XtAppAddTimeOut(), and is supposed to be an unsigned long. Thus, the 0.5 presumably turns into a 0 ms timeout. Whatever effect that is being seen is due to seeing a rectangle drawn as fast as the poor little X server can do it. commit a04689bccae3bd2df3812a8ed7fc0d675fdb05e9 Author: Derek Wang Date: Mon May 8 00:00:00 2000 -0700 Sun bug 1166559: highlight of selection box not discernable on some configs 1) On devices whose default visual is 24-bit TrueColor the selection area bounding box has no contrast with the background. This is because a value of 1 is being xor'd in. This won't provide enough contrast. A value of 0xffffff would be better. 2) On my machine (which is a dual 50-Mhz SS10) you can sort of see the bounding box on my GX if you look really, really close, but it's a faint flicker. I believe what is happening is that the bounding box is being drawn and undrawn so fast you can hardly see it. commit 80faa0025128c10662694e818747fd0a592bc108 Author: Alan Coopersmith Date: Fri Jun 1 16:40:07 2007 -0700 Replace static ChangeLog with dist-hook to generate from git log commit bff2deea15bd0b676458b88acb46d63fd72b86af Author: Alan Coopersmith Date: Sat May 19 00:06:28 2007 -0700 X.Org Bug #10616: xmag man page says "Cut" button instead of "Select" X.Org Bugzilla #10616: Reported upstream from Debian bug #180712 commit f137f0414022575553bd65c3179b694be391c428 Author: Alan Coopersmith Date: Sat May 19 00:01:58 2007 -0700 renamed: .cvsignore -> .gitignore commit 5ef80b96a9d8676f79c5e27c727789d63a61e45b Author: Kevin E Martin Date: Wed Dec 21 02:29:52 2005 +0000 Update package version for X11R7 release. commit 0a9729f6c8a8e644e4048ee5135a35d9f0603e56 Author: Adam Jackson Date: Mon Dec 19 16:22:45 2005 +0000 Stub COPYING files commit 094ca9cfcd3c6910a3e6981afdea8c461b636271 Author: Kevin E Martin Date: Thu Dec 15 00:24:09 2005 +0000 Update package version number for final X11R7 release candidate. commit 61019bb2e2eea3f970540dc24d1bd52d508e5f60 Author: Kevin E Martin Date: Wed Dec 7 16:18:00 2005 +0000 Change to use the app-defaults default dir configured in libXt. commit 95ba475220dafec7777d5e3802d817fb068a70ed Author: Kevin E Martin Date: Tue Dec 6 22:48:24 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit 9223bc8f2d024f4dd378454ec3ecf5da6d51874e Author: Kevin E Martin Date: Sat Dec 3 05:49:26 2005 +0000 Update package version number for X11R7 RC3 release. commit 7ebdd01ac939fdbe290d14a6c80a7d4aaf555347 Author: Alan Coopersmith Date: Mon Nov 28 22:01:44 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit 0fdfec2cbbd3ac47a2c67e5a6bf5594a300c92be Author: Eric Anholt Date: Mon Nov 21 10:35:02 2005 +0000 Another pass at .cvsignores for apps. commit 5dad105bfb499209c18e8716a38f1c4eb5e93d6d Author: Eric Anholt Date: Sun Nov 20 22:08:54 2005 +0000 Add/improve .cvsignore files for apps. commit 75f0fc733252f111d0fc7de07622a46e4adc675a Author: Kevin E Martin Date: Wed Oct 19 02:47:55 2005 +0000 Update package version number for RC1 release. commit 0d383b0eb8c7177fa12f8138c7ad9e527a98ba59 Author: Alan Coopersmith Date: Tue Oct 18 00:32:54 2005 +0000 Change default install dir for app-default files from $(sysconfdir)/X11/app-defaults to $(libdir)/X11/app-defaults to match the monolith & allow localization commit c15d91b39f14e916d17581b1b653e3057571399f Author: Alan Coopersmith Date: Mon Oct 17 23:56:24 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 3beed227e1ea75c57e38deba4a325303136947f4 Author: Alan Coopersmith Date: Fri Oct 14 00:25:46 2005 +0000 Use sed to fill in variables in man page commit 3a983a36e2a566b96dc92ba061c7795207ff6e0c Author: Kevin E Martin Date: Tue Oct 4 23:59:50 2005 +0000 Add xmag.icon to EXTRA_DIST commit bb2d194053c71d49aefbcce7cbc371924163d7ce Author: Alan Coopersmith Date: Sun Oct 2 20:20:12 2005 +0000 Add developer documentation of xmag's Scale widget class to app/xmag commit 400ba6d65004e8c5ccc2fe45195374e46be21fe4 Author: Alan Coopersmith Date: Mon Aug 1 20:25:30 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit 312910577edf6841f797317a8fe521abb1987a1b Author: Kevin E Martin Date: Fri Jul 29 21:22:36 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit 175a29fb026e628b815a443beb305514bf90f74e Author: Alan Coopersmith Date: Tue Jul 26 15:44:02 2005 +0000 Replace more GNU make-ism's with more portable macros commit 2453fa155493771d1ce948de0122c3e53e0cd5d1 Author: Matthieu Herrb Date: Sat Jul 23 16:43:02 2005 +0000 fix GNU-make only app-defaults rule commit 45e2eed46b415283bd56f2830d67117c7861cb3c Author: Adam Jackson Date: Wed Jul 20 19:32:02 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit 38ca5441b199b16b3d2dee2c2b8eaa133aec99a9 Author: Søren Sandmann Pedersen Date: Tue Jul 5 22:51:11 2005 +0000 Add build systems for xlogo, xlsatoms, xlsclients, xmag, xman, xmessage, xmh, xmore. lib/Xaw/xaw.m4: Add an AM_CONDITIONAL and a shell variable xaw_use_xprint symlink.sh: add some extra files for xgc, xinit, xkbcomp, xlogo, xmb, and xmodmap xc/programs/xmore/xmore.c: Conditionalize use of xprint commit 0cac7e38453d2c9c670fb9f9100c244bf9f7b98e Author: Egbert Eich Date: Fri Apr 23 19:54:58 2004 +0000 Merging XORG-CURRENT into trunk commit 6571a03e0f78ea6f45a4c67c60ba54b8980c3f76 Author: Egbert Eich Date: Sun Mar 14 08:35:39 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit 4344e337c42eb72bcc24257ba5345a4d102c1849 Author: Egbert Eich Date: Wed Mar 3 12:13:14 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit ce152a72a5422ba9c6c7a4c0298f8da6cf0f0a50 Author: Egbert Eich Date: Thu Feb 26 13:36:26 2004 +0000 readding XFree86's cvs IDs commit 8f63e90e414e756e3aeeb57014c75b2b0882f799 Author: Egbert Eich Date: Thu Feb 26 09:24:14 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit 07819d0d328460410b940d05ee36235c255cf698 Author: Kaleb Keithley Date: Tue Nov 25 19:29:15 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit c6d1f60f8f68135337e8d0c5a9d564d1b4932104 Author: Kaleb Keithley Date: Fri Nov 14 16:49:23 2003 +0000 XFree86 4.3.0.1 commit 4c688ea7bec8b76e643d610577104e5519722be9 Author: Kaleb Keithley Date: Fri Nov 14 16:49:23 2003 +0000 Initial revision commit 31f434e2df14612e3cf18fe45a6c161eb3c225ff Author: Kaleb Keithley Date: Fri Nov 14 15:54:54 2003 +0000 R6.6 is the Xorg base-line x11-apps-7.7+5+nmu1ubuntu1/xmag/ScaleP.h0000664000000000000000000000515312514127176014457 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Davor Matic, MIT X Consortium */ #ifndef _ScaleP_h #define _ScaleP_h #include "Scale.h" #include typedef struct { int foo; } ScaleClassPart; /* Full class record declaration */ typedef struct _ScaleClassRec { CoreClassPart core_class; SimpleClassPart simple_class; ScaleClassPart scale_class; } ScaleClassRec; extern ScaleClassRec scaleClassRec; typedef struct { Position *x, *y; Dimension *width, *height; } Table; /* New fields for the Scale widget record */ #ifndef XtGravity #define XtGravity int #endif typedef struct { /* resources */ Pixel foreground_pixel; Dimension internal_width; Dimension internal_height; XtGravity gravity; String scale_x_str, scale_y_str; String aspect_ratio_str; String precision_str; XImage *image; Boolean resize; Boolean autoscale; Boolean proportional; Boolean paste_buffer; Cardinal buffer_size; XtPointer userData; Visual *visual; /* private */ float scale_x, scale_y; float aspect_ratio; float precision; GC gc; Position x, y; Dimension width, height; Table table; XRectangle *rectangles; Cardinal nrectangles; } ScalePart; /* Full instance record declaration */ typedef struct _ScaleRec { CorePart core; SimplePart simple; ScalePart scale; } ScaleRec; #endif /* _ScaleP_h */ x11-apps-7.7+5+nmu1ubuntu1/xmag/CutPaste.h0000664000000000000000000000301312514127176015031 0ustar /* * Copyright (C) 1999 The XFree86 Project, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. */ #ifndef _CUTPASTE_H #define _CUTPASTE_H extern void SWGrabSelection ( Widget w, Time time ); extern void SWRequestSelection ( Widget w, Time time ); #endif x11-apps-7.7+5+nmu1ubuntu1/xmag/depcomp0000755000000000000000000005601612656634704014525 0ustar #! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xmag/config.guess0000775000000000000000000012367212514123564015463 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-11-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xmag/RootWin.h0000664000000000000000000000415312514127176014710 0ustar /* Copyright 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _RootWindow_h #define _RootWindow_h /**************************************************************** * * RootWindow widget * ****************************************************************/ /* Resources: Name Class RepType Default Value ---- ----- ------- ------------- background Background Pixel XtDefaultBackground border BorderColor Pixel XtDefaultForeground borderWidth BorderWidth Dimension 1 destroyCallback Callback Pointer NULL height Height Dimension 0 mappedWhenManaged MappedWhenManaged Boolean True sensitive Sensitive Boolean True width Width Dimension 0 x Position Position 0 y Position Position 0 */ /* declare specific RootWindowWidget class and instance datatypes */ typedef struct _RootWindowClassRec* RootWindowWidgetClass; typedef struct _RootWindowRec* RootWindowWidget; /* declare the class constant */ extern WidgetClass rootWindowWidgetClass; #endif /* _RootWindow_h */ x11-apps-7.7+5+nmu1ubuntu1/xmag/Scale.c0000664000000000000000000006667312514127176014350 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Davor Matic, MIT X Consortium */ #include "config.h" #include #include #include #include #include #include #include #include #include "CutPaste.h" #include "ScaleP.h" #ifdef HAVE_LRINT #define myrint(x) lrint(x) #else #define myrint(x) floor(x + 0.5) #endif #define streq(a,b) (strcmp( (a), (b) ) == 0) #ifndef min #define min(x, y) ((x) > (y) ? (y) : (x)) #endif #ifndef max #define max(x, y) ((x) < (y) ? (y) : (x)) #endif #define DefaultBufferSize 1024 #define DefaultScaleFactor NULL #define Offset(field) XtOffsetOf(ScaleRec, scale.field) static XtResource resources[] = { {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), Offset(foreground_pixel), XtRString, (XtPointer) XtDefaultForeground}, {XtNgravity, XtCGravity, XtRGravity, sizeof(XtGravity), Offset(gravity), XtRImmediate, (XtPointer) "ForgetGravity"}, {XtNinternalWidth, XtCWidth, XtRDimension, sizeof(Dimension), Offset(internal_width), XtRImmediate, (XtPointer) 2}, {XtNinternalHeight, XtCHeight, XtRDimension, sizeof(Dimension), Offset(internal_height), XtRImmediate, (XtPointer) 2}, {XtNresize, XtCResize, XtRBoolean, sizeof(Boolean), Offset(resize), XtRImmediate, (XtPointer) True}, {XtNautoscale, XtCAutoscale, XtRBoolean, sizeof(Boolean), Offset(autoscale), XtRImmediate, (XtPointer) True}, {XtNproportional, XtCProportional, XtRBoolean, sizeof(Boolean), Offset(proportional), XtRImmediate, (XtPointer) True}, {XtNscaleX, XtCScaleFactor, XtRString, sizeof(String), Offset(scale_x_str), XtRImmediate, (XtPointer) DefaultScaleFactor}, {XtNscaleY, XtCScaleFactor, XtRString, sizeof(String), Offset(scale_y_str), XtRImmediate, (XtPointer) DefaultScaleFactor}, {XtNaspectRatio, XtCAspectRatio, XtRString, sizeof(String), Offset(aspect_ratio_str), XtRImmediate, (XtPointer) "1.0"}, {XtNprecision, XtCPrecision, XtRString, sizeof(String), Offset(precision_str), XtRImmediate, (XtPointer) "0.001"}, {XtNimage, XtCImage, XtRImage, sizeof(XImage*), Offset(image), XtRImmediate, (XtPointer) NULL}, {XtNpasteBuffer, XtCPasteBuffer, XtRBoolean, sizeof(Boolean), Offset(paste_buffer), XtRImmediate, (XtPointer) False}, {XtNbufferSize, XtCBufferSize, XtRCardinal, sizeof(Cardinal), Offset(buffer_size), XtRImmediate, (XtPointer) DefaultBufferSize}, {XtNuserData, XtCuserData, XtRuserData, sizeof(XtPointer), Offset(userData), XtRImmediate, (XtPointer) NULL}, { XtNvisual, XtCvisual, XtRVisual, sizeof(Visual*), Offset(visual), XtRImmediate, CopyFromParent} }; #undef Offset static void ClassInitialize ( void ); static void GetGC ( ScaleWidget sw ); static void GetInitialScaleValues ( ScaleWidget sw ); static void GetRectangleBuffer ( ScaleWidget sw, Cardinal buffer_size ); static void Initialize ( Widget request, Widget new, ArgList args, Cardinal *num_args ); static void BuildTable ( ScaleWidget sw ); static void FlushRectangles ( ScaleWidget sw, Drawable drawable, GC gc ); static void FillRectangle ( ScaleWidget sw, Drawable drawable, GC gc, Position x, Position y, Dimension width, Dimension height ); static void ScaleImage ( ScaleWidget sw, Drawable drawable, Position img_x, Position img_y, Position dst_x, Position dst_y, Dimension img_width, Dimension img_height ); static int FindPixel ( ScaleWidget sw, Position x, Position y, Position *img_x, Position *img_y, Pixel *img_pixel ); static void Redisplay ( Widget w, XEvent *event, Region region ); static void TryResize ( ScaleWidget sw ); static void Precision ( ScaleWidget sw ); static void Proportional ( ScaleWidget sw ); static void GetScaledSize ( ScaleWidget sw ); static void GetScaleValues ( ScaleWidget sw ); static void Unscale ( ScaleWidget sw ); static void Autoscale ( ScaleWidget sw ); static void PositionImage ( ScaleWidget sw ); static void Resize ( Widget w ); static void Realize ( Widget wid, Mask *vmask, XSetWindowAttributes *attr ); static void Destroy ( Widget w ); static Boolean SetValues ( Widget current, Widget request, Widget new, ArgList args, Cardinal *num_args ); static XtActionsRec actions[] = { {"unscale", SWUnscale}, {"autoscale", SWAutoscale}, {"initial-size", SWInitialSize}, {"paste", RequestSelection}, {"cut", GrabSelection} }; static char translations[] = "\ u: unscale()\n\ a: autoscale()\n\ i: initial-size()\n\ "; ScaleClassRec scaleClassRec = { { /* core fields */ /* superclass */ (WidgetClass) &simpleClassRec, /* class_name */ "Scale", /* widget_size */ sizeof(ScaleRec), /* class_initialize */ ClassInitialize, /* class_part_initialize */ NULL, /* class_inited */ FALSE, /* initialize */ Initialize, /* initialize_hook */ NULL, /* realize */ Realize, /* actions */ actions, /* num_actions */ XtNumber(actions), /* resources */ resources, /* num_resources */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, /* compress_exposure */ XtExposeCompressMaximal| XtExposeGraphicsExposeMerged, /* compress_enterleave */ TRUE, /* visible_interest */ TRUE, /* destroy */ Destroy, /* resize */ Resize, /* expose */ Redisplay, /* set_values */ SetValues, /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ translations, /* query_geometry */ XtInheritQueryGeometry, /* display_accelerator */ XtInheritDisplayAccelerator, /* extension */ NULL }, { /* change_sensitive */ XtInheritChangeSensitive, } }; WidgetClass scaleWidgetClass = (WidgetClass) &scaleClassRec; /* * Private Procedures */ static void ClassInitialize(void) { } static void GetGC(ScaleWidget sw) { XGCValues values; values.foreground = sw->scale.foreground_pixel; values.background = sw->core.background_pixel; values.function = GXcopy; sw->scale.gc = XtGetGC((Widget) sw, GCForeground | GCBackground | GCFunction, &values); } static void GetInitialScaleValues(ScaleWidget sw) { if (sw->scale.proportional) { sw->scale.scale_x = sw->scale.scale_y = ((sw->scale.aspect_ratio > 1.0) ? sw->scale.aspect_ratio : 1.0 / sw->scale.aspect_ratio) * (sw->scale.precision > 1.0 ? sw->scale.precision : 1.0); Proportional(sw); /* need to cut them down to proper values */ } else sw->scale.scale_x = sw->scale.scale_y = 1.0; } static void GetRectangleBuffer(ScaleWidget sw, Cardinal buffer_size) /* * This procedure will realloc a new rectangles buffer. * If the new buffer size is less than nrectangles, some * information will be lost. */ { if (buffer_size == 0) { buffer_size = DefaultBufferSize; XtWarning("buffer size has to be a positive number greater than zero"); } sw->scale.rectangles = (XRectangle *) XtRealloc((char *) sw->scale.rectangles, buffer_size * sizeof(XRectangle)); sw->scale.buffer_size = buffer_size; } /* ARGSUSED */ static void Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args) { ScaleWidget new_sw = (ScaleWidget) new; new_sw->scale.table.x = (Position *) NULL; new_sw->scale.table.y = (Position *) NULL; new_sw->scale.table.width = (Dimension *) NULL; new_sw->scale.table.height = (Dimension *) NULL; new_sw->scale.nrectangles = 0; new_sw->scale.rectangles = (XRectangle *) NULL; GetRectangleBuffer(new_sw, new_sw->scale.buffer_size); GetGC(new_sw); if (new_sw->scale.image != NULL) { if (new_sw->core.width == 0) new_sw->core.width = new_sw->scale.image->width + 2 * new_sw->scale.internal_width; if (new_sw->core.height == 0) new_sw->core.height = new_sw->scale.image->height + 2 *new_sw->scale.internal_height; } else { if (new_sw->core.width == 0) new_sw->core.width = 1 + 2 * new_sw->scale.internal_width; if (new_sw->core.height == 0) new_sw->core.height = 1 + 2 * new_sw->scale.internal_height; new_sw->scale.image = XCreateImage(XtDisplay(new), DefaultVisual(XtDisplay(new), DefaultScreen(XtDisplay(new))), 1, XYBitmap, 0, XtCalloc(1, sizeof(char)), 1, 1, 8, 0); } if ((new_sw->scale.aspect_ratio = atof(new_sw->scale.aspect_ratio_str)) < 0.0) { new_sw->scale.aspect_ratio = 1.0; XtWarning("AspectRatio has to be a positive number. (forced to 1.0)"); } if ((new_sw->scale.precision = atof(new_sw->scale.precision_str)) < 0.0) { new_sw->scale.precision = 0.001; XtWarning("Precision has to be a positive number. (forced to 0.001)"); } if (new_sw->scale.scale_x_str == DefaultScaleFactor || new_sw->scale.scale_y_str == DefaultScaleFactor) GetInitialScaleValues(new_sw); else { if ((new_sw->scale.scale_x = atof(new_sw->scale.scale_x_str)) < 0.0) { new_sw->scale.scale_x = 1.0; XtWarning("ScaleValue has to be a positive number. (forced to 1.0)"); } if ((new_sw->scale.scale_y = atof(new_sw->scale.scale_y_str)) < 0.0) { new_sw->scale.scale_y = 1.0; XtWarning("ScaleValue has to be a positive number. (forced to 1.0)"); } } } static void BuildTable(ScaleWidget sw) /* * This procedure builds scaling table for image in the scale struct * Requires image, scale_x and scale_y to be set properly */ { Position x, y; XtFree((char *) sw->scale.table.x); XtFree((char *) sw->scale.table.y); XtFree((char *) sw->scale.table.width); XtFree((char *) sw->scale.table.height); sw->scale.table.x = (Position *) XtMalloc(sizeof(Position) * sw->scale.image->width); sw->scale.table.y = (Position *) XtMalloc(sizeof(Position) * sw->scale.image->height); sw->scale.table.width = (Dimension *) XtMalloc(sizeof(Dimension) * sw->scale.image->width); sw->scale.table.height = (Dimension *) XtMalloc(sizeof(Dimension) * sw->scale.image->height); /* Build the scaling table */ for (x = 0; x < sw->scale.image->width; x++) { sw->scale.table.x[(int) x] = (Position) myrint(sw->scale.scale_x * x); sw->scale.table.width[(int) x] = (Dimension) myrint(sw->scale.scale_x *(x + 1)) - myrint(sw->scale.scale_x * x); } for (y = 0; y < sw->scale.image->height; y++) { sw->scale.table.y[(int) y] = (Position) myrint(sw->scale.scale_y * y); sw->scale.table.height[(int) y] = (Dimension) myrint(sw->scale.scale_y *(y + 1)) - myrint(sw->scale.scale_y * y); } } static void FlushRectangles(ScaleWidget sw, Drawable drawable, GC gc) { XFillRectangles(XtDisplay(sw), drawable, gc, sw->scale.rectangles, sw->scale.nrectangles); sw->scale.nrectangles = 0; } static void FillRectangle(ScaleWidget sw, Drawable drawable, GC gc, Position x, Position y, Dimension width, Dimension height) { if (sw->scale.nrectangles == sw->scale.buffer_size) FlushRectangles(sw, drawable, gc); sw->scale.rectangles[(int) sw->scale.nrectangles].x = x; sw->scale.rectangles[(int) sw->scale.nrectangles].y = y; sw->scale.rectangles[(int) sw->scale.nrectangles].width = width; sw->scale.rectangles[(int) sw->scale.nrectangles].height = height; ++sw->scale.nrectangles; } static void ScaleImage(ScaleWidget sw, Drawable drawable, Position img_x, Position img_y, Position dst_x, Position dst_y, Dimension img_width, Dimension img_height) /* * This procedure scales image into the specified drawable * It assumes scaling table was already built */ { GC gc; XGCValues gcv; Position x, y; Pixel pixel; /* Clip the img coordinates */ img_x = min(max(img_x, 0), (Position) sw->scale.image->width - 1); img_y = min(max(img_y, 0), (Position) sw->scale.image->height - 1); img_width = min(img_width, (Dimension)(sw->scale.image->width - (Dimension)img_x)); img_height = min(img_height, (Dimension)(sw->scale.image->height - (Dimension)img_y)); if (sw->scale.scale_x == 1.0 && sw->scale.scale_y == 1.0) XPutImage(XtDisplay(sw), drawable, sw->scale.gc, sw->scale.image, img_x, img_y, dst_x, dst_y, img_width, img_height); else { dst_x = dst_x - sw->scale.table.x[(int) img_x]; dst_y = dst_y - sw->scale.table.y[(int) img_y]; gc = XCreateGC(XtDisplay(sw), drawable, 0, NULL); gcv.function = GXcopy; XChangeGC(XtDisplay(sw), gc, GCFunction, &gcv); /* make sure gc knows the right background */ gcv.background = sw->core.background_pixel; XChangeGC(XtDisplay(sw), gc, GCBackground, &gcv); /* Set the background of drawable. If the most frequent color is the background color it can speed up scaling process. */ gcv.foreground = gcv.background; XChangeGC(XtDisplay(sw), gc, GCForeground, &gcv); XFillRectangle(XtDisplay(sw), drawable, gc, sw->scale.table.x[(int) img_x] + dst_x, sw->scale.table.y[(int) img_y] + dst_y, sw->scale.table.x[(int) img_x + img_width - 1] - sw->scale.table.x[(int) img_x], sw->scale.table.y[(int) img_y + img_height - 1] - sw->scale.table.y[(int) img_y]); if (sw->scale.image->format == XYBitmap) { for (x = img_x; x < img_x + (Position)img_width; x++) for (y = img_y; y < img_y + (Position)img_height; y++) { pixel = XGetPixel(sw->scale.image, x, y); if (pixel) /* Do not draw background */ FillRectangle(sw, drawable, sw->scale.gc, sw->scale.table.x[(int) x] + dst_x, sw->scale.table.y[(int) y] + dst_y, sw->scale.table.width[(int) x], sw->scale.table.height[(int) y]); } FlushRectangles(sw, drawable, sw->scale.gc); } else { for (x = img_x; x < img_x + (Position)img_width; x++) for (y = img_y; y < img_y + (Position)img_height; y++) { pixel = XGetPixel(sw->scale.image, x, y); if (pixel != gcv.background) { /* Do not draw background */ if (gcv.foreground != pixel) { /* Change fg to pixel */ gcv.foreground = pixel; XChangeGC(XtDisplay(sw), gc, GCForeground, &gcv); } XFillRectangle(XtDisplay(sw), drawable, gc, sw->scale.table.x[(int) x] + dst_x, sw->scale.table.y[(int) y] + dst_y, sw->scale.table.width[(int) x], sw->scale.table.height[(int) y]); } } } XFreeGC(XtDisplay(sw), gc); } } static int FindPixel(ScaleWidget sw, Position x, Position y, Position *img_x, Position *img_y, Pixel *img_pixel) /* (x,y) == (0,0) where image starts in sw window*/ { if (*img_x < 0 || *img_x >= sw->scale.image->width || *img_y < 0 || *img_y >= sw->scale.image->height) return (-1); if (sw->scale.table.x[(int) *img_x] >= x) { --*img_x; return FindPixel(sw, x, y, img_x, img_y, img_pixel); } if (sw->scale.table.x[(int) *img_x] + (Position)sw->scale.table.width[(int) *img_x] < x) { ++*img_x; return FindPixel(sw, x, y, img_x, img_y, img_pixel); } if (sw->scale.table.y[(int) *img_y] >= y) { --*img_y; return FindPixel(sw, x, y, img_x, img_y, img_pixel); } if (sw->scale.table.y[(int) *img_y] + (Position)sw->scale.table.height[(int) *img_y] < y) { ++*img_y; return FindPixel(sw, x, y, img_x, img_y, img_pixel); } *img_pixel = XGetPixel(sw->scale.image, *img_x, *img_y); return (0); } int SWGetImagePixel(Widget w, Position x, Position y, Position *img_x, Position *img_y, Pixel *img_pixel) { ScaleWidget sw = (ScaleWidget) w; x -= sw->scale.x; y -= sw->scale.y; *img_x = (Position) floor(x / sw->scale.scale_x); *img_y = (Position) floor(y / sw->scale.scale_y); return FindPixel(sw, x, y, img_x, img_y, img_pixel); } /* ARGSUSED */ static void Redisplay(Widget w, XEvent *event, Region region) { ScaleWidget sw = (ScaleWidget) w; Position x, y, img_x, img_y; Dimension width, height; if (event->type == Expose) { if (event->xexpose.x < sw->scale.x) { x = 0; width = event->xexpose.width - (sw->scale.x - event->xexpose.x); } else { x = event->xexpose.x - sw->scale.x; width = event->xexpose.width; } if (event->xexpose.y < sw->scale.y) { y = 0; height = event->xexpose.height - (sw->scale.y - event->xexpose.y); } else { y = event->xexpose.y - sw->scale.y; height = event->xexpose.height; } img_x = min(max((Position) floor((float) x / (float) sw->scale.scale_x), 0), (Position) sw->scale.image->width - 1); img_y = min(max((Position) floor((float) y / (float) sw->scale.scale_y), 0), (Position) sw->scale.image->height - 1); if (sw->core.visible) { ScaleImage(sw, XtWindow(w), img_x, img_y, sw->scale.x + sw->scale.table.x[(int) img_x], sw->scale.y + sw->scale.table.y[(int) img_y], (Dimension) ceil((float) width / sw->scale.scale_x) + 1, (Dimension) ceil((float) height / sw->scale.scale_y) + 1); } } } static void TryResize(ScaleWidget sw) { Dimension width, height; XtGeometryResult result; width = (Dimension) floor(sw->scale.image->width * sw->scale.scale_x) + 2 * sw->scale.internal_width; height = (Dimension) floor(sw->scale.image->height * sw->scale.scale_y) + 2 * sw->scale.internal_height; while ((result = /* SUPPRESS 530 */XtMakeResizeRequest((Widget)sw,width,height,&width,&height)) == XtGeometryAlmost); if (result != XtGeometryNo) { sw->core.width = width; sw->core.height = height; } } static void Precision(ScaleWidget sw) { if (sw->scale.scale_x != 1.0) sw->scale.scale_x = floor(sw->scale.scale_x / sw->scale.precision) * sw->scale.precision; if (sw->scale.scale_y != 1.0) sw->scale.scale_y = floor(sw->scale.scale_y / sw->scale.precision) * sw->scale.precision; } static void Proportional(ScaleWidget sw) { float scale_x, scale_y; scale_x = sw->scale.scale_y / sw->scale.aspect_ratio; scale_y = sw->scale.scale_x * sw->scale.aspect_ratio; if (scale_x <= sw->scale.scale_x && scale_y <= sw->scale.scale_y) { if (scale_x > scale_y) sw->scale.scale_x = scale_x; else sw->scale.scale_y = scale_y; } else if (scale_x <= sw->scale.scale_x) sw->scale.scale_x = scale_x; else if (scale_y <= sw->scale.scale_y) sw->scale.scale_y = scale_y; else { float x_ratio, y_ratio; x_ratio = scale_x / sw->scale.scale_x; y_ratio = scale_y / sw->scale.scale_y; if (x_ratio < y_ratio) sw->scale.scale_y /= x_ratio; else sw->scale.scale_x /= y_ratio; } if (fabs(sw->scale.scale_x / sw->scale.scale_y * sw->scale.aspect_ratio - 1.0) > sw->scale.precision) XtWarning("can not preserve aspect ratio"); } static void GetScaledSize(ScaleWidget sw) { sw->scale.width = (Dimension) max(myrint(sw->scale.scale_x * sw->scale.image->width), 1); sw->scale.height = (Dimension) max(myrint(sw->scale.scale_y * sw->scale.image->height), 1); } static void GetScaleValues(ScaleWidget sw) { /* * Make sure to subtract internal width and height. */ sw->scale.scale_x = (float) max((int)(sw->core.width - 2 * sw->scale.internal_width), 1) / (float) sw->scale.image->width; sw->scale.scale_y = (float) max((int)(sw->core.height - 2 * sw->scale.internal_height), 1) / (float) sw->scale.image->height; } static void Unscale(ScaleWidget sw) { sw->scale.scale_x = sw->scale.scale_y = 1.0; GetScaledSize(sw); BuildTable(sw); } static void Autoscale(ScaleWidget sw) { GetScaleValues(sw); if (sw->scale.proportional) Proportional(sw); Precision(sw); GetScaledSize(sw); BuildTable(sw); } static void PositionImage(ScaleWidget sw) { /* * Set as if for ForgegGravity (that is center the image) */ sw->scale.x = (Position) (sw->core.width - sw->scale.width) / 2; sw->scale.y = (Position) (sw->core.height - sw->scale.height) / 2; /***** if (sw->scale.gravity & WestGravity) { } if (sw->scale.gravity & EastGravity) { } if (sw->scale.gravity & NorthGravity) { } if (sw->scale.gravity & SouthGravity) { } *****/ } static void Resize(Widget w) { ScaleWidget sw = (ScaleWidget) w; if (sw->scale.autoscale) Autoscale(sw); PositionImage(sw); } static void Realize(Widget wid, Mask *vmask, XSetWindowAttributes *attr) { ScaleWidget sw = (ScaleWidget) wid; XtCreateWindow(wid, (unsigned int) InputOutput, (Visual *) sw->scale.visual, *vmask, attr); } static void Destroy(Widget w) { ScaleWidget sw = (ScaleWidget) w; XtFree((char *) sw->scale.table.x); XtFree((char *) sw->scale.table.y); XtFree((char *) sw->scale.table.width); XtFree((char *) sw->scale.table.height); XtFree((char *) sw->scale.rectangles); XtReleaseGC(w, sw->scale.gc); XDestroyImage(sw->scale.image); } /* ARGSUSED */ static Boolean SetValues(Widget current, Widget request, Widget new, ArgList args, Cardinal *num_args) { ScaleWidget cur_sw = (ScaleWidget) current; /* ScaleWidget req_sw = (ScaleWidget) request; */ ScaleWidget new_sw = (ScaleWidget) new; Boolean redisplay = False; Cardinal i; for (i = 0; i < *num_args; i++) { if (streq(XtNbackground, args[i].name)) { XSetBackground(XtDisplay(new), new_sw->scale.gc, new_sw->core.background_pixel); } if (streq(XtNforeground, args[i].name)) { XSetForeground(XtDisplay(new), new_sw->scale.gc, new_sw->scale.foreground_pixel); } if (streq(XtNimage, args[i].name)) { XDestroyImage(cur_sw->scale.image); if (new_sw->scale.image == NULL) new_sw->scale.image = XCreateImage(XtDisplay(new), DefaultVisual(XtDisplay(new), DefaultScreen(XtDisplay(new))), 1, XYBitmap, 0, XtCalloc(1, sizeof(char)), 1, 1, 8, 0); else new_sw->scale.image = XSubImage(new_sw->scale.image, 0, 0, new_sw->scale.image->width, new_sw->scale.image->height); if (new_sw->scale.resize) TryResize(new_sw); if (new_sw->scale.autoscale) Autoscale(new_sw); else { GetScaledSize(new_sw); BuildTable(new_sw); } PositionImage(new_sw); redisplay = True; } if (streq(XtNuserData, args[i].name)) new_sw->scale.userData = (XtPointer)args[i].value; if (streq(XtNbufferSize, args[i].name)) { if (new_sw->scale.buffer_size != cur_sw->scale.buffer_size) { GetRectangleBuffer(new_sw, new_sw->scale.buffer_size); } } if (streq(XtNaspectRatio, args[i].name)) { if ((new_sw->scale.aspect_ratio = atof(new_sw->scale.aspect_ratio_str)) < 0.0) { new_sw->scale.aspect_ratio = cur_sw->scale.aspect_ratio; XtWarning("AspectRatio has to be a positive number."); } else if (new_sw->scale.aspect_ratio != cur_sw->scale.aspect_ratio){ if (new_sw->scale.proportional) { Proportional(new_sw); Precision(new_sw); GetScaledSize(new_sw); BuildTable(new_sw); PositionImage(new_sw); redisplay = True; } } } if (streq(XtNproportional, args[i].name)) { if (new_sw->scale.proportional != cur_sw->scale.proportional) { if (new_sw->scale.proportional) Proportional(new_sw); Precision(new_sw); GetScaledSize(new_sw); BuildTable(new_sw); PositionImage(new_sw); redisplay = True; } } if (streq(XtNscaleX, args[i].name) || streq(XtNscaleY, args[i].name)) { if (new_sw->scale.scale_x_str == DefaultScaleFactor || new_sw->scale.scale_y_str == DefaultScaleFactor) GetInitialScaleValues(new_sw); else { if ((new_sw->scale.scale_x = atof(new_sw->scale.scale_x_str)) < 0.0) { new_sw->scale.scale_x = cur_sw->scale.scale_x; XtWarning("ScaleValue has to be a positive number."); } if ((new_sw->scale.scale_y = atof(new_sw->scale.scale_y_str)) < 0.0) { new_sw->scale.scale_y = cur_sw->scale.scale_y; XtWarning("ScaleValue has to be a positive number."); } } if (new_sw->scale.scale_x != cur_sw->scale.scale_x || new_sw->scale.scale_y != cur_sw->scale.scale_y) { /*?*?*?*?*?*?*?*?*?*?*?*?*?*?**?*?*?*?*?*?*?*?*?***?*/ fprintf(stderr, "================>>%f %f\n", new_sw->scale.scale_x, new_sw->scale.scale_y); if (new_sw->scale.proportional) Proportional(new_sw); Precision(new_sw); if (new_sw->scale.resize) TryResize(new_sw); GetScaledSize(new_sw); BuildTable(new_sw); PositionImage(new_sw); redisplay = True; } } if (streq(XtNprecision, args[i].name)) { if ((new_sw->scale.precision = atof(new_sw->scale.precision_str)) < 0.0) { new_sw->scale.precision = cur_sw->scale.precision; XtWarning("Precision has to be a positive number."); } if (new_sw->scale.precision != cur_sw->scale.precision) { if (new_sw->scale.proportional) Proportional(new_sw); Precision(new_sw); GetScaledSize(new_sw); BuildTable(new_sw); PositionImage(new_sw); redisplay = True; } } } return(redisplay); } void SWUnscale(Widget w, XEvent *event, String *params, Cardinal *num_params) { ScaleWidget sw = (ScaleWidget) w; Unscale(sw); PositionImage(sw); XClearArea(XtDisplay(w), XtWindow(w), 0, 0, 0, 0, True); } void SWAutoscale(Widget w, XEvent *event, String *params, Cardinal *num_params) { ScaleWidget sw = (ScaleWidget) w; Autoscale(sw); PositionImage(sw); XClearArea(XtDisplay(w), XtWindow(w), 0, 0, 0, 0, True); } void SWInitialSize(Widget w, XEvent *event, String *params, Cardinal *num_params) { ScaleWidget sw = (ScaleWidget) w; GetInitialScaleValues(sw); if (sw->scale.proportional) Proportional(sw); Precision(sw); if (sw->scale.resize) TryResize(sw); GetScaledSize(sw); BuildTable(sw); PositionImage(sw); XClearArea(XtDisplay(w), XtWindow(w), 0, 0, 0, 0, True); } void SWSetImage(Widget w, XImage *image) { int n; Arg wargs[2]; n = 0; XtSetArg(wargs[n], XtNimage, (XtArgVal) image); n++; XtSetValues(w, wargs, n); } void RequestSelection(Widget w, XEvent *event, String *params, Cardinal *num_params) { SWRequestSelection(w, event->xbutton.time); } void GrabSelection(Widget w, XEvent *event, String *params, Cardinal *num_params) { SWGrabSelection(w, event->xbutton.time); } Pixmap SWGetPixmap(Widget w) { ScaleWidget sw = (ScaleWidget) w; Pixmap pixmap; pixmap = XCreatePixmap(XtDisplay(w), XtWindow(w), sw->scale.width, sw->scale.height, sw->scale.image->depth); ScaleImage(sw, pixmap, 0, 0, 0, 0, (Dimension) sw->scale.image->width, (Dimension) sw->scale.image->height); return(pixmap); } x11-apps-7.7+5+nmu1ubuntu1/xmag/xmag.c0000664000000000000000000007612412514127176014245 0ustar /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #include "config.h" #include /* for exit() and abs() */ #include #include #include #include #include #include #include #include #include #include "RootWin.h" #include "Scale.h" #include "CutPaste.h" #define SRCWIDTH 64 #define SRCHEIGHT 64 #ifndef min #define min(a, b) ((a) < (b) ? (a) : (b)) #endif #ifndef max #define max(a, b) ((a) > (b) ? (a) : (b)) #endif /* highlight interval (in milliseconds) */ #define HLINTERVAL 100 /* sleep between draw & erase of highlight * 20 milliseconds - enough for screen refresh - not too long to annoy users * since we hold a server grab during this time */ #define HLSLEEPINTERVAL 20 /* milliseconds */ #ifdef HAVE_NANOSLEEP #include #define HLSLEEP do { \ struct timespec sleeptime = { 0 , HLSLEEPINTERVAL * 1000000 } ; \ nanosleep(&sleeptime, NULL); \ } while(0) #elif defined(HAVE_POLL) #include #define HLSLEEP poll(NULL, 0, HLSLEEPINTERVAL) #elif defined(HAVE_SELECT) #include #define HLSLEEP do { \ struct timeval sleeptime = { 0 , HLSLEEPINTERVAL * 1000 } ; \ select(0, NULL, NULL, NULL, &sleeptime); \ } while(0) #else #define HLSLEEP XSync(dpy, False) #endif /* highlight mode */ typedef enum { drag, resize, done } hlMode; /* highlight data structure */ typedef struct { Boolean newScale; hlMode selectMode; GC gc; XWindowAttributes win_info; XImage *image; Position homeX, homeY, x, y; Dimension width, height; Widget scaleShell, scaleInstance, pixShell, pixLabel, cmapWinList [2]; } hlStruct, *hlPtr; /* global variables */ static XtAppContext app; static Cursor ulAngle, urAngle, lrAngle, llAngle; static Display *dpy; static int scr; static GC selectGC; static XGCValues selectGCV; static Widget toplevel, root; static Atom wm_delete_window; static int numXmags = 0; static int srcStat, srcX, srcY; static unsigned int srcWidth, srcHeight; /* forward declarations */ static int Error(Display *, XErrorEvent *); static void CloseAP(Widget, XEvent *, String *, Cardinal *); static void SetCmapPropsAP(Widget, XEvent *, String *, Cardinal *); static void UnsetCmapPropsAP(Widget, XEvent *, String *, Cardinal *); static void NewAP(Widget, XEvent *, String *, Cardinal *); static void ReplaceAP(Widget, XEvent *, String *, Cardinal *); static void PopupPixelAP(Widget, XEvent *, String *, Cardinal *); static void UpdatePixelAP(Widget, XEvent *, String *, Cardinal *); static void PopdownPixelAP(Widget, XEvent *, String *, Cardinal *); static void SelectRegionAP(Widget, XEvent *, String *, Cardinal *); static void CheckPoints(Position *, Position *, Position *, Position *); static void HighlightTO(XtPointer, XtIntervalId *); static void CloseCB(Widget, XtPointer, XtPointer); static void ReplaceCB(Widget, XtPointer, XtPointer); static void NewCB(Widget, XtPointer, XtPointer); static void SelectCB(Widget, XtPointer, XtPointer); static void PasteCB(Widget, XtPointer, XtPointer); static void SetupGC(void); static Window FindWindow(int, int); static void ResizeEH(Widget, XtPointer, XEvent *, Boolean *); static void DragEH(Widget, XtPointer, XEvent *, Boolean *); static void StartRootPtrGrab(int, hlPtr); static void CreateRoot(void); static void GetImageAndAttributes(Window, int, int, int, int, hlPtr); static int Get_XColors(XWindowAttributes *, XColor **); static Pixel GetMaxIntensity(hlPtr); static Pixel GetMinIntensity(hlPtr); static void PopupNewScale(hlPtr); static void RedoOldScale(hlPtr); static void InitCursors(void); static void ParseSourceGeom(void); /* application resources */ typedef struct { String geometry, source, mag, title; } OptionsRec; static OptionsRec options; #define Offset(field) XtOffsetOf(OptionsRec, field) static XtResource resources[] = { {"geometry", "Geometry", XtRString, sizeof(String), Offset(geometry), XtRString, (XtPointer)NULL}, {"mag", "Mag", XtRString, sizeof(String), Offset(mag), XtRString, (XtPointer)"5.0"}, {"source", "Source", XtRString, sizeof(String), Offset(source), XtRString, (XtPointer)"SRCWIDTHxSRCHEIGHT"}, {"title", XtCString, XtRString, sizeof(char *), Offset(title), XtRString, "xmag"}, }; #undef Offset static XrmOptionDescRec optionDesc[] = { {"-bd", "*borderColor", XrmoptionSepArg, (XtPointer)NULL}, {"-bg", "*background", XrmoptionSepArg, (XtPointer)NULL}, {"-bw", "*borderWidth", XrmoptionSepArg, (XtPointer)NULL}, {"-geometry", "*geometry", XrmoptionSepArg, (XtPointer)NULL}, {"-mag", "*mag", XrmoptionSepArg, (XtPointer)NULL}, {"-source", "*source", XrmoptionSepArg, (XtPointer)NULL}, {"-title", "*title", XrmoptionSepArg, (XtPointer)NULL}, }; /* action table */ static XtActionsRec actions_table[] = { {"close", CloseAP}, {"set-colors", SetCmapPropsAP}, {"unset-colors", UnsetCmapPropsAP}, {"new", NewAP}, {"replace", ReplaceAP}, {"popup-pixel", PopupPixelAP}, {"update-pixel", UpdatePixelAP}, {"popdown-pixel", PopdownPixelAP}, {"select-region", SelectRegionAP} }; /* * Error() -- Error handler: Catch a bad match in magnifying an * area that contains bits of different depths. */ static int Error(Display *dpy, XErrorEvent *err) { (void) XmuPrintDefaultErrorMessage (dpy, err, stderr); return 0; } /* * CloseAP() -- Close this dialog. If its the last one exit the program. * */ static void /* ARGSUSED */ CloseAP(Widget w, XEvent *event, String *params, Cardinal *num_params) { Arg wargs[2]; int n; hlPtr data; if (!--numXmags) exit(0); if (event->type != ClientMessage) { n = 0; /* get user data */ XtSetArg(wargs[0], XtNuserData, &data); n++; XtGetValues(w, wargs, n); w = data->scaleShell; } XtPopdown(w); XtDestroyWidget(w); } /* * SetCmapPropsAP() -- Put the scale widget first in WM_COLORMAP_WINDOWS * */ static void /* ARGSUSED */ SetCmapPropsAP(Widget w, XEvent *event, String *params, Cardinal *num_params) { Arg wargs[2]; int n; hlPtr data; n = 0; /* get user data */ XtSetArg(wargs[0], XtNuserData, &data); n++; XtGetValues(w, wargs, n); if (data->win_info.colormap != DefaultColormap(dpy, scr)) { data->cmapWinList[0] = data->scaleInstance; data->cmapWinList[1] = data->scaleShell; XtSetWMColormapWindows(data->scaleShell, data->cmapWinList, 2); } } /* * UnsetCmapPropsAP() -- Put the shell first in WM_COLORMAP_WINDOWS * */ static void /* ARGSUSED */ UnsetCmapPropsAP(Widget w, XEvent *event, String *params, Cardinal *num_params) { Arg wargs[2]; int n; hlPtr data; n = 0; /* get user data */ XtSetArg(wargs[0], XtNuserData, &data); n++; XtGetValues(w, wargs, n); if (data->win_info.colormap != DefaultColormap(dpy, scr)) { data->cmapWinList[0] = data->scaleShell; data->cmapWinList[1] = data->scaleInstance; XtSetWMColormapWindows(data->scaleShell, data->cmapWinList, 2); } } /* * NewAP() -- Create an additional xmag dialog. THIS IS A COPY OF NewEH * FIND A BETTER WAY.... */ static void /* ARGSUSED */ NewAP(Widget w, XEvent *event, String *params, Cardinal *num_params) { StartRootPtrGrab(True, NULL); } /* * ReplaceAP() -- Replace this particular xmag dialog. */ static void /* ARGSUSED */ ReplaceAP(Widget w, XEvent *event, String *params, Cardinal *num_params) { Arg wargs[2]; int n; hlPtr data; n = 0; /* get user data */ XtSetArg(wargs[0], XtNuserData, &data); n++; XtGetValues(w, wargs, n); StartRootPtrGrab(False, data); } /* * PopupPixelAP() -- Show pixel information. */ static void /* ARGSUSED */ PopupPixelAP(Widget w, XEvent *event, String *params, Cardinal *num_params) { Position scale_x, scale_y; Dimension scale_height; Position label_x, label_y; Dimension label_height; int n; Arg wargs[3]; hlPtr data; n = 0; /* get user data */ XtSetArg(wargs[0], XtNuserData, &data); n++; XtGetValues(w, wargs, n); n = 0; XtSetArg(wargs[n], XtNheight, &scale_height); n++; XtGetValues(w, wargs, n); XtTranslateCoords(w, -1, -1, &scale_x, &scale_y); XtRealizeWidget(data->pixShell); /* to get the right height */ n = 0; XtSetArg(wargs[n], XtNheight, &label_height); n++; XtGetValues(data->pixShell, wargs, n); if ((double) event->xbutton.y / (double) scale_height > 0.5) { label_x = scale_x; label_y = scale_y; } else { label_x = scale_x; label_y = scale_y + scale_height - label_height; } n = 0; XtSetArg(wargs[n], XtNx, label_x); n++; XtSetArg(wargs[n], XtNy, label_y); n++; XtSetValues(data->pixShell, wargs, n); UpdatePixelAP(w, event, NULL, NULL); } /* * UpdatePixelAP() -- Update pixel information. */ static void /* ARGSUSED */ UpdatePixelAP(Widget w, XEvent *event, String *params, Cardinal *num_params) { Position x, y; Pixel pixel; XColor color; int n; Arg wargs[3]; char string[80]; hlPtr data; n = 0; XtSetArg(wargs[0], XtNuserData, &data); n++; XtGetValues(w, wargs, n); if (SWGetImagePixel(w, event->xbutton.x, event->xbutton.y, &x, &y, &pixel)) XtPopdown(data->pixShell); else { color.pixel = pixel; XQueryColor(dpy, data->win_info.colormap, &color); snprintf(string, sizeof(string), "Pixel %ld at (%d,%d) colored (%x,%x,%x).", pixel, x + data->x, y + data->y, color.red, color.green, color.blue); n = 0; XtSetArg(wargs[n], XtNlabel, string); n++; XtSetValues(data->pixLabel, wargs, n); XtPopup(data->pixShell, XtGrabNone); } } /* * PopdownPixelAP() -- Remove pixel info. */ static void /* ARGSUSED */ PopdownPixelAP(Widget w, XEvent *event, String *params, Cardinal *num_params) { int n; Arg wargs[3]; hlPtr data = NULL; n = 0; XtSetArg(wargs[0], XtNuserData, &data); n++; XtGetValues(w, wargs, n); if (data) XtPopdown(data->pixShell); } static void /* ARGSUSED */ SelectRegionAP(Widget w, XEvent *event, String *params, Cardinal *num_params) { /***** NOT SURE WHAT TO DO WITH THIS if (app_resources.unmap) XtUnmapWidget(toplevel); Redisplay(XtDisplay(w), RootWindow(XtDisplay(w), DefaultScreen(XtDisplay(w))), source.width, source.height, app_resources.freq, app_resources.puls, ul_angle, lr_angle, app_resources.grab); if (app_resources.unmap) XtMapWidget(toplevel); ******/ } /* * CheckPoints() -- Change the cursor for the correct quadrant. * Make sure the first point is less than the second * for drawing the selection rectangle. * */ static void CheckPoints(Position *x1, Position *x2, Position *y1, Position *y2) { Position tmp; Boolean above, left; Cursor newC; above = (*y2 < *y1); left = (*x2 < *x1); if (above&&left) newC = ulAngle; else if (above&&!left) newC = urAngle; else if (!above&&!left) newC = lrAngle; else newC = llAngle; XChangeActivePointerGrab (dpy, PointerMotionMask|ButtonPressMask|ButtonReleaseMask, newC, CurrentTime); if (*x2 < *x1) { tmp = *x1; *x1 = *x2; *x2 = tmp; } if (*y2 < *y1) { tmp = *y1; *y1 = *y2; *y2 = tmp; } } /* * HighlightTO() -- Timer to highlight the selection box */ static void HighlightTO(XtPointer closure, XtIntervalId *id) /* ARGSUSED */ { hlPtr data = (hlPtr)closure; XGrabServer(dpy); if (data->selectMode == drag) { XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc, data->x, data->y, data->width, data->height); XFlush(dpy); HLSLEEP; XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc, data->x, data->y, data->width, data->height); } else if (data->selectMode == resize) { Position x1 = data->homeX, x2 = data->x, y1 = data->homeY, y2 = data->y; CheckPoints(&x1, &x2, &y1, &y2); XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc, x1, y1, x2 - x1, y2 - y1); XFlush(dpy); HLSLEEP; XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc, x1, y1, x2 - x1, y2 - y1); } XUngrabServer(dpy); if (data->selectMode != done) XtAppAddTimeOut(app, HLINTERVAL, HighlightTO, (XtPointer)data); } /* * CloseCB() -- Delete this xmag dialog. If its the only one on the screen * then exit. */ static void /* ARGSUSED */ CloseCB(Widget w, XtPointer clientData, XtPointer callData) { Widget shell = (Widget)clientData; if (!--numXmags) exit(0); XtPopdown(shell); XtDestroyWidget(shell); } /* * ReplaceCB() -- Replace this particular xmag dialog. */ static void /* ARGSUSED */ ReplaceCB(Widget w, XtPointer clientData, XtPointer callData) { hlPtr data = (hlPtr)clientData; StartRootPtrGrab(False, data); } /* * NewCB() -- Create an additional xmag dialog. */ static void /* ARGSUSED */ NewCB(Widget w, XtPointer clientData, XtPointer callData) { StartRootPtrGrab(True, NULL); } /* * SelectCB() -- Own the primary selection. */ static void /* ARGSUSED */ SelectCB(Widget w, XtPointer clientData, XtPointer callData) { hlPtr data = (hlPtr)clientData; SWGrabSelection(data->scaleInstance, XtLastTimestampProcessed(dpy)); } /* * PasteCB() -- Paste from the primary selectin into xmag. */ static void /* ARGSUSED */ PasteCB(Widget w, XtPointer clientData, XtPointer callData) { hlPtr data = (hlPtr)clientData; SWRequestSelection(data->scaleInstance, XtLastTimestampProcessed(dpy)); } /* * SetupGC() -- Graphics context for magnification selection. */ static void SetupGC(void) { selectGCV.function = GXxor; selectGCV.foreground = 0xffffffff; selectGCV.subwindow_mode = IncludeInferiors; selectGC = XtGetGC(toplevel, GCFunction|GCForeground|GCSubwindowMode, &selectGCV); } /* * FindWindow() -- Determine window the pointer is over. * */ static Window FindWindow(int x, int y) /* Location of cursor */ { XWindowAttributes wa; Window findW = DefaultRootWindow(dpy), stopW, childW; /* Setup for first window find */ stopW = findW; while (stopW) { XTranslateCoordinates(dpy, findW, stopW, x, y, &x, &y, &childW); findW = stopW; /* If child is not InputOutput (for example, InputOnly) */ /* then don't continue, return the present findW which */ /* can be the root, or a root child of class InputOutput */ if (childW && XGetWindowAttributes(dpy, childW, &wa) && wa.class != InputOutput) break; stopW = childW; } return findW; } /* * ResizeEH() -- Event Handler for resize of selection box. */ static void ResizeEH(Widget w, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch) /* ARGSUSED */ { hlPtr data = (hlPtr)closure; switch (event->type) { case MotionNotify: data->x = event->xmotion.x_root; data->y = event->xmotion.y_root; break; case ButtonRelease: GetImageAndAttributes(FindWindow(event->xmotion.x_root, event->xmotion.y_root), min(data->homeX,event->xbutton.x_root), min(data->homeY,event->xbutton.y_root), abs(data->homeX - event->xbutton.x_root), abs(data->homeY - event->xbutton.y_root), data); if (data->newScale) PopupNewScale(data); else SWSetImage(data->scaleInstance, data->image); XtUngrabPointer(w, CurrentTime); /***** XtRemoveRawEventHandler(w, PointerMotionMask|ButtonReleaseMask, True, ResizeEH, (XtPointer)data); *****/ XtRemoveEventHandler(w, PointerMotionMask|ButtonReleaseMask, True, ResizeEH, (XtPointer)data); data->selectMode = done; break; } } /* * DragEH() -- Event Handler for dragging selection box. */ static void DragEH(Widget w, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch) /* ARGSUSED */ { hlPtr data = (hlPtr)closure; switch (event->type) { case MotionNotify: /* drag mode */ data->x = event->xmotion.x_root; data->y = event->xmotion.y_root; break; case ButtonRelease: /* end drag mode */ if (event->xbutton.button == Button1) { /* get image */ /* Problem: You can't get bits with XGetImage outside of its window. * xmag will only do a GetImage on the actual window in the case * where the depth of the window does not match the depth of * the root window. */ GetImageAndAttributes(FindWindow(event->xmotion.x_root, event->xmotion.y_root), event->xbutton.x_root, event->xbutton.y_root, srcWidth, srcHeight, data); if (data->newScale) PopupNewScale(data); else RedoOldScale(data); XtUngrabPointer(w, CurrentTime); XtRemoveRawEventHandler(w, PointerMotionMask|ButtonPressMask| ButtonReleaseMask, True, DragEH, (XtPointer)data); data->selectMode = done; } break; case ButtonPress: if (event->xbutton.button == Button2) { /* turn on resize mode */ data->homeX = event->xbutton.x_root; data->homeY = event->xbutton.y_root; data->x = event->xbutton.x_root + srcWidth; data->y = event->xbutton.y_root + srcHeight; data->selectMode = resize; XtRemoveRawEventHandler(w, PointerMotionMask|ButtonPressMask| ButtonReleaseMask, True, DragEH, (XtPointer)data); XChangeActivePointerGrab (dpy, PointerMotionMask|ButtonPressMask|ButtonReleaseMask, lrAngle, CurrentTime); XWarpPointer(dpy, None, None, 0, 0, 0, 0, srcWidth, srcHeight); XtAddEventHandler(w, PointerMotionMask|ButtonReleaseMask, True, ResizeEH, (XtPointer)data); } break; } } /* * StartRootPtrGrab() -- Bring up the selection box. * */ static void StartRootPtrGrab(int new, /* do we create a new scale instance? */ hlPtr data) /* highlight data */ { Window rootR, childR; int rootX, rootY, winX, winY; unsigned int mask; hlPtr hlData; XtGrabPointer (root, False, PointerMotionMask|ButtonPressMask|ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, ulAngle, CurrentTime); XQueryPointer(dpy, DefaultRootWindow(dpy), &rootR, &childR, &rootX, &rootY, &winX, &winY, &mask); if (new) { numXmags++; hlData = (hlPtr)XtMalloc(sizeof(hlStruct)); } else hlData = data; hlData->newScale = new; hlData->selectMode = drag; hlData->x = rootX; hlData->y = rootY; hlData->gc = selectGC; hlData->width = srcWidth; hlData->height = srcHeight; XtAddRawEventHandler (root, PointerMotionMask|ButtonPressMask|ButtonReleaseMask, True, DragEH, (XtPointer)hlData); (void) XtAppAddTimeOut(app, HLINTERVAL, HighlightTO, (XtPointer)hlData); } /* * CreateRoot() -- Create a root window widget. If the user specified x and y * in the source geometry then use this to directly get the * image. */ static void CreateRoot(void) { hlPtr data; root = XtCreateWidget("root", rootWindowWidgetClass, toplevel, NULL, 0); XtRealizeWidget(root); if (XValue & srcStat && YValue &srcStat) { numXmags = 1; data = (hlPtr)XtMalloc(sizeof(hlStruct)); data = data; data->newScale = True; data->selectMode = drag; data->x = srcX; data->y = srcY; data->gc = selectGC; data->width = srcWidth; data->height = srcHeight; GetImageAndAttributes(RootWindow(dpy, scr), srcX, srcY, srcWidth, srcHeight, data); PopupNewScale(data); return; } } /* * GetImageAndAttributes() -- Get the image bits from the screen. * We will also determine here the colormap, depth, and * visual to be used for the magnification image. */ static void GetImageAndAttributes(Window w, int x, int y, int width, int height, hlPtr data) { /* get parameters of window being magnified */ XGetWindowAttributes(dpy, w, &data->win_info); if (data->win_info.depth == DefaultDepth(dpy, scr)) { /* avoid off screen pixels */ if (x < 0) x = 0; if (y < 0) y = 0; if (x + width > DisplayWidth(dpy,scr)) x = DisplayWidth(dpy,scr) - width; if (y + height > DisplayHeight(dpy,scr)) y = DisplayHeight(dpy,scr) - height; data->x = x; data->y = y; /* get image pixels */ data->image = XGetImage (dpy, RootWindow(dpy, scr), x, y, width, height, AllPlanes, ZPixmap); } else { int t0, t1; int x0, x1, y0, y1; int xInWin, yInWin; Window childWin; XTranslateCoordinates(dpy, DefaultRootWindow(dpy), w, x, y, &xInWin, &yInWin, &childWin); /* Avoid off screen pixels. Assume this routine is not * called for totally offscreen windows. */ x0 = max(x, 0); y0 = max(y, 0); x1 = min(DisplayWidth(dpy, scr), min(x0 + width, x0 + (data->win_info.width - xInWin))); y1 = min(DisplayHeight(dpy, scr), min(y0 + height, y0 + (data->win_info.height - yInWin))); /* Try to use up to width x height pixels */ if (x1 - x0 < width) { t0 = x0; t1 = max(0, x - xInWin + data->win_info.width - DisplayWidth(dpy, scr)); x0 = max(0, x1 - min(width, data->win_info.width - t1)); xInWin -= t0 - x0; } if (y1 - y0 < height) { t0 = y0; t1 = max(0, y - yInWin + data->win_info.height - DisplayHeight(dpy, scr)); y0 = max(0, y1 - min(height, data->win_info.height - t1)); yInWin -= t0 - y0; } data->x = x0; data->y = y0; data->width = x1 - x0; data->height = y1 - y0; data->image = XGetImage (dpy, w, xInWin, yInWin, data->width, data->height, AllPlanes, ZPixmap); } } /* * Get_XColors() Get the XColors of all pixels in image - returns # of colors * This function was taken from xwd (thanks Bob...) */ #define lowbit(x) ((x) & (~(x) + 1)) static int Get_XColors(XWindowAttributes *win_info, XColor **colors) { int i, ncolors; if (!win_info->colormap) return(0); ncolors = win_info->visual->map_entries; if (!(*colors = (XColor *) XtMalloc (sizeof(XColor) * ncolors))) XtError("Out of memory!"); if (win_info->visual->class == DirectColor || win_info->visual->class == TrueColor) { Pixel red, green, blue, red1, green1, blue1; red = green = blue = 0; red1 = lowbit(win_info->visual->red_mask); green1 = lowbit(win_info->visual->green_mask); blue1 = lowbit(win_info->visual->blue_mask); for (i=0; i win_info->visual->red_mask) red = 0; green += green1; if (green > win_info->visual->green_mask) green = 0; blue += blue1; if (blue > win_info->visual->blue_mask) blue = 0; } } else { for (i=0; icolormap, *colors, ncolors); return(ncolors); } #define Intensity(cptr) (3.0*cptr->red+0.59*cptr->green+0.11*cptr->blue) /* * GetMaxIntensity() -- Find the maximum intensity pixel value for a colormap. */ static Pixel GetMaxIntensity(hlPtr data) { XColor *colors = NULL, *mptr, *tptr; int i, ncolors; if (data->win_info.colormap == DefaultColormap(dpy, scr)) return WhitePixel(dpy, scr); ncolors = Get_XColors(&data->win_info, &colors); mptr = tptr = colors; tptr++; for (i=1; ipixel; else return WhitePixel(dpy, scr); } /* * GetMinIntensity() -- Find the minimum intensity pixel value for a colormap. */ static Pixel GetMinIntensity(hlPtr data) { XColor *colors = NULL, *mptr, *tptr; int i, ncolors; if (data->win_info.colormap == DefaultColormap(dpy, scr)) return BlackPixel(dpy, scr); ncolors = Get_XColors(&data->win_info, &colors); mptr = tptr = colors; tptr++; for (i=1; i (int)Intensity(tptr)) mptr = tptr; tptr++; } /* Null pointer protection */ if(mptr) return mptr->pixel; else return BlackPixel(dpy, scr); } static Widget pane1, pane2, pane3, cclose, replace, new, select_w, paste; /* * PopupNewScale() -- Create and popup a new scale composite. */ static void PopupNewScale(hlPtr data) { Arg warg; data->scaleShell = XtVaCreatePopupShell("xmag", topLevelShellWidgetClass, toplevel, XtNgeometry, (XtArgVal)options.geometry, XtNtitle, (XtArgVal)options.title, NULL); pane1 = XtCreateManagedWidget("pane1", panedWidgetClass, data->scaleShell, (Arg *) NULL, 0); pane2 = XtCreateManagedWidget("pane2", panedWidgetClass, pane1, (Arg *) NULL, 0); cclose = XtCreateManagedWidget("close", commandWidgetClass, pane2, (Arg *) NULL, 0); XtAddCallback(cclose, XtNcallback, CloseCB, (XtPointer)data->scaleShell); replace = XtCreateManagedWidget("replace", commandWidgetClass, pane2, (Arg *) NULL, 0); XtAddCallback(replace, XtNcallback, ReplaceCB, (XtPointer)data); new = XtCreateManagedWidget("new", commandWidgetClass, pane2, (Arg *) NULL, 0); XtAddCallback(new, XtNcallback, NewCB, (XtPointer)NULL); select_w = XtCreateManagedWidget("select", commandWidgetClass, pane2, (Arg *) NULL, 0); XtAddCallback(select_w, XtNcallback, SelectCB, (XtPointer)data); paste = XtCreateManagedWidget("paste", commandWidgetClass, pane2, (Arg *) NULL, 0); XtAddCallback(paste, XtNcallback, PasteCB, (XtPointer)data); (void) XtCreateManagedWidget("helpLabel", labelWidgetClass, pane2, (Arg *) NULL, 0); pane3 = XtCreateManagedWidget("pane2", panedWidgetClass, pane1, (Arg *) NULL, 0); data->scaleInstance = XtVaCreateManagedWidget("scale", scaleWidgetClass, pane3, XtNvisual, (XtArgVal)data->win_info.visual, XtNcolormap, (XtArgVal)data->win_info.colormap, XtNdepth, (XtArgVal)data->win_info.depth, XtNscaleX, (XtArgVal)options.mag, XtNscaleY, (XtArgVal)options.mag, NULL); SWSetImage(data->scaleInstance, data->image); XtOverrideTranslations (data->scaleShell, XtParseTranslationTable ("WM_PROTOCOLS: close()")); XtSetArg(warg, XtNuserData, data); XtSetValues(data->scaleInstance, &warg, 1); data->pixShell = XtVaCreatePopupShell("pixShell", overrideShellWidgetClass, toplevel, XtNvisual, (XtArgVal)data->win_info.visual, XtNcolormap, (XtArgVal)data->win_info.colormap, XtNdepth, (XtArgVal)data->win_info.depth, XtNborderWidth, (XtPointer)0, NULL); data->pixLabel = XtVaCreateManagedWidget("pixLabel", labelWidgetClass, data->pixShell, XtNforeground, (XtPointer)GetMaxIntensity(data), XtNbackground, (XtPointer)GetMinIntensity(data), XtNborderWidth, (XtPointer)0, NULL); XtInstallAllAccelerators(pane1, pane1); /* install accelerators */ if (data->newScale) { XtPopup(data->scaleShell, XtGrabNone); (void) XSetWMProtocols /* ICCCM delete window */ (dpy, XtWindow(data->scaleShell), &wm_delete_window, 1); } if (data->win_info.colormap != DefaultColormap(dpy, scr)) { data->cmapWinList[0] = data->scaleShell; data->cmapWinList[1] = data->scaleInstance; XtSetWMColormapWindows(data->scaleShell, data->cmapWinList, 2); } } /* * RedoOldScale() -- If the visual, depth, or colormap has changed, unrealize * the scale widget and change its colormap/depth/visual. * Then re-realize it. Also do this for the pixel display * widget. */ static void RedoOldScale(hlPtr data) { Arg wargs[3]; int n; Visual *oldVis; int oldDepth; Colormap oldCmap; n=0; XtSetArg(wargs[n], XtNvisual, &oldVis); n++; XtSetArg(wargs[n], XtNdepth, &oldDepth); n++; XtSetArg(wargs[n], XtNcolormap, &oldCmap); n++; XtGetValues(data->scaleInstance, wargs, n); if (oldVis == data->win_info.visual && oldDepth == data->win_info.depth && oldCmap == data->win_info.colormap) { SWSetImage(data->scaleInstance, data->image); return; } /* get width and height, save and reuse them */ XtUnmanageChild(data->scaleInstance); XtUnrealizeWidget(data->scaleInstance); n=0; XtSetArg(wargs[n], XtNcolormap, data->win_info.colormap); n++; XtSetArg(wargs[n], XtNdepth, data->win_info.depth); n++; XtSetArg(wargs[n], XtNvisual, data->win_info.visual); n++; XtSetValues(data->scaleInstance, wargs, n); n=0; XtSetArg(wargs[n], XtNforeground, GetMaxIntensity(data)); n++; XtSetArg(wargs[n], XtNbackground, GetMinIntensity(data)); n++; XtSetValues(data->pixLabel, wargs, n); SWSetImage(data->scaleInstance, data->image); XtRealizeWidget(data->scaleInstance); XtManageChild(data->scaleInstance); } /* * InitCursors() -- Create our cursors for area selection. */ static void InitCursors(void) { ulAngle = XCreateFontCursor(dpy, XC_ul_angle); urAngle = XCreateFontCursor(dpy, XC_ur_angle); lrAngle = XCreateFontCursor(dpy, XC_lr_angle); llAngle = XCreateFontCursor(dpy, XC_ll_angle); } /* * ParseSourceGeom() -- Determine dimensions of area to magnify from resources. */ static void ParseSourceGeom(void) { /* source */ srcStat = XParseGeometry(options.source, &srcX, &srcY, &srcWidth, &srcHeight); if (!srcWidth) srcWidth = SRCWIDTH; if (!srcHeight) srcHeight = SRCHEIGHT; if (XNegative & srcStat) srcX = DisplayWidth(dpy, scr) + srcX - srcWidth; if (YNegative & srcStat) srcY = DisplayHeight(dpy, scr) + srcY - srcHeight; /* mag */ } /* * Main program. */ int main(int argc, char *argv[]) { XSetErrorHandler(Error); /* SUPPRESS 594 */ toplevel = XtAppInitialize(&app, "Xmag", optionDesc, XtNumber(optionDesc), &argc, argv, NULL, NULL, 0); dpy = XtDisplay(toplevel); scr = DefaultScreen(dpy); XtGetApplicationResources(toplevel, (XtPointer) &options, resources, XtNumber(resources), NULL, 0); if (argc != 1) { fprintf (stderr, "usage: xmag [-source geom] [-mag magfactor] [-toolkitoption]\n"); exit(1); } ParseSourceGeom(); XtAppAddActions(app, actions_table, XtNumber(actions_table)); InitCursors(); SetupGC(); CreateRoot(); if (!(XValue & srcStat && YValue & srcStat)) StartRootPtrGrab(True, (hlPtr)NULL); wm_delete_window = XInternAtom(dpy, "WM_DELETE_WINDOW", False); XtAppMainLoop(app); exit(0); } x11-apps-7.7+5+nmu1ubuntu1/xmag/RootWinP.h0000664000000000000000000000327412514127176015033 0ustar /* Copyright 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _RootWindoP_h #define _RootWindoP_h #include "RootWin.h" /* include superclass private header file */ #include typedef struct { int empty; } RootWindowClassPart; typedef struct _RootWindowClassRec { CoreClassPart core_class; RootWindowClassPart root_class; } RootWindowClassRec; extern RootWindowClassRec rootClassRec; typedef struct { /* resources */ char* resource; /* private state */ } RootWindowPart; typedef struct _RootWindowRec { CorePart core; RootWindowPart root; } RootWindowRec; #endif /* _RootWindoP_h */ x11-apps-7.7+5+nmu1ubuntu1/xmag/config.h.in0000664000000000000000000000361412656634703015170 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `lrint' function. */ #undef HAVE_LRINT /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `nanosleep' function. */ #undef HAVE_NANOSLEEP /* Define to 1 if you have the `poll' function. */ #undef HAVE_POLL /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION x11-apps-7.7+5+nmu1ubuntu1/xmag/xmag.icon0000664000000000000000000000155312514127176014745 0ustar #define xmag_width 32 #define xmag_height 32 static char xmag_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0x7f, 0x00, 0xff, 0xff, 0x1f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xf8, 0xff, 0x07, 0x00, 0xf0, 0xff, 0x07, 0x00, 0xf0, 0xff, 0x03, 0x00, 0xe0, 0xff, 0x03, 0x00, 0xe0, 0xff, 0x03, 0x00, 0xe0, 0xff, 0x01, 0x00, 0xc0, 0xff, 0x01, 0x00, 0xc0, 0xff, 0x01, 0x00, 0xc0, 0xff, 0x03, 0x00, 0xe0, 0xff, 0x03, 0x00, 0xe0, 0xff, 0x03, 0x00, 0xe0, 0xff, 0x07, 0x00, 0xf0, 0xff, 0x07, 0x00, 0xf0, 0xff, 0x0f, 0x00, 0xf0, 0xff, 0x1f, 0x00, 0xe0, 0xff, 0x7f, 0x00, 0xc7, 0xff, 0xff, 0xe3, 0x8f, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xc7, 0xff, 0xff, 0xff, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; x11-apps-7.7+5+nmu1ubuntu1/xmag/man/0000775000000000000000000000000012656635743013721 5ustar x11-apps-7.7+5+nmu1ubuntu1/xmag/man/xmag.man0000664000000000000000000000731212514127176015342 0ustar .\" Copyright 1991, 1994, 1998 The Open Group .\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" .\" .TH XMAG 1 __xorgversion__ .SH NAME xmag \- magnify parts of the screen .SH SYNOPSIS .B xmag [ .B \-mag .I magfactor ] [ .B \-source .I geom ] [ .I \-toolkitoption \&.\|.\|. ] .SH DESCRIPTION The \fIxmag\fP program allows you to magnify portions of an X screen. If no explicit region is specified, a square with the pointer in the upper left corner is displayed indicating the area to be enlarged. The area can be dragged out to the desired size by pressing Button 2. Once a region has been selected, a window is popped up showing a blown up version of the region in which each pixel in the source image is represented by a small square of the same color. Pressing Button1 in the enlargement window shows the position and RGB value of the pixel under the pointer until the button is released. Typing ``Q'' or ``^C'' in the enlargement window exits the program. The application has 5 buttons across its top. \fIClose\fP deletes this particular magnification instance. \fIReplace\fP brings up the rubber band selector again to select another region for this magnification instance. \fINew\fP brings up the rubber band selector to create a new magnification instance. \fISelect\fP puts the magnification image into the primary selection. \fIPaste\fP copies the primary selection buffer into \fIxmag\fP. Note that you can cut and paste between \fIxmag\fP and the \fIbitmap\fP program. Resizing \fIxmag\fP resizes the magnification area. \fIxmag\fP preserves the colormap, visual, and window depth of the source. .SH WIDGETS \fIxmag\fP uses the X Toolkit and the Athena Widget Set. The magnified image is displayed in the Scale widget. For more information, see the Athena Widget Set documentation. Below is the widget structure of the \fIxmag\fP application. Indentation indicates hierarchical structure. The widget class name is given first, followed by the widget instance name. .sp .nf Xmag xmag RootWindow root TopLevelShell xmag Paned pane1 Paned pane2 Command close Command replace Command new Command select Command paste Label xmag label Paned pane2 Scale scale OverrideShell pixShell Label pixLabel .fi .SH OPTIONS .TP 15 .B \-source\fI geom\fP This option specifies the size and/or location of the source region on the screen. By default, a 64x64 square is provided for the user to select an area of the screen. .TP 15 .B \-mag\fI integer\fP This option indicates the magnification to be used. 5 is the default. .SH AUTHORS Dave Sternlicht and Davor Matic, MIT X Consortium. x11-apps-7.7+5+nmu1ubuntu1/xmag/man/Makefile.am0000664000000000000000000000052212514127176015741 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = xmag.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/xmag/config.sub0000775000000000000000000010622312514123564015117 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-12-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xmag/Makefile.am0000664000000000000000000000350512514127176015172 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. SUBDIRS = man bin_PROGRAMS = xmag AM_CFLAGS = $(XMAG_CFLAGS) $(CWARNFLAGS) xmag_LDADD = $(XMAG_LIBS) xmag_SOURCES = \ CutPaste.c \ CutPaste.h \ RootWin.c \ RootWin.h \ RootWinP.h \ Scale.c \ Scale.h \ ScaleP.h \ xmag.c # App default files (*.ad) DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ dist_appdefault_DATA = \ app-defaults/Xmag # Developer documentation for Scale widget in Scale.c EXTRA_DIST = Scale.txt xmag.icon MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xmag/missing0000755000000000000000000001533012656634704014541 0ustar #! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xmag/configure.ac0000664000000000000000000000473412514127176015431 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xmag], [1.0.6], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xmag]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS AC_CHECK_FUNCS([nanosleep poll select]) # Math libraries & functions # - some compilers use builtin inlines for floor # - lrint() is a C99 addition not found on some older systems # - must do the libm check first so that the lrint check will have it in $LIBS AC_SEARCH_LIBS([floor], [m]) AC_SEARCH_LIBS([lrint], [m]) AC_CHECK_FUNCS([lrint]) # Checks for pkg-config packages PKG_CHECK_MODULES(XMAG, xaw7 xmu xt x11) xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` AC_ARG_WITH(appdefaultdir, AS_HELP_STRING([--with-appdefaultdir=], [specify directory for app-defaults files (default is autodetected)]), [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xmag/README0000664000000000000000000000126312514127176014015 0ustar xmag displays a magnified snapshot of a portion of an X11 screen. All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xmag http://cgit.freedesktop.org/xorg/app/xmag For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xmag/RootWin.c0000664000000000000000000000531312514127176014702 0ustar /* Copyright 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #include #include #include "RootWinP.h" static void Realize ( Widget w, XtValueMask *value_mask, XSetWindowAttributes *attributes ); RootWindowClassRec rootWindowClassRec = { { /* core fields */ /* superclass */ (WidgetClass) &widgetClassRec, /* class_name */ "RootWindow", /* widget_size */ sizeof(RootWindowRec), /* class_initialize */ NULL, /* class_part_initialize */ NULL, /* class_inited */ FALSE, /* initialize */ NULL, /* initialize_hook */ NULL, /* realize */ Realize, /* actions */ NULL, /* num_actions */ 0, /* resources */ NULL, /* num_resources */ 0, /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, /* compress_exposure */ TRUE, /* compress_enterleave */ TRUE, /* visible_interest */ FALSE, /* destroy */ NULL, /* resize */ NULL, /* expose */ NULL, /* set_values */ NULL, /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ NULL, /* query_geometry */ XtInheritQueryGeometry, /* display_accelerator */ XtInheritDisplayAccelerator, /* extension */ NULL }, { /* rootWindow fields */ /* empty */ 0 } }; WidgetClass rootWindowWidgetClass = (WidgetClass)&rootWindowClassRec; /*ARGSUSED*/ static void Realize(Widget w, XtValueMask *value_mask, XSetWindowAttributes *attributes) { w->core.window = RootWindowOfScreen(w->core.screen); } x11-apps-7.7+5+nmu1ubuntu1/xmag/COPYING0000664000000000000000000000465512514127176014200 0ustar Copyright 1989, 1990, 1991, 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright (C) 1999 The XFree86 Project, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the XFree86 Project shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project. x11-apps-7.7+5+nmu1ubuntu1/xmag/Scale.txt0000664000000000000000000001164412514127176014731 0ustar Scale Widget Header file Scale.h Class scaleWidgetClass Class Name Scale Superclass Simple The Scale widget is an immutable image displayed within a rectangular region of the screen. When the widget is selected, it is highlighted, and an application callback routine is invoked. When the widget is resized the image can be autoscaled to fit new size of the widget window. The widget can also cut and paste its contents. When creating a Scale widget instance, the following resources are retreived from the argument list or from the resource database: All the Simple Widget resources plus... ------------------------------------------------------------------------------- Name Cass Type Default Value ------------------------------------------------------------------------------- aspectRatio AspectRatio Float 1.0 autoscale Autoscale Boolean True bufferSize BufferSize Cardinal 1024 foreground Foreground Pixel XtDefaultForeground gravity Gravity XtGravity ForgetGravity image Image XImage* NULL internalHeight Height Dimension 2 internalWidth Width Dimension 2 pasteBuffer PasteBuffer Boolean False precision Precision Float 0.001 proportional Proportional Boolean True resize Resize Boolean True scaleX ScaleFactor Float DefaultScaleValue scaleY ScaleFactor Float DefaultScaleValue exponent Exponent integer -3 ------------------------------------------------------------------------------- aspectRatio This resource specifies the aspect ratio of the scaled image in the x / y * aspectRatio = 1 form. It is effective within the precision resource only if proportional resource is set to true. AspectRatio resource can be any positive number greater than zero. autoscale If this resource is set to True then the image will be autoscaled to fit the window size within internal width and internal height resource values. If the resource is False, the widget will only reposition the image according to the gravity resource value. bufferSize This resource specifies the buffer size in XRectangle's for buffering the XFillRectangle calls. It is effective only for XYBitmap image type. background This resource has the same meaning as for the Simple widget. However, it is worth mentioning that if the most frequent pixel value in the XYPixmap or ZPixmap image is specified as backgroud, the scaling process can be speeded up noticably. foreground The color used to paint the image if in XYBitmap format. If the image is XYPixmap or ZPixmap format, the foreground resource has no effect. gravity This resource will determine where to put the image if it does not fit the window size minus internal width and height. The widget will try to preserve gravity rather than internal width and height resources. image This is the image to be displayed in the widget window. If no image is desired, the NULL value can be passed. The passed image is copied and set to the resource value. Applications should destroy the passed image argument if they do not intend to use it at some later time. internalHeight internalWidth These resources specify the minimum distance from the boarder of the widget window to be maintanied when manipulating the image. If image is too big or small to satisfy given conditions, the widget will position the image to preserve gravity rather than internalWidth or internalHeight. pasteBuffer If this resource is true then the widget owns the paste selection buffer. This resource can only be queried. precision This resource specifies the precision of the scale factors when scaling the image. The precision resource can be any positive number greater than zero. (For example, if precision is 1.0 then the image will be scaled only by integer values.) proportional If this resource is set to true it will make sure that the image proportions, as specified by aspectRatio resource, are being kept whenever it is scaled. resize If this resource is true the widget will try to resize when addopting a new image thus preserveing the scale values. If it is false the scale values will not be preserved unless the image can fit in the current window size with the same scale values. scaleX scaleY These resources specify the scaling values for the widget image. They will be floored to satisfy precision resource values. If uniform resource is true the scale values will be only integers. These resources can be any positive number greater than zero. shiftFactor ... x11-apps-7.7+5+nmu1ubuntu1/xmag/INSTALL0000664000000000000000000003660012514127224014163 0ustar Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/0000775000000000000000000000000012656635743014411 5ustar x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/ChangeLog0000664000000000000000000004142712342463321016152 0ustar commit 68939d23da457d4beeab73fca644b5c68224bdd3 Author: Alan Coopersmith Date: Sat May 31 16:33:07 2014 -0700 xcursorgen 1.0.6 Signed-off-by: Alan Coopersmith commit c21306ebf8cfa780d3d4fd31a41d1c7cac2e8dbb Author: Alan Coopersmith Date: Tue Nov 26 22:22:30 2013 -0800 Print which option was in error along with usage message Signed-off-by: Alan Coopersmith commit 3c31233990f8c91b4f54b4ba7d4cd02f67c7812e Author: Alan Coopersmith Date: Sat Feb 23 11:59:56 2013 -0800 config: Add missing AC_CONFIG_SRCDIR Regroup AC statements under the Autoconf initialization section. Regroup AM statements under the Automake initialization section. Signed-off-by: Alan Coopersmith commit 7c50a1b8952baa8227908881858428f2ce971ed8 Author: Alan Coopersmith Date: Sat Feb 23 11:56:33 2013 -0800 Combine usage message into single string/call Signed-off-by: Alan Coopersmith commit 70d4855b4b313621cb250922712a1461dd742c3f Author: Alan Coopersmith Date: Sat Feb 23 11:52:11 2013 -0800 Use C99 struct initializer for ximage in check_image() Signed-off-by: Alan Coopersmith commit b0e174921ac5216fb4e21015a9b4bb9999b4b87b Author: Alan Coopersmith Date: Sat Feb 23 11:44:00 2013 -0800 Change order of struct flist members to pack better on 64-bit archs As reported by clang: xcursorgen.c:42:9: warning: padding struct 'struct flist' with 4 bytes to align 'pngfile' [-Wpadded] char *pngfile; ^ xcursorgen.c:44:17: warning: padding struct 'struct flist' with 4 bytes to align 'next' [-Wpadded] struct flist *next; Signed-off-by: Alan Coopersmith commit 1edaf53856983391b05d3a488acc0b6cc257a401 Author: Alan Coopersmith Date: Thu Mar 22 21:54:00 2012 -0700 xcursorgen 1.0.5 Signed-off-by: Alan Coopersmith commit 5610c2cca68228c1ce8fa5006021e7859e632cf5 Author: Alan Coopersmith Date: Tue Feb 14 19:53:55 2012 -0800 Fix -image argument parsing to not shadow "i" variable Also avoids starting at the wrong argument if -image is not the first flag passed to xcompmgr (though that's not really supported in the current syntax). Fixes gcc warning: xcursorgen.c: In function `main': xcursorgen.c:394: warning: declaration of 'i' shadows a previous local xcursorgen.c:377: warning: shadowed declaration is here Signed-off-by: Alan Coopersmith Reviewed-by: Jeremy Huddleston commit 471a4ef735fae193305b29484975e0201fc00a4f Author: Alan Coopersmith Date: Wed Sep 28 20:40:40 2011 -0700 Add const attributes to fix gcc -Wwrite-strings warnings Signed-off-by: Alan Coopersmith commit dc2354cdd2e7ad247dd2a3e456c90a40095b98ee Author: Alan Coopersmith Date: Wed Sep 28 20:36:25 2011 -0700 Remove old XFree86 CVS id Signed-off-by: Alan Coopersmith commit 4acc916ea1aa2a651f600f135ebd743add4e486b Author: Alan Coopersmith Date: Wed Sep 28 20:36:04 2011 -0700 Strip trailing whitespace Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' git diff -w & git diff -b show no diffs from this change Signed-off-by: Alan Coopersmith commit 512e7a8e82c42add636fbf13d13df854290a35f7 Author: Gaetan Nadon Date: Wed Jan 19 10:06:56 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 667b2259b41152f4146b28677d464b7d47ef6bac Author: Gaetan Nadon Date: Wed Jan 12 16:28:02 2011 -0500 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS This silences an Autoconf warning commit bd5c027d923351ea8ef541a6d5092ba9e8661f6c Author: Alan Coopersmith Date: Thu Sep 23 19:41:07 2010 -0700 xcursorgen 1.0.4 Signed-off-by: Alan Coopersmith commit b848ae7bbd9d328fa8115707153a92414b302753 Author: Alan Coopersmith Date: Thu Sep 23 19:38:42 2010 -0700 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now PKG_CONFIG_MODULES handles AC_SUBST of the CFLAGS & LIBS variables Signed-off-by: Alan Coopersmith commit 4768df2f3051a92dc351a4072d2232ffd9304eb0 Author: Gaetan Nadon Date: Tue Jul 20 18:45:18 2010 -0400 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon commit be56a72e4afc0ba6599fb862f2b527fa49afbf82 Author: Yaakov Selkowitz Date: Sun Aug 8 21:45:54 2010 -0500 Use AC_PROG_SED and MAN_SUBSTS in macros-1.8 Tested-by: Gaetan Nadon Signed-off-by: Yaakov Selkowitz commit 0aa3f45edaddd3deef9845ed290518ebb91e22c0 Author: Yaakov Selkowitz Date: Sun Aug 8 21:45:53 2010 -0500 Remove INSTALL from git The INSTALL file is added to the tarball by XORG_INSTALL. Tested-by: Gaetan Nadon Signed-off-by: Yaakov Selkowitz commit 9e7c41e0e16183110cd7b28d012a0bb69aed4655 Author: Cody Maloney Date: Sun Mar 14 00:07:23 2010 -0800 Upgraded to work with libpng14 setjmp(png_ptr->jmpbuf) is depreceated so removed it and changed the configure.ac version number to accept libpng12 or libpng14 Signed-off-by: Cody Maloney Tested-by: Yaakov Selkowitz Signed-off-by: Alan Coopersmith commit 194d9a4353dbf0b4c1d2895e60966bbc4429c54d Author: Gaetan Nadon Date: Thu Nov 26 09:19:53 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit a8cd9706d08c02a947db00f391dc753a7d8167e0 Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit 763593472fd31103f63afa90d4405643d90fc79e Author: Gaetan Nadon Date: Mon Oct 26 22:08:38 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit 821f55410152bfa8b7e8e3c9ee809e1835db9e2f Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit db68e86e2d2d058e178598a46f6237f9762e4fd3 Author: Gaetan Nadon Date: Sun Sep 27 16:02:01 2009 -0400 Makefile.am: do not include autogen.sh in distribution #24183 This is a private build script that should not be distributed commit 32dc0bbbd067bfe27f506a510da3c5344964ee23 Author: Alan Coopersmith Date: Fri Oct 16 17:41:51 2009 -0700 xcursorgen 1.0.3 Signed-off-by: Alan Coopersmith commit 47428dfabe933239919dfb4a51a9187ad4e2cb48 Author: Alan Coopersmith Date: Fri Oct 16 17:41:20 2009 -0700 Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS Signed-off-by: Alan Coopersmith commit 334aca2e5ab6d046659fdd60b16b0109aa0fe441 Author: Alan Coopersmith Date: Thu Oct 1 14:54:22 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit c4c3d77ea9a89b2c5c23518b5cf235d4f7e017bf Author: Paulo Cesar Pereira de Andrade Date: Mon Jan 19 20:40:12 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings. commit 5aca565a857da642bc3f9dc89e88bfa3c1b13f11 Author: Alan Coopersmith Date: Mon Aug 20 18:14:28 2007 -0700 Version bump: 1.0.2 commit ea7f29dd3104c23f2533e45395852202dc588d36 Author: Alan Coopersmith Date: Mon Aug 20 18:11:58 2007 -0700 Set version string in man page commit bdbbaa94ea75511dd7f5dd8573b6772dab56e55e Author: Alan Coopersmith Date: Mon Aug 20 17:52:25 2007 -0700 Use strdup instead of malloc/strlen/strcpy commit e5c1a83c1b8f71615d2fe724456bc044d9799efa Author: Alan Coopersmith Date: Mon Aug 20 17:48:19 2007 -0700 Correct help flag in usage message (-?, not -h) commit a6cc06762ae726765db2d5f76ce8f9464fb6dab8 Author: Alan Coopersmith Date: Mon Aug 20 17:46:28 2007 -0700 Add options/flags to man page & other man page cleanups commit 3392d92ac031ac5796a1ebce816366c25f10e18a Author: Alan Coopersmith Date: Mon Aug 20 16:42:23 2007 -0700 Remove unused AC_TYPE_SIGNAL from configure.ac commit c2c7f8b3f8301f3f47af514627631acdb5aae109 Author: Alan Coopersmith Date: Mon Aug 20 16:40:19 2007 -0700 Use PACKAGE_VERSION for --version output commit fb4fc37392c441e5e970ac68fc366758dac4a560 Author: Alan Coopersmith Date: Mon Aug 20 16:35:42 2007 -0700 Replace static ChangeLog with dist-hook to generate from git log commit 1dc83c571d81288ea3eea6032a3c3f8880b77442 Author: Alan Coopersmith Date: Mon Aug 20 15:16:02 2007 -0700 Change xcursorgen_CFLAGS to AM_CFLAGS to make automake-1.10 happier commit 50d163d5ec3a5ab6d9defe883f6b96aec5e7c481 Author: Alan Coopersmith Date: Tue Dec 12 15:46:57 2006 -0800 Coverity #624: RESOURCE_LEAK: Returned without freeing storage "fp" commit c7b1efdc8ee552b97e43ff985b531cc8f0d155a0 Author: Alan Coopersmith Date: Tue Dec 12 15:38:56 2006 -0800 renamed: .cvsignore -> .gitignore commit 92171a05977622f2233bbd9fa63408fd85d637de Author: Alan Coopersmith Date: Tue Dec 12 15:33:55 2006 -0800 Coverity #621: RESOURCE_LEAK: Returned without freeing storage "curr" free(curr) in error path when second malloc fails. commit bf8160df027e3c4335e8473cf7aae8c1d21546cf Author: Adam Jackson Date: Fri May 19 18:33:36 2006 +0000 Bump to 1.0.1 commit c3eb5d737f8281a3c7ffaf592c443d41a47f5c40 Author: Adam Jackson Date: Mon Apr 3 22:06:24 2006 +0000 Bug #3270: Fix rounding errors. commit b7b26fefc1b334672e84a16c8caf5edd2b85f294 Author: Kevin E Martin Date: Thu Dec 15 00:24:05 2005 +0000 Update package version number for final X11R7 release candidate. commit ab065281c8875bba88c2b9adb492a9977ea39ed0 Author: Kevin E Martin Date: Tue Dec 6 22:48:20 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit ae1b20a0473e596754eae33bab0fedeb692f381b Author: Kevin E Martin Date: Sat Dec 3 05:49:19 2005 +0000 Update package version number for X11R7 RC3 release. commit 46218fc220339a616694ea0310a173d50ef7bf12 Author: Alan Coopersmith Date: Mon Nov 28 22:01:40 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit f3a8d8e594e16f9c9b9b89215eb297232da936e0 Author: Eric Anholt Date: Mon Nov 21 10:34:59 2005 +0000 Another pass at .cvsignores for apps. commit 21e0bf931f260b7c1dbc4724b2698a1cd1143e79 Author: Eric Anholt Date: Sun Nov 20 22:08:51 2005 +0000 Add/improve .cvsignore files for apps. commit 15664a0e83dad641da695c6b35965c08e8b6935d Author: Alan Coopersmith Date: Sat Nov 12 17:52:00 2005 +0000 Bug #5021 Patch #3786 xcursorgen installs manpages into 'man1' instead of 'man1x' commit 0c9649fc7598ac601f4bc67253c7caf3ae1bd04b Author: Kevin E Martin Date: Wed Nov 9 21:09:20 2005 +0000 Update package version number for X11R7 RC2 release. commit 4ef9256645536bc4200f4611014176de65231bde Author: Eric Anholt Date: Thu Oct 20 23:28:50 2005 +0000 Update ChangeLog for last fix, including attribution: Fix spelling of man1_MANS so the manpage gets installed. (Bill Crawford) commit e1aafb476b2fd87b5c8d998f78a268b218db95db Author: Eric Anholt Date: Thu Oct 20 23:20:13 2005 +0000 Fix spelling of man1_MANS so the manpage gets installed. commit 0075a0d8b02c0bf069cb28d569341be0efabd831 Author: Kevin E Martin Date: Fri Jul 29 21:22:31 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit d1e8b882f87ed8f6e335daff461ea1427f92c8c9 Author: Keith Packard Date: Sat Jul 9 23:36:22 2005 +0000 Add .cvsignore files commit 36faf2957f84e050486a9ca187f22c82867e383d Author: Daniel Stone Date: Wed Jul 6 05:39:42 2005 +0000 Set version to 1.0. commit 74a7675c0608d7e1b9a22263b907ce7804bb3250 Author: Daniel Stone Date: Wed Jul 6 05:35:51 2005 +0000 Add xcursorgen build system. commit a750fa933a7d54c971badb401a23fcd020da315b Author: Kristian Høgsberg Date: Fri Dec 3 22:21:22 2004 +0000 Check malloc return values. commit 4b9f8a6bb5e2bd7129339264aab23f3818ff4952 Author: Egbert Eich Date: Fri Apr 23 19:54:41 2004 +0000 Merging XORG-CURRENT into trunk commit 67c2de8d39f56345bd5a5b40b8bd93a5a6aac9de Author: Egbert Eich Date: Sun Mar 14 08:35:01 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit 11ad36a7b30edcab5d75fc3b96ab6f5b28295ac5 Author: Egbert Eich Date: Wed Mar 3 12:12:55 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit a72ceed75bbb818736df95fc0756e40469416bb1 Author: Egbert Eich Date: Thu Feb 26 13:36:16 2004 +0000 readding XFree86's cvs IDs commit 3a6cb640d6a1a86e8586d998f97538df0cca6e14 Author: Egbert Eich Date: Thu Feb 26 09:23:58 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit 7c4674de0645c6deab515b153f86520967bd0a4f Author: Kaleb Keithley Date: Tue Nov 25 19:29:04 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit b3bfcbc826cc3316c1068724633897abb11d8118 Author: Kaleb Keithley Date: Fri Nov 14 16:48:58 2003 +0000 XFree86 4.3.0.1 commit 439e6e965ce471e53cd740549743fea761c46dda Author: Kaleb Keithley Date: Fri Nov 14 16:48:58 2003 +0000 Initial revision x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/config.guess0000775000000000000000000013036112342463275016724 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-06-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/config.h.in0000664000000000000000000000315012656634647016435 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/AUTHORS0000664000000000000000000000004012342463266015442 0ustar Original authors: Manish Singh x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/man/0000775000000000000000000000000012656635743015164 5ustar x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/man/xcursorgen.man0000664000000000000000000000531012342463266020046 0ustar .\" .\" Copyright 2002 Keith Packard.\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation, and that the name of Keith Packard not be used in .\" advertising or publicity pertaining to distribution of the software without .\" specific, written prior permission. Keith Packard makes no .\" representations about the suitability of this software for any purpose. It .\" is provided "as is" without express or implied warranty. .\" .\" KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, .\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO .\" EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR .\" CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, .\" DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER .\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" .\" .\" $XFree86: xc/programs/xcursorgen/xcursorgen.man,v 1.1 2002/09/03 06:48:28 keithp Exp $ .\" .TH XCURSORGEN __appmansuffix__ __vendorversion__ .SH NAME xcursorgen \- create an X cursor file from a collection of PNG images .SH SYNOPSIS .B "xcursorgen" [ \fB\-V\fP ] [ \fB\-\-version\fP ] [ \fB\-?\fP ] [ \fB\-\-help\fP ] [ \fB\-p\fP \fIdir\fP ] [ \fB\-\-prefix\fP \fIdir\fP ] .RI "[ " config-file .RI "[ " output-file " ] ]" .SH DESCRIPTION Xcursorgen reads the \fIconfig-file\fP to find the list of cursor images along with their hotspot and nominal size information. Xcursorgen converts all of the images to Xcursor format and writes them to the \fIoutput-file\fP. .P Each line in the config file is of the form: .br .br .P Multiple images with the same are used to create animated cursors, the value on each line indicates how long each image should be displayed before switching to the next. can be elided for static cursors. .P If \fIconfig-file\fP is not specified, or is specified as "-", standard input is used for the configuration file. If \fIoutput-file\fP is not specified, or is specified as "-", standard output is used for the output file. .SH OPTIONS .TP 8 .BR \-V ", " \-\-version Display the version number and exit. .TP 8 .BR \-? ", " \-\-help Display the usage message and exit. .TP 8 .BR "\-p \fIdir\fP" ", " "\-\-prefix \fIdir\fP" Find cursor images in the directory specified by \fIdir\fP. If not specified, the current directory is used. .SH "SEE ALSO" Xcursor(__libmansuffix__) x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/man/Makefile.am0000664000000000000000000000053012342463266017205 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = xcursorgen.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/xcursorgen.c0000664000000000000000000002301512342463266016744 0ustar /* * xcursorgen.c * * Copyright (C) 2002 Manish Singh * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Manish Singh not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Manish Singh makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * MANISH SINGH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL MANISH SINGH BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include "config.h" #include #include #include #include #include #include #include #include struct flist { int size; int xhot, yhot; int delay; char *pngfile; struct flist *next; }; static void usage (const char *name) { fprintf (stderr, "usage: %s [-V] [--version] [-?] [--help] [-p ] [--prefix ] [CONFIG [OUT]]\n%s", name, "Generate an Xcursor file from a series of PNG images\n" "\n" " -V, --version display the version number and exit\n" " -?, --help display this message and exit\n" " -p, --prefix find cursor images in \n" "\n" "With no CONFIG, or when CONFIG is -, read standard input. " "Same with OUT and\n" "standard output.\n"); } static int read_config_file (const char *config, struct flist **list) { FILE *fp; char line[4096], pngfile[4000]; int size, xhot, yhot, delay; struct flist *start = NULL, *end = NULL, *curr; int count = 0; if (strcmp (config, "-") != 0) { fp = fopen (config, "r"); if (!fp) { *list = NULL; return 0; } } else fp = stdin; while (fgets (line, sizeof (line), fp) != NULL) { if (line[0] == '#') continue; switch (sscanf (line, "%d %d %d %3999s %d", &size, &xhot, &yhot, pngfile, &delay)) { case 4: delay = 50; break; case 5: break; default: { fprintf (stderr, "Bad config file data!\n"); fclose (fp); return 0; } } curr = malloc (sizeof (struct flist)); if (curr == NULL) { fprintf (stderr, "malloc() failed\n"); fclose (fp); return 0; } curr->size = size; curr->xhot = xhot; curr->yhot = yhot; curr->delay = delay; curr->pngfile = strdup (pngfile); if (curr->pngfile == NULL) { fprintf (stderr, "strdup() failed\n"); fclose (fp); free(curr); return 0; } curr->next = NULL; if (start) { end->next = curr; end = curr; } else { start = curr; end = curr; } count++; } fclose (fp); *list = start; return count; } #define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8) static void premultiply_data (png_structp png, png_row_infop row_info, png_bytep data) { int i; for (i = 0; i < row_info->rowbytes; i += 4) { unsigned char *base = &data[i]; unsigned char blue = base[0]; unsigned char green = base[1]; unsigned char red = base[2]; unsigned char alpha = base[3]; XcursorPixel p; red = div_255((unsigned)red * (unsigned)alpha); green = div_255((unsigned)green * (unsigned)alpha); blue = div_255((unsigned)blue * (unsigned)alpha); p = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0); memcpy (base, &p, sizeof (XcursorPixel)); } } static XcursorImage * load_image (struct flist *list, const char *prefix) { XcursorImage *image; png_structp png; png_infop info; png_bytepp rows; FILE *fp; int i; png_uint_32 width, height; int depth, color, interlace; char *file; png = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png == NULL) return NULL; info = png_create_info_struct (png); if (info == NULL) { png_destroy_read_struct (&png, NULL, NULL); return NULL; } if (setjmp (png_jmpbuf(png))) { png_destroy_read_struct (&png, &info, NULL); return NULL; } if (prefix) { file = malloc (strlen (prefix) + 1 + strlen (list->pngfile) + 1); if (file == NULL) { fprintf (stderr, "malloc() failed\n"); png_destroy_read_struct (&png, &info, NULL); return NULL; } strcpy (file, prefix); strcat (file, "/"); strcat (file, list->pngfile); } else file = list->pngfile; fp = fopen (file, "rb"); if (prefix) free (file); if (fp == NULL) { png_destroy_read_struct (&png, &info, NULL); return NULL; } png_init_io (png, fp); png_read_info (png, info); png_get_IHDR (png, info, &width, &height, &depth, &color, &interlace, NULL, NULL); /* TODO: More needs to be done here maybe */ if (color == PNG_COLOR_TYPE_PALETTE && depth <= 8) png_set_expand (png); if (color == PNG_COLOR_TYPE_GRAY && depth < 8) png_set_expand (png); if (png_get_valid (png, info, PNG_INFO_tRNS)) png_set_expand (png); if (depth == 16) png_set_strip_16 (png); if (depth < 8) png_set_packing (png); if (color == PNG_COLOR_TYPE_GRAY || color == PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb (png); if (interlace != PNG_INTERLACE_NONE) png_set_interlace_handling (png); png_set_bgr (png); png_set_filler (png, 255, PNG_FILLER_AFTER); png_set_read_user_transform_fn (png, premultiply_data); png_read_update_info (png, info); image = XcursorImageCreate (width, height); image->size = list->size; image->xhot = list->xhot; image->yhot = list->yhot; image->delay = list->delay; rows = malloc (sizeof (png_bytep) * height); if (rows == NULL) { fclose (fp); png_destroy_read_struct (&png, &info, NULL); return NULL; } for (i = 0; i < height; i++) rows[i] = (png_bytep) (image->pixels + i * width); png_read_image (png, rows); png_read_end (png, info); free (rows); fclose (fp); png_destroy_read_struct (&png, &info, NULL); return image; } static int write_cursors (int count, struct flist *list, const char *filename, const char *prefix) { XcursorImages *cimages; XcursorImage *image; int i; FILE *fp; int ret; if (strcmp (filename, "-") != 0) { fp = fopen (filename, "wb"); if (!fp) return 1; } else fp = stdout; cimages = XcursorImagesCreate (count); cimages->nimage = count; for (i = 0; i < count; i++, list = list->next) { image = load_image (list, prefix); if (image == NULL) { fprintf (stderr, "PNG error while reading %s!\n", list->pngfile); fclose(fp); return 1; } cimages->images[i] = image; } ret = XcursorFileSaveImages (fp, cimages); fclose (fp); return ret ? 0 : 1; } static int check_image (char *image) { unsigned int width, height; unsigned char *data; int x_hot, y_hot; unsigned char hash[XCURSOR_BITMAP_HASH_SIZE]; int i; if (XReadBitmapFileData (image, &width, &height, &data, &x_hot, &y_hot) != BitmapSuccess) { fprintf (stderr, "Can't open bitmap file \"%s\"\n", image); return 1; } else { XImage ximage = { .width = width, .height = height, .depth = 1, .bits_per_pixel = 1, .xoffset = 0, .format = XYPixmap, .data = (char *)data, .byte_order = LSBFirst, .bitmap_unit = 8, .bitmap_bit_order = LSBFirst, .bitmap_pad = 8, .bytes_per_line = (width+7)/8 }; XcursorImageHash (&ximage, hash); } printf ("%s: ", image); for (i = 0; i < XCURSOR_BITMAP_HASH_SIZE; i++) printf ("%02x", hash[i]); printf ("\n"); return 0; } int main (int argc, char *argv[]) { struct flist *list; int count; const char *in = NULL, *out = NULL; const char *prefix = NULL; int i; for (i = 1; i < argc; i++) { if (strcmp (argv[i], "-V") == 0 || strcmp (argv[i], "--version") == 0) { printf ("xcursorgen version %s\n", PACKAGE_VERSION); return 0; } if (strcmp (argv[i], "-?") == 0 || strcmp (argv[i], "--help") == 0) { usage (argv[0]); return 0; } if (strcmp (argv[i], "-image") == 0) { int ret = 0; while (argv[++i]) { if (check_image (argv[i])) ret = i; } return ret; } if (strcmp (argv[i], "-p") == 0 || strcmp (argv[i], "--prefix") == 0) { i++; if (argv[i] == NULL) { fprintf (stderr, "%s: %s requires an argument\n", argv[0], argv[i-1]); usage (argv[0]); return 1; } prefix = argv[i]; continue; } if (!in) in = argv[i]; else if (!out) out = argv[i]; else { fprintf (stderr, "%s: unexpected argument '%s'\n", argv[0], argv[i]); usage (argv[0]); return 1; } } if (!in) in = "-"; if (!out) out = "-"; count = read_config_file (in, &list); if (count == 0) { fprintf (stderr, "Error reading config file!\n"); return 1; } return write_cursors (count, list, out, prefix); } x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/config.sub0000775000000000000000000010530112167023104016347 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-04-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/Makefile.am0000664000000000000000000000047512342463266016442 0ustar SUBDIRS = man bin_PROGRAMS = xcursorgen xcursorgen_SOURCES = xcursorgen.c AM_CFLAGS = $(CWARNFLAGS) $(XCURSORGEN_CFLAGS) xcursorgen_LDADD = $(XCURSORGEN_LIBS) MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/configure.ac0000664000000000000000000000132212342463266016664 0ustar dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xcursorgen], [1.0.6], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xcursorgen]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Require xorg-macros 1.8 or later: XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS # Checks for pkg-config packages PKG_CHECK_MODULES(XCURSORGEN, x11 xcursor libpng >= 1.2.0) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/README0000664000000000000000000000127212342463266015262 0ustar xcursorgen prepares X11 cursor sets for use with libXcursor. All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xcursorgen http://cgit.freedesktop.org/xorg/app/xcursorgen For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/COPYING0000664000000000000000000000210612342463266015432 0ustar Copyright (C) 2002 Manish Singh Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Manish Singh not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Manish Singh makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. MANISH SINGH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL MANISH SINGH BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. x11-apps-7.7+5+nmu1ubuntu1/xcursorgen/INSTALL0000664000000000000000000003660012342463321015426 0ustar Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/transset/0000775000000000000000000000000012656635743014055 5ustar x11-apps-7.7+5+nmu1ubuntu1/transset/ChangeLog0000664000000000000000000003252112167023104015605 0ustar commit 39db25e110cfedcec99394dfa7614ca248685c0d Author: Alan Coopersmith Date: Fri May 17 17:47:14 2013 -0700 transset 1.0.1 Signed-off-by: Alan Coopersmith commit fc4bf3cda6d14cac9272f8399bb6dc614c1ef956 Author: Alan Coopersmith Date: Fri Feb 22 22:05:39 2013 -0800 Add the options to the man page (they were all missing before) Signed-off-by: Alan Coopersmith commit f59b8db649c1596a38ce20025417c4060d442d64 Author: Alan Coopersmith Date: Fri Feb 22 21:33:25 2013 -0800 Store min & max as doubles, not floats Since atof generates doubles, and we use them to compare/limit the values of the double "d", might as well keep them in the same format instead of doing unnecessary conversions. Signed-off-by: Alan Coopersmith commit e79903a50b0a9cba9d0e41fc2e389117f3ff42ef Author: Alan Coopersmith Date: Fri Feb 22 21:27:00 2013 -0800 Typo fixes in verbose message & comment Signed-off-by: Alan Coopersmith commit da0682051e880faa2ef1accac388040bb52b46d8 Author: Alan Coopersmith Date: Fri Feb 22 21:22:43 2013 -0800 Use correct variable for printing current opacity Found by clang: transSet.c:303:30: warning: variable 'opacity' is uninitialized when used here [-Wuninitialized] (double) opacity / OPAQUE); ^~~~~~~ When running transset -v, it prints the current opacity of a window before changing it, but was printing garbage - after this fix, correctly prints the value set by the previous run. Signed-off-by: Alan Coopersmith commit 65f010b8c4ef0e4fa5fc6a0679173f81c7a4b626 Author: Alan Coopersmith Date: Fri Feb 22 21:17:59 2013 -0800 Move release date from transset.c to configure.ac so we remember to update it Currently our 2012 release prints: released: 2007-09-21 when you run transset --version Signed-off-by: Alan Coopersmith commit 6cd34b45c87717ae7901993e32b99a43652fa0f3 Author: Alan Coopersmith Date: Fri Feb 22 21:14:09 2013 -0800 Include PACKAGE_STRING in --version output Signed-off-by: Alan Coopersmith commit 2b57aeb0ea616cfca8e6fcbd844960269af8c533 Author: Alan Coopersmith Date: Fri Feb 22 21:11:04 2013 -0800 Combine usage message into single string/call Signed-off-by: Alan Coopersmith commit a2485424bd0f184700dd0a4f0823fb4c4cf25f66 Author: Arnaud Fontaine Date: Thu Jun 7 19:33:28 2012 +0900 Fix program name in usage information, transset instead of transset-df. commit 49d17bde62694c2f0e2bb7883641bd60830c6bd5 Author: Arnaud Fontaine Date: Tue Jun 5 14:55:54 2012 +0900 transset 1.0.0 commit 5f23076c05c58e790eaffa66ed6b676f5f736555 Author: Arnaud Fontaine Date: Tue Jun 5 14:43:11 2012 +0900 Rename dpy to disp in function parameter to avoid shadowing dpy global declaration. commit 8cc91040c81e5e33e6422066763bcc231c778011 Author: Arnaud Fontaine Date: Tue Jun 5 14:29:19 2012 +0900 Add missing const keywords on Fatal_Error() and program_name to clear GCC warnings. commit ef2753866bf0b51a38484ae5a86562d5057fabab Author: Arnaud Fontaine Date: Tue Jun 5 14:27:02 2012 +0900 Add _X_ATTRIBUTE_PRINTF attribute to Fatal_Error() to clear GCC warning. commit bd4ca2af9f39e3282e319e6d31450e04b1b16e64 Author: Arnaud Fontaine Date: Tue Jun 5 14:26:08 2012 +0900 Add _X_NORETURN to Usage() to clear GCC warning. commit dcdc705fe7af9e834714219a618ddfd74b70294f Author: Arnaud Fontaine Date: Tue Jun 5 14:18:42 2012 +0900 Use _X_NORETURN from xproto 7.0.17 instead of checking __GNUC__. commit 051275fbad049b6b88da4350683aa391e9e8b94f Author: Arnaud Fontaine Date: Tue Jun 5 14:08:30 2012 +0900 Add autogen.sh to EXTRA_DIST. commit c70e20694b27928429715b964f32e0abc519cb19 Author: Arnaud Fontaine Date: Tue Jun 5 12:37:09 2012 +0900 Clear GCC warning (-Wmaybe-uninitialized). commit 7018537e9003a1fd311a5875d12f135b9057c184 Author: Arnaud Fontaine Date: Fri Feb 10 10:44:51 2012 +0900 Add copyright statement and update accordingly COPYING file. Reviewed-by: Gaetan Nadon commit 43fb446ddc881f089200ec0d732631d3d7a46544 Author: Arnaud Fontaine Date: Mon Jan 23 11:49:16 2012 +0900 Update README. commit cbc473428a71299255d11bfc1dcc7db6a9985eec Author: Gaetan Nadon Date: Fri Jan 20 15:00:14 2012 -0500 config: add dependency on xproto transSet.c includes Reviewed-by: Alan Coopersmith Signed-off-by: Gaetan Nadon commit 6c6df06a876eac0a2cf04e4c1020bd8590e3f87c Author: Gaetan Nadon Date: Fri Jan 20 14:47:42 2012 -0500 Remove XFree86 and IMakefile version control information in source code Signed-off-by: Gaetan Nadon commit ced0d07de735fc4f2fec47b64eeb8d6bd1cdf7ac Author: Gaetan Nadon Date: Fri Jan 20 14:37:58 2012 -0500 config: upgrade, comment and fix autoconf warnings In the same way other xorg modules have been. - minimum autoconf level is 2.60 - AC_CONFIG_HEADER (singular) is obsolete Signed-off-by: Gaetan Nadon commit 7ffbc93b24e3d9a27046d6c52501c0b81a32bd37 Author: Gaetan Nadon Date: Fri Jan 20 14:18:31 2012 -0500 make: remove $(LIBOBJS) dead code Starting at Autoconf 2.53, the use of LIBOBJS is an error. http://www.gnu.org/software/autoconf/manual/autoconf.html# AC_005fLIBOBJ-vs-LIBOBJS There are no system functions to override in this module. Signed-off-by: Gaetan Nadon commit 0530b5b6f17febd1f50234aa242b7c0a83ebbcd3 Author: Gaetan Nadon Date: Fri Jan 20 13:59:46 2012 -0500 man: normalize man page header/footer Do not hard coded man page section number. Signed-off-by: Gaetan Nadon commit 77b57c63393ad16588b1da1503640c3af9657e07 Author: Gaetan Nadon Date: Fri Jan 20 12:16:14 2012 -0500 man: use X.Org makefile which will also fix failing distcheck Signed-off-by: Gaetan Nadon commit 1dceb7139994565d1142b12938560c0650a636f4 Author: Gaetan Nadon Date: Fri Jan 20 11:48:32 2012 -0500 autogen.sh: use the X.Org version Signed-off-by: Gaetan Nadon commit 33c0e20c588fa87ac2b9f2f89267024a349727c3 Author: Gaetan Nadon Date: Fri Jan 20 11:39:27 2012 -0500 AUTHORS: remove empty file Not required when Automake is initialized with "foreign" keyword. It can be added with proper content anytime. Signed-off-by: Gaetan Nadon commit ad4179a465586d0f3d70adc2f0d2ca78a1dad84c Author: Arnaud Fontaine Date: Wed Dec 14 20:26:17 2011 +0900 Get rid of useless includes. commit d371dac4aeffa1ff782d5dd44479b42c3fe3a282 Author: Arnaud Fontaine Date: Wed Dec 14 20:06:22 2011 +0900 Use enum for selected method for readability sake. commit 79549aefac1c7babbcb54e270520caaee8982b15 Author: Arnaud Fontaine Date: Wed Dec 14 19:28:41 2011 +0900 Use Bool rather than int type for booleans. commit 84d26bdf9c96b51dccedd89b70095bae1b13fdd5 Author: Arnaud Fontaine Date: Wed Dec 14 19:24:55 2011 +0900 Fix GCC warning (-Wuninitialized). commit 7fe1a565a902798a8d69ea0c3f2c8c2e7055189c Author: Arnaud Fontaine Date: Wed Dec 14 19:09:16 2011 +0900 Close property the Display and fix error exit code value. commit 55597dda964d335e5f63892c1b37c36b90eeffb4 Author: Arnaud Fontaine Date: Wed Dec 14 19:05:31 2011 +0900 Remove useless malloc(). commit 3dbf96b34c732c74bc96abeb7d371579d20ce56f Author: Arnaud Fontaine Date: Wed Dec 14 19:04:57 2011 +0900 Free properly memory allocated by XQueryTree(). commit 8605d0178461b98099c5dee33b19eb8204487487 Author: Arnaud Fontaine Date: Sun Oct 30 20:33:40 2011 +0900 Fix coding style. commit e4d0f93a64dbb9b77ee6a32dcf85ce1b65449e9d Author: Arnaud Fontaine Date: Sun Oct 30 20:17:51 2011 +0900 Add missing static qualifiers. commit b2c269400d3138802831e583b5b42fd20846b0ce Author: Arnaud Fontaine Date: Sun Oct 30 20:12:22 2011 +0900 Fix GCC warning about old-style function definitions. commit f8a9c03bafc1a8c1981076cd31299d9a2096dfca Author: Arnaud Fontaine Date: Sun Oct 30 20:02:03 2011 +0900 Add INSTALL file. commit b042c46a6cb03284d3b8f4c9bc1f363b9c7a66e8 Author: Arnaud Fontaine Date: Sun Oct 30 17:26:49 2011 +0900 Add .gitignore. commit 2fe8dadbd42a17acff20a95e889fe6769d49a4ca Author: Arnaud Fontaine Date: Sun Oct 30 17:22:18 2011 +0900 Get rid of unused code from dsimple.c. commit 6da6193021802ba1455a953e6e21707e88f18985 Merge: 705d787 c63bf55 Author: Arnaud Fontaine Date: Sun Oct 30 16:47:08 2011 +0900 Merge branch 'transset-df' commit c63bf55e69fc50e08b9bf500e9b05cf36ce48680 Author: Arnaud Fontaine Date: Sun Oct 30 16:46:01 2011 +0900 2007-09-21 Daniel Forchheimer Release v6 * transSet.c Select flag: --actual Set transparency to the actual focused X11 window Thanks to Roman Divacky for the patch commit 88d9e28837f71f391402654c33394635d27d4b30 Author: Arnaud Fontaine Date: Sun Oct 30 16:45:00 2011 +0900 2006-01-10 Daniel Forchheimer Release v5 * transSet.c: Applied patch so that transset-df compiles with gcc 2.95 Thanks to Andreas Kohn for the patch commit 470ea5431ffe0a54995c93506ab5e55ce534e039 Author: Arnaud Fontaine Date: Sun Oct 30 16:43:09 2011 +0900 2005-03-13 Daniel Forchheimer Release v4 Bugfix: select by name or id didn't work in many windowmanagers like xfce and wmaker. * transSet.c: Function get_top_window() fixes the bug Options verbose, no-regex * dsimple.c: Window_With_Name_Regex() now takes same arguments as Window_With_Name() * Makefile: Added simple install instructions 2005-02-08 Daniel Forchheimer Select name now takes a regular expression Fixed all warnings * dsimple.c: Window_With_Name_Regex() * transSet.c: use the new regex function print the name (if possible) * dsimple.h: Added the new functions to avoid warnings commit 30300bf213557b99bcfd3d92587f6a96e9494124 Author: Arnaud Fontaine Date: Sun Oct 30 16:41:56 2011 +0900 2005-01-14 Daniel Forchheimer Release v3 * transSet.c: Select by name (-n, --name) Select by id (-i, --id) commit ed0236ce0b9fcdbd7e7874327c65610b3f13d47e Author: Arnaud Fontaine Date: Sun Oct 30 16:41:04 2011 +0900 2005-01-14 Daniel Forchheimer * transSet.c: Options increase/decrease Options maximum/minimum commit 55a5a8da9b0a2b997096319e8d990a70ee31ac94 Author: Arnaud Fontaine Date: Sun Oct 30 16:40:04 2011 +0900 2005-01-13 Daniel Forchheimer * transSet.c: (main): Forked transset-df of transset Added flags Added select without clicking Wrote usage * dsimple.c: Added function to select without clicking commit 705d787a5b35a8409c482526b5c2955aa5371b1e Author: Alan Coopersmith Date: Fri Oct 21 18:32:26 2011 -0700 Remove unneccessary configure steps Signed-off-by: Alan Coopersmith commit 6ceb665aeb5164bc5668786fc718dd0b0ba2a76c Author: Alan Coopersmith Date: Fri Oct 21 18:30:58 2011 -0700 Drop unnecessary dependencies Signed-off-by: Alan Coopersmith commit 0f8d2e6b1526de1558312c1b994318867d92f245 Author: Stuart Kreitman Date: Mon Nov 23 16:41:59 2009 -0800 Convert to autoconf/automake commit bb69f00c4876d80daf0c01706bbcc52dc30302d5 Author: Keith Packard Date: Tue Jan 20 20:03:02 2004 +0000 2004-01-20 Keith Packard * transSet.c: (main): Change property name to _NET_WM_WINDOW_OPACITY Report values as doubles. Delete property when opaque. commit 59e751294611cb043252e6b8180601ac71b17bcf Author: Keith Packard Date: Mon Nov 24 17:12:27 2003 +0000 Initial revision x11-apps-7.7+5+nmu1ubuntu1/transset/config.guess0000775000000000000000000012757212167023104016366 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-04-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif #else #include #ifdef __UCLIBC__ LIBC=uclibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) LIBC=gnu test -r /lib/libc.so && od -An -S13 /lib/libc.so | grep -q __uClibc_main && LIBC=uclibc echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/transset/dsimple.h0000664000000000000000000000507612167023104015646 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Just_display.h: This file contains the definitions needed to use the * functions in just_display.c. It also declares the global * variables dpy, screen, and program_name which are needed to * use just_display.c. * * Written by Mark Lillibridge. Last updated 7/1/87 * * Send bugs, etc. to chariot@athena.mit.edu. */ #include extern const char *program_name; /* Name of this program */ extern Display *dpy; /* The current display */ extern int screen; /* The current screen */ #define INIT_NAME program_name=argv[0] /* use this in main to setup program_name */ void Setup_Display_And_Screen (int *, char **); void Usage (void) _X_NORETURN; #define X_USAGE "[host:display]" /* X arguments handled by Get_Display_Name */ /* * Other_stuff.h: Definitions of routines in other_stuff. * * Written by Mark Lillibridge. Last updated 7/1/87 * * Send bugs, etc. to chariot@athena.mit.edu. */ Window Select_Window (Display *); Window Get_Window_Under_Cursor (Display *); /*added by Daniel Forchheimer for transset-df*/ Window Window_With_Name (Display *, Window, char *); Window Window_With_Name_Regex (Display *, Window, char *); /*added by Daniel Forchheimer for transset-df*/ void Fatal_Error (const char *, ...) _X_NORETURN _X_ATTRIBUTE_PRINTF(1,2); x11-apps-7.7+5+nmu1ubuntu1/transset/autogen.sh0000775000000000000000000000030412167023104016026 0ustar #! /bin/sh srcdir=`dirname $0` test -z "$srcdir" && srcdir=. ORIGDIR=`pwd` cd $srcdir autoreconf -v --install || exit 1 cd $ORIGDIR || exit $? $srcdir/configure --enable-maintainer-mode "$@" x11-apps-7.7+5+nmu1ubuntu1/transset/transSet.c0000664000000000000000000002474712167023104016015 0ustar /* Copyright © 2003-2004 Matthew Hawn * Copyright © 2003-2004 Andreas Kohn * Copyright © 2003-2004 Roman Divacky * Copyright © 2003-2004 Keith Packard * Copyright © 2005-2007 Daniel Forchheimer * Copyright © 2011-2012 Arnaud Fontaine * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #define VERSIONSTR "6" #include #include #include #include "dsimple.h" #include #include #include #include Window target_win; /* needed by dsimple.c */ void Usage (void) { fputs ("usage: transset [-options ...] [opacity]\n" "options:\n" " -h, --help display this message\n" " -t, --toggle force toggle of opacity\n" " -c, --click select by clicking on window (default)\n" " -p, --point select the window currently under the cursor\n" " -a, --actual select the actual window\n" " -n, --name NAME select by name, NAME is matched as regular expression\n" " --no-regex don't use regular expression for matching name\n" " -i, --id select by window id\n" " --inc increase by the given opacity\n" " --dec decrease by given opacity\n" " -m, --min OPACITY minimum possible opacity (default = 0)\n" " -x, --max OPACITY maximum possible opacity (default = 1)\n" " -v, --verbose print some debug info\n" " -V, --version print version number\n", stderr); exit (1); } #define OPAQUE 0xffffffff #define OPACITY "_NET_WM_WINDOW_OPACITY" /* returns the highest parent of child that is not the root-window */ static Window Get_Top_Window (Display *disp, Window child) { Window parent; Window root; Window *child_list; unsigned int num_children; if (!XQueryTree (disp, child, &root, &parent, &child_list, &num_children)) Fatal_Error ("Can't query window tree."); XFree ((void *) child_list); if (parent == root) return child; while (parent != root) { child = parent; if (!XQueryTree (disp, child, &root, &parent, &child_list, &num_children)) Fatal_Error ("Can't query window tree."); XFree ((void *) child_list); } return child; } static Window Get_Actual_Window (Display *disp) { int i; Window w; XGetInputFocus (disp, &w, &i); return Get_Top_Window (disp, w); } typedef enum { SELECT_METHOD_CLICK = 0, SELECT_METHOD_WINDOW_UNDER_CURSOR = 1, SELECT_METHOD_WINDOW_ID = 2, SELECT_METHOD_WINDOW_NAME = 3, SELECT_METHOD_FOCUSED_WINDOW = 4 } select_method_t; int main (int argc, char **argv) { Bool gotd = False; double d = 0.75; unsigned int opacity; unsigned int current_opacity; select_method_t select_method = SELECT_METHOD_CLICK; Bool flag_toggle = False; Bool flag_increase = False; Bool flag_decrease = False; Bool flag_verbose = False; Bool flag_no_regex = False; int o; double min = 0.0, max = 1.0; char *idstr = NULL, *namestr = NULL; char *windowname = NULL; int options_index = 0; static struct option long_options[] = { {"toggle", 0, NULL, 't'}, {"help", 0, NULL, 'h'}, {"point", 0, NULL, 'p'}, {"actual", 0, NULL, 'a'}, {"click", 0, NULL, 'c'}, {"id", 1, NULL, 'i'}, {"name", 1, NULL, 'n'}, {"inc", 0, NULL, '1'}, {"dec", 0, NULL, '2'}, {"min", 1, NULL, 'm'}, {"max", 1, NULL, 'x'}, {"no-regex", 0, NULL, '4'}, {"version", 0, NULL, 'V'}, {"verbose", 0, NULL, 'v'}, {0, 0, 0, 0} }; unsigned char *data; Atom actual; int format; unsigned long n, left; /* wonderful utility */ Setup_Display_And_Screen (&argc, argv); /* parse arguments */ while ((o = getopt_long (argc, argv, "thapci:n:vVm:x:123", long_options, &options_index)) != -1) { switch (o) { case 't': flag_toggle = True; break; case 'h': Usage (); break; case 'c': select_method = SELECT_METHOD_CLICK; break; case 'p': select_method = SELECT_METHOD_WINDOW_UNDER_CURSOR; break; case 'i': idstr = optarg; select_method = SELECT_METHOD_WINDOW_ID; break; case 'n': namestr = optarg; select_method = SELECT_METHOD_WINDOW_NAME; break; case 'a': select_method = SELECT_METHOD_FOCUSED_WINDOW; break; case '1': flag_increase = True; break; case '2': flag_decrease = True; break; case 'v': flag_verbose = True; break; case '4': flag_no_regex = True; break; case 'm': min = atof (optarg); break; case 'x': max = atof (optarg); break; case 'V': fprintf (stderr, "%s\nversion: %s\nreleased: %s\n", PACKAGE_STRING, VERSIONSTR, RELEASE_DATE); exit (1); break; default: Usage (); } } if (optind < argc) { d = atof (argv[optind]); gotd = True; } /* select the window to make transparent */ switch (select_method) { case SELECT_METHOD_WINDOW_UNDER_CURSOR: /* don't wait for click */ if (flag_verbose) printf ("Selecting window by click\n"); target_win = Get_Window_Under_Cursor (dpy); break; case SELECT_METHOD_WINDOW_ID: /* pretty much ripped from dsimple.c */ if (flag_verbose) printf ("Selecting window by id\n"); sscanf (idstr, "0x%lx", &target_win); if (!target_win) sscanf (idstr, "%ld", &target_win); if (!target_win) { fprintf (stderr, "Invalid window id format: %s.\n", idstr); XCloseDisplay (dpy); return 1; } if (flag_verbose) printf ("Selected 0x%x, trying to get top parent ... ", (unsigned int) target_win); target_win = Get_Top_Window (dpy, target_win); if (flag_verbose) printf ("found 0x%x\n", (unsigned int) target_win); break; case SELECT_METHOD_WINDOW_NAME: /* select by name, pretty much ripped from dsimple.c */ if (flag_verbose) printf ("Selecting window by name\n"); if (flag_no_regex) target_win = Window_With_Name (dpy, RootWindow (dpy, screen), namestr); else target_win = Window_With_Name_Regex (dpy, RootWindow (dpy, screen), namestr); if (!target_win) { fprintf (stderr, "No window matching %s exists!\n", namestr); XCloseDisplay (dpy); return 1; } /* store the matched window name*/ XFetchName (dpy, target_win, &windowname); if (flag_verbose) printf ("Selected 0x%x, trying to get top parent ... ", (unsigned int) target_win); target_win = Get_Top_Window (dpy, target_win); if (flag_verbose) printf ("found 0x%x\n", (unsigned int) target_win); break; case SELECT_METHOD_FOCUSED_WINDOW: target_win = Get_Actual_Window (dpy); break; default: /* grab mouse and return window that is next clicked */ target_win = Select_Window (dpy); break; } /* get property */ XGetWindowProperty (dpy, target_win, XInternAtom (dpy, OPACITY, False), 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left, (unsigned char **) &data); if (data != None) { memcpy (¤t_opacity, data, sizeof (unsigned int)); XFree ((void *) data); if (flag_verbose) printf ("Found transparency: %g\n", (double) current_opacity / OPAQUE); } else current_opacity = OPAQUE; if (flag_increase) d = (double) current_opacity / OPAQUE + d; else if (flag_decrease) d = (double) current_opacity / OPAQUE - d; /* check min and max */ if (d < min) d = min; if (d > max) d = max; opacity = (unsigned int) (d * OPAQUE); /* for user-compatibility with transset */ if (!gotd) flag_toggle = True; /* toggle */ if (flag_toggle) if (current_opacity != OPAQUE) opacity = OPAQUE; if (opacity == OPAQUE) XDeleteProperty (dpy, target_win, XInternAtom (dpy, OPACITY, False)); /* set it */ else XChangeProperty (dpy, target_win, XInternAtom (dpy, OPACITY, False), XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &opacity, 1L); XSync (dpy, False); printf ("Set Property to %g", (double) opacity / OPAQUE); if (windowname) printf (" on \n%s\n", windowname); else printf ("\n"); if (flag_verbose) printf ("Property set on: 0x%x\n", (unsigned int) target_win); XCloseDisplay (dpy); return 0; } x11-apps-7.7+5+nmu1ubuntu1/transset/config.h.in0000664000000000000000000000324012656634613016072 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Release date of this package */ #undef RELEASE_DATE /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION x11-apps-7.7+5+nmu1ubuntu1/transset/man/0000775000000000000000000000000012656635743014630 5ustar x11-apps-7.7+5+nmu1ubuntu1/transset/man/transset.man0000664000000000000000000000777212167023104017160 0ustar .\" Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. .\" .\" Permission is hereby granted, free of charge, to any person obtaining a .\" copy of this software and associated documentation files (the "Software"), .\" to deal in the Software without restriction, including without limitation .\" the rights to use, copy, modify, merge, publish, distribute, sublicense, .\" and/or sell copies of the Software, and to permit persons to whom the .\" Software is furnished to do so, subject to the following conditions: .\" .\" The above copyright notice and this permission notice (including the next .\" paragraph) shall be included in all copies or substantial portions of the .\" Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR .\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, .\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL .\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER .\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING .\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER .\" DEALINGS IN THE SOFTWARE. .\" .ds q \N'34' .TH TRANSSET __appmansuffix__ __xorgversion__ .SH NAME transset \- Set transparency on a window .SH SYNOPSIS .B transset [\fI-options ...\fP] [\fIopacity\fP] .SH DESCRIPTION .B transset is a simple program for X servers supporting the XFIXES, DAMAGE, and COMPOSITE extensions. It lets the user set the transparency on a window. .PP The \fIopacity\fP value is a number from 0 to 1, with zero being fully transparent and 1 being fully opaque. If no \fIopacity\fP argument is given, a default value of 0.75 is used for the opacity value. If neither \fB--inc\fP nor \fB--dec\fP are given, the opacity is treated as an absolute value and set to the given opacity value. If \fB--inc\fP or \fB--dec\fP is specified, then the opacity is treated as a relative value to increase or decrease the current opacity by. .SH OPTIONS .PP .TP 8 .B -display \fIdisplay\fP This option specifies the server to use; see \fIX(__miscmansuffix__)\fP. .PP .TP 8 .BR -h ", " --help This option displays a help message and exits. .PP .TP 8 .BR -t ", " --toggle This option forces a toggle of opacity. If the current opacity is not set to fully opaque (opacity 1.0), it will be reset to fully opaque. If the window is already fully opaque, the opacity will be set normally. .PP .TP 8 .BR -c ", " --click This option selects the target window by waiting for the user to click the mouse - the topmost window under the mouse cursor when the mouse click occurs will be used as the target. .PP .TP 8 .BR -p ", " --point This option selects the window currently under the cursor to be the target. .PP .TP 8 .BR -a ", " --actual This option selects the window that currently has input focus to be the target. .PP .TP 8 .BR -n ", " --name " \fIname\fP" This option selects the target window by name, where \fIname\fP is matched as a regular expression, unless \fB--no-regex\fP is also specified. .PP .TP 8 .B --no-regex This option disables treating the \fIname\fP argument to \fB--name\fP as a regular expression. .PP .TP 8 .BR -i ", " --id This option selects the target window by window id. .PP .TP 8 .B --inc This option increases the window opacity by the given \fIopacity\fP argument. .PP .TP 8 .B --dec This option decreases the window opacity by the given \fIopacity\fP argument. .PP .TP 8 .BR -m ", " --min " \fIopacity\fP" This option sets the minimum possible opacity value. It defaults to 0 if this option is not given. .PP .TP 8 .BR -x ", " --max " \fIopacity\fP" This option sets the maximum possible opacity value. It defaults to 1 if this option is not given. .PP .TP 8 .BR -v ", " --verbose This option prints some additional debug info as the program operates. .PP .TP 8 .BR -V ", " --version This option prints the program version number and exits. .SH BUGS Probably. Please report any you find to https://bugs.freedesktop.org/enter_bug.cgi?product=xorg. .SH AUTHORS Matthew Hawn x11-apps-7.7+5+nmu1ubuntu1/transset/man/Makefile.am0000664000000000000000000000052612167023104016642 0ustar appmandir = $(APP_MAN_DIR) appman_PRE = transset.man appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) EXTRA_DIST = $(appman_PRE) CLEANFILES = $(appman_DATA) SUFFIXES = .$(APP_MAN_SUFFIX) .man # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(APP_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ x11-apps-7.7+5+nmu1ubuntu1/transset/config.sub0000775000000000000000000010530112167023104016013 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-04-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/transset/Makefile.am0000664000000000000000000000053512167023104016067 0ustar SUBDIRS = man EXTRA_DIST = autogen.sh bin_PROGRAMS = transset AM_CFLAGS = $(CWARNFLAGS) $(TRANSSET_CFLAGS) transset_LDADD = $(TRANSSET_LIBS) transset_SOURCES = transSet.c dsimple.c dsimple.h MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/transset/dsimple.c0000664000000000000000000002311412167023104015632 0ustar /* $Xorg: dsimple.c,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ */ /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #include #include #include #include #include #include #include /* * Other_stuff.h: Definitions of routines in other_stuff. * * Written by Mark Lillibridge. Last updated 7/1/87 */ #include "dsimple.h" /* * Just_display: A group of routines designed to make the writing of simple * X11 applications which open a display but do not open * any windows much faster and easier. Unless a routine says * otherwise, it may be assumed to require program_name, dpy, * and screen already defined on entry. * * Written by Mark Lillibridge. Last updated 7/1/87 */ /* This stuff is defined in the calling program by just_display.h */ const char *program_name = "unknown_program"; Display *dpy; int screen; /* * Get_Display_Name (argc, argv) Look for -display, -d, or host:dpy (obselete) * If found, remove it from command line. Don't go past a lone -. */ static char * Get_Display_Name (int *pargc, char **argv) { int argc = *pargc; char **pargv = argv + 1; char *displayname = NULL; int i; for (i = 1; i < argc; i++) { char *arg = argv[i]; if (!strcmp (arg, "-display") || !strcmp (arg, "-d")) { if (++i >= argc) Usage (); displayname = argv[i]; *pargc -= 2; continue; } if (!strcmp (arg, "-")) { while (i 0) /* there may have been some down before we started */ buttons--; break; } } XUngrabPointer (disp, CurrentTime); /* Done with pointer */ return (target_win); } /* * Routine that returns the window currently under the cursor * Added by Daniel Forchheimer. Last updated 19/12/04 */ Window Get_Window_Under_Cursor (Display *disp) { int status; Cursor cursor; //XEvent event; Window target_win = None, root = RootWindow (disp, screen); //int buttons = 0; Window tmp; int rx, ry, cx, cy; unsigned int mask; /* Make the target cursor */ cursor = XCreateFontCursor (disp, XC_crosshair); /* Grab the pointer using target cursor, letting it room all over */ status = XGrabPointer (disp, root, False, ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, root, cursor, CurrentTime); if (status != GrabSuccess) Fatal_Error ("Can't grab the mouse."); /* get the window under the cursor */ XQueryPointer (disp, root, &tmp, &target_win, &rx, &ry, &cx, &cy, &mask); XUngrabPointer (disp, CurrentTime); /* Done with pointer */ return (target_win); } /* * Window_With_Name: routine to locate a window with a given name on a display. * If no window with the given name is found, 0 is returned. * If more than one window has the given name, the first * one found will be returned. Only top and its subwindows * are looked at. Normally, top should be the RootWindow. */ Window Window_With_Name (Display *disp, Window top, char *name) { Window *children, dummy; unsigned int nchildren; int i; Window w = 0; char *window_name; if (XFetchName (disp, top, &window_name) && !strcmp (window_name, name)) return (top); if (!XQueryTree (disp, top, &dummy, &dummy, &children, &nchildren)) return (0); for (i = 0; i < nchildren; i++) { w = Window_With_Name (disp, children[i], name); if (w) break; } if (children) XFree ((char *) children); return (w); } /* * Window_With_Name_Regex: Same as above but use regular expressions * to match a window name. Only returns the first * result. * Window_With_Name_Regex_Recurse: Takes regex_t struct as argument instead of char* * Written by Daniel Forchheimer 2005 * */ static Window Window_With_Name_Regex_Recurse (Display *disp, Window top, regex_t *reg_name) { Window *children, dummy; unsigned int nchildren; int i; Window w = 0; char *window_name; if (XFetchName (disp, top, &window_name) && !regexec (reg_name, window_name, 0, NULL, 0)) return (top); if (!XQueryTree (disp, top, &dummy, &dummy, &children, &nchildren)) return (0); for (i = 0; i < nchildren; i++) { w = Window_With_Name_Regex_Recurse (disp, children[i], reg_name); if (w) break; } if (children) XFree ((char *) children); return (w); } /* prepare the reg-exp for use with above function */ Window Window_With_Name_Regex (Display *disp, Window top, char *name) { int err_no = 0; regex_t *regexp_name; Window target_win; regexp_name = (regex_t *) malloc (sizeof (regex_t)); if ((err_no = regcomp (regexp_name, name, 0)) != 0) { size_t length; char *buffer; length = regerror (err_no, regexp_name, NULL, 0); buffer = malloc (length); regerror (err_no, regexp_name, buffer, length); fprintf (stderr, "%s\n", buffer); free (buffer); regfree (regexp_name); exit (1); } target_win = Window_With_Name_Regex_Recurse (disp, RootWindow (disp, screen), regexp_name); regfree (regexp_name); free (regexp_name); return target_win; } x11-apps-7.7+5+nmu1ubuntu1/transset/configure.ac0000664000000000000000000000151512167023104016320 0ustar # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([transset], [1.0.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [transset]) RELEASE_DATE="2013-05-17" AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Require xorg-macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS # Obtain compiler/linker options for the transset dependencies PKG_CHECK_MODULES(TRANSSET, x11 xproto >= 7.0.17) AC_DEFINE_UNQUOTED(RELEASE_DATE, ["$RELEASE_DATE"], [Release date of this package]) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/transset/README0000664000000000000000000000156312167023104014715 0ustar transset is an utility for setting opacity property. Features: * select window by clicking (as transset) * select actual focused X11 window * select window by pointing * select by window name or id * force toggle * increase or decrease opacity All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/transset http://cgit.freedesktop.org/xorg/app/transset For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/transset/COPYING0000664000000000000000000000456412167023104015074 0ustar Copyright © 2003-2004 Matthew Hawn Copyright © 2003-2004 Andreas Kohn Copyright © 2003-2004 Roman Divacky Copyright © 2003-2004 Keith Packard Copyright © 2005-2007 Daniel Forchheimer Copyright © 2011-2012 Arnaud Fontaine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. x11-apps-7.7+5+nmu1ubuntu1/transset/INSTALL0000664000000000000000000002622212167023104015065 0ustar Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 6. Often, you can also type `make uninstall' to remove the installed files again. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *Note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xgc/0000775000000000000000000000000012656635743012773 5ustar x11-apps-7.7+5+nmu1ubuntu1/xgc/Bugs0000664000000000000000000000072112514123556013601 0ustar Bugs found with xbench ---------------------- Lines, FillStyle Solid, Planemask 0, LineWidth 0 - draws lines anyways. other FillStyles work correctly. Rectangles - same problem. Filled Rectangles, FillStyle other than OpaqueStippled, Planemask 0 - draws rectangles anyways. OpaqueStippled works fine. Dashed Lines - sometimes hangs. only happens when lots of lines/short dashes/long lines. Lines, Function equiv, LineWidth > 1 - copies instead of equiving. x11-apps-7.7+5+nmu1ubuntu1/xgc/Written/0000775000000000000000000000000012520517024014404 5ustar x11-apps-7.7+5+nmu1ubuntu1/xgc/Written/Jim0000664000000000000000000002423212514123556015057 0ustar The Commands menu should contain the following items: Run [the selected benchmark] Benchmark Options.../Hide Benchmark Options [toggle] Graphics Options.../Hide Graphics Options [toggle] Describe Test.../Hide Test Description [toggle] Start Recording/Stop Recording [toggle] Playback [pop up a dialogue box asking for filename] -------- Quit [pop up a dialogue box asking if we are really done] The Benchmark Options sheet should contain the information shown below. The list of graphics primitives was derived from the "Definition of the Porting Layer for the X v11 Sample Server" by Angebranndt et al. and from the Protocol document. Benchmark Options +-----------------------+-----------------------+ Test | Copy Area | Copy Plane | +-----------------------+-----------------------+ | Points | Lines | +-----------------------+-----------------------+ | Segments | Rectangles | +-----------------------+-----------------------+ | Arcs | Filled Polygons | +-----------------------+-----------------------+ | Filled Rectangles | Filled Arcs | +-----------------------+-----------------------+ | Put Image | Get Image | +-----------------------+-----------------------+ | Text 8 | Image Text 8 | +-----------------------+-----------------------+ | Text 16 | Image Text 16 | +-----------------------+-----------------------+ +---------+ Iterations | 10000 | +---------+ +----+-----+ +----+-----+ Record | on | off | Describe Test | on | off | +----+-----+ +----+-----+ +-----------------------------------------------+ Filename | ./xbench.log | +-----------------------------------------------+ ******************************************************************************* The Graphics Options area would contain the following entries: Function - one-of { clear, and, andReverse, copy, andInverted, noop, xor, or, nor, equiv, invert, orReverse, copyInverted, orInverted, nand, set } PlaneMask - unsigned value or many-of-n representing bits Foreground - unsigned value in range 0..2^nplanes Background - unsigned value in range 0..2^nplanes ForegroundColor - set rgb value of Foreground BackgroundColor - set rgb value of background LineWidth - unsigned number in range 0..65535 LineStyle - oneof { Solid, OnOffDash, DoubleDash } CapStyle - one-of { NotLast, Butt, Round, Projecting } JoinStyle - one-of { Miter, Round, Bevel } FillStyle - one-of { Solid, Tiled, OpaqueStippled, Stippled } FillRule - one-of { EvenOdd, Winding } ArcMode - one-of { Chord, PieSlice } # Tile - pixmap [probably not edittable in first version] # Stipple - pixmap [probably not edittable in first version] TileStipXOrigin - signed number in range -32768..32767 TileStipYOrigin - signed number in range -32768..32767 Font - name of font ClipXOrigin - signed number in range -32768..32767 ClipYOrigin - signed number in range -32768..32767 ClipMask - one-of { None, select } [user selects by clicking in work area] DashOffset - unsigned number in range -32768..32767 DashList - many-of-n of 8 boxes for defining dashes Graphics Options +--------------+--------------+--------------+--------------+ Function | clear | and | andReverse | copy | +--------------+--------------+--------------+--------------+ | andInverted | noop | xor | or | +--------------+--------------+--------------+--------------+ | nor | equiv | invert | orReverse | +--------------+--------------+--------------+--------------+ | copyInverted | orInverted | nand | set | +--------------+--------------+--------------+--------------+ +-----+---------+ Colormap | new | default | +-----+---------+ +----------+ +--------+--------+--------+ Foreground | 1 | ForegroundColor | ffff | ffff | ffff | +----------+ +--------+--------+--------+ +----------+ +--------+--------+--------+ Background | 0 | BackgroundColor | 0000 | 0000 | 0000 | +----------+ +--------+--------+--------+ +------+ +-------+-----------+------------+ LineWidth | 3 | LineStyle | Solid | OnOffDash | DoubleDash | +------+ +-------+-----------+------------+ +---------+------+-------+------------+ CapStyle | NotLast | Butt | Round | Projecting | +---------+------+-------+------------+ +-------+-------+-------+ JoinStyle | Miter | Round | Bevel | +-------+-------+-------+ +-------+-------+----------+----------------+ FillStyle | Solid | Tiled | Stippled | OpaqueStippled | +-------+-------+----------+----------------+ +---------+---------+ FillRule | EvenOdd | Winding | +---------+---------+ +-------+----------+ ArcMode | Chord | PieSlice | +-------+----------+ +--------------+ TStipOrigin | +####, +#### | +--------------+ +-+-+-+-+-+-+-+-+ +-------+ DashList | | |X|X| | |X|X| DashOffset | +#### | +-+-+-+-+-+-+-+-+ +-------+ +----+-----+-----+-------+ +--------+ ClipMask | on | off | set | clear | PlaneMask | ffff | +----+-----+-----+-------+ +--------+ ******************************************************************************* Grammar Both to support Record/Playback (used for debugging, demonstrations, and for creating benchmark scripts), there needs to be a command line language that can be used to set all options. Although we won't be doing anything as sophisticated as what is provided in many UIMS's, it would be nice to keep the application section of the benchmark as separate as possible from the user interface. test { CopyArea, CopyPlane, PolyPoint, PolyLine, PolySegment, PolyRectangle, PolyArc, FillPolygon, PolyFillRect, PolyFillArc, PutImage, GetImage, ImageText8, PolyText8, ImageText16, PolyText16 } - selects the test to be performed. colormap { new, default } - selects which colormap should be used for test iterations UNSIGNEDNUMBER - specifies the number of times that the test should be run. record BOOLEAN - indicates whether or not to record commands into the record-file. record-file FILENAME - specifies the name of the file into which commands are recorded. describe BOOLEAN - indicates whether or not a description of the test should be displayed whenever a test is selected (or when this option is specified). function { clear, and, andReverse, copy, andInverted, noop, xor, or, nor, equiv, invert, orReverse, copyInverted, orInverted, nand, set } - selects the alu function to use in the GC. foreground UNSIGNEDNUMBER - selects the foreground pixel value to use in the GC; if a new colormap is being used, the RGB value for this slot may be changed. background UNSIGNEDNUMBER - selects the background pixel value to use in the GC; if a new colormap is being used, the RGB value for this slot may be changed. forecolor COLORNAME - specifies the RGB value or name of the color to be used for the foreground pixel, if settable. backcolor COLORNAME - specifies the RGB value or name of the color to be used for the background pixel, if settable. linewidth NUMBER - specifies width of lines to use in the GC. linestyle { Solid, OnOffDash, DoubleDash } - selects the type of lines to use in the GC. capstyle { NotLast, Butt, Round, Projecting } - selects the type of caps to use in the GC. joinstyle { Miter, Round, Bevel } - selects the type of joins to use in the GC. fillstyle { Solid, Tiled, Stippled, OpaqueStippled } - selects the type of fills to use in the GC. fillrule { EvenOdd, Winding } - selects the fill rule to be used in the GC. arcmode { Chord, PieSlice } - selects the type of arcs to be drawn in the GC. tsorigin NUMBER NUMBER - specifies the X and Y values of the TileStippleOrigin in the GC. dashlist DASHPATTERN - specifies a pattern of 8 binary digits to use in the dashlist in the GC; the characters are given in big-endian order such that they may be read in binary to form a number between 0 and 255. dashoffset NUMBER - specifies the dashoffset to use in the GC. cliporigin NUMBER NUMBER - specifies the X and Y values of the cliporigin in the GC. clipmask { on, off, set NUMBER NUMBER NUMBER NUMBER, clear } - selects a clipping mode. If "on", then use the most recently defined set of clipping rectangles; if "off", then do not do any clipping but keep the clipping rectangles for future reference; if "set", then add the rectangle specified by the remaining numeric arguments as X1 Y1 X2 Y2 relative to the cliporigin. planemask NUMBER - specifies the set of planes on to which graphics may be drawn in the GC. run - run the currently configured test. quit - exit the program x11-apps-7.7+5+nmu1ubuntu1/xgc/Written/Notes0000664000000000000000000001222212514123556015424 0ustar ClearArea --------- Basically a special case of PolyFillRect. Put up some sort of image first so we can clear it away. Try both small areas and big areas, to give credit to servers for optimizing small ones. Data: Pixels per second. Breaking that down into large and small areas would probably not be userful. GC Fields: None. CopyArea -------- Putting up some image and then repeatedly copying from one part of it to another would do the right thing and could look neat if done right. We probably want to see what happens when the source area is clipped, as that as mentioned specifically in the protocol document. Data: Pixels per second. GC Fields: function (*) plane-mask subwindow-mode graphics-exposures clip-x-origin clip-y-origin clip-mask CopyPlane --------- Special case of CopyArea again. PolyPoint --------- Draw lots of points. Either start out with an image that's 50/50 black and white (preferred) or draw enough points that some points will get drawn at least twice (to test functions other than copy). Data: Points per second. GC fields: function (*) plane-mask foreground subwindow-mode clip-x-origin clip-y-origin clip-mask PolyLine -------- Circular test like there is now. Try clipping at window boundaries? Data: Lines per second. Pixels per second (is this valid - do lines that are twice as long take twice as long to draw? Also, is it valid to compare thin lines and fat lines?) GC fields: function (*) plane-mask line-width (*) line-style (*) cap-style (*) join-style (*) fill-style (*) subwindow-mode clip-x-origin clip-y-origin clip-mask Possibly foreground background tile (*) stipple (*) tile-stipple-x-origin tile-stipple-y-origin dash-offset dashes (*) PolySegment ----------- Just like PolyLine but lines don't have to be connected. Crosshatching? Data: Lines per second, pixels per second(?) GC fields: function plane-mask line-width line-style cap-style fill-style subwindow-mode clip-x-origin clip-y-origin clip-mask Possibly foreground background tile stipple tile-stipple-x-origin tile-stipple-y-origin dash-offset dashes PolyRectangle ------------- Lots of five point PolyLines. Partly concentric ones would look nice; we also need overlap for testing different functions. Data: Rectangles per second. Pixels per second? (divide by perimeter) GC fields: function plane-mask line-width line-style join-style fill-style subwindow-mode clip-x-origin clip-y-origin clip-mask Possibly foreground background tile stipple tile-stipple-x-origin tile-stipple-y-origin dash-offset dashes PolyArc ------- Overlapping concentric things (ripples) would look cool. Is it possible to special-case circles? Test for this? Data: Arcs per second? If we had the same test each time this might be OK. Pixels per second? Finding the length of an arc could be annoying. GC fields: function plane-mask line-width line-style cap-style join-style fill-style subwindow-mode clip-x-origin clip-y-origin clip-mask Possibly foreground background tile stipple tile-stipple-x-origin tile-stipple-y-origin dash-offset dashes FillPoly -------- Use the same test as PolyLine? Overlapping is a must to test functions. Convex vs. Concave polygons. Data: Pixels per second, I guess. Data for convex vs. concave could be interesting. GC fields: function plane-mask fill-style fill-rule subwindow-mode clip-x-origin clip-y-origin clip-mask Possibly foreground background tile stipple tile-stipple-x-origin tile-stipple-y-origin PolyFillRectangle ----------------- Use same test as PolyRectangle? Perhaps give FillPoly some of these too, see if it special cases them. Fill Rectangle vs. Fill Poly for same size areas would be an interesting comparison. Data: Pixels per second. GC fields: function plane-mask fill-style subwindow-mode clip-x-origin clip-y-origin clip-mask Possibly foreground background tile stipple tile-stipple-x-origin tile-stipple-y-origin PolyFillArc ----------- Use same test as PolyArc? Data: Pixels per second would be hard to compute, but what else is there? GC fields: function plane-mask fill-style arc-mode subwindow-mode clip-x-origin clip-y-origin clip-mask Possibly foreground background tile stipple tile-stipple-x-origin tile-stipple-y-origin PutImage -------- GC fields: function plane-mask subwindow-mode clip-x-origin clip-y-origin clip-mask Possibly foreground background GetImage -------- PolyText8 --------- GC fields: function plane-mask fill-style font subwindow-mode clip-x-origin clip-y-origin clip-mask Possibly foreground background tile stipple tile-stipple-x-origin tile-stipple-y-origin PolyText16 ---------- ImageText8 ---------- GC fields: plane-mask foreground background font subwindow-mode clip-x-origin clip-y-origin clip-mask ImageText16 --------- x11-apps-7.7+5+nmu1ubuntu1/xgc/Written/Interface0000664000000000000000000000043012514123556016232 0ustar The command buttons at the top - Benchmark Options, Graphics Options, etc. should just bring up the window, not force you to use it. 1) It is nicer to the person who might want to have both up at once. 2) It is nicer to the programmer who doesn't know how to focus events. x11-apps-7.7+5+nmu1ubuntu1/xgc/Written/Notes20000664000000000000000000001012312514123556015504 0ustar C |C |C |P |P |P |P |P |F |P |P |P |G |P |P |I |I | l |o |o |o |o |o |o |o |i |o |o |u |e |o |o |m |m | e |p |p |l |l |l |l |l |l |l |l |t |t |l |l |a |a | a |y |y |y |y |y |y |y |l |y |y |I |I |y |y |g |g | r |A |P |P |L |S |R |A |P |F |F |m |m |T |T |e |e | A |r |l |o |i |e |e |r |o |i |i |a |a |e |e |T |T | r |e |a |i |n |g |c |c |l |l |l |g |g |x |x |e |e | e |a |n |n |e |m |t | |y |l |l |e |e |t |t |x |x | a | |e |t | |e |a | | |R |A | | |8 |1 |t |t | | | | | |n |n | | |e |r | | | |6 |8 |1 | | | | | |t |g | | |c |c | | | | | |6 | | | | | | |l | | |t | | | | | | | | | | | | | |e | | |a | | | | | | | | | | | | | | | | |n | | | | | | | | | | | | | | | | |g | | | | | | | | | | | | | | | | |l | | | | | | | | | | | | | | | | |e | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ function |XX| |XX|XX|XX|XX|XX|XX|XX|XX|XX| |XX|XX| | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ plane_mask |XX| |XX|XX|XX|XX|XX|XX|XX|XX|XX| |XX|XX|XX|XX| ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ foreground | | |XX|**|**|**|**|**|**|**|**| |**|**|XX|XX| ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ background | | | |**|**|**|**|**|**|**|**| |**|**|XX|XX| ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ line_width | | | |XX|XX|XX|XX| | | | | | | | | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ line_style | | | |XX|XX|XX|XX| | | | | | | | | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ cap_style | | | |XX|XX| |XX| | | | | | | | | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ join_style | | | |XX| |XX|XX| | | | | | | | | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ fill_style | | | |XX|XX|XX|XX|XX|XX|XX| | |XX|XX| | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ fill_rule | | | | | | | |XX| | | | | | | | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ arc_mode | | | | | | | | | |XX| | | | | | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ tile | | | |**|**|**|**|**|**|**| | |**|**| | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ stipple | | | |**|**|**|**|**|**|**| | |**|**| | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ ts_x_origin | | | |**|**|**|**|**|**|**| | |**|**| | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ ts_y_origin | | | |**|**|**|**|**|**|**| | |**|**| | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ font | | | | | | | | | | | | |XX|XX|XX|XX| ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ subwindow_mode |XX| |XX|XX|XX|XX|XX|XX|XX|XX|XX| |XX|XX|XX|XX| ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ exposures |XX| | | | | | | | | | | | | | | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ clip_x_origin |XX| |XX|XX|XX|XX|XX|XX|XX|XX|XX| |XX|XX|XX|XX| ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ clip_y_origin |XX| |XX|XX|XX|XX|XX|XX|XX|XX|XX| |XX|XX|XX|XX| ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ clip_mask |XX| |XX|XX|XX|XX|XX|XX|XX|XX|XX| |XX|XX|XX|XX| ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ dash_offset | | | |**|**|**|**| | | | | | | | | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ dashes | | | |**|**|**|**| | | | | | | | | | ----------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ x11-apps-7.7+5+nmu1ubuntu1/xgc/Written/Widget0000664000000000000000000000174512514123556015567 0ustar What we need is a widget which presents a collection of buttons. The user can select only one of them at a time. When one is selected, its foreground and background colors should be reversed and stay that way until another one is selected. Exactly one button can be selected at any one time. Possible implementations: 1. As a new kind of widget. bleah. 2. Box surrounding a lot of command buttons. The command buttons have the appropriate callbacks. Callbacks: a) set all buttons to normal colors b) set this button to reverse colors c) change the appropriate variable to the desired value. This can all be done at the time of creation, thus the buttons would be invisible to the rest of the program (a good thing). (2) would be a heck of a lot easier to program, since creating widgets is a bitch. However, (1) could come in handy outside of this program. Perhaps write it using (2) and switch to (1) if/when we can get the widget working. x11-apps-7.7+5+nmu1ubuntu1/xgc/Written/Outline0000664000000000000000000001340412514123556015756 0ustar Outline for Xbench ------------------ GENERAL ------- Stuff starting with '-' are callbacks for that widget. '<>' means whatever is appropriate. Choice widgets will either be implemented as a new type of widget or a form containing a bunch of Command widgets. The automatic callbacks for the commands are: - set all children of parent to normal colors - set oneself to reverse colors There will be a - put <> in buffer, specified by the parent widget There will also be a - put <>\n in buffer specific to each command. In general, the buffer does not need to be looked at until the test is actually run; however, if we decide to "gray out" choices in the Graphics Options window that have nothing to do with the benchmark, then choosing a benchmark must flush also. Widgets - we need to decide whether the windows that are turn-on-and-offable should be children of Form, or of TopLevel. If they're children of Form, then the user won't be able to stack them or have a say in where they go. We also might run out of space. If they're children of TopLevel, the user can decide where they go, but he's going to have to choose their location (with the wm) every time they come up. I would vote for the latter approach. (Uh oh... I don't think that the TopLevel widget can have more than one child...) All choosing Widgets should write strings in the Xbench language to some buffer, where the actual testing thing can pull them out. HIERARCHY OF WIDGETS -------------------- Form (form) surrounding the whole thing (owned by TopLevel) Title (label) on top describing version & current test (owned by Form) MenuLine (form) under Title giving top level choices (owned by Form) MenuLine contains these Commands: Run - flush the buffer - run benchmark BenchmarkOptionsOn - map benchmark options window (BenchmarkOptions) BenchmarkOptionsOff - unmap benchmark options window GraphicsOptionsOn - map graphics options window (GraphicsOptions) GraphicsOptionsOff - unmap graphics options window DescriptionOn - map description window (Description) DescriptionOff - unmap description window RecordingOn - bring up dialog box for name of file - start saving commands into file (set a global boolean TRUE) RecordingOff - stop saving commands into file (set the global boolean FALSE) Playback - bring up dialog box for name of file - read from file until EOF Quit - quit The toggling command buttons exist in pairs, of which only one is visible at any one point. This makes callbacks/names of buttons easier to implement. --- BenchmarkOptions (form) describing benchmark options (owned by Toplevel?) BenchmarkOptions contains: TestChoice (choice) the 16 different test choices. - put "test <>" in buffer - put description of test in Description window - call disable_gc_choices() with the GC field flags Iterations (text) the number of times to run. - put "iterations <>" in buffer --- GraphicsOptions (form) describing graphics options (owned by Toplevel?) GraphicsOptions contains: ChooseFunction (choice) - put "function <>" in buffer ChooseColormap (choice) - put "colormap <>" in buffer Foreground (text) - put "foreground <>" in buffer Background (text) - put "background <>" in buffer LineWidth (text) - put "linewidth <>" in buffer LineStyle (choice) - put "linestyle <>" in buffer CapStyle (choice) - put "capstyle <>" in buffer JoinStyle (choice) - put "joinstyle <>" in buffer FillStyle (choice) - put "fillstyle <>" in buffer FillRule (choice) - put "fillrule <>" in buffer ArcMode (choice) - put "arcmode <>" in buffer TStipOrigin (text * 2) - put "tsorigin <>" in buffer DashList (???) - put "dashlist <>" in buffer DashOffset (text?) - put "dashoffset <>" in buffer ClipMask (choice) - put "clipmask <>" in buffer Planemask (text) - put "planemask <>" in buffer We need specialized widgets for DashList, possibly TStipOrigin and DashOffset. Still to be decided: can one choose GC options that have no meaning for that particular benchmark? I don't think it should be a problem. --- Description (text) describing the current test (owned by Toplevel?) I really need to find out how to use sources and sinks for Text widgets - the documentation does not say how to do it. Every test will have a block of text associated with it. When a new benchmark is chosen, its associated text will become the source for the Description widget. Note that we don't have to worry about whether Description is mapped or not; we're just setting a source. --- Analysis (text) describing the results of the current test (owned by Form - we always want this to be around) This will display the name of the test, the important values of the GC, the results of the test, and a short analysis thereof. If more than one test of a particular benchmark is performed, it will be appended to the analysis source (not replacing it). This will allow for comparing results obtained with different GC's. --- Test (core + expose event handler) for doing the test. All this really needs to do, besides actually doing the test, is to time it and make sure the Analysis part knows about it. --- RecordingOn / RecordingOff / Playback When the user presses Playback, pretty much all we have to do is to 1) change the buffer to the file that he wants, and 2) start reading. The rest should be taken care of the buffer-interpreting module. RecordingOn changes the output buffer _and_ the input buffer to the desired file. RecordingOff changes them both back to the usual. x11-apps-7.7+5+nmu1ubuntu1/xgc/Written/FilledRects0000664000000000000000000000546612514123556016550 0ustar General concerns ---------------- Machine type Display type Display on different machine? Visual Clipping Obscured by cursor Background tiling The whole software vs. hardware bit: computational overhead vs. time spent drawing Planemask PolyFillRectangle ----------------- Use same test as PolyRectangle? Perhaps give FillPoly some of these too, see if it special cases them. Fill Rectangle vs. Fill Poly for same size areas would be an interesting comparison. Things to look for: All it's really doing is setting or unsetting planes. When a whole word is filled, it should be quite fast (just setting it to 0 or ~0). Otherwise, the speed of a single rectangle should be about equal to its size. Data: Pixels per second. Average size of rectangle. GC fields: function: Tiling: likely to be a lot slower, although for whole words you're just setting it to a certain value, rather than 0. (You also have to look at the y value). Strange width tiles (are these allowed?) are likely to be real bad. Stippling: also slower - I'm not sure whether or not this would be slower than tiling. This probably has a greater chance of being done in hardware. plane-mask: plane of 0 would be real fast, since it doesn't modify anything. plane of ~0 should be fast, since it doesn't have to think. Anything else would probably be proportional to the number of planes... subwindow-mode: I don't believe it matters. clip-x-origin clip-y-origin clip-mask: Clipping in general should probably increase speed rather than decrease it, unless the clipping region is strange. Possible increase in speed because less change to the display is being made; possible decrease in speed because more thought has to be given to what is drawn or not. Software vs. hardware, I suppose. Possibly foreground: similar to plane-mask in its effect, I would think. tile: "nice" width tiles would probably be better. A width which is not a divisor of the length of a word would be significantly slower. A width the size of a word is probably perfect. The actual contents of the tile probably don't matter: Any code to check for tiles which could be "simplified" would probably take too much time to execute to do any good. stipple: like tile Other: alignment on word bounaries: fastest when one is changing whole words at a time. That way, you're just setting whole words to 0 or ~0 and not doing any computation. A 32x1 rectangle should be much faster than a 1x32 rectangle. --------- Things to put in test: Check all alignments. Perhaps some sort of comparison between thin rectangles oriented horizontally and oriented vertically. Small rectangles, big rectangles: compare pixels/second for each. Good way of computing overhead costs. --------- test (1-32)x32 at all 32 bits in a word. (97-128)x32 (97-128)x128 x11-apps-7.7+5+nmu1ubuntu1/xgc/lex.c0000664000000000000000000020153612514123575013722 0ustar #line 3 "lex.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart(yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart (FILE *input_file ); void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); void yy_delete_buffer (YY_BUFFER_STATE b ); void yy_flush_buffer (YY_BUFFER_STATE b ); void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); void yypop_buffer_state (void ); static void yyensure_buffer_stack (void ); static void yy_load_buffer_state (void ); static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); void *yyalloc (yy_size_t ); void *yyrealloc (void *,yy_size_t ); void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern int yylineno; int yylineno = 1; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ yyleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 72 #define YY_END_OF_BUFFER 73 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[420] = { 0, 0, 0, 73, 70, 68, 69, 70, 70, 65, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 0, 66, 70, 70, 0, 67, 65, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 10, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 66, 0, 70, 0, 66, 70, 4, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 11, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 1, 18, 70, 70, 70, 70, 70, 9, 70, 70, 66, 0, 70, 70, 70, 70, 70, 41, 70, 70, 70, 6, 70, 70, 70, 70, 70, 63, 70, 70, 70, 70, 70, 70, 70, 70, 17, 8, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 19, 70, 70, 6, 70, 70, 70, 70, 70, 45, 70, 56, 3, 70, 70, 70, 70, 70, 12, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 44, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 46, 51, 70, 48, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 13, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 55, 70, 70, 70, 70, 70, 70, 70, 53, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 40, 70, 70, 70, 70, 64, 70, 70, 26, 70, 70, 70, 70, 70, 70, 70, 70, 70, 54, 70, 70, 70, 39, 20, 70, 70, 62, 70, 70, 52, 70, 70, 2, 31, 70, 70, 70, 70, 70, 70, 70, 70, 57, 70, 70, 23, 70, 70, 70, 70, 70, 30, 49, 70, 70, 70, 70, 21, 70, 70, 47, 70, 70, 43, 36, 60, 37, 70, 70, 14, 61, 70, 70, 22, 70, 70, 70, 32, 70, 70, 5, 59, 70, 38, 70, 58, 70, 33, 70, 16, 70, 70, 70, 70, 34, 42, 7, 70, 27, 35, 70, 29, 70, 70, 24, 15, 70, 28, 70, 70, 25, 50, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 4, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 7, 6, 6, 6, 6, 8, 6, 9, 6, 1, 1, 1, 1, 1, 1, 1, 10, 11, 12, 13, 14, 15, 16, 1, 17, 18, 1, 19, 20, 21, 22, 23, 1, 24, 25, 26, 1, 1, 27, 28, 1, 1, 1, 29, 1, 1, 1, 1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int32_t yy_meta[55] = { 0, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int16_t yy_base[427] = { 0, 0, 0, 498, 0, 499, 499, 53, 56, 54, 21, 35, 36, 37, 24, 34, 463, 44, 452, 457, 456, 44, 46, 56, 48, 61, 45, 455, 448, 461, 71, 460, 443, 58, 445, 69, 440, 70, 436, 451, 450, 0, 114, 103, 0, 117, 120, 480, 499, 118, 449, 449, 448, 428, 429, 432, 432, 441, 429, 425, 422, 421, 436, 428, 86, 425, 418, 436, 414, 426, 420, 413, 418, 87, 438, 429, 111, 411, 423, 426, 414, 410, 404, 402, 408, 401, 408, 410, 399, 405, 402, 397, 398, 401, 93, 499, 135, 145, 126, 148, 154, 136, 399, 400, 405, 389, 389, 389, 405, 380, 396, 401, 393, 387, 388, 379, 393, 394, 408, 388, 389, 379, 387, 386, 386, 373, 0, 398, 381, 369, 371, 379, 380, 386, 367, 355, 369, 390, 363, 0, 0, 367, 359, 354, 368, 368, 0, 346, 358, 137, 141, 355, 363, 352, 359, 353, 0, 344, 359, 344, 144, 349, 348, 337, 365, 139, 0, 350, 336, 342, 349, 335, 333, 111, 333, 0, 0, 349, 343, 327, 325, 324, 340, 332, 338, 165, 337, 328, 336, 335, 322, 0, 333, 327, 347, 121, 312, 311, 328, 313, 0, 305, 0, 0, 311, 314, 315, 317, 320, 0, 320, 308, 301, 301, 302, 310, 317, 320, 296, 295, 294, 304, 0, 293, 327, 305, 304, 303, 293, 297, 292, 286, 294, 293, 286, 295, 294, 293, 294, 295, 0, 0, 283, 0, 280, 288, 287, 286, 275, 277, 283, 265, 285, 266, 300, 279, 270, 269, 255, 264, 263, 270, 271, 0, 250, 249, 269, 252, 270, 274, 251, 250, 247, 263, 264, 261, 251, 248, 252, 257, 252, 234, 237, 249, 250, 247, 235, 234, 0, 230, 245, 248, 243, 233, 226, 244, 0, 219, 238, 230, 220, 226, 234, 214, 225, 224, 215, 0, 215, 213, 212, 212, 0, 225, 210, 0, 216, 222, 212, 205, 211, 203, 213, 216, 216, 0, 199, 199, 203, 0, 0, 198, 210, 0, 195, 206, 0, 207, 197, 0, 0, 190, 204, 203, 199, 198, 196, 199, 198, 0, 191, 155, 0, 181, 199, 194, 164, 184, 0, 0, 192, 191, 191, 174, 0, 185, 177, 0, 187, 169, 0, 0, 0, 0, 174, 185, 0, 0, 170, 182, 0, 172, 171, 205, 0, 176, 178, 0, 0, 176, 0, 166, 0, 200, 0, 162, 0, 174, 173, 168, 136, 0, 0, 0, 149, 0, 0, 140, 0, 123, 101, 0, 0, 80, 0, 75, 43, 0, 0, 499, 70, 191, 193, 195, 197, 199, 201 } ; static yyconst flex_int16_t yy_def[427] = { 0, 419, 1, 419, 420, 419, 419, 421, 422, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 421, 423, 420, 424, 422, 425, 419, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 419, 426, 421, 423, 421, 424, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 423, 426, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 0, 419, 419, 419, 419, 419, 419, 419 } ; static yyconst flex_int16_t yy_nxt[554] = { 0, 4, 5, 6, 7, 8, 9, 9, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 4, 10, 29, 30, 31, 32, 33, 4, 4, 34, 18, 4, 19, 4, 35, 36, 37, 4, 38, 39, 40, 4, 4, 4, 28, 4, 43, 43, 44, 47, 48, 49, 49, 49, 49, 50, 52, 55, 59, 51, 53, 61, 41, 63, 56, 72, 62, 418, 57, 64, 88, 58, 60, 45, 89, 65, 54, 67, 68, 73, 74, 77, 75, 83, 76, 78, 85, 93, 79, 84, 72, 80, 55, 64, 81, 77, 86, 82, 95, 65, 417, 87, 79, 57, 94, 416, 92, 43, 43, 44, 98, 43, 99, 47, 48, 49, 49, 49, 49, 130, 115, 95, 125, 96, 116, 126, 131, 127, 125, 43, 149, 126, 95, 415, 45, 43, 149, 100, 43, 43, 44, 43, 43, 44, 151, 204, 96, 98, 43, 99, 220, 152, 205, 211, 221, 150, 378, 96, 206, 212, 213, 150, 383, 414, 384, 45, 231, 393, 45, 394, 379, 232, 413, 412, 100, 233, 411, 212, 213, 234, 235, 236, 237, 42, 42, 46, 46, 43, 43, 97, 97, 47, 47, 98, 98, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 392, 391, 390, 389, 388, 387, 386, 385, 382, 381, 380, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 205, 244, 243, 242, 241, 240, 239, 238, 230, 229, 228, 227, 226, 225, 224, 223, 222, 219, 218, 217, 216, 215, 214, 210, 209, 208, 207, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 129, 128, 124, 123, 122, 121, 120, 119, 118, 117, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 48, 88, 85, 84, 76, 68, 61, 59, 52, 91, 90, 71, 70, 69, 66, 419, 3, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419 } ; static yyconst flex_int16_t yy_chk[554] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 7, 7, 8, 8, 9, 9, 9, 9, 10, 11, 12, 13, 10, 11, 14, 420, 15, 12, 21, 14, 416, 12, 15, 26, 12, 13, 7, 26, 15, 11, 17, 17, 21, 22, 23, 22, 24, 22, 23, 25, 33, 23, 24, 35, 23, 30, 33, 23, 37, 25, 23, 43, 33, 415, 25, 37, 30, 35, 413, 30, 42, 42, 42, 45, 45, 45, 46, 46, 49, 49, 49, 49, 76, 64, 98, 73, 43, 64, 73, 76, 73, 94, 96, 96, 94, 149, 410, 42, 150, 150, 45, 97, 97, 97, 99, 99, 99, 101, 160, 98, 100, 100, 100, 173, 101, 160, 165, 173, 96, 351, 149, 160, 195, 195, 150, 356, 409, 356, 97, 185, 369, 99, 369, 351, 185, 407, 404, 100, 185, 400, 165, 165, 185, 185, 185, 185, 421, 421, 422, 422, 423, 423, 424, 424, 425, 425, 426, 426, 399, 398, 397, 395, 393, 391, 389, 386, 385, 383, 382, 381, 379, 378, 375, 374, 368, 366, 365, 363, 362, 361, 360, 357, 355, 354, 353, 350, 348, 347, 346, 345, 344, 343, 342, 341, 338, 337, 335, 334, 332, 331, 328, 327, 326, 324, 323, 322, 321, 320, 319, 318, 317, 316, 314, 313, 311, 310, 309, 308, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 295, 294, 293, 292, 291, 290, 289, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 242, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 208, 207, 206, 205, 204, 201, 199, 198, 197, 196, 194, 193, 192, 190, 189, 188, 187, 186, 184, 183, 182, 181, 180, 179, 178, 177, 174, 172, 171, 170, 169, 168, 167, 164, 163, 162, 161, 159, 158, 157, 155, 154, 153, 152, 151, 148, 147, 145, 144, 143, 142, 141, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 75, 74, 72, 71, 70, 69, 68, 67, 66, 65, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 47, 40, 39, 38, 36, 34, 32, 31, 29, 28, 27, 20, 19, 18, 16, 3, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "lex.l" /* ** lex file for xgc syntax */ /* Lots of stuff stolen from gwm's wool.lex */ #line 8 "lex.l" #include #include #include "gram.h" #include "constants.h" #if defined(FLEX_SCANNER) && !defined(YY_FLEX_LEX_COMPAT) && !defined(__UNIXOS2__) int yylineno; #endif #line 724 "lex.c" #define INITIAL 0 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int yylex_destroy (void ); int yyget_debug (void ); void yyset_debug (int debug_flag ); YY_EXTRA_TYPE yyget_extra (void ); void yyset_extra (YY_EXTRA_TYPE user_defined ); FILE *yyget_in (void ); void yyset_in (FILE * in_str ); FILE *yyget_out (void ); void yyset_out (FILE * out_str ); int yyget_leng (void ); char *yyget_text (void ); int yyget_lineno (void ); void yyset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap (void ); #else extern int yywrap (void ); #endif #endif static void yyunput (int c,char *buf_ptr ); #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex (void); #define YY_DECL int yylex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 25 "lex.l" #line 909 "lex.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 420 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 499 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 27 "lex.l" { return (RUN); } YY_BREAK case 2: YY_RULE_SETUP #line 29 "lex.l" { return (FUNCTION); } YY_BREAK case 3: YY_RULE_SETUP #line 30 "lex.l" { yylval.num = GXclear; return (FUNCTIONTYPE); } YY_BREAK case 4: YY_RULE_SETUP #line 32 "lex.l" { yylval.num = GXand; return (FUNCTIONTYPE); } YY_BREAK case 5: YY_RULE_SETUP #line 34 "lex.l" { yylval.num = GXandReverse; return (FUNCTIONTYPE); } YY_BREAK case 6: YY_RULE_SETUP #line 36 "lex.l" { yylval.num = GXcopy; return (FUNCTIONTYPE); } YY_BREAK case 7: YY_RULE_SETUP #line 38 "lex.l" { yylval.num = GXandInverted; return (FUNCTIONTYPE); } YY_BREAK case 8: YY_RULE_SETUP #line 40 "lex.l" { yylval.num = GXnoop; return (FUNCTIONTYPE); } YY_BREAK case 9: YY_RULE_SETUP #line 42 "lex.l" { yylval.num = GXxor; return (FUNCTIONTYPE); } YY_BREAK case 10: YY_RULE_SETUP #line 44 "lex.l" { yylval.num = GXor; return (FUNCTIONTYPE); } YY_BREAK case 11: YY_RULE_SETUP #line 46 "lex.l" { yylval.num = GXnor; return (FUNCTIONTYPE); } YY_BREAK case 12: YY_RULE_SETUP #line 48 "lex.l" { yylval.num = GXequiv; return (FUNCTIONTYPE); } YY_BREAK case 13: YY_RULE_SETUP #line 50 "lex.l" { yylval.num = GXinvert; return (FUNCTIONTYPE); } YY_BREAK case 14: YY_RULE_SETUP #line 52 "lex.l" { yylval.num = GXorReverse; return (FUNCTIONTYPE); } YY_BREAK case 15: YY_RULE_SETUP #line 54 "lex.l" { yylval.num = GXcopyInverted; return (FUNCTIONTYPE); } YY_BREAK case 16: YY_RULE_SETUP #line 56 "lex.l" { yylval.num = GXorInverted; return (FUNCTIONTYPE); } YY_BREAK case 17: YY_RULE_SETUP #line 58 "lex.l" { yylval.num = GXnand; return (FUNCTIONTYPE); } YY_BREAK case 18: YY_RULE_SETUP #line 60 "lex.l" { yylval.num = GXset; return (FUNCTIONTYPE); } YY_BREAK case 19: YY_RULE_SETUP #line 63 "lex.l" { return (TEST); } YY_BREAK case 20: YY_RULE_SETUP #line 64 "lex.l" { yylval.num = CopyArea; return (TESTTYPE); } YY_BREAK case 21: YY_RULE_SETUP #line 66 "lex.l" { yylval.num = CopyPlane; return (TESTTYPE); } YY_BREAK case 22: YY_RULE_SETUP #line 68 "lex.l" { yylval.num = PolyPoint; return (TESTTYPE); } YY_BREAK case 23: YY_RULE_SETUP #line 70 "lex.l" { yylval.num = PolyLine; return (TESTTYPE); } YY_BREAK case 24: YY_RULE_SETUP #line 72 "lex.l" { yylval.num = PolySegment; return (TESTTYPE); } YY_BREAK case 25: YY_RULE_SETUP #line 74 "lex.l" { yylval.num = PolyRectangle; return (TESTTYPE); } YY_BREAK case 26: YY_RULE_SETUP #line 76 "lex.l" { yylval.num = PolyArc; return (TESTTYPE); } YY_BREAK case 27: YY_RULE_SETUP #line 78 "lex.l" { yylval.num = FillPolygon; return (TESTTYPE); } YY_BREAK case 28: YY_RULE_SETUP #line 80 "lex.l" { yylval.num = PolyFillRect; return (TESTTYPE); } YY_BREAK case 29: YY_RULE_SETUP #line 82 "lex.l" { yylval.num = PolyFillArc; return (TESTTYPE); } YY_BREAK case 30: YY_RULE_SETUP #line 84 "lex.l" { yylval.num = PutImage; return (TESTTYPE); } YY_BREAK case 31: YY_RULE_SETUP #line 86 "lex.l" { yylval.num = GetImage; return (TESTTYPE); } YY_BREAK case 32: YY_RULE_SETUP #line 88 "lex.l" { yylval.num = PolyText8; return (TESTTYPE); } YY_BREAK case 33: YY_RULE_SETUP #line 90 "lex.l" { yylval.num = ImageText8; return (TESTTYPE); } YY_BREAK case 34: YY_RULE_SETUP #line 92 "lex.l" { yylval.num = PolyText16; return (TESTTYPE); } YY_BREAK case 35: YY_RULE_SETUP #line 94 "lex.l" { yylval.num = ImageText16; return (TESTTYPE); } YY_BREAK case 36: YY_RULE_SETUP #line 97 "lex.l" { return (LINESTYLE); } YY_BREAK case 37: YY_RULE_SETUP #line 98 "lex.l" { yylval.num = LineOnOffDash; return (LINESTYLETYPE); } YY_BREAK case 38: YY_RULE_SETUP #line 100 "lex.l" { yylval.num = LineDoubleDash; return (LINESTYLETYPE); } YY_BREAK case 39: YY_RULE_SETUP #line 103 "lex.l" { return (CAPSTYLE); } YY_BREAK case 40: YY_RULE_SETUP #line 104 "lex.l" { yylval.num = CapNotLast; return (CAPSTYLETYPE); } YY_BREAK case 41: YY_RULE_SETUP #line 106 "lex.l" { yylval.num = CapButt; return (CAPSTYLETYPE); } YY_BREAK case 42: YY_RULE_SETUP #line 108 "lex.l" { yylval.num = CapProjecting; return (CAPSTYLETYPE); } YY_BREAK case 43: YY_RULE_SETUP #line 111 "lex.l" { return (JOINSTYLE); } YY_BREAK case 44: YY_RULE_SETUP #line 112 "lex.l" { yylval.num = JoinMiter; return (JOINSTYLETYPE); } YY_BREAK case 45: YY_RULE_SETUP #line 114 "lex.l" { yylval.num = JoinBevel; return (JOINSTYLETYPE); } YY_BREAK case 46: YY_RULE_SETUP #line 117 "lex.l" { return (ROUND); } YY_BREAK case 47: YY_RULE_SETUP #line 119 "lex.l" { return (FILLSTYLE); } YY_BREAK case 48: YY_RULE_SETUP #line 120 "lex.l" { yylval.num = FillTiled; return (FILLSTYLETYPE); } YY_BREAK case 49: YY_RULE_SETUP #line 122 "lex.l" { yylval.num = FillStippled; return (FILLSTYLETYPE); } YY_BREAK case 50: YY_RULE_SETUP #line 124 "lex.l" { yylval.num = FillOpaqueStippled; return (FILLSTYLETYPE); } YY_BREAK case 51: YY_RULE_SETUP #line 127 "lex.l" { return (SOLID); } YY_BREAK case 52: YY_RULE_SETUP #line 129 "lex.l" { return (FILLRULE); } YY_BREAK case 53: YY_RULE_SETUP #line 130 "lex.l" { yylval.num = EvenOddRule; return (FILLRULETYPE); } YY_BREAK case 54: YY_RULE_SETUP #line 132 "lex.l" { yylval.num = WindingRule; return (FILLRULETYPE); } YY_BREAK case 55: YY_RULE_SETUP #line 135 "lex.l" { return (ARCMODE); } YY_BREAK case 56: YY_RULE_SETUP #line 136 "lex.l" { yylval.num = ArcChord; return (ARCMODETYPE); } YY_BREAK case 57: YY_RULE_SETUP #line 138 "lex.l" { yylval.num = ArcPieSlice; return (ARCMODETYPE); } YY_BREAK case 58: YY_RULE_SETUP #line 141 "lex.l" { return (FOREGROUND); } YY_BREAK case 59: YY_RULE_SETUP #line 142 "lex.l" { return (BACKGROUND); } YY_BREAK case 60: YY_RULE_SETUP #line 143 "lex.l" { return (LINEWIDTH); } YY_BREAK case 61: YY_RULE_SETUP #line 144 "lex.l" { return (PLANEMASK); } YY_BREAK case 62: YY_RULE_SETUP #line 145 "lex.l" { return (DASHLIST); } YY_BREAK case 63: YY_RULE_SETUP #line 146 "lex.l" { return (FONT); } YY_BREAK case 64: YY_RULE_SETUP #line 147 "lex.l" { return (PERCENT); } YY_BREAK case 65: YY_RULE_SETUP #line 149 "lex.l" { (void) sscanf ((char *)yytext, "%d", &yylval.num); return (NUMBER); } YY_BREAK case 66: /* rule 66 can match eol */ YY_RULE_SETUP #line 151 "lex.l" { yylval.ptr = (char *) yytext; return (STRING); } YY_BREAK case 67: /* rule 67 can match eol */ YY_RULE_SETUP #line 153 "lex.l" { ; } YY_BREAK case 68: YY_RULE_SETUP #line 154 "lex.l" { ; } YY_BREAK case 69: /* rule 69 can match eol */ YY_RULE_SETUP #line 155 "lex.l" { return ('\n'); } YY_BREAK case 70: YY_RULE_SETUP #line 157 "lex.l" { yylval.ptr = (char *) yytext; return (STRING); } YY_BREAK case 71: YY_RULE_SETUP #line 160 "lex.l" { fprintf(stderr, "xgc: bad character `%s', line %d\n", yytext, yylineno); } YY_BREAK case 72: YY_RULE_SETUP #line 164 "lex.l" ECHO; YY_BREAK #line 1406 "lex.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart(yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 420 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 420 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 419); return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { register char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up yytext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = (yy_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart(yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_init_buffer(YY_CURRENT_BUFFER,input_file ); yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * */ void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yyfree((void *) b->yy_ch_buf ); yyfree((void *) b ); } #ifndef __cplusplus extern int isatty (int ); #endif /* __cplusplus */ /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; yyensure_buffer_stack(); /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void yyensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { return yy_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param bytes the byte buffer to scan * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int yyget_lineno (void) { return yylineno; } /** Get the input stream. * */ FILE *yyget_in (void) { return yyin; } /** Get the output stream. * */ FILE *yyget_out (void) { return yyout; } /** Get the length of the current token. * */ int yyget_leng (void) { return yyleng; } /** Get the current token. * */ char *yyget_text (void) { return yytext; } /** Set the current line number. * @param line_number * */ void yyset_lineno (int line_number ) { yylineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see yy_switch_to_buffer */ void yyset_in (FILE * in_str ) { yyin = in_str ; } void yyset_out (FILE * out_str ) { yyout = out_str ; } int yyget_debug (void) { return yy_flex_debug; } void yyset_debug (int bdebug ) { yy_flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from yylex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; #else yyin = (FILE *) 0; yyout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * yylex_init() */ return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *yyalloc (yy_size_t size ) { return (void *) malloc( size ); } void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void yyfree (void * ptr ) { free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 164 "lex.l" #ifndef yywrap int yywrap(void) { return (1); } #endif x11-apps-7.7+5+nmu1ubuntu1/xgc/compile0000755000000000000000000001624512656634667014363 0ustar #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xgc/getfile.c0000664000000000000000000001057012514123556014544 0ustar /* ** getfilename.c ** */ #include #include #include #include #include #include #include #include #include "xgc.h" static Widget popupshell = NULL; /* popup dialog box */ Widget filename_text_widget; /* Widget containing the name of the file the user has selected */ static void kill_popup_shell(void); void get_filename( void (*success)(void), /* what function to call when a filename is chosen */ void (*failure)(void)) /* what function to call when the user cancels */ { static Widget popupform; /* form inside shell */ static Widget label; /* "Filename :" */ Window dummy1, dummy2; int x1,y1,x2,y2; unsigned int mask; /* The translation table for the text widget. Things such as ** confirm the user's choice. Other keys which would move out of ** the range of a one-line window are disabled. */ static const char *translationtable = "CtrlJ: KillPopup() Done()\n\ CtrlM: KillPopup() Done()\n\ Linefeed: KillPopup() Done()\n\ Return: KillPopup() Done()\n\ CtrlO: Nothing()\n\ MetaI: Nothing()\n\ CtrlN: Nothing()\n\ CtrlP: Nothing()\n\ CtrlZ: Nothing()\n\ MetaZ: Nothing()\n\ CtrlV: Nothing()\n\ MetaV: Nothing()"; /* What the actions in the translation table correspond to. */ static XtActionsRec actiontable[] = { {"KillPopup", (XtActionProc) kill_popup_shell}, {"Done", NULL}, {"Nothing", NULL} }; static Arg popupshellargs[] = { /* Where to put the popup shell. */ {XtNx, (XtArgVal) NULL}, {XtNy, (XtArgVal) NULL} }; static Arg labelargs[] = { /* ArgList for the label */ {XtNborderWidth, (XtArgVal) 0}, {XtNjustify, (XtArgVal) XtJustifyRight} }; static Arg textargs[] = { /* ArgList for the text widget */ {XtNeditType, (XtArgVal) XawtextEdit}, {XtNwidth, (XtArgVal) 200}, {XtNhorizDistance, (XtArgVal) 10}, {XtNfromHoriz, (XtArgVal) NULL}, }; static Arg cancelargs[] = { /* ArgList for the cancel button */ {XtNfromHoriz, (XtArgVal) NULL}, {XtNcallback, (XtArgVal) NULL} }; /* Procedures to call when the user selects 'cancel' */ static XtCallbackRec cancelcallbacklist[] = { {(XtCallbackProc) kill_popup_shell, NULL}, {NULL, NULL}, {NULL, NULL} }; if (popupshell != NULL) { XtPopup(popupshell,XtGrabExclusive); return; } /* Find out where the pointer is, so we can put the popup window there */ (void) XQueryPointer(X.dpy,XtWindow(topform),&dummy1,&dummy2,&x1,&y1, &x2,&y2,&mask); popupshellargs[0].value = (XtArgVal) x2; popupshellargs[1].value = (XtArgVal) y2; popupshell = XtCreatePopupShell("popup",overrideShellWidgetClass, topform,popupshellargs,XtNumber(popupshellargs)); popupform = XtCreateManagedWidget("form",formWidgetClass,popupshell, NULL, 0); label = XtCreateManagedWidget("Filename: ",labelWidgetClass,popupform, labelargs,XtNumber(labelargs)); textargs[3].value = (XtArgVal) label; filename_text_widget = XtCreateManagedWidget("text",asciiTextWidgetClass, popupform, textargs,XtNumber(textargs)); /* Complete the action table. We have to do it here because success ** isn't known at compile time. */ actiontable[1].proc = (XtActionProc) success; /* Register actions, translations, callbacks */ XtAppAddActions(appcontext,actiontable,XtNumber(actiontable)); XtOverrideTranslations(filename_text_widget, XtParseTranslationTable(translationtable)); cancelcallbacklist[1].callback = (XtCallbackProc) failure; cancelargs[0].value = (XtArgVal) filename_text_widget; cancelargs[1].value = (XtArgVal) cancelcallbacklist; (void) XtCreateManagedWidget("Cancel",commandWidgetClass,popupform, cancelargs,XtNumber(cancelargs)); /* Bring up the popup. When the user presses cancel or the return key, ** the function kill_popup_shell (below) will be called to remove it. */ XtPopup(popupshell,XtGrabExclusive); } /* kill_popup_shell() ** ------------------ ** Remove the popup window that get_filename popped up. */ static void kill_popup_shell(void) { XtPopdown(popupshell); } x11-apps-7.7+5+nmu1ubuntu1/xgc/app-defaults/0000775000000000000000000000000012520517024015335 5ustar x11-apps-7.7+5+nmu1ubuntu1/xgc/app-defaults/Xgc-color0000664000000000000000000000446112514123556017130 0ustar *Foreground: rgb:2/3/1 *Background: rgb:c/d/b *BorderWidth: 0 *Label.justify: left *Text.Background: rgb:d/e/c *Text.displayList: foreground rgb:f/f/d;segments 1,-1,-2,-1, -1,-2,-1,1;foreground rgb:7/7/5;segments -2,0,1,0, 0,1,0,-2 *Form.displayList: foreground rgb:7/7/5;segments 1,-1,-2,-1, -1,-2,-1,1;foreground rgb:f/f/d;segments -2,0,1,0, 0,1,0,-2 *Label.width: 130 *Label.left: chainLeft *Label.right: chainLeft *topform.Form.displayList: foreground rgb:e/e/e;segments 1,-1,-2,-1, -1,-2,-1,1;foreground rgb:4/4/4;segments -2,0,1,0, 0,1,0,-2 *topform.Form.Form.displayList: *topform.Form.linestyle.Toggle.width: 123 *topform.Form.capstyle.Toggle.width: 185 *topform.Form.joinstyle.Toggle.width: 123 *topform.Form.fillstyle.Toggle.width: 185 *topform.Form.fillrule.Toggle.width: 185 *topform.Form.arcmode.Toggle.width: 185 *topform.Form.linewidth.Text.width: 372 *topform.Form.font.Text.width: 372 *topform.Form.foreground.Text.width: 110 *topform.Form.background.Text.width: 110 *topform.Form.testpercent.100.Background: rgb:b/c/a *topform.Form.testpercent.100.displayList: foreground rgb:e/e/c;segments 1,-1,-2,-1, -1,-2,-1,1;foreground rgb:5/5/3;segments -2,0,1,0, 0,1,0,-2 *topform.Form.testpercent.100.justify:right *topform.Form.testpercent.100.width: 30 *topform.Form.testpercent.100.left: chainLeft *topform.Form.testpercent.100.right: chainRight *topform.Form.testpercent.100.borderWidth: 0 *topform.Form.testpercent.Scrollbar.width: 332 *topform.Form.testpercent.Scrollbar.displayList: foreground rgb:e/e/c;segments 1,-1,-2,-1, -1,-2,-1,1;foreground rgb:5/5/3;segments -2,0,1,0, 0,1,0,-2 *topform.Form.testpercent.Scrollbar.Background: rgb:b/c/a *Toggle.borderWidth: 1 *Toggle.borderColor: rgb:6/8/6 *Toggle.justify: left *Toggle.foreground: rgb:2/4/2 *Toggle.background: rgb:8/a/8 *Toggle.highlightThickness: 0 *Toggle.displayList: foreground rgb:4/6/4;draw-rect 1,1,-2,-2;foreground rgb:8/a/8;draw-rect 0,0,-1,-1 *Command.width: 102 *Command.borderWidth: 1 *Command.borderColor: rgb:a/8/6 *Command.justify: left *Command.foreground: rgb:6/6/2 *Command.background: rgb:c/c/8 *Command.highlightThickness: 2 *Command.displayList: line-style solid;foreground rgb:8/8/4;draw-rect 1,1,-2,-2;dashes 2,2;line-style onoffdash;foreground rgb:c/c/8;draw-rect 0,0,-1,-1 *test.BorderWidth: 1 x11-apps-7.7+5+nmu1ubuntu1/xgc/app-defaults/Xgc0000664000000000000000000000010112514123556015777 0ustar *planemask*ShapeStyle: rectangle *dashlist*ShapeStyle: rectangle x11-apps-7.7+5+nmu1ubuntu1/xgc/ChangeLog0000664000000000000000000005266312514123601014533 0ustar commit 54f109228e566759799894ff4d6ef4bac74c9aac Author: Alan Coopersmith Date: Thu Apr 16 23:25:45 2015 -0700 xgc 1.0.5 Signed-off-by: Alan Coopersmith commit a17909006e1a545286f92a3465782086a0739ffd Author: Alan Coopersmith Date: Mon Jun 2 22:37:18 2014 -0700 autogen.sh: Honor NOCONFIGURE=1 See http://people.gnome.org/~walters/docs/build-api.txt Signed-off-by: Alan Coopersmith commit bbbe7620f0964366697dc0db7b1f5175886b3aed Author: Alan Coopersmith Date: Mon Jun 2 22:37:18 2014 -0700 configure: Drop AM_MAINTAINER_MODE Signed-off-by: Alan Coopersmith commit da8d7ffba24611182df5e9518278754df5f030b8 Author: Christian Weisgerber Date: Tue Dec 3 23:23:51 2013 +0100 Remove include of Version 7 header I don't know if there are any extant operating systems that still require for getrusage(). Signed-off-by: Matthieu Herrb commit d96e5ffd26c44cc7ef454e5d1496957293ef7e3e Author: Julien Cristau Date: Tue Aug 13 12:36:39 2013 +0200 configure: look for gram.c in $srcdir That's where it is when building from the tarball. Regression from ff668395fc408f540604bd534e323b483f52a4ea. Signed-off-by: Julien Cristau Reviewed-by: Alan Coopersmith commit bb714a16b2e79bc391184bafce6046a897baf293 Author: Alan Coopersmith Date: Sat Jan 12 18:18:15 2013 -0800 xgc 1.0.4 Signed-off-by: Alan Coopersmith commit c6b6d11bc2bb2cfc877124fe931073f8cebc440a Author: Alan Coopersmith Date: Sat Jan 12 18:16:38 2013 -0800 config: Add missing AC_CONFIG_SRCDIR Regroup AC statements under the Autoconf initialization section. Regroup AM statements under the Automake initialization section. Signed-off-by: Alan Coopersmith commit 17734f0b7b2d5240c0adb14f7ce03763603fd99c Author: Alan Coopersmith Date: Wed Dec 28 20:36:26 2011 -0800 Bounds check value passed to WriteText Read outside array bounds (CWE 125): In array dereference of names[type] with index 'type' Array size is 4 elements (of 8 bytes each), index >= 0 and index <= 2147483647 at line 155 of text.c in function 'WriteText'. [ This bug was found by the Parfait 0.4.2 bug checking tool. For more information see http://labs.oracle.com/projects/parfait/ ] Signed-off-by: Alan Coopersmith commit 84e7552c98096930cef9ed2d1d91f3d8abceeb4e Author: Gaetan Nadon Date: Tue Mar 8 07:36:55 2011 -0500 config: let Automake handle Lex and Yacc dist and cleaning MAINTAINERCLEANFILES are not needed for lex and yacc. Only gram.h needs to be specified as built source. Automake generates all the rules to handle building, distribution and cleaning. Signed-off-by: Gaetan Nadon commit 1a25a116e87e8cde709cf1b810ac2371ac485280 Author: Gaetan Nadon Date: Wed Jan 19 10:06:56 2011 -0500 config: move man pages into their own directory Use services provided by XORG_MANPAGE_SECTIONS. Use standard Makefile for man pages. Signed-off-by: Gaetan Nadon commit 75d2575ad02fdff4085df16f1e160be718d7b299 Author: Gaetan Nadon Date: Wed Jan 12 16:28:02 2011 -0500 config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS This silences an Autoconf warning commit 6adff4c81ca7eef354e54e0fc71645849023bbc3 Author: Gaetan Nadon Date: Wed Jan 12 15:29:50 2011 -0500 config: replace deprecated AC_HELP_STRING with AS_HELP_STRING This silences an Automake warning. Signed-off-by: Gaetan Nadon commit ff668395fc408f540604bd534e323b483f52a4ea Author: Gaetan Nadon Date: Mon Nov 1 13:19:23 2010 -0400 config: replace AC_CHECK_FILE with test -f * AC_CHECK_FILE doesn't work for cross compilation Signed-off-by: Gaetan Nadon commit 76ba19a5b0f1ec9515ac802c3c3efaad87f3079f Author: Alan Coopersmith Date: Sat Oct 30 16:09:30 2010 -0700 xgc 1.0.3 Signed-off-by: Alan Coopersmith commit 66718aca54618f65abbe99ace710d3d4899d2f62 Author: Alan Coopersmith Date: Sat Oct 30 16:08:20 2010 -0700 config: Remove unnecessary calls from configure.ac AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now PKG_CONFIG_MODULES handles AC_SUBST of the CFLAGS & LIBS variables Signed-off-by: Alan Coopersmith commit 3425a0f5319a0602a809f7ece099b1d8235cadd0 Author: Alan Coopersmith Date: Sat Oct 30 16:05:45 2010 -0700 Purge CVS version tags Signed-off-by: Alan Coopersmith commit 28dc5acd02f7e20354f3dc7c6aae0b7e685d24db Author: Gaetan Nadon Date: Sat Oct 30 16:04:37 2010 -0700 config: update AC_PREREQ statement to 2.60 Unrelated to the previous patches, the new value simply reflects the reality that the minimum level for autoconf to configure all x.org modules is 2.60 dated June 2006. ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz Signed-off-by: Gaetan Nadon Signed-off-by: Alan Coopersmith commit 370e37a3a02ef8100c048c1a39af325662009970 Author: Alan Coopersmith Date: Sat Oct 30 16:03:39 2010 -0700 Sun's copyrights now belong to Oracle Signed-off-by: Alan Coopersmith commit ebd3e2400d05f779c0be6f1db352fe0e55a2c435 Author: Gaetan Nadon Date: Sun Jul 18 09:38:40 2010 -0400 config: allow to build tarball when yacc is missingmaster Autoconf does not handle this scenario as well as Automake does. If gram.c is already there, do not abort the configuration if yacc is missing as it is not needed. If both xkbparse.c and yacc are missing, abort configuration. Yacc is a required tool to build the package. Signed-off-by: Gaetan Nadon commit 79eee2354907010045d64c05b3a008cffda2c952 Author: Alan Coopersmith Date: Thu Jul 1 18:07:39 2010 -0700 Call snprintf directly, instead of via XmuSnprintf We could add an autoconf check to fix the old #ifdef HAS_SNPRINTF test here, but all platforms we support today have a native snprintf anyway. Signed-off-by: Alan Coopersmith commit 2dd98f64c53a6353716982d2e69c3c493a6b9f78 Author: Alan Coopersmith Date: Wed Jun 30 23:25:03 2010 -0700 config: upgrade to util-macros 1.8 for additional man page support Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS The value of MAN_SUBST is the same for all X.Org packages. Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS The existing statement can now be removed from the configuration file. Use XORG_DEFAULT_OPTIONS provided $(SED) Use platform appropriate version of sed. Signed-off-by: Alan Coopersmith commit e1d1a9f5b65691338e7a6d41dbbf05bc7073740a Author: Gaetan Nadon Date: Fri Jun 4 14:03:55 2010 -0400 config: add check for yacc to insure it is installed #27973 Unlike other macros AC_PROG_YACC sets the YACC variable to "yacc" as a last resort, even if no programs have been found. Improve error checking by issuing an error message if yacc is not found. The module cannot build anyway. Signed-off-by: Gaetan Nadon commit 301f7d91b74bd1ef625ba1d82e877294ed283210 Author: Alan Coopersmith Date: Thu Jan 14 22:12:21 2010 -0800 Update Sun license notices to current X.Org standard form Signed-off-by: Alan Coopersmith commit b788ecebe37fffc96856481a6e239123214540e9 Author: Gaetan Nadon Date: Sat Dec 19 20:48:48 2009 -0500 configure.ac: use backticks rather than $() for cmd subs Use "$PKG_CONFIG" rather than hard coded "pkg-config" Signed-off-by: Gaetan Nadon commit 3f4012aecec63dee6858797d0c893472877ac027 Author: Gaetan Nadon Date: Thu Nov 26 09:19:54 2009 -0500 Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES Now that the INSTALL file is generated. Allows running make maintainer-clean. commit bb9d4ca9f616c24fcda388749a9ec7fbe7ea6f55 Author: Gaetan Nadon Date: Wed Oct 28 14:09:08 2009 -0400 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 Add missing INSTALL file. Use standard GNU file on building tarball README may have been updated Remove AUTHORS file as it is empty and no content available yet. Remove NEWS file as it is empty and no content available yet. commit 6daab486099dc404bf0b88546fd3091855c01c89 Author: Gaetan Nadon Date: Tue Oct 27 15:07:25 2009 -0400 Deploy the new XORG_DEFAULT_OPTIONS #24242 This macro aggregate a number of existing macros that sets commmon X.Org components configuration options. It shields the configuration file from future changes. commit bd327d662f16987b11bbcfbda5451008da300d5e Author: Gaetan Nadon Date: Mon Oct 26 22:08:39 2009 -0400 Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 ChangeLog filename is known to Automake and requires no further coding in the makefile. commit abdc601cdbdfaf106bb94e9052e14acee5eca04b Author: Gaetan Nadon Date: Thu Oct 22 12:34:15 2009 -0400 .gitignore: use common defaults with custom section # 24239 Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. commit e3247097e61ddd8432921f8d52b73f09f6bf23c4 Author: Alan Coopersmith Date: Tue Nov 10 22:55:23 2009 -0800 xgc 1.0.2 Signed-off-by: Alan Coopersmith commit 543917eccecd94261ff3cde8f617ca2801fefcd6 Author: Alan Coopersmith Date: Tue Nov 10 22:54:08 2009 -0800 Fill in COPYING with notices from main.c & xgc.man Signed-off-by: Alan Coopersmith commit fab6c10f50649961059607ff6a43981d72e28c72 Author: Alan Coopersmith Date: Tue Nov 10 22:25:32 2009 -0800 Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS Signed-off-by: Alan Coopersmith commit 90877de1d293d9f0ec47e588a518327b43536c6e Author: Alan Coopersmith Date: Tue Nov 10 22:21:23 2009 -0800 Include more detailed xgc man page description from Solaris Signed-off-by: Alan Coopersmith commit d1abdda8c4e84b7df4927260753a8f47d027c6be Author: Alan Coopersmith Date: Thu Oct 1 14:54:24 2009 -0700 Add README with pointers to mailing lists, bugzilla, & git Signed-off-by: Alan Coopersmith commit 038f559845ac8b8b45f5a53537b011e169d45f59 Author: Paulo Cesar Pereira de Andrade Date: Wed Jan 14 19:02:22 2009 -0200 Xgc now in Technicolor Added a simple Xgc-color resources file. Corrected a bug that would prevent it from showing 100 in percent label, due to using a buffer of 3 bytes. Hardcode "test area" foreground&background to black&white. Remove a few hardcoded resource values to better work with the new resources file (some settings may require moving data from Xgc-color to Xgc, if you don't have a color display). commit cc62903f999ba0c5076861888106365e3561f775 Author: Jens Stroebel Date: Wed Jan 14 06:24:16 2009 -0800 correcting typo w. regards to XGC_CFLAGS Signed-off-by: Dan Nicholson commit 04b994830dfebfed9311f1c3714620ebbdc1f75a Author: Paulo Cesar Pereira de Andrade Date: Tue Jan 13 15:55:19 2009 -0200 Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and most gcc 4.3 and sparse warnings. commit d662fac7b6541571ab9852f4e0290d48f0e97561 Author: Peter Breitenlohner Date: Mon Nov 10 20:08:37 2008 +0100 enable VPATH build, reorganize app default files commit f964031d5f702ad17c76f7e7b1ab91efd56e0f01 Author: James Cloos Date: Wed Aug 20 10:32:51 2008 -0400 xaw8 is gone, use xaw7 commit 16f631981143cdac06f3b7125c8ef2fb45962970 Author: Jeremy Huddleston Date: Thu Mar 27 20:08:02 2008 -0700 Build fix for file systems that are not case sensitive commit a269f72e27d1bc368b6ecc5bc076f6f4e08bc1c2 Author: Alan Coopersmith Date: Tue Jan 22 16:02:26 2008 -0800 Change xgc_CFLAGS to AM_CFLAGS to make automake-1.10 happier Makefile.am:29: compiling `choice.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.ac' commit 8b87daa805cd684eb765872a73c6981eb90fcf9f Author: Alan Coopersmith Date: Tue Jan 22 16:01:11 2008 -0800 Bug 14185: MAINTAINERCLEANFILES multiply defined in Makefile.am commit fa7c9e5a92664b214f2787d07ce8737df75e8e85 Author: James Cloos Date: Thu Dec 6 16:37:17 2007 -0500 Replace static ChangeLog with dist-hook to generate from git log commit 39311d4f5de1648379dbb0d954090ff6ee82f80f Author: James Cloos Date: Mon Sep 3 05:51:25 2007 -0400 Add *~ to .gitignore to skip patch/emacs droppings commit a45aff7c0231080087f15707a0628f71cef60adf Author: James Cloos Date: Thu Aug 23 19:24:51 2007 -0400 Rename .cvsignore to .gitignore commit c31f20376c03da9395d6ab4bd46423ffe55d15df Author: Kevin E Martin Date: Wed Dec 21 02:29:50 2005 +0000 Update package version for X11R7 release. commit 3371db03f5ee610d5b4538b3c8206775ca8c4aea Author: Adam Jackson Date: Mon Dec 19 16:22:44 2005 +0000 Stub COPYING files commit 225fada87719040b7da4a4a4cf7651704d5f4203 Author: Kevin E Martin Date: Thu Dec 15 00:24:07 2005 +0000 Update package version number for final X11R7 release candidate. commit 62a334ff8c8ad8aac1800096a65885cadc0e4857 Author: Kevin E Martin Date: Wed Dec 7 16:18:00 2005 +0000 Change to use the app-defaults default dir configured in libXt. commit 676cb92b59b998681eec1f94e549b131357f5f4a Author: Kevin E Martin Date: Tue Dec 6 22:48:22 2005 +0000 Change *man_SOURCES ==> *man_PRE to fix autotools warnings. commit eda7026e7b05b60d028acac0adaa95fff5136cf5 Author: Kevin E Martin Date: Sat Dec 3 05:49:24 2005 +0000 Update package version number for X11R7 RC3 release. commit 5dfb2831c12bfbeff3f8f54f27f4d8f0e35c3134 Author: Alan Coopersmith Date: Mon Nov 28 22:01:42 2005 +0000 Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4 update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir) commit ac983da50c30042cd3c408b8fb6125d20009b274 Author: Eric Anholt Date: Mon Nov 21 10:35:01 2005 +0000 Another pass at .cvsignores for apps. commit 24ade0e366b9dd681c8956005853dd86d14e9623 Author: Eric Anholt Date: Sun Nov 20 22:08:53 2005 +0000 Add/improve .cvsignore files for apps. commit 9e1414070bef650f18e326fcd1427f8e2b9c7d7d Author: Kevin E Martin Date: Wed Oct 19 02:47:54 2005 +0000 Update package version number for RC1 release. commit 677a1f2616a47bec64bddf2d7424551dbf9bcae3 Author: Alan Coopersmith Date: Tue Oct 18 00:32:54 2005 +0000 Change default install dir for app-default files from $(sysconfdir)/X11/app-defaults to $(libdir)/X11/app-defaults to match the monolith & allow localization commit e76fafcfd736eb3a0ee87ad5ba9b51a5e8e8649c Author: Alan Coopersmith Date: Mon Oct 17 23:56:22 2005 +0000 Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to work better with BSD make commit 68cf52e97a8f3051eb515847f6274998af4e8037 Author: Kevin E Martin Date: Sat Oct 15 19:22:35 2005 +0000 Have generated files be cleaned by maintainer in order to pass check-tarball test. commit 64d7716266320d32acd3c804060a587623e4f054 Author: Alan Coopersmith Date: Fri Oct 14 00:25:45 2005 +0000 Use sed to fill in variables in man page commit da90b92a612915f9d7053015025785e338ee7a0c Author: Keith Packard Date: Tue Aug 2 18:10:32 2005 +0000 Mark generated files as BUILT_SOURCES and CLEANFILES to ensure they are regenerated after 'make clean' and to make parallel builds work right. commit dea36bb8cdeed1629110cbc407fdb18482d59651 Author: Keith Packard Date: Mon Aug 1 22:20:34 2005 +0000 dont initialize yylineno in case the lex variant defines it separately (as flex does) commit ead3a2dc87122b8d6af79efe719362e2d7d4d697 Author: Alan Coopersmith Date: Mon Aug 1 20:25:30 2005 +0000 Install man pages to section 1 instead of section m (Patch from Donnie Berkholz) commit 97cfe91fdcc59406eba5fb2f085362593ea84e72 Author: Alan Coopersmith Date: Sat Jul 30 21:07:26 2005 +0000 Add prototypes of Xalloc/free functions. Export ImUtil.h to match modular tree install. Define SVR4 to 1 to avoid warning about redefining to different values. Include missing headers to clear more compiler warnings. commit c6e2c72275eeb266abecc5273fb3257f45e71687 Author: Kevin E Martin Date: Fri Jul 29 21:22:34 2005 +0000 Various changes preparing packages for RC0: - Verify and update package version numbers as needed - Implement versioning scheme - Change bug address to point to bugzilla bug entry form - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to reenable it) - Fix makedepend to use pkgconfig and pass distcheck - Update build script to build macros first - Update modular Xorg version commit afa5fe1308479c6605c59922b1c61183f259a154 Author: Alan Coopersmith Date: Tue Jul 26 15:44:02 2005 +0000 Replace more GNU make-ism's with more portable macros commit 18b73d71673d73bfb03b238bc20e50ebf2ae48e8 Author: Matthieu Herrb Date: Sat Jul 23 16:33:41 2005 +0000 Fix GNU-make only app-defaults rule commit e32351b3b39517f94e976062f91403a154488359 Author: Adam Jackson Date: Wed Jul 20 19:31:57 2005 +0000 Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global configure cache, you cache it, and the cached value is probably wrong. commit 23e06fb205c2494dc8c44e976e27ca0a30c30ed2 Author: Søren Sandmann Pedersen Date: Thu Jul 14 22:40:16 2005 +0000 Add _BSD_SOURCE to lots of applications - patch from Stefan Dirsch commit 07ed043059d5fc7e8d694f6814eb1ba63946d646 Author: Søren Sandmann Pedersen Date: Tue Jul 5 21:11:37 2005 +0000 Add build system for xgc commit ace744607cc888bafb3ba487a11785fd46b65818 Author: Egbert Eich Date: Fri Apr 23 19:54:48 2004 +0000 Merging XORG-CURRENT into trunk commit 2d5c3705b18672d88db46343c3a55b1768aaeaee Author: Egbert Eich Date: Sun Mar 14 08:35:24 2004 +0000 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 commit ce3e739625e75b9caf59f0a2e0290e3528f0cc8a Author: Egbert Eich Date: Wed Mar 3 12:13:08 2004 +0000 Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 commit 8f8ef8a10885b51d38ef4aad7b36af5897f90e7b Author: Egbert Eich Date: Thu Feb 26 13:36:24 2004 +0000 readding XFree86's cvs IDs commit 40d4328f4b4e1a70a227d2359532a667d79cee1c Author: Egbert Eich Date: Thu Feb 26 09:24:08 2004 +0000 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 commit c059776a3a8a7c760799d1a55c1a130c2179ecc9 Author: Kaleb Keithley Date: Tue Nov 25 19:29:13 2003 +0000 XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks commit e3dfd7a6398174ae8db6a1c0d5e5590d1dabcf31 Author: Kaleb Keithley Date: Fri Nov 14 16:49:22 2003 +0000 XFree86 4.3.0.1 commit 82a6e01af6c39e22855495b912c23efddfb17224 Author: Kaleb Keithley Date: Fri Nov 14 16:49:22 2003 +0000 Initial revision x11-apps-7.7+5+nmu1ubuntu1/xgc/tile0000664000000000000000000000056512514123556013644 0ustar #if !defined(tile_width) && !defined(tile_height) #define tile_width 16 #define tile_height 16 #ifdef DEFINE_TILE static unsigned char tile_bits[] = { 0xff, 0x80, 0xfc, 0x80, 0x70, 0xc0, 0xc0, 0xc0, 0xe0, 0xe3, 0xe0, 0xef, 0xf0, 0xff, 0xf0, 0xdf, 0xfb, 0x0f, 0xff, 0x0f, 0xf7, 0x07, 0xc7, 0x07, 0x03, 0x03, 0x03, 0x0e, 0x01, 0x3f, 0x01, 0xff}; #endif #endif x11-apps-7.7+5+nmu1ubuntu1/xgc/constants.h0000664000000000000000000000327112514123556015146 0ustar /* ** xgc ** ** constants.h ** ** Lots of constants which many files need. */ /* Find the max of two numbers */ #ifndef max #define max(x,y) (((x)>(y))?(x):(y)) #endif #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #define MAXCHOICES 16 /* Max # of choices for any option */ #define Black BlackPixel(X.dpy,0) #define White WhitePixel(X.dpy,0) #define CopyArea 0 /* different tests */ #define CopyPlane 1 #define PolyPoint 2 #define PolyLine 3 #define PolySegment 4 #define PolyRectangle 5 #define PolyArc 6 #define FillPolygon 7 #define PolyFillRect 8 #define PolyFillArc 9 #define PutImage 10 #define GetImage 11 #define PolyText8 12 #define ImageText8 13 #define PolyText16 14 #define ImageText16 15 #define CFunction 0 /* different GC things you can choose */ #define CLinestyle 1 #define CCapstyle 2 #define CJoinstyle 3 #define CFillstyle 4 #define CFillrule 5 #define CArcmode 6 #define NUMCHOICES 7 #define CTest 7 #define TLineWidth 0 /* different editable text widgets */ #define TFont 1 #define TForeground 2 #define TBackground 3 #define NUMTEXTWIDGETS 4 #define StartTimer 0 /* flags for timing tests */ #define EndTimer 1 #define start_timer() timer(StartTimer) #define end_timer() timer(EndTimer) /* the number of toggle widgets in various groups */ #define NUM_TESTS 16 #define NUM_FUNCTIONS 16 #define NUM_LINESTYLES 3 #define NUM_CAPSTYLES 4 #define NUM_JOINSTYLES 3 #define NUM_FILLSTYLES 4 #define NUM_FILLRULES 2 #define NUM_ARCMODES 2 /* The number of bits in the dash description */ #define DASHLENGTH 8 x11-apps-7.7+5+nmu1ubuntu1/xgc/testfrac.c0000664000000000000000000001236412514123556014743 0ustar /* ** testfrac.c ** ** How to make a widget to choose the fraction of tests to be run. ** */ #include #include #include #include #include #include #include "xgc.h" #define SCROLLBAR_LENGTH 125 #define SLIDER_LENGTH 0.2 /* proportion of scrollbar taken up by the slider */ static Widget label; /* the label */ static Widget slider; /* the scrollbar */ static Widget percent; /* label with chosen percentage */ static float fraction; /* what percent has been chosen */ static int oldpercent = -1; /* so we only update when the slider has been moved */ /* slider_jump(w,data,position) ** ---------------------------- ** This function is called if the user moves the scrollbar to a new ** position (generally, by using the middle button). It updates ** information about where the scrollbar is. */ /*ARGSUSED*/ static void slider_jump(Widget w, caddr_t data, caddr_t position) { static Arg percentargs[] = { {XtNlabel, (XtArgVal) NULL} }; float oldpercent; /* where the scrollbar is */ float newpercent; /* normalized scrollbar */ char snewpercent[4]; /* string representation of scrollbar */ oldpercent = *(float *) position; /* We want the scrollbar to be at 100% when the right edge of the slider ** hits the end of the scrollbar, not the left edge. When the right edge ** is at 1.0, the left edge is at 1.0 - SLIDER_LENGTH. Normalize ** accordingly. */ newpercent = oldpercent / (1.0 - SLIDER_LENGTH); /* If the slider's partially out of the scrollbar, move it back in. */ if (newpercent > 1.0) { newpercent = 1.0; XawScrollbarSetThumb( slider, 1.0 - SLIDER_LENGTH, SLIDER_LENGTH); } /* Store the position of the silder where it can be found */ *(float *)data = newpercent; /* Update the label widget */ snprintf(snewpercent, sizeof snewpercent, "%d",(int)(newpercent*100)); percentargs[0].value = (XtArgVal) snewpercent; XtSetValues(percent, percentargs, XtNumber(percentargs)); } /* slider_scroll(w,data,position) ** ------------------------------ ** This function is called when the user does incremental scrolling, ** generally with the left or right button. Right now it just ignores it. */ /*ARGSUSED*/ static void slider_scroll(Widget w, caddr_t data, caddr_t position) { } /*ARGSUSED*/ static void update(Widget w, XEvent *event, String *params, int *num_params) { char buf[80]; int newpercent; newpercent = (int)(fraction * 100.0); if (newpercent != oldpercent) { snprintf(buf, sizeof buf, "percent %d\n", (int)(fraction * 100.0)); interpret(buf); oldpercent = newpercent; } } /* create_testfrac_choice(w) ** ------------------------- ** Inside w (a form widget), creates: ** 1. A label "Percentage of Test" ** 2. A scrollbar for the user to choose the percentage (from 0 to 100) ** 3. A label with the current percentage displayed on it. ** The percentage starts at 100. ** ** When the pointer leaves the scrollbar, a string is sent to interpret() ** so that it knows the position of the scrollbar. */ void create_testfrac_choice(Widget w) { static XtCallbackRec jumpcallbacks[] = { {(XtCallbackProc) slider_jump, NULL}, {NULL, NULL} }; static XtCallbackRec scrollcallbacks[] = { {(XtCallbackProc) slider_scroll, NULL}, {NULL, NULL} }; static Arg labelargs[] = { {XtNborderWidth, (XtArgVal) 0}, {XtNjustify, (XtArgVal) XtJustifyRight}, {XtNvertDistance, (XtArgVal) 4} }; static Arg percentargs[] = { {XtNhorizDistance, (XtArgVal) 10}, {XtNfromHoriz, (XtArgVal) NULL} }; static Arg scrollargs[] = { {XtNorientation, (XtArgVal) XtorientHorizontal}, {XtNlength, (XtArgVal) SCROLLBAR_LENGTH}, {XtNthickness, (XtArgVal) 10}, {XtNshown, (XtArgVal) 10}, {XtNhorizDistance, (XtArgVal) 10}, {XtNfromHoriz, (XtArgVal) NULL}, {XtNjumpProc, (XtArgVal) NULL}, {XtNscrollProc, (XtArgVal) NULL} }; static const char *translationtable = ": Update()"; static XtActionsRec actiontable[] = { {"Update", (XtActionProc) update}, {NULL, NULL} }; /* Let the scrollbar know where to store information where we ** can see it */ jumpcallbacks[0].closure = (caddr_t) &fraction; label = XtCreateManagedWidget("Percentage of Test",labelWidgetClass,w, labelargs,XtNumber(labelargs)); percentargs[1].value = (XtArgVal) label; percent = XtCreateManagedWidget("100",labelWidgetClass,w, percentargs,XtNumber(percentargs)); scrollargs[5].value = (XtArgVal) percent; scrollargs[6].value = (XtArgVal) jumpcallbacks; scrollargs[7].value = (XtArgVal) scrollcallbacks; slider = XtCreateManagedWidget("Slider",scrollbarWidgetClass,w, scrollargs,XtNumber(scrollargs)); XtAppAddActions(appcontext,actiontable,XtNumber(actiontable)); XtOverrideTranslations(slider,XtParseTranslationTable(translationtable)); /* Start the thumb out at 100% */ XawScrollbarSetThumb(slider, 1.0 - SLIDER_LENGTH, SLIDER_LENGTH); } void update_slider(int newpercent) { fraction = (float) newpercent / 100.0; XawScrollbarSetThumb(slider, fraction / (1.0-SLIDER_LENGTH), SLIDER_LENGTH); } x11-apps-7.7+5+nmu1ubuntu1/xgc/depcomp0000755000000000000000000005601612656634667014362 0ustar #! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xgc/config.guess0000775000000000000000000012367212514123564015310 0ustar #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-11-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xgc/interpret.c0000664000000000000000000002206012514123556015136 0ustar /* ** interpret.c ** ** interprets and executes lines in the Xgc syntax. */ #include #include #include #include #include "xgc.h" #include "tile" /* interpret(string) ** ----------------- ** Takes string, which is a line written in the xgc syntax, figures ** out what it means, and passes the buck to the right procedure. ** That procedure gets called with feedback set to FALSE; interpret() ** is only called if the user is selecting things interactively. ** ** This procedure will go away when I can figure out how to make yacc ** and lex read from strings as well as files. */ void interpret(const char *string) { char word1[20], word2[80]; int i; sscanf(string,"%s",word1); if (!strcmp(word1,"run")) run_test(); else { sscanf(string,"%s %s",word1,word2); print_if_recording(string); /* So word1 is the first word on the line and word2 is the second. Now the fun begins... */ if (!strcmp(word1,TestStuff.choice.text)) { for (i=0;i XXX_XXX_ => [3,1,3,1] */ void GC_change_dashlist(int dashlist, Boolean feedback) { char dasharray[DASHLENGTH]; /* what we're gonna pass to XSetDashes */ int dashnumber = 0; /* which element of dasharray we're currently modifying */ int i; /* which bit of the dashlist we're on */ int state = 1; /* whether the list bit we checked was on (1) or off (0) */ /* Initialize the dasharray */ for (i = 0; i < DASHLENGTH; ++i) dasharray[i] = 0; if (dashlist == 0) return; /* having no dashes at all is bogus */ /* XSetDashes expects the dashlist to start with an on bit, so if it ** doesn't, we keep on rotating it until it does */ while (!(dashlist&1)) dashlist /= 2; /* Go through all the bits in dashlist, and update the dasharray ** accordingly */ for (i = 0; i < DASHLENGTH; ++i) { /* the following if statements checks to see if the bit we're looking ** at as the same on or offness as the one before it (state). If ** so, we increment the length of the current dash. */ if (((dashlist&1< 100) return; X.percent = (float) percent / 100.0; if (feedback) update_slider(percent); } x11-apps-7.7+5+nmu1ubuntu1/xgc/tests.c0000664000000000000000000003664412514123556014301 0ustar /* ** */ #include #include #include #include #include #include #include #include "xgc.h" #ifdef SVR4 #define SYSV #endif #if !defined(SYSV) && !defined(QNX4) #include #endif #ifndef PI #define PI 3.14159265 #endif #ifdef SYSV #define random lrand48 #endif /* timer(flag) ** ----------- ** When called with StartTimer, starts the stopwatch and returns nothing. ** When called with EndTimer, stops the stopwatch and returns the time ** in microseconds since it started. ** ** Uses rusage() so we can subtract the time used by the system and user ** from our timer, and just concentrate on the time used in the X calls. */ static long timer(int flag) { #if !defined(SYSV) static struct timeval starttime; /* starting time for gettimeofday() */ struct timeval endtime; /* ending time for gettimeofday() */ #if !defined(__UNIXOS2__) && !defined(QNX4) static struct rusage startusage; /* starting time for getrusage() */ struct rusage endusage; /* ending time for getrusage() */ #endif struct timezone tz; /* to make gettimeofday() happy */ long elapsedtime; /* how long since we started the timer */ switch (flag) { case StartTimer: /* store initial values */ gettimeofday(&starttime,&tz); #if !defined(__UNIXOS2__) && !defined(QNX4) getrusage(RUSAGE_SELF,&startusage); #endif return((long) NULL); case EndTimer: gettimeofday(&endtime,&tz); /* store final values */ #if !defined(__UNIXOS2__) && !defined(QNX4) getrusage(RUSAGE_SELF,&endusage); #endif /* all the following line does is use the formula elapsed time = ending time - starting time, but there are three different timers and two different units of time, ack... */ #if !defined(__UNIXOS2__) && !defined(QNX4) elapsedtime = (long) ((long) ((endtime.tv_sec - endusage.ru_utime.tv_sec - endusage.ru_stime.tv_sec - starttime.tv_sec + startusage.ru_utime.tv_sec + startusage.ru_stime.tv_sec)) * 1000000) + (long) ((endtime.tv_usec - endusage.ru_utime.tv_usec - endusage.ru_stime.tv_usec - starttime.tv_usec + startusage.ru_utime.tv_usec + startusage.ru_stime.tv_usec)); #else elapsedtime = (long)( ((long)endtime.tv_sec-(long)starttime.tv_sec)*1000000 +((long)endtime.tv_usec-(long)starttime.tv_usec)); #endif return(elapsedtime); default: fprintf(stderr,"Invalid flag in timer()\n"); return((long) NULL); } #else static time_t starttime; switch (flag) { case StartTimer: time(&starttime); return((long) NULL); case EndTimer: return( (time(NULL) - starttime) * 1000000); default: fprintf(stderr,"Invalid flag in timer()\n"); return((long) NULL); } #endif } void copyarea_test(void) { int num_copies = 200; int i; long totaltime; char buf[80]; num_copies *= X.percent; XSetFillStyle(X.dpy,X.miscgc,FillTiled); XFillRectangle(X.dpy,X.win,X.miscgc,0,0,400,400); XSync(X.dpy,0); timer(StartTimer); for (i=0;i #include #include #include #include #include #include #include #include "xgc.h" static void start_recording(void); static void stop_recording(void); static void print_out_gc_values(void); static void chose_playback_filename(void); static void cancel_playback(void); static void done_choosing_filename(void) ; static void cancel_record(void); FILE *recordfile; /* the file we're recording to */ FILE *playbackfile; /* the file we're playing back from */ /* toggle_recordbutton(w,closure,call_data) ** ---------------------------------------- ** This function is called when the user presses the "Record" ** command button. If we're not recording, we start; if we are, ** we stop. Also change the label to reflect the change in the ** function of the button. */ /*ARGSUSED*/ void toggle_recordbutton(Widget w, caddr_t closure, caddr_t call_data) { /* ArgList for changing the label */ static Arg recordargs[] = { {XtNlabel, (XtArgVal) NULL} }; char tmp[20]; /* new label */ if (!recording) { start_recording(); } else { recording = FALSE; stop_recording(); snprintf(tmp, sizeof tmp, "Record"); recordargs[0].value = (XtArgVal) tmp; } XtSetValues(recordbutton,recordargs,XtNumber(recordargs)); } /* start_recording() ** ----------------- ** Get the name of the file the user wants to record into, and ** start recording into it if he doesn't cancel. */ static void start_recording(void) { get_filename(done_choosing_filename,cancel_record); } /* stop_recording() ** ---------------- ** Close the output file. */ static void stop_recording(void) { fclose(recordfile); } /* cancel_record() ** --------------- ** What to do if the if the user canceled recording, i.e. nothing. */ static void cancel_record(void) { } /* done_choosing_filename() ** ------------------------ ** What to do after the user's chosen a file. Change the label on the ** command button, open the file, and dump the current contents of the ** GC into it. */ static void done_choosing_filename(void) { static Arg recordargs[] = { {XtNlabel, (XtArgVal) NULL}, {XtNresize, (XtArgVal) True} }; Arg args[1]; char tmp[20], *filename; XtSetArg(args[0], XtNstring, &filename); XtGetValues(filename_text_widget, args, (Cardinal) 1); if ((recordfile = fopen(filename,"w")) != NULL) { recording = TRUE; snprintf(tmp, sizeof tmp, "End Record"); recordargs[0].value = (XtArgVal) tmp; XtSetValues(recordbutton,recordargs,XtNumber(recordargs)); print_out_gc_values(); } } /* print_if_recording(str) ** ----------------------- ** If we're recording to a file, put str in it. */ void print_if_recording(const char *str) { if (recording) fprintf(recordfile,"%s",str); } /* close_file_if_recording() ** ------------------------- ** If we're recording, stop. */ void close_file_if_recording(void) { if (recording) fclose(recordfile); } /* print_out_gc_values() ** --------------------- ** Dump the contents of the GC to the file, so that when the file gets ** played back, it will be correctly initialized. */ static void print_out_gc_values(void) { int i; for (i=0;i header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Major version of this package */ #undef PACKAGE_VERSION_MAJOR /* Minor version of this package */ #undef PACKAGE_VERSION_MINOR /* Patch version of this package */ #undef PACKAGE_VERSION_PATCHLEVEL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER x11-apps-7.7+5+nmu1ubuntu1/xgc/ylwrap0000755000000000000000000001531212656634667014243 0ustar #! /bin/sh # ylwrap - wrapper for lex/yacc invocations. scriptversion=2013-01-12.17; # UTC # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . get_dirname () { case $1 in */*|*\\*) printf '%s\n' "$1" | sed -e 's|\([\\/]\)[^\\/]*$|\1|';; # Otherwise, we want the empty string (not "."). esac } # guard FILE # ---------- # The CPP macro used to guard inclusion of FILE. guard () { printf '%s\n' "$1" \ | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g' \ -e 's/__*/_/g' } # quote_for_sed [STRING] # ---------------------- # Return STRING (or stdin) quoted to be used as a sed pattern. quote_for_sed () { case $# in 0) cat;; 1) printf '%s\n' "$1";; esac \ | sed -e 's|[][\\.*]|\\&|g' } case "$1" in '') echo "$0: No files given. Try '$0 --help' for more information." 1>&2 exit 1 ;; --basedir) basedir=$2 shift 2 ;; -h|--h*) cat <<\EOF Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... Wrapper for lex/yacc invocations, renaming files as desired. INPUT is the input file OUTPUT is one file PROG generates DESIRED is the file we actually want instead of OUTPUT PROGRAM is program to run ARGS are passed to PROG Any number of OUTPUT,DESIRED pairs may be used. Report bugs to . EOF exit $? ;; -v|--v*) echo "ylwrap $scriptversion" exit $? ;; esac # The input. input=$1 shift # We'll later need for a correct munging of "#line" directives. input_sub_rx=`get_dirname "$input" | quote_for_sed` case $input in [\\/]* | ?:[\\/]*) # Absolute path; do nothing. ;; *) # Relative path. Make it absolute. input=`pwd`/$input ;; esac input_rx=`get_dirname "$input" | quote_for_sed` # Since DOS filename conventions don't allow two dots, # the DOS version of Bison writes out y_tab.c instead of y.tab.c # and y_tab.h instead of y.tab.h. Test to see if this is the case. y_tab_nodot=false if test -f y_tab.c || test -f y_tab.h; then y_tab_nodot=true fi # The parser itself, the first file, is the destination of the .y.c # rule in the Makefile. parser=$1 # A sed program to s/FROM/TO/g for all the FROM/TO so that, for # instance, we rename #include "y.tab.h" into #include "parse.h" # during the conversion from y.tab.c to parse.c. sed_fix_filenames= # Also rename header guards, as Bison 2.7 for instance uses its header # guard in its implementation file. sed_fix_header_guards= while test $# -ne 0; do if test x"$1" = x"--"; then shift break fi from=$1 # Handle y_tab.c and y_tab.h output by DOS if $y_tab_nodot; then case $from in "y.tab.c") from=y_tab.c;; "y.tab.h") from=y_tab.h;; esac fi shift to=$1 shift sed_fix_filenames="${sed_fix_filenames}s|"`quote_for_sed "$from"`"|$to|g;" sed_fix_header_guards="${sed_fix_header_guards}s|"`guard "$from"`"|"`guard "$to"`"|g;" done # The program to run. prog=$1 shift # Make any relative path in $prog absolute. case $prog in [\\/]* | ?:[\\/]*) ;; *[\\/]*) prog=`pwd`/$prog ;; esac dirname=ylwrap$$ do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 mkdir $dirname || exit 1 cd $dirname case $# in 0) "$prog" "$input" ;; *) "$prog" "$@" "$input" ;; esac ret=$? if test $ret -eq 0; then for from in * do to=`printf '%s\n' "$from" | sed "$sed_fix_filenames"` if test -f "$from"; then # If $2 is an absolute path name, then just use that, # otherwise prepend '../'. case $to in [\\/]* | ?:[\\/]*) target=$to;; *) target=../$to;; esac # Do not overwrite unchanged header files to avoid useless # recompilations. Always update the parser itself: it is the # destination of the .y.c rule in the Makefile. Divert the # output of all other files to a temporary file so we can # compare them to existing versions. if test $from != $parser; then realtarget=$target target=tmp-`printf '%s\n' "$target" | sed 's|.*[\\/]||g'` fi # Munge "#line" or "#" directives. Don't let the resulting # debug information point at an absolute srcdir. Use the real # output file name, not yy.lex.c for instance. Adjust the # include guards too. sed -e "/^#/!b" \ -e "s|$input_rx|$input_sub_rx|" \ -e "$sed_fix_filenames" \ -e "$sed_fix_header_guards" \ "$from" >"$target" || ret=$? # Check whether files must be updated. if test "$from" != "$parser"; then if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then echo "$to is unchanged" rm -f "$target" else echo "updating $to" mv -f "$target" "$realtarget" fi fi else # A missing file is only an error for the parser. This is a # blatant hack to let us support using "yacc -d". If -d is not # specified, don't fail when the header file is "missing". if test "$from" = "$parser"; then ret=1 fi fi done fi # Remove the directory. cd .. rm -rf $dirname exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xgc/gram.y0000664000000000000000000000373612514123556014107 0ustar /* ** grammar for xgc syntax */ %{ #define YYDEBUG 1 #include #include #include #include "xgc.h" extern int yylineno; %} %union { int num; char *ptr; }; %token STRING %token NUMBER %token RUN %token FUNCTION FUNCTIONTYPE %token TEST TESTTYPE %token LINESTYLE LINESTYLETYPE %token CAPSTYLE CAPSTYLETYPE %token JOINSTYLE JOINSTYLETYPE %token ROUND SOLID %token FILLSTYLE FILLSTYLETYPE %token FILLRULE FILLRULETYPE %token ARCMODE ARCMODETYPE %token FOREGROUND BACKGROUND LINEWIDTH PLANEMASK DASHLIST PERCENT %token FONT %% all : stmts ; stmts : /* empty */ | stmts '\n' | stmts stmt '\n' ; stmt : error | RUN { run_test(); } | TEST TESTTYPE { change_test ($2, TRUE); } | FUNCTION FUNCTIONTYPE { GC_change_function ($2, TRUE); } | LINESTYLE LINESTYLETYPE { GC_change_linestyle ($2, TRUE); } | LINESTYLE SOLID { GC_change_linestyle (LineSolid, TRUE); } | CAPSTYLE CAPSTYLETYPE { GC_change_capstyle ($2, TRUE); } | CAPSTYLE ROUND { GC_change_capstyle (CapRound, TRUE); } | JOINSTYLE JOINSTYLETYPE { GC_change_joinstyle ($2, TRUE); } | JOINSTYLE ROUND { GC_change_joinstyle (JoinRound, TRUE); } | FILLSTYLE FILLSTYLETYPE { GC_change_fillstyle ($2, TRUE); } | FILLSTYLE SOLID { GC_change_fillstyle (FillSolid, TRUE); } | FILLRULE FILLRULETYPE { GC_change_fillrule ($2, TRUE); } | ARCMODE ARCMODETYPE { GC_change_arcmode ($2, TRUE); } | FOREGROUND NUMBER { GC_change_foreground ($2, TRUE); } | BACKGROUND NUMBER { GC_change_background ($2, TRUE); } | LINEWIDTH NUMBER { GC_change_linewidth ($2, TRUE); } | PLANEMASK NUMBER { GC_change_planemask ($2, TRUE); } | DASHLIST NUMBER { GC_change_dashlist ($2, TRUE); } | FONT STRING { GC_change_font ($2, TRUE); } | PERCENT NUMBER { change_percent ($2, TRUE); } ; %% void yyerror(const char *s) { fprintf(stderr, "xgc: syntax error, line %d\n", yylineno); } x11-apps-7.7+5+nmu1ubuntu1/xgc/dashlist.c0000664000000000000000000001155312514123556014742 0ustar /* ** dashlist.c ** ** How to make a widget to choose a dashlist. ** ** NOTE: This file uses static variables. Therefore, trying to use these ** functions to create more than one of these dashlist choice things ** will fail in a big way. */ #include #include #include #include #include #include #include #include #include "xgc.h" static void change_dashlist(Widget, caddr_t, caddr_t); static short dashlist = 240; /* in binary, becomes the dashlist (240 = XXXX____) */ static Widget *dashes; /* the toggle widgets */ /* create_dashlist_choice(w) ** ------------------------- ** Inside w (a form widget), creates a bunch of little toggle buttons ** in a row, representing the dash list. There's also a label so ** the user knows what it is. */ void create_dashlist_choice(Widget w) { /* callback list for the toggle widgets */ static XtCallbackRec callbacklist[] = { {(XtCallbackProc) change_dashlist, NULL}, {NULL, NULL} }; /* ArgList for the label */ static Arg labelargs[] = { {XtNborderWidth, (XtArgVal) 0}, {XtNjustify, (XtArgVal) XtJustifyRight}, {XtNvertDistance, (XtArgVal) 4} }; /* ArgList for the toggles */ static Arg dashargs[] = { {XtNcallback, (XtArgVal) NULL}, {XtNhorizDistance, (XtArgVal) NULL}, {XtNfromHoriz, (XtArgVal) NULL}, {XtNwidth, (XtArgVal) 10}, {XtNheight, (XtArgVal) 10}, {XtNhighlightThickness, (XtArgVal) 1}, {XtNstate, (XtArgVal) False}, {XtNlabel, (XtArgVal) ""} }; static Widget label; /* the label, of course */ static int *dashinfo; /* contains integers saying which bit a particular button is; sent to change_dashlist to tell it which bit got changed */ int i; /* counter */ char name[11]; /* allocate space for stuff that we don't know the size of yet */ dashes = (Widget *) malloc(DASHLENGTH * sizeof(Widget)); dashinfo = (int *) malloc(DASHLENGTH * sizeof(int)); /* make the label widget */ label = XtCreateManagedWidget("dashlist",labelWidgetClass,w, labelargs,XtNumber(labelargs)); dashargs[0].value = (XtArgVal) callbacklist; for (i=0;i #include #include #include #include #include #include #include #include "xgc.h" static void choose_plane(Widget, caddr_t, caddr_t); static unsigned long planemask; static Widget *pm; /* create_planemask_choice(w) ** ------------------------- ** Inside w (a form widget), creates a bunch of little toggle buttons ** in a row, representing the planemask. There's also a label so ** the user knows what it is. */ void create_planemask_choice(Widget w) { /* callback list for the toggle widgets */ static XtCallbackRec callbacklist[] = { {(XtCallbackProc) choose_plane, NULL}, {NULL, NULL} }; /* ArgList for the label */ static Arg labelargs[] = { {XtNborderWidth, (XtArgVal) 0}, {XtNjustify, (XtArgVal) XtJustifyRight}, {XtNvertDistance, (XtArgVal) 4} }; /* ArgList for the toggles */ static Arg pmargs[] = { {XtNcallback, (XtArgVal) NULL}, {XtNhorizDistance, (XtArgVal) NULL}, {XtNfromHoriz, (XtArgVal) NULL}, {XtNwidth, (XtArgVal) 10}, {XtNheight, (XtArgVal) 10}, {XtNhighlightThickness,(XtArgVal) 1}, {XtNstate, (XtArgVal) True}, {XtNlabel, (XtArgVal) ""} }; static Widget label; /* the label, of course */ static int *pminfo; /* contains integers saying which bit a particular button is; sent to choose_plane to tell it which bit got changed */ int i, num_planes; char buf[40]; char name[12]; num_planes = PlanesOfScreen(X.scr); planemask = (1< $@ x11-apps-7.7+5+nmu1ubuntu1/xgc/config.sub0000775000000000000000000010622312514123564014744 0ustar #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-12-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: x11-apps-7.7+5+nmu1ubuntu1/xgc/gram.h0000664000000000000000000000645112514123575014064 0ustar /* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { STRING = 258, NUMBER = 259, RUN = 260, FUNCTION = 261, FUNCTIONTYPE = 262, TEST = 263, TESTTYPE = 264, LINESTYLE = 265, LINESTYLETYPE = 266, CAPSTYLE = 267, CAPSTYLETYPE = 268, JOINSTYLE = 269, JOINSTYLETYPE = 270, ROUND = 271, SOLID = 272, FILLSTYLE = 273, FILLSTYLETYPE = 274, FILLRULE = 275, FILLRULETYPE = 276, ARCMODE = 277, ARCMODETYPE = 278, FOREGROUND = 279, BACKGROUND = 280, LINEWIDTH = 281, PLANEMASK = 282, DASHLIST = 283, PERCENT = 284, FONT = 285 }; #endif /* Tokens. */ #define STRING 258 #define NUMBER 259 #define RUN 260 #define FUNCTION 261 #define FUNCTIONTYPE 262 #define TEST 263 #define TESTTYPE 264 #define LINESTYLE 265 #define LINESTYLETYPE 266 #define CAPSTYLE 267 #define CAPSTYLETYPE 268 #define JOINSTYLE 269 #define JOINSTYLETYPE 270 #define ROUND 271 #define SOLID 272 #define FILLSTYLE 273 #define FILLSTYLETYPE 274 #define FILLRULE 275 #define FILLRULETYPE 276 #define ARCMODE 277 #define ARCMODETYPE 278 #define FOREGROUND 279 #define BACKGROUND 280 #define LINEWIDTH 281 #define PLANEMASK 282 #define DASHLIST 283 #define PERCENT 284 #define FONT 285 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE #line 18 "gram.y" { int num; char *ptr; } /* Line 1489 of yacc.c. */ #line 114 "gram.h" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif extern YYSTYPE yylval; x11-apps-7.7+5+nmu1ubuntu1/xgc/Makefile.am0000664000000000000000000000410412514123556015011 0ustar # # Copyright 2005 Red Hat, Inc. # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of Red Hat not be used in # advertising or publicity pertaining to distribution of the software without # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. # # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. AM_YFLAGS = -d SUBDIRS = man bin_PROGRAMS = xgc AM_CFLAGS = $(CWARNFLAGS) $(XGC_CFLAGS) -D_BSD_SOURCE xgc_LDADD = $(XGC_LIBS) -lm xgc_SOURCES = \ choice.c \ constants.h \ dashlist.c \ getfile.c \ gram.y \ interpret.c \ lex.l \ main.c \ planemask.c \ record.c \ testfrac.c \ tests.c \ text.c \ xgc.h BUILT_SOURCES = gram.h MAINTAINERCLEANFILES = ChangeLog INSTALL # App default files DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ dist_appdefault_DATA = \ app-defaults/Xgc \ app-defaults/Xgc-color EXTRA_DIST = tile Bugs \ Written/FilledRects \ Written/Interface \ Written/Jim \ Written/Notes \ Written/Notes2 \ Written/Outline \ Written/Widget .PHONY: ChangeLog INSTALL INSTALL: $(INSTALL_CMD) ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL x11-apps-7.7+5+nmu1ubuntu1/xgc/xgc.h0000664000000000000000000001162712514123556013717 0ustar /* ** xgc ** ** xgc.h */ #include "constants.h" typedef struct { Display *dpy; /* the display! */ Screen *scr; /* the screen! */ Window win; /* the window the test runs in */ GC gc; /* the GC! */ GC miscgc; /* used for doing stuff when we don't want to change the normal GC */ XGCValues gcv; /* a separate copy of what's in the GC, since we're not allowed to look in it */ Pixmap tile; /* what we tile with */ Pixmap stipple; /* what we stipple with */ XImage *image; /* image for GetImage & PutImage */ int test; /* which test is being run */ float percent; /* percentage of test to run */ Pixel foreground; Pixel background; char *fontname; } XStuff; /* All the stuff that only X needs to know about */ typedef struct { char name[40]; /* name as it will appear on the screen */ char text[40]; /* Xgc command it translates to */ int num_commands; /* number of command buttons inside it */ int columns; /* how many columns of command buttons; if 0, then there's only one row */ struct { char name[40]; /* name as it will appear on the screen */ char text[40]; /* Xgc command it translates to */ } command_data[MAXCHOICES]; } ChoiceStuff; /* All the info needed to deal with a choice widget */ typedef struct { const char *name; const char *text; int code; } XgcData; typedef struct { struct { const char *name; const char *text; int num_toggles; int columns; } choice; XgcData *data; } XgcStuff; typedef struct { Widget label; int size; WidgetList widgets; } ChoiceDesc; /************/ extern XStuff X; extern Widget topform; extern XtAppContext appcontext; extern XgcStuff TestStuff; extern XgcStuff FunctionStuff; extern XgcStuff LinestyleStuff; extern XgcStuff CapstyleStuff; extern XgcStuff JoinstyleStuff; extern XgcStuff FillstyleStuff; extern XgcStuff FillruleStuff; extern XgcStuff ArcmodeStuff; extern ChoiceDesc *GCdescs[]; extern ChoiceDesc *testchoicedesc; extern Widget test; extern Widget GCform; extern Widget foregroundtext; extern Widget backgroundtext; extern Widget linewidthtext; extern Widget fonttext; extern Widget dashlistchoice; extern Widget planemaskchoice; extern Widget testchoiceform; extern Widget result; extern Boolean recording; extern Widget filename_text_widget, recordbutton; extern int fildes[2]; extern FILE *outend; extern FILE *yyin; /************/ extern void change_percent(int, Boolean); extern void change_test(int, Boolean); extern void change_text(Widget, String); extern void choose_defaults(ChoiceDesc *[], int); extern void circle_line_test(int, int); extern void close_file_if_recording(void); extern void copyarea_test(void); extern void copyplane_test(void); extern ChoiceDesc * create_choice(Widget, XgcStuff *); extern void create_dashlist_choice(Widget); extern void create_planemask_choice(Widget); extern void create_testfrac_choice(Widget); extern Widget create_text_choice(Widget, int, int, int); extern void fillpolygon_test(void); extern void GC_change_arcmode(int, Boolean); extern void GC_change_background(unsigned long, Boolean); extern void GC_change_capstyle(int, Boolean); extern void GC_change_dashlist(int, Boolean); extern void GC_change_fillrule(int, Boolean); extern void GC_change_fillstyle(int, Boolean); extern void GC_change_font(char *, Boolean); extern void GC_change_foreground(unsigned long, Boolean); extern void GC_change_function(int, Boolean); extern void GC_change_joinstyle(int, Boolean); extern void GC_change_linestyle(int, Boolean); extern void GC_change_linewidth(int, Boolean); extern void GC_change_planemask(unsigned long, Boolean); extern void genericarc_test(Boolean); extern void genericrectangle_test(Boolean); extern void get_filename(void (*)(void), void (*)(void)); extern void imagetext16_test(void); extern void imagetext8_test(void); extern void interpret(const char *); extern void line_up_labels(ChoiceDesc *[], int); extern void polyarc_test(void); extern void polyfillarc_test(void); extern void polyfillrectangle_test(void); extern void polyline_test(void); extern void polypoint_test(void); extern void polyrectangle_test(void); extern void polysegment_test(void); extern void polytext16_test(void); extern void polytext8_test(void); extern void print_if_recording(const char *); extern void putimage_test(void); extern void read_from_keyboard(void); extern void run_test(void); extern void select_button(ChoiceDesc *, int); extern void set_text(Widget, char *); extern void show_result(char *); extern void start_playback(void); extern void toggle_recordbutton(Widget, caddr_t, caddr_t); extern void update_dashlist(int); extern void update_planemask(long); extern void update_slider(int); extern void yyerror(const char *); extern int yylex(void); extern int yyparse(void); extern void yyrestart(FILE *); extern int yywrap(void); x11-apps-7.7+5+nmu1ubuntu1/xgc/main.c0000664000000000000000000004704012514123556014053 0ustar /* Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* xgc ** ** main.c ** ** Contains the bare minimum necessary to oversee the whole operation. */ #include #include #include #include #include #include #include #include #include "xgc.h" #define DEFINE_TILE #include "tile" static void fill_up_commandform(Widget); static void quit(void); static void quitAction(Widget, XEvent *, String *, Cardinal *); static void clear_test_window(void); static void clear_result_window(void); static void set_foreground_and_background(void); /* The three columns in the XgcData arrays are: ** name: the name of the toggle button ** text: the corresponding text in the xgc syntax ** code: the integer that the text corresponds to, for sending stuff ** to X calls, etc. */ static XgcData FunctionData[NUM_FUNCTIONS] = { {"clear", "clear", GXclear}, {"and", "and", GXand}, {"andReverse", "andReverse", GXandReverse}, {"copy", "copy", GXcopy}, {"andInverted", "andInverted", GXandInverted}, {"noop", "noop", GXnoop}, {"xor", "xor", GXxor}, {"or", "or", GXor}, {"nor", "nor", GXnor}, {"equiv", "equiv", GXequiv}, {"invert", "invert", GXinvert}, {"orReverse", "orReverse", GXorReverse}, {"copyInverted", "copyInverted", GXcopyInverted}, {"orInverted", "orInverted", GXorInverted}, {"nand", "nand", GXnand}, {"set", "set", GXset} }; /* The two rows in the XgcStuff structure are: ** name of label, xgc syntax text, # of toggles, # of columns of toggles ** (0 columns means 1 row, as many columns as necessary) ** appropriate XgcData */ XgcStuff FunctionStuff = { {"Function","function",NUM_FUNCTIONS,4}, FunctionData }; static XgcData TestData[NUM_TESTS] = { {"Copy Area", "CopyArea", CopyArea}, {"Copy Plane", "CopyPlane", CopyPlane}, {"Points", "PolyPoint", PolyPoint}, {"Lines", "PolyLine", PolyLine}, {"Segments", "PolySegment", PolySegment}, {"Rectangles", "PolyRectangle", PolyRectangle}, {"Arcs", "PolyArc", PolyArc}, {"(Filled Polygons)", "FillPolygon", FillPolygon}, {"Filled Rectangles", "PolyFillRect", PolyFillRect}, {"Filled Arcs", "PolyFillArc", PolyFillArc}, {"Put Image", "PutImage", PutImage}, {"(Get Image)", "GetImage", GetImage}, {"Text 8", "PolyText8", PolyText8}, {"Image Text 8", "ImageText8", ImageText8}, {"Text 16", "PolyText16", PolyText16}, {"Image Text 16", "ImageText16", ImageText16} }; XgcStuff TestStuff = { {"Test","test",NUM_TESTS,2}, TestData }; static XgcData LinestyleData[NUM_LINESTYLES] = { {"Solid", "Solid", LineSolid}, {"OnOffDash", "OnOffDash", LineOnOffDash}, {"DoubleDash", "DoubleDash", LineDoubleDash} }; XgcStuff LinestyleStuff = { {"LineStyle","linestyle",NUM_LINESTYLES,0}, LinestyleData }; static XgcData CapstyleData[NUM_CAPSTYLES] = { {"NotLast", "NotLast", CapNotLast}, {"Butt", "Butt", CapButt}, {"Round", "Round", CapRound}, {"Projecting", "Projecting", CapProjecting} }; XgcStuff CapstyleStuff = { {"CapStyle","capstyle",NUM_CAPSTYLES,2}, CapstyleData }; static XgcData JoinstyleData[NUM_JOINSTYLES] = { {"Miter", "Miter", JoinMiter}, {"Round", "Round", JoinRound}, {"Bevel", "Bevel", JoinBevel} }; XgcStuff JoinstyleStuff = { {"JoinStyle","joinstyle",NUM_JOINSTYLES,0}, JoinstyleData }; static XgcData FillstyleData[NUM_FILLSTYLES] = { {"Solid", "Solid", FillSolid}, {"Tiled", "Tiled", FillTiled}, {"Stippled", "Stippled", FillStippled}, {"OpaqueStippled", "OpaqueStippled", FillOpaqueStippled} }; XgcStuff FillstyleStuff = { {"FillStyle","fillstyle",NUM_FILLSTYLES,2}, FillstyleData }; static XgcData FillruleData[NUM_FILLRULES] = { {"EvenOdd", "EvenOdd", EvenOddRule}, {"Winding", "Winding", WindingRule} }; XgcStuff FillruleStuff = { {"FillRule","fillrule",NUM_FILLRULES,0}, FillruleData }; static XgcData ArcmodeData[NUM_ARCMODES] = { {"Chord", "Chord", ArcChord}, {"PieSlice", "PieSlice", ArcPieSlice} }; XgcStuff ArcmodeStuff = { {"ArcMode","arcmode",NUM_ARCMODES,0}, ArcmodeData }; /* Pointers to all the Xgcstuffs so we can run them through a loop */ static XgcStuff *Everything[8] = { &FunctionStuff, &LinestyleStuff, &CapstyleStuff, &JoinstyleStuff, &FillstyleStuff, &FillruleStuff, &ArcmodeStuff, &TestStuff }; #ifdef notdef int fildes[2]; /* for pipe */ FILE *outend; #endif XStuff X; /* GC stuff plus some global variables */ Boolean recording = FALSE; /* Whether we're recording into a file */ XtAppContext appcontext; /* To make Xt happy */ static Atom wm_delete_window; static XtActionsRec actions[] = { {"quit", quitAction} }; static Widget bigdaddy; /* the top level widget */ Widget topform; /* form surrounding the whole thing */ Widget GCform; /* form in which you choose the GC */ static Widget Testform; /* form in which you choose the test */ Widget testchoiceform; /* form inside that */ ChoiceDesc *testchoicedesc; /* record of what widgets are in the test choice form */ static Widget commandform; /* form with run, quit, clear, etc. */ Widget test; /* where the test is run */ Widget result; /* where the results are displayed */ static Widget runbutton; /* command for running */ static Widget clearbutton; /* command for clearing the test window */ Widget recordbutton; /* start/stop recording */ static Widget playbackbutton; /* playback from file */ static Widget keyinputbutton; /* start reading from keyboard */ static Widget GCchoices[NUMCHOICES]; /* all the forms that contain stuff for changing GC's*/ ChoiceDesc *GCdescs[NUMCHOICES]; /* record of the widgets inside the choice widgets */ Widget planemaskchoice; /* form for choosing the plane mask */ Widget dashlistchoice; /* form for choosing the dash list */ static Widget linewidthchoice; /* form for choosing line width */ Widget linewidthtext; /* text widget within that */ static Widget fontchoice; /* form for choosing the font */ Widget fonttext; /* text widget within that */ static Widget foregroundchoice; /* form for choosing foreground */ Widget foregroundtext; /* text widget within that */ static Widget backgroundchoice; /* form for choosing background */ Widget backgroundtext; /* text widget within that */ static Widget percentchoice; /* form for choosing percentage of test */ /* main(argc.argv) ** --------------- ** Initializes the toolkit, initializes data, puts up the widgets, ** starts the event loop. */ int main(int argc, char *argv[]) { static Arg shellargs[] = { {XtNinput, (XtArgVal) True} }; static Arg testformargs[] = { {XtNfromVert, (XtArgVal) NULL} /* put it under GCform */ }; static Arg commandformargs[] = { {XtNfromVert, (XtArgVal) NULL}, /* put it under GCform */ {XtNfromHoriz, (XtArgVal) NULL} /* and to the right of Testform */ }; static Arg testargs[] = { {XtNheight, (XtArgVal) 400}, {XtNwidth, (XtArgVal) 400}, {XtNfromHoriz, (XtArgVal) NULL} /* put it to the right of GCform */ }; static Arg resultargs[] = { {XtNheight, (XtArgVal) 50}, {XtNwidth, (XtArgVal) 400}, {XtNfromHoriz, (XtArgVal) NULL}, /* put it to the right of GCform */ {XtNfromVert, (XtArgVal) NULL} /* and under test */ }; static Arg gcchoiceargs[] = { {XtNfromVert, (XtArgVal) NULL}, /* put it under the one above it */ {XtNfromHoriz, (XtArgVal) NULL}, /* and next to that one */ {XtNborderWidth, (XtArgVal) 0} /* no ugly borders */ }; static Arg testchoiceargs[] = { {XtNborderWidth, (XtArgVal) 0} }; int i; /* counter */ /* Open the pipe */ #ifdef notdef pipe(fildes); outend = fdopen(fildes[0],"r"); #endif /* Initialize toolkit stuff */ XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); bigdaddy = XtAppInitialize(&appcontext, "Xgc", (XrmOptionDescList) NULL, (Cardinal) 0, &argc, argv, (String *) NULL, shellargs, XtNumber(shellargs)); X.dpy = XtDisplay(bigdaddy); XtAppAddActions(appcontext, actions, XtNumber(actions)); XtOverrideTranslations (bigdaddy, XtParseTranslationTable("WM_PROTOCOLS: quit()")); /* Initialize GC stuff */ X.scr = DefaultScreenOfDisplay(X.dpy); X.gc = XCreateGC(X.dpy,RootWindowOfScreen(X.scr),0,(XGCValues *) NULL); X.miscgc = XCreateGC(X.dpy,RootWindowOfScreen(X.scr),0,(XGCValues *) NULL); /* Find out what the foreground & background are, and update the GC ** accordingly */ set_foreground_and_background(); topform = XtCreateManagedWidget("topform",formWidgetClass,bigdaddy, NULL,0); GCform = XtCreateManagedWidget("GCform",formWidgetClass,topform, NULL,0); /* create all the GCchoices forms */ for (i=0;ichoice.text, formWidgetClass,GCform, gcchoiceargs,XtNumber(gcchoiceargs)); /* now fill up that form */ GCdescs[i] = create_choice(GCchoices[i],Everything[i]); } /* put the planemask choice under the bottom GC choice */ gcchoiceargs[0].value = (XtArgVal) GCchoices[NUMCHOICES-1]; planemaskchoice = XtCreateManagedWidget("planemask",formWidgetClass,GCform, gcchoiceargs,XtNumber(gcchoiceargs)); /* fill it up */ create_planemask_choice(planemaskchoice); /* put the dashlist choice under the planemask choice */ gcchoiceargs[0].value = (XtArgVal) planemaskchoice; dashlistchoice = XtCreateManagedWidget("dashlist",formWidgetClass,GCform, gcchoiceargs,XtNumber(gcchoiceargs)); /* fill it up */ create_dashlist_choice(dashlistchoice); /* put the linewidth choice under the dashlist choice */ gcchoiceargs[0].value = (XtArgVal) dashlistchoice; linewidthchoice = XtCreateManagedWidget("linewidth",formWidgetClass,GCform, gcchoiceargs,XtNumber(gcchoiceargs)); /* fill it up */ linewidthtext = create_text_choice(linewidthchoice,TLineWidth,2,30); /* put the font choice under the linewidth choice */ gcchoiceargs[0].value = (XtArgVal) linewidthchoice; fontchoice = XtCreateManagedWidget("font",formWidgetClass,GCform, gcchoiceargs,XtNumber(gcchoiceargs)); /* fill it up */ fonttext = create_text_choice(fontchoice,TFont,80,300); gcchoiceargs[0].value = (XtArgVal) fontchoice; foregroundchoice = XtCreateManagedWidget("foreground",formWidgetClass,GCform, gcchoiceargs,XtNumber(gcchoiceargs)); foregroundtext = create_text_choice(foregroundchoice,TForeground,9,50); /* FIXME 9 characters may not be the proper choice; really it * should understand a more proper pixel specification... */ gcchoiceargs[1].value = (XtArgVal) foregroundchoice; backgroundchoice = XtCreateManagedWidget("background",formWidgetClass,GCform, gcchoiceargs,XtNumber(gcchoiceargs)); backgroundtext = create_text_choice(backgroundchoice,TBackground,9,50); gcchoiceargs[1].value = (XtArgVal) NULL; gcchoiceargs[0].value = (XtArgVal) foregroundchoice; percentchoice = XtCreateManagedWidget("testpercent",formWidgetClass,GCform, gcchoiceargs,XtNumber(gcchoiceargs)); X.percent = 1.0; create_testfrac_choice(percentchoice); /* make all the labels inside the choices line up nicely */ line_up_labels(GCdescs,(int) XtNumber(GCdescs)); /* put the test form under the GC form */ testformargs[0].value = (XtArgVal) GCform; Testform = XtCreateManagedWidget("Testform",formWidgetClass,topform, testformargs,XtNumber(testformargs)); testchoiceform = XtCreateManagedWidget("testchoiceform",formWidgetClass, Testform,testchoiceargs,XtNumber(testchoiceargs)); testchoicedesc = create_choice(testchoiceform,Everything[CTest]); commandformargs[0].value = (XtArgVal) GCform; commandformargs[1].value = (XtArgVal) Testform; commandform = XtCreateManagedWidget("commandform",formWidgetClass,topform, commandformargs,XtNumber(commandformargs)); /* Put the appropriate command buttons in the command form */ fill_up_commandform(commandform); testargs[2].value = (XtArgVal) GCform; /* to the right of */ test = XtCreateManagedWidget("test",widgetClass,topform, testargs,XtNumber(testargs)); resultargs[2].value = (XtArgVal) GCform; /* to the right of */ resultargs[3].value = (XtArgVal) test; /* under */ result = XtCreateManagedWidget("result",asciiTextWidgetClass,topform, resultargs,XtNumber(resultargs)); /* Now realize all the widgets */ XtRealizeWidget(bigdaddy); /* Now do things we couldn't do until we had a window available */ X.win = XtWindow(test); X.tile = XCreatePixmap(X.dpy,X.win,tile_width,tile_height, DefaultDepthOfScreen(X.scr)); X.tile = XCreatePixmapFromBitmapData(X.dpy,X.win, (char *)tile_bits,tile_width, tile_height,Black,White, DefaultDepthOfScreen(X.scr)); X.stipple = XCreateBitmapFromData(X.dpy,X.win,(char *)tile_bits,tile_width, tile_height); XSetStipple(X.dpy,X.gc,X.stipple); XSetStipple(X.dpy,X.miscgc,X.stipple); GC_change_foreground(X.foreground,TRUE); GC_change_background(X.background,TRUE); wm_delete_window = XInternAtom(X.dpy, "WM_DELETE_WINDOW", False); (void) XSetWMProtocols(X.dpy, XtWindow(bigdaddy), &wm_delete_window, 1); /* Act like the user picked the first choice in each group */ choose_defaults(GCdescs,(int)XtNumber(GCdescs)); choose_defaults(&testchoicedesc,1); /* Loop forever, dealing with events */ XtAppMainLoop(appcontext); return 0; } /* fill_up_commandform(w) ** ---------------------- ** Put the appropriate command buttons in the command form (w). */ static void fill_up_commandform(Widget w) { static XtCallbackRec runcallbacklist[] = { {(XtCallbackProc) run_test, NULL}, {NULL, NULL} }; static XtCallbackRec quitcallbacklist[] = { {(XtCallbackProc) quit, NULL}, {NULL, NULL} }; static XtCallbackRec clearcallbacklist[] = { {(XtCallbackProc) clear_test_window, NULL}, {(XtCallbackProc) clear_result_window, NULL}, {NULL, NULL} }; static XtCallbackRec playbackcallbacklist[] = { {(XtCallbackProc) start_playback, NULL}, {NULL, NULL} }; static XtCallbackRec keyinputcallbacklist[] = { {(XtCallbackProc) read_from_keyboard, NULL}, {NULL, NULL} }; static XtCallbackRec recordcallbacklist[] = { {(XtCallbackProc) toggle_recordbutton, NULL}, {NULL, NULL} }; static Arg runargs[] = { {XtNcallback, (XtArgVal) NULL} }; static Arg clearargs[] = { {XtNcallback, (XtArgVal) NULL}, {XtNfromVert, (XtArgVal) NULL}, /* put it under runbutton */ {XtNvertDistance,(XtArgVal) 10} }; static Arg recordargs[] = { {XtNcallback, (XtArgVal) NULL}, {XtNfromVert, (XtArgVal) NULL}, /* put it under clearbutton */ {XtNvertDistance,(XtArgVal) 10}, {XtNresizable, (XtArgVal) True} /* so we can change the name */ }; static Arg playbackargs[] = { {XtNcallback, (XtArgVal) NULL}, {XtNfromVert, (XtArgVal) NULL} /* put it under recordbutton */ }; static Arg keyinputargs[] = { {XtNcallback, (XtArgVal) NULL}, {XtNfromVert, (XtArgVal) NULL} /* put it under playbackbutton */ }; static Arg quitargs[] = { {XtNcallback, (XtArgVal) NULL}, {XtNfromVert, (XtArgVal) NULL}, /* put it under keyinputbutton */ {XtNvertDistance,(XtArgVal) 10} }; runargs[0].value = (XtArgVal) runcallbacklist; runbutton = XtCreateManagedWidget("Run",commandWidgetClass, w,runargs,XtNumber(runargs)); clearargs[0].value = (XtArgVal) clearcallbacklist; clearargs[1].value = (XtArgVal) runbutton; /* under */ clearbutton = XtCreateManagedWidget("Clear window",commandWidgetClass, w,clearargs,XtNumber(clearargs)); recordargs[0].value = (XtArgVal) recordcallbacklist; recordargs[1].value = (XtArgVal) clearbutton; /* under */ recordbutton = XtCreateManagedWidget("Record",commandWidgetClass, w,recordargs,XtNumber(recordargs)); playbackargs[0].value = (XtArgVal) playbackcallbacklist; playbackargs[1].value = (XtArgVal) recordbutton; /* under */ playbackbutton = XtCreateManagedWidget("Playback",commandWidgetClass, w,playbackargs,XtNumber(playbackargs)); keyinputargs[0].value = (XtArgVal) keyinputcallbacklist; keyinputargs[1].value = (XtArgVal) playbackbutton; keyinputbutton = XtCreateManagedWidget("Read Input",commandWidgetClass, w,keyinputargs,XtNumber(keyinputargs)); quitargs[0].value = (XtArgVal) quitcallbacklist; quitargs[1].value = (XtArgVal) keyinputbutton; /* under */ (void) XtCreateManagedWidget("Quit",commandWidgetClass, w,quitargs,XtNumber(quitargs)); } /* quit() ** ------ ** Leave the program nicely. */ static void quit(void) { close_file_if_recording(); exit(0); } static void quitAction(Widget w, XEvent *e, String *p, Cardinal *n) { if (e->type == ClientMessage && e->xclient.data.l[0] != wm_delete_window) XBell(XtDisplay(w), 0); else quit(); } /* clear_test_window() ** ------------------- ** Clear the test window. */ static void clear_test_window(void) { XClearWindow(X.dpy,XtWindow(test)); } /* clear_result_window() ** --------------------- ** Clear the result window. */ static void clear_result_window(void) { set_text(result, ""); } /* set_foreground_and_background() ** ------------------------------- ** Finds the user-specified foreground and background by querying ** the resource manager, and sets state accordingly. Also specifies ** the initial font for text tests. */ static void set_foreground_and_background(void) { X.gcv.foreground = X.foreground = 0; X.gcv.background = X.background = 0xffffffff; X.fontname = "6x10"; GC_change_font(X.fontname,FALSE); } x11-apps-7.7+5+nmu1ubuntu1/xgc/text.c0000664000000000000000000001407012514123556014110 0ustar /* ** xgc ** ** text.c ** ** How to make a text widget that returns a string when the cursor ** leaves its window. */ #include #include #include #include #include #include #include #include "xgc.h" static void WriteText(Widget, XEvent *, String *, Cardinal *); /* the strings which are displayed on the screen, edited, and sent to interpret() */ static char textstrings[NUMTEXTWIDGETS][80]; static char oldtextstrings[NUMTEXTWIDGETS][80]; static const char *defaultstrings[NUMTEXTWIDGETS] = {"0","6x10","0","1"}; /* The labels displayed next to them */ static const char *labels[NUMTEXTWIDGETS] = {"Line Width","Font","Foreground", "Background"}; /* the first half of what gets sent to interpret() */ static const char *names[NUMTEXTWIDGETS] = {"linewidth ","font ","foreground ", "background "}; /* create_text_choice(w,type,length,width) ** --------------------------------------- ** Inside w (a form), creates an editable text widget of width width. The ** user can enter a string of up to length characters. type is one of ** the constants defined in xgc.h; it decides things like the label, ** what string will be displayed and edited, etc. When the pointer leaves ** the widget, the widget does the appropriate thing with the text ** inside it; the user doesn't have to press an "enter" button or anything. ** Returns the text widget which the user will edit. */ Widget create_text_choice(Widget w, int type, int length, int width) { char translationtable[600]; /* for adding the new action (calling WriteText() when the pointer leaves) */ static XtActionsRec actionTable[] = { /* likewise */ {"WriteText", WriteText}, {"Nothing", NULL} }; static Arg labelargs[] = { {XtNborderWidth, (XtArgVal) 0}, {XtNjustify, (XtArgVal) XtJustifyRight} }; static Arg textargs[] = { {XtNeditType, (XtArgVal) XawtextEdit}, {XtNstring, (XtArgVal) NULL}, {XtNlength, (XtArgVal) NULL}, {XtNhorizDistance, (XtArgVal) 10}, {XtNfromHoriz, (XtArgVal) NULL}, {XtNinsertPosition, (XtArgVal) NULL}, {XtNuseStringInPlace, (XtArgVal) True} }; static Widget text; /* the text widget */ static Widget label; /* the label widget */ /* Disable keys which would cause the cursor to go off the single ** line that we want to display. If the pointer leaves the window, ** update the GC accordingly. The integer passed to WriteText is ** so it knows what type of widget was just updated. */ snprintf(translationtable,sizeof translationtable, ": WriteText(%d)\n\ : set-keyboard-focus() select-start()\n\ CtrlJ: Nothing()\n\ CtrlM: Nothing()\n\ Linefeed: Nothing()\n\ Return: Nothing()\n\ CtrlO: Nothing()\n\ MetaI: Nothing()\n\ CtrlN: Nothing()\n\ CtrlP: Nothing()\n\ CtrlZ: Nothing()\n\ MetaZ: Nothing()\n\ CtrlV: Nothing()\n\ MetaV: Nothing()",type); /* label uses type to find out what its title is */ label = XtCreateManagedWidget(labels[type],labelWidgetClass,w, labelargs,XtNumber(labelargs)); /* text uses type to find out what its string is */ switch (type) { case TForeground: snprintf(textstrings[type],sizeof textstrings[type], "%d",(int) X.gcv.foreground); snprintf(oldtextstrings[type],sizeof oldtextstrings[type], "%d",(int) X.gcv.foreground); break; case TBackground: snprintf(textstrings[type],sizeof textstrings[type], "%d",(int) X.gcv.background); snprintf(oldtextstrings[type],sizeof oldtextstrings[type], "%d",(int) X.gcv.background); break; default: strcpy(textstrings[type],defaultstrings[type]); strcpy(oldtextstrings[type],defaultstrings[type]); } textargs[1].value = (XtArgVal) textstrings[type]; textargs[2].value = (XtArgVal) length; textargs[4].value = (XtArgVal) label; textargs[5].value = (XtArgVal) strlen(textstrings[type]); text = XtCreateManagedWidget("text", asciiTextWidgetClass,w, textargs,XtNumber(textargs)); /* Register the actions and translations */ XtAppAddActions(appcontext,actionTable,XtNumber(actionTable)); XtOverrideTranslations(text,XtParseTranslationTable(translationtable)); return(text); } /* WriteText(w,event,params,num_params) ** ------------------------------------ ** Makes an appropriate string and sends it off to interpret(). ** It's an ActionProc, thus the funny arguments. */ /*ARGSUSED*/ static void WriteText(Widget w, XEvent *event, String *params, Cardinal *num_params) { char mbuf[80]; int type; /* which string # to send */ type = atoi(params[0]); if (type < 0 || type >= NUMTEXTWIDGETS) { fprintf(stderr, "Invalid value %s in WriteText()\n", params[0]); return; } if (strcmp(textstrings[type],oldtextstrings[type])) { strcpy(oldtextstrings[type],textstrings[type]); snprintf(mbuf,sizeof mbuf,"%s%s\n", names[type], /* the right first half */ textstrings[type]); /* the right second half */ interpret(mbuf); /* send it off */ } } /* change_text(w,type,newtext) ** ------------------------ ** Changes the text in the text widget w of type type to newtext. */ void change_text(Widget w, String newtext) { XawTextBlock text; /* the new text */ XawTextPosition first, last; /* boundaries of the old text */ String oldtext; /* the old text */ static Arg textargs[] = { {XtNstring, (XtArgVal) 0} }; /* Initialize the XawTextBlock. */ if (!newtext) newtext = ""; text.firstPos = 0; text.length = strlen(newtext); text.ptr = newtext; text.format = FMT8BIT; /* Find the old text, so we can get its length, so we know how ** much of it to update. */ textargs[0].value = (XtArgVal) &oldtext; XtGetValues(w,textargs,XtNumber(textargs)); first = XawTextTopPosition(w); if (!oldtext) oldtext = ""; last = (XawTextPosition) strlen(oldtext)+1; /* Replace it with the new text. */ XawTextReplace(w, first, last, &text); } x11-apps-7.7+5+nmu1ubuntu1/xgc/missing0000755000000000000000000001533012656634667014376 0ustar #! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: x11-apps-7.7+5+nmu1ubuntu1/xgc/configure.ac0000664000000000000000000000443712514123556015254 0ustar dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that dnl copyright notice and this permission notice appear in supporting dnl documentation, and that the name of Red Hat not be used in dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR dnl PERFORMANCE OF THIS SOFTWARE. dnl dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xgc], [1.0.5], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xgc]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS AC_PROG_LEX AC_PROG_YACC AC_PATH_PROG([YACC_INST], $YACC) if ! test -f "$srcdir/gram.c"; then if test -z "$YACC_INST"; then AC_MSG_ERROR([yacc not found - unable to compile gram.y]) fi fi PKG_CHECK_MODULES(XGC, xaw7 xt) xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` AC_ARG_WITH(appdefaultdir, AS_HELP_STRING([--with-appdefaultdir=], [specify directory for app-defaults files (default is autodetected)]), [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) AC_CONFIG_FILES([ Makefile man/Makefile]) AC_OUTPUT x11-apps-7.7+5+nmu1ubuntu1/xgc/README0000664000000000000000000000132512514123556013637 0ustar xgc is an X11 graphics demo that shows various features of the X11 core protocol graphics primitives. All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/app/xgc http://cgit.freedesktop.org/xorg/app/xgc For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage x11-apps-7.7+5+nmu1ubuntu1/xgc/lex.l0000664000000000000000000001076212514123556013731 0ustar /* ** lex file for xgc syntax */ /* Lots of stuff stolen from gwm's wool.lex */ %{ #include #include #include "gram.h" #include "constants.h" #if defined(FLEX_SCANNER) && !defined(YY_FLEX_LEX_COMPAT) && !defined(__UNIXOS2__) int yylineno; #endif %} %p 4000 %a 3000 number [0-9]+ word [^\n\t ]+ string \"([^"]|\\.)*\" %% [Rr]un { return (RUN); } [Ff]unction { return (FUNCTION); } [Cc]lear { yylval.num = GXclear; return (FUNCTIONTYPE); } [Aa]nd { yylval.num = GXand; return (FUNCTIONTYPE); } [Aa]ndReverse { yylval.num = GXandReverse; return (FUNCTIONTYPE); } [Cc]opy { yylval.num = GXcopy; return (FUNCTIONTYPE); } [Aa]ndInverted { yylval.num = GXandInverted; return (FUNCTIONTYPE); } [Nn]oop { yylval.num = GXnoop; return (FUNCTIONTYPE); } [Xx]or { yylval.num = GXxor; return (FUNCTIONTYPE); } [Oo]r { yylval.num = GXor; return (FUNCTIONTYPE); } [Nn]or { yylval.num = GXnor; return (FUNCTIONTYPE); } [Ee]quiv { yylval.num = GXequiv; return (FUNCTIONTYPE); } [Ii]nvert { yylval.num = GXinvert; return (FUNCTIONTYPE); } [Oo]rReverse { yylval.num = GXorReverse; return (FUNCTIONTYPE); } [Cc]opyInverted { yylval.num = GXcopyInverted; return (FUNCTIONTYPE); } [Oo]rInverted { yylval.num = GXorInverted; return (FUNCTIONTYPE); } [Nn]and { yylval.num = GXnand; return (FUNCTIONTYPE); } [Ss]et { yylval.num = GXset; return (FUNCTIONTYPE); } [Tt]est { return (TEST); } CopyArea { yylval.num = CopyArea; return (TESTTYPE); } CopyPlane { yylval.num = CopyPlane; return (TESTTYPE); } PolyPoint { yylval.num = PolyPoint; return (TESTTYPE); } PolyLine { yylval.num = PolyLine; return (TESTTYPE); } PolySegment { yylval.num = PolySegment; return (TESTTYPE); } PolyRectangle { yylval.num = PolyRectangle; return (TESTTYPE); } PolyArc { yylval.num = PolyArc; return (TESTTYPE); } FillPolygon { yylval.num = FillPolygon; return (TESTTYPE); } PolyFillRect { yylval.num = PolyFillRect; return (TESTTYPE); } PolyFillArc { yylval.num = PolyFillArc; return (TESTTYPE); } PutImage { yylval.num = PutImage; return (TESTTYPE); } GetImage { yylval.num = GetImage; return (TESTTYPE); } PolyText8 { yylval.num = PolyText8; return (TESTTYPE); } ImageText8 { yylval.num = ImageText8; return (TESTTYPE); } PolyText16 { yylval.num = PolyText16; return (TESTTYPE); } ImageText16 { yylval.num = ImageText16; return (TESTTYPE); } [Ll]inestyle { return (LINESTYLE); } OnOffDash { yylval.num = LineOnOffDash; return (LINESTYLETYPE); } DoubleDash { yylval.num = LineDoubleDash; return (LINESTYLETYPE); } [Cc]apstyle { return (CAPSTYLE); } NotLast { yylval.num = CapNotLast; return (CAPSTYLETYPE); } Butt { yylval.num = CapButt; return (CAPSTYLETYPE); } Projecting { yylval.num = CapProjecting; return (CAPSTYLETYPE); } [Jj]oinstyle { return (JOINSTYLE); } Miter { yylval.num = JoinMiter; return (JOINSTYLETYPE); } Bevel { yylval.num = JoinBevel; return (JOINSTYLETYPE); } Round { return (ROUND); } [Ff]illstyle { return (FILLSTYLE); } Tiled { yylval.num = FillTiled; return (FILLSTYLETYPE); } Stippled { yylval.num = FillStippled; return (FILLSTYLETYPE); } OpaqueStippled { yylval.num = FillOpaqueStippled; return (FILLSTYLETYPE); } Solid { return (SOLID); } [Ff]illrule { return (FILLRULE); } EvenOdd { yylval.num = EvenOddRule; return (FILLRULETYPE); } Winding { yylval.num = WindingRule; return (FILLRULETYPE); } [Aa]rcmode { return (ARCMODE); } Chord { yylval.num = ArcChord; return (ARCMODETYPE); } PieSlice { yylval.num = ArcPieSlice; return (ARCMODETYPE); } [Ff]oreground { return (FOREGROUND); } [Bb]ackground { return (BACKGROUND); } [Ll]inewidth { return (LINEWIDTH); } [Pp]lanemask { return (PLANEMASK); } [Dd]ashlist { return (DASHLIST); } [Ff]ont { return (FONT); } [Pp]ercent { return (PERCENT); } {number} { (void) sscanf ((char *)yytext, "%d", &yylval.num); return (NUMBER); } {string} { yylval.ptr = (char *) yytext; return (STRING); } \#[^\n]*\n { ; } [\t ] { ; } \n { return ('\n'); } {word} { yylval.ptr = (char *) yytext; return (STRING); } . { fprintf(stderr, "xgc: bad character `%s', line %d\n", yytext, yylineno); } %% #ifndef yywrap int yywrap(void) { return (1); } #endif x11-apps-7.7+5+nmu1ubuntu1/xgc/gram.c0000664000000000000000000013216312514123575014057 0ustar /* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { STRING = 258, NUMBER = 259, RUN = 260, FUNCTION = 261, FUNCTIONTYPE = 262, TEST = 263, TESTTYPE = 264, LINESTYLE = 265, LINESTYLETYPE = 266, CAPSTYLE = 267, CAPSTYLETYPE = 268, JOINSTYLE = 269, JOINSTYLETYPE = 270, ROUND = 271, SOLID = 272, FILLSTYLE = 273, FILLSTYLETYPE = 274, FILLRULE = 275, FILLRULETYPE = 276, ARCMODE = 277, ARCMODETYPE = 278, FOREGROUND = 279, BACKGROUND = 280, LINEWIDTH = 281, PLANEMASK = 282, DASHLIST = 283, PERCENT = 284, FONT = 285 }; #endif /* Tokens. */ #define STRING 258 #define NUMBER 259 #define RUN 260 #define FUNCTION 261 #define FUNCTIONTYPE 262 #define TEST 263 #define TESTTYPE 264 #define LINESTYLE 265 #define LINESTYLETYPE 266 #define CAPSTYLE 267 #define CAPSTYLETYPE 268 #define JOINSTYLE 269 #define JOINSTYLETYPE 270 #define ROUND 271 #define SOLID 272 #define FILLSTYLE 273 #define FILLSTYLETYPE 274 #define FILLRULE 275 #define FILLRULETYPE 276 #define ARCMODE 277 #define ARCMODETYPE 278 #define FOREGROUND 279 #define BACKGROUND 280 #define LINEWIDTH 281 #define PLANEMASK 282 #define DASHLIST 283 #define PERCENT 284 #define FONT 285 /* Copy the first part of user declarations. */ #line 5 "gram.y" #define YYDEBUG 1 #include #include #include #include "xgc.h" extern int yylineno; /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE #line 18 "gram.y" { int num; char *ptr; } /* Line 187 of yacc.c. */ #line 173 "gram.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 216 of yacc.c. */ #line 186 "gram.c" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 40 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 32 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 4 /* YYNRULES -- Number of rules. */ #define YYNRULES 26 /* YYNRULES -- Number of states. */ #define YYNSTATES 43 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 285 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 31, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 5, 6, 9, 13, 15, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44, 47, 50, 53, 56, 59, 62, 65, 68, 71 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 33, 0, -1, 34, -1, -1, 34, 31, -1, 34, 35, 31, -1, 1, -1, 5, -1, 8, 9, -1, 6, 7, -1, 10, 11, -1, 10, 17, -1, 12, 13, -1, 12, 16, -1, 14, 15, -1, 14, 16, -1, 18, 19, -1, 18, 17, -1, 20, 21, -1, 22, 23, -1, 24, 4, -1, 25, 4, -1, 26, 4, -1, 27, 4, -1, 28, 4, -1, 30, 3, -1, 29, 4, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 40, 40, 43, 44, 45, 48, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "STRING", "NUMBER", "RUN", "FUNCTION", "FUNCTIONTYPE", "TEST", "TESTTYPE", "LINESTYLE", "LINESTYLETYPE", "CAPSTYLE", "CAPSTYLETYPE", "JOINSTYLE", "JOINSTYLETYPE", "ROUND", "SOLID", "FILLSTYLE", "FILLSTYLETYPE", "FILLRULE", "FILLRULETYPE", "ARCMODE", "ARCMODETYPE", "FOREGROUND", "BACKGROUND", "LINEWIDTH", "PLANEMASK", "DASHLIST", "PERCENT", "FONT", "'\\n'", "$accept", "all", "stmts", "stmt", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 10 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 32, 33, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 0, 2, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 3, 0, 0, 1, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 9, 8, 10, 11, 12, 13, 14, 15, 17, 16, 18, 19, 20, 21, 22, 23, 24, 26, 25, 5 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 1, 2, 22 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -10 static const yytype_int8 yypact[] = { -10, 2, 0, -10, -10, -10, 8, 10, -8, -9, 1, -6, 11, -2, 19, 29, 30, 31, 32, 33, 35, -10, 9, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -10, -10, -10, -10 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -3 static const yytype_int8 yytable[] = { -2, 4, 3, 25, 27, 5, 6, 28, 7, 26, 8, 31, 9, 32, 10, 23, 29, 30, 11, 24, 12, 34, 13, 35, 14, 15, 16, 17, 18, 19, 20, 21, 33, 36, 37, 38, 39, 40, 41, 0, 42 }; static const yytype_int8 yycheck[] = { 0, 1, 0, 11, 13, 5, 6, 16, 8, 17, 10, 17, 12, 19, 14, 7, 15, 16, 18, 9, 20, 23, 22, 4, 24, 25, 26, 27, 28, 29, 30, 31, 21, 4, 4, 4, 4, 4, 3, -1, 31 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 33, 34, 0, 1, 5, 6, 8, 10, 12, 14, 18, 20, 22, 24, 25, 26, 27, 28, 29, 30, 31, 35, 7, 9, 11, 17, 13, 16, 15, 16, 17, 19, 21, 23, 4, 4, 4, 4, 4, 4, 3, 31 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) yytype_int16 *bottom; yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 7: #line 50 "gram.y" { run_test(); } break; case 8: #line 52 "gram.y" { change_test ((yyvsp[(2) - (2)].num), TRUE); } break; case 9: #line 54 "gram.y" { GC_change_function ((yyvsp[(2) - (2)].num), TRUE); } break; case 10: #line 56 "gram.y" { GC_change_linestyle ((yyvsp[(2) - (2)].num), TRUE); } break; case 11: #line 58 "gram.y" { GC_change_linestyle (LineSolid, TRUE); } break; case 12: #line 60 "gram.y" { GC_change_capstyle ((yyvsp[(2) - (2)].num), TRUE); } break; case 13: #line 62 "gram.y" { GC_change_capstyle (CapRound, TRUE); } break; case 14: #line 64 "gram.y" { GC_change_joinstyle ((yyvsp[(2) - (2)].num), TRUE); } break; case 15: #line 66 "gram.y" { GC_change_joinstyle (JoinRound, TRUE); } break; case 16: #line 68 "gram.y" { GC_change_fillstyle ((yyvsp[(2) - (2)].num), TRUE); } break; case 17: #line 70 "gram.y" { GC_change_fillstyle (FillSolid, TRUE); } break; case 18: #line 72 "gram.y" { GC_change_fillrule ((yyvsp[(2) - (2)].num), TRUE); } break; case 19: #line 74 "gram.y" { GC_change_arcmode ((yyvsp[(2) - (2)].num), TRUE); } break; case 20: #line 76 "gram.y" { GC_change_foreground ((yyvsp[(2) - (2)].num), TRUE); } break; case 21: #line 78 "gram.y" { GC_change_background ((yyvsp[(2) - (2)].num), TRUE); } break; case 22: #line 80 "gram.y" { GC_change_linewidth ((yyvsp[(2) - (2)].num), TRUE); } break; case 23: #line 82 "gram.y" { GC_change_planemask ((yyvsp[(2) - (2)].num), TRUE); } break; case 24: #line 84 "gram.y" { GC_change_dashlist ((yyvsp[(2) - (2)].num), TRUE); } break; case 25: #line 86 "gram.y" { GC_change_font ((yyvsp[(2) - (2)].ptr), TRUE); } break; case 26: #line 88 "gram.y" { change_percent ((yyvsp[(2) - (2)].num), TRUE); } break; /* Line 1267 of yacc.c. */ #line 1511 "gram.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } #line 91 "gram.y" void yyerror(const char *s) { fprintf(stderr, "xgc: syntax error, line %d\n", yylineno); } x11-apps-7.7+5+nmu1ubuntu1/xgc/COPYING0000664000000000000000000000454012514123556014014 0ustar Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. x11-apps-7.7+5+nmu1ubuntu1/xgc/INSTALL0000664000000000000000000003660012514123601014003 0ustar Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. x11-apps-7.7+5+nmu1ubuntu1/xgc/choice.c0000664000000000000000000002037612514123556014364 0ustar /* ** xgc ** ** choice.c ** ** All the generic stuff for dealing with choice widgets. */ #include #include #include #include #include #include #include "xgc.h" static void print_text_to_buffer(Widget, caddr_t, caddr_t); /* create_choice(w,info) ** --------------------- ** What a choice widget is: A collection of toggle buttons placed inside ** a form widget. Exactly one of these toggle buttons can be "on" at ** any given time; the rest are "off". "On" toggle buttons have ** the foreground and background colors reversed. ** Also, specifically because it comes in handy in xgc, choosing one ** of the buttons causes a string associated with it to be printed out ** (and interpreted). Half of the string is global to the whole form ** and the other half is local to each button. ** ** For example, pressing the "xor" button in the "function" form would ** cause xgc to interpret the string "function xor", thus changing the ** function in the GC to xor. ** ** There's also a label widget to the left of that mess, with an ** incredibly descriptive title. ** ** create_choice() makes one. ** ** w is the form widget (already created) into which we will place the ** toggle buttons. info contains lots of useful information, such ** as the names of the buttons and their strings (see xgc.h). */ ChoiceDesc * create_choice(Widget w, XgcStuff *info) { ChoiceDesc *choice; /* What we will return. Contains ** Widget ID's of the label and toggles. */ int i; /* Counter */ char *text; /* Text to be interpreted when the ** toggle widget is selected. */ /* ArgList for the label widget */ static Arg labelargs[] = { {XtNborderWidth, (XtArgVal) 0}, {XtNjustify, (XtArgVal) XtJustifyRight}, {XtNvertDistance, (XtArgVal) 4} }; /* ArgList for the toggle widgets */ static Arg toggleargs[] = { {XtNfromHoriz, (XtArgVal) NULL}, {XtNfromVert, (XtArgVal) NULL}, {XtNhorizDistance, (XtArgVal) 4}, {XtNvertDistance, (XtArgVal) 4}, {XtNradioGroup, (XtArgVal) NULL}, {XtNcallback, (XtArgVal) NULL} }; /* Callback list for the toggle widgets */ static XtCallbackRec callbacklist[] = { {(XtCallbackProc) print_text_to_buffer, NULL}, {NULL, NULL} }; /* Allocate space for the widgets and initialize choice */ choice = (ChoiceDesc *) XtMalloc(sizeof(ChoiceDesc)); choice->widgets = (WidgetList) XtMalloc(sizeof(Widget) * info->choice.num_toggles); choice->size = info->choice.num_toggles; choice->label = XtCreateManagedWidget(info->choice.name,labelWidgetClass,w, labelargs,XtNumber(labelargs)); /* set up the toggle widgets */ toggleargs[5].value = (XtArgVal) callbacklist; for (i = 0; i < info->choice.num_toggles; ++i) { if (i == 0) { /* the upper left toggle; put it next to the label and don't worry about radio groups */ toggleargs[0].value = (XtArgVal) choice->label; toggleargs[1].value = (XtArgVal) NULL; toggleargs[2].value = (XtArgVal) 10; toggleargs[3].value = (XtArgVal) 4; toggleargs[4].value = (XtArgVal) NULL; } else { toggleargs[4].value = (XtArgVal) choice->widgets[0]; /* are we starting a new row? */ if (info->choice.columns > 0 && i > 1 && (i % (info->choice.columns) == 0)) { toggleargs[0].value = (XtArgVal) choice->label; /* under the appropriate toggle */ toggleargs[1].value = (XtArgVal) choice->widgets[i - info->choice.columns]; toggleargs[2].value = (XtArgVal) 10; toggleargs[3].value = (XtArgVal) 4; } else { /* we're in the middle of a row */ /* to the right of the previous toggle */ toggleargs[0].value = (XtArgVal) choice->widgets[i - 1]; toggleargs[1].value = (XtArgVal) NULL; toggleargs[2].value = (XtArgVal) -1; /* overlapping slightly */ toggleargs[3].value = (XtArgVal) 4; } if (info->choice.columns > 0 && i >= info->choice.columns) { /* correct vertical spacing */ toggleargs[1].value = (XtArgVal) choice->widgets[i - info->choice.columns]; toggleargs[3].value = (XtArgVal) -1; } } /* Put the correct stuff in the text field */ text = (char *) XtMalloc((unsigned) (strlen(info->choice.text) + strlen((info->data)[i].text) + 3)); strcpy(text, info->choice.text); strcat(text, " "); strcat(text, (info->data)[i].text); strcat(text, "\n"); callbacklist[0].closure = (caddr_t) text; /* Create it finally */ choice->widgets[i] = XtCreateManagedWidget((info->data[i]).name, toggleWidgetClass, w, toggleargs, XtNumber(toggleargs)); } /* The toggle widgets have all been created; ** now make the all the same width if that's ** what we want to do. */ if (info->choice.columns > 0) { Dimension maxwidth = 0; /* maximum width we've found */ Dimension width; /* width of the current widget */ static Arg args[] = { /* for getting and setting the width */ {XtNwidth, (XtArgVal) NULL} }; args[0].value = (XtArgVal) &width; /* Find the maximum width of any toggle widget */ for (i = 0; i < info->choice.num_toggles; ++i) { XtGetValues(choice->widgets[i],args,1); maxwidth = max(maxwidth,width); } /* Now set them all to that width */ args[0].value = (XtArgVal) maxwidth; for (i = 0; i < info->choice.num_toggles; ++i) XtSetValues(choice->widgets[i],args,1); } /* return the list of toggles that were just created */ return (choice); } /* select_button(choice,togglenum) ** ------------------------------- ** "Selects" the togglenumth toggle widget in the choice layout ** represented by choice. It simply turns the widget on, as if the ** user had selected it, without calling any callbacks. It's used ** to give feedback when reading from a script. */ void select_button(ChoiceDesc *choice, int togglenum) { static Arg toggleargs[] = { {XtNstate, (XtArgVal) True} }; XtSetValues(choice->widgets[togglenum],toggleargs,XtNumber(toggleargs)); } /* line_up_labels(descs,numdescs) ** ------------------------------ ** descs represents a bunch of choice layouts (numdescs is the size of ** descs). This function sets each label in descs to the same width, ** thus making them line up nicely since they're all on the left margin. */ void line_up_labels(ChoiceDesc *descs[], int numdescs) { int i; /* counter */ Dimension width; /* current width */ Dimension maxwidth = (Dimension) 0; /* max width found */ static Arg widthargs[] = { {XtNwidth, (XtArgVal) NULL } }; widthargs[0].value = (XtArgVal) &width; /* Find the maximum width */ for (i = 0; i < numdescs; ++i) { XtGetValues(descs[i]->label, widthargs, XtNumber(widthargs)); maxwidth = max(maxwidth,width); } /* Set all labels to that width */ widthargs[0].value = (XtArgVal) maxwidth; for (i = 0; i < numdescs; ++i) { XtSetValues(descs[i]->label, widthargs, XtNumber(widthargs)); } } /* choose_defaults(descs,numdescs) ** ------------------------------- ** descs represents a bunch of choice layouts (numdescs is the size of ** descs). This function goes through all of descs and selects the ** appropriate toggle widget for each one. This includes calling ** the callbacks associated with that widget. ** ** This function ends up initializing both the screen and the GC, and ** ensures that they are consistent. */ void choose_defaults(ChoiceDesc *descs[], int numdescs) { int i; /* which choice layout */ int j; /* which toggle within it */ for (i = 0; i < numdescs; ++i) { j = 0; if (i == 0) j = 3; select_button(descs[i],j); XtCallCallbacks(descs[i]->widgets[j], XtNcallback, (caddr_t) NULL); } } /* print_text_to_buffer(w,closure,call_data) ** ----------------------------------------- ** This is also in the list of callbacks for the toggle buttons in a ** choice widget. It sends the string contained in closure (which ** was set way back in create_choice()) over to interpret(), which ** decides what to do with it. */ /*ARGSUSED*/ static void print_text_to_buffer( Widget w, caddr_t closure, /* contains the string */ caddr_t call_data) { interpret((char *) closure); /* Gee, that was easy */ }