diff -dru SRGP_DISTRIB/examples/Makefile SRGP_DISTRIB.fjo/examples/Makefile --- SRGP_DISTRIB/examples/Makefile Thu Dec 21 04:31:53 1995 +++ SRGP_DISTRIB.fjo/examples/Makefile Mon Nov 29 23:35:31 2004 @@ -17,7 +17,7 @@ INCLUDE = -I../include LDLIBS = -lsrgp -lX11 -LDFLAGS = -L../lib +LDFLAGS = -L../lib -L/usr/X11/lib $(PROG): diff -dru SRGP_DISTRIB/include/geom.h SRGP_DISTRIB.fjo/include/geom.h --- SRGP_DISTRIB/include/geom.h Thu Dec 21 04:32:05 1995 +++ SRGP_DISTRIB.fjo/include/geom.h Mon Nov 29 23:46:16 2004 @@ -1,5 +1,6 @@ /** G E O M E T R I C A R I T H M E T I C **/ +#ifndef __cplusplus /* Adds two points, returning the result */ point GEOM_sumOfPoints (point pt1, point pt2); @@ -31,3 +32,18 @@ * or in the interior of the given rectangle. */ int GEOM_ptInRect (point pt, rectangle rect); + +#else + +extern "C" { + point GEOM_sumOfPoints (point, point); + int GEOM_widthOfRect (rectangle); + int GEOM_heightOfRect (rectangle); + void GEOM_computeRectUnion (rectangle, rectangle, rectangle*); + int GEOM_computeRectIntersection (rectangle, rectangle, rectangle*); + rectangle GEOM_rectWithCommonCenter (rectangle, int, int); + rectangle GEOM_rectFromDiagPoints (point, point); + int GEOM_ptInRect (point, rectangle); +} + +#endif diff -dru SRGP_DISTRIB/include/srgplocal.h SRGP_DISTRIB.fjo/include/srgplocal.h --- SRGP_DISTRIB/include/srgplocal.h Thu Dec 21 04:32:06 1995 +++ SRGP_DISTRIB.fjo/include/srgplocal.h Mon Nov 29 23:50:41 2004 @@ -123,10 +123,11 @@ DECLARE canvas_spec srgp__curActiveCanvasSpec; DECLARE canvas_spec *srgp__canvasTable; +#ifndef __cplusplus void SRGP__setCanvasDefaults (void); void SRGP__reactToScreenResize (int newwidth, int newheight); void SRGP__forceScreenResize (int newwidth, int newheight); - +#endif @@ -192,8 +193,9 @@ DECLARE fontInfo *srgp__fontTable; +#ifndef __cplusplus void SRGP__initFont (void); - +#endif @@ -232,6 +234,7 @@ DECLARE int srgp__cur_mode[4]; /* one for each device, including NO_DEVICE */ DECLARE int srgp__device_at_head_of_queue; +#ifndef __cplusplus void SRGP__initInputModule (void); void SRGP__initInputDrivers (void); void SRGP__activateDevice (int device); @@ -270,6 +273,7 @@ /* We hide this from gnu's compiler, which doesn't understand it. */ void SRGP__error (...); #endif +#endif extern errorHandlingMode srgp__curErrHndlMode; @@ -293,6 +297,7 @@ #define COLORINDEX(c) ((int)(c|srgp__base_colorindex)) #endif +#ifndef __cplusplus #ifdef THINK_C PaletteHandle SRGP__getPalette(void); #endif @@ -307,7 +312,7 @@ void SRGP__initGraphicsDevice (char *name, int requested_planes, boolean debugasap); void SRGP__cleanupMacMemory (void); - +#endif /** STORAGE OF VERTEX LISTS Needed by the X version of output.c @@ -481,3 +486,47 @@ #define PUSH_TRACE srgp__userDebugAidsDisabled++ #define POP_TRACE srgp__userDebugAidsDisabled-- + +#ifdef __cplusplus +extern "C" { + void SRGP__setCanvasDefaults (void); + void SRGP__reactToScreenResize (int, int); + void SRGP__forceScreenResize (int, int); + void SRGP__initFont (void); + void SRGP__initInputModule (void); + void SRGP__initInputDrivers (void); + void SRGP__activateDevice (int); + void SRGP__cleanupGraphicsDevice (void); + void SRGP__deactivateDevice (int); + int SRGP__handleRawEvents (boolean, boolean); + void SRGP__initEchoModule (void); + void SRGP__enableLocatorRubberEcho (void); + void SRGP__disableLocatorRubberEcho (void); + void SRGP__updateLocatorRubberEcho (void); + void SRGP__updateLocatorRubberAnchor (void); + void SRGP__enableLocatorCursorEcho (void); + void SRGP__disableLocatorCursorEcho (void); + void SRGP__updateLocatorCursorShape (void); + void SRGP__updateRawCursorPosition (void); + void SRGP__enableKeyboardEcho (void); + void SRGP__disableKeyboardEcho (void); + void SRGP__updateKeyboardEcho (void); + void SRGP__updateKeyboardEchoAttributes (void); + void SRGP__updateLocationKnowledge (void); + void SRGP__updateInputSelectionMask (void); + void SRGP__drawSquareMarker (int, int); + void SRGP__drawCircleMarker (int, int); + void SRGP__drawXMarker (int, int); + #ifdef THINK_C + void ReportSpecialError (char*, boolean); + void SRGP__error (...); + PaletteHandle SRGP__getPalette(void); + #endif + void SRGP__initColor (int); + void SRGP__cleanupColor (void); + void SRGP__activateApplColorTable (void); + void SRGP__deactivateApplColorTable (void); + void SRGP__initGraphicsDevice (char*, int, boolean); + void SRGP__cleanupMacMemory (void); +} +#endif diff -dru SRGP_DISTRIB/include/srgppublic.h SRGP_DISTRIB.fjo/include/srgppublic.h --- SRGP_DISTRIB/include/srgppublic.h Thu Dec 21 04:32:06 1995 +++ SRGP_DISTRIB.fjo/include/srgppublic.h Mon Nov 29 23:51:59 2004 @@ -151,14 +151,14 @@ #endif ; - +#ifndef __cplusplus void SRGP_setMaxCanvasIndex (int i); void SRGP_setMaxPatternIndex (int i); void SRGP_setMaxCursorIndex (int i); void SRGP_setMaxFontIndex (int i); void SRGP_setMaxPointlistSize (int i); void SRGP_setMaxStringSize (int i); - +#endif @@ -185,6 +185,7 @@ /** PROTOTYPES FOR ALL PUBLIC SRGP ROUTINES **/ +#ifndef __cplusplus /******************** attribute.c */ void SRGP_setAttributes (attributeGroup* group); void SRGP_setBackgroundColor (int colorIndex); @@ -308,5 +309,130 @@ void SRGP_changeScreenCanvasSize (int newwidth, int newheight); void SRGP_end (void); +#else + +extern "C" { + void SRGP_setMaxCanvasIndex (int); + void SRGP_setMaxPatternIndex (int); + void SRGP_setMaxCursorIndex (int); + void SRGP_setMaxFontIndex (int); + void SRGP_setMaxPointlistSize (int); + void SRGP_setMaxStringSize (int); + + void SRGP_setAttributes (attributeGroup*); + void SRGP_setBackgroundColor (int); + void SRGP_setClipRectangle (rectangle); + void SRGP_setColor (int); + void SRGP_setFillBitmapPattern (int); + void SRGP_setFillPixmapPattern (int); + void SRGP_setFillStyle (drawStyle); + void SRGP_setFont (int); + void SRGP_setLineStyle (lineStyle); + void SRGP_setLineWidth (int); + void SRGP_setMarkerStyle (markerStyle); + void SRGP_setMarkerSize (int); + void SRGP_setPenBitmapPattern (int); + void SRGP_setPenPixmapPattern (int); + void SRGP_setPenStyle (drawStyle); + void SRGP_setPlaneMask (int); + void SRGP_setWriteMode (writeMode); + + canvasID SRGP_createCanvas (int, int); + void SRGP_useCanvas (canvasID); + void SRGP_deleteCanvas (canvasID); + + void SRGP_loadCommonColor (int, char*); + void SRGP_loadColorTable (int, int, ush*, ush*, ush*); + void SRGP_loadSingleColor (int, ush, ush, ush); + + void SRGP_loadCursor (int, int); + void SRGP_loadFont (int, char*); + void SRGP_inquireTextExtent (char*, int*, int*, int*); + int SRGP_loadBitmapPatternsFromFile (FILE*); + int SRGP_loadPixmapPatternsFromFile (FILE*); + void SRGP_loadBitmapPattern (int, char*); + void SRGP_loadPixmapPattern (int, int*); + + void SRGP_setInputMode (inputDevice, inputMode); + inputDevice SRGP_waitEvent (int); + void SRGP_getLocator (locatorMeasure*); + void SRGP_getKeyboard (char*, int); + void SRGP_getDeluxeLocator (deluxeLocatorMeasure*); + void SRGP_getDeluxeKeyboard (deluxeKeyboardMeasure*); + void SRGP_sampleLocator (locatorMeasure*); + void SRGP_sampleKeyboard (char*, int); + void SRGP_sampleDeluxeLocator (deluxeLocatorMeasure*); + void SRGP_sampleDeluxeKeyboard (deluxeKeyboardMeasure*); + void SRGP_setLocatorMeasure (point position); + void SRGP_setKeyboardMeasure (char*); + void SRGP_setLocatorEchoType (echoType); + void SRGP_setLocatorEchoCursorShape (int); + void SRGP_setLocatorEchoRubberAnchor (point); + void SRGP_setLocatorButtonMask (int); + void SRGP_setKeyboardProcessingMode (keyboardMode); + void SRGP_setKeyboardEchoColor (int); + void SRGP_setKeyboardEchoOrigin (point); + void SRGP_setKeyboardEchoFont (int); + + void SRGP_inquireAttributes (attributeGroup*); + rectangle SRGP_inquireClipRectangle (void); + canvasID SRGP_inquireActiveCanvas (void); + rectangle SRGP_inquireCanvasExtent (canvasID); + void SRGP_inquireCanvasSize (canvasID, int*, int*); + int SRGP_inquireCanvasDepth (void); + lineStyle SRGP_inquireLineStyle (void); + void SRGP_inquireColorTable (int, int, ush*, ush*, ush*); + #ifndef THINK_C + Drawable SRGP_inquireXDrawable (canvasID); + #endif + + point SRGP_defPoint (int, int); + rectangle SRGP_defRectangle (int, int, int, int); + void SRGP_beep (void); + void SRGP_pointCoord (int, int); + void SRGP_point (point); + void SRGP_polyPoint (int, point*); + void SRGP_polyPointCoord (int, int*, int*); + void SRGP_markerCoord (int, int); + void SRGP_marker (point); + void SRGP_polyMarker (int, point*); + void SRGP_polyMarkerCoord (int, int*, int*); + void SRGP_lineCoord (int, int, int, int); + void SRGP_line (point, point); + void SRGP_rectangleCoord (int, int, int, int); + void SRGP_rectanglePt (point, point); + void SRGP_rectangle (rectangle); + void SRGP_polyLine (int, point*); + void SRGP_polyLineCoord (int, int*, int*); + void SRGP_polygon (int, point*); + void SRGP_polygonCoord (int, int*, int*); + void SRGP_fillRectangleCoord (int, int, int, int); + void SRGP_fillRectanglePt (point, point); + + void SRGP_fillRectangle (rectangle); + void SRGP_fillPolygon (int, point*); + void SRGP_fillPolygonCoord (int, int*, int*); + void SRGP_ellipse (rectangle); + void SRGP_ellipseArc (rectangle, double, double); + void SRGP_fillEllipse (rectangle); + void SRGP_fillEllipseArc (rectangle, double, double); + void SRGP_text (point, char*); + void SRGP_refresh (void); + + void SRGP_copyPixel (canvasID, rectangle, point); + + void SRGP_begin (char*, int, int, int, boolean); + void SRGP_beginWithDebug (char*, int, int, int, boolean); + void SRGP_disableDebugAids (void); + void SRGP_enableBlockedWait (void); + void SRGP_setErrorHandlingMode (errorHandlingMode); + void SRGP_enableSynchronous (void); + void SRGP_tracing (boolean); + void SRGP_allowResize (boolean); + void SRGP_registerResizeCallback (funcptr); + void SRGP_changeScreenCanvasSize (int, int); + void SRGP_end (void); +} +#endif #undef ush diff -dru SRGP_DISTRIB/src/srgp/Makefile SRGP_DISTRIB.fjo/src/srgp/Makefile --- SRGP_DISTRIB/src/srgp/Makefile Thu Dec 21 04:31:57 1995 +++ SRGP_DISTRIB.fjo/src/srgp/Makefile Mon Nov 29 23:35:19 2004 @@ -13,7 +13,7 @@ # Very important! The first flag (struct-return) makes it safe to link # gcc objects with cc objects. #GCCFLAGS = -GCCFLAGS = -fpcc-struct-return +GCCFLAGS = -fpcc-struct-return # Object files wiil go in this subdirectory OBJ_DIR = objects @@ -64,6 +64,7 @@ echo $(PATH_OBJECTS) ar rv $(TARGET) $(PATH_OBJECTS) ranlib $(TARGET) + cp $(TARGET) ../../lib/ mv $(TARGET) $(OBJ_DIR) remove: diff -dru SRGP_DISTRIB/src/srgp/srgp_attrib.c SRGP_DISTRIB.fjo/src/srgp/srgp_attrib.c --- SRGP_DISTRIB/src/srgp/srgp_attrib.c Thu Dec 21 04:31:58 1995 +++ SRGP_DISTRIB.fjo/src/srgp/srgp_attrib.c Mon Nov 29 23:10:04 2004 @@ -571,10 +571,17 @@ srgp__curActiveCanvasSpec.attributes.color = value; #ifdef X11 - XSetForeground(srgpx__display, srgp__curActiveCanvasSpec.gc_fill, - XCOLOR(COLORINDEX(value))); - XSetForeground(srgpx__display, srgp__curActiveCanvasSpec.gc_frame, - XCOLOR(COLORINDEX(value))); + if (srgp__available_depth == 8 || srgp__visual_class == PseudoColor) { + XSetForeground(srgpx__display, srgp__curActiveCanvasSpec.gc_fill, + XCOLOR(COLORINDEX(value))); + XSetForeground(srgpx__display, srgp__curActiveCanvasSpec.gc_frame, + XCOLOR(COLORINDEX(value))); + } else { + XSetForeground(srgpx__display, srgp__curActiveCanvasSpec.gc_fill, + srgp__colorindex[value]); + XSetForeground(srgpx__display, srgp__curActiveCanvasSpec.gc_frame, + srgp__colorindex[value]); + } #endif #ifdef THINK_C Only in SRGP_DISTRIB.fjo/src/srgp: srgp_attrib.c~ diff -dru SRGP_DISTRIB/src/srgp/srgp_color_X.c SRGP_DISTRIB.fjo/src/srgp/srgp_color_X.c --- SRGP_DISTRIB/src/srgp/srgp_color_X.c Thu Dec 21 04:31:58 1995 +++ SRGP_DISTRIB.fjo/src/srgp/srgp_color_X.c Mon Nov 29 23:10:04 2004 @@ -20,10 +20,9 @@ srgp__base_colorindex = 0; } + else if (srgp__available_depth <= 8 || srgp__visual_class == PseudoColor) { - else { - - /****** PERFORMED FOR COLOR DISPLAYS */ + /****** PERFORMED FOR PSEUDO COLOR DISPLAYS */ SRGP_BLACK = 1; SRGP_WHITE = 0; @@ -40,6 +39,7 @@ srgp__application_depth = requested_planes; srgp__max_pixel_value = (1 << srgp__application_depth) - 1; + srgp__colorindex = (unsigned long *)malloc(sizeof(unsigned long)*srgp__max_pixel_value); if (srgp__application_depth == srgp__available_depth) { /***** APPL WANTS ENTIRE COLOR TABLE! */ @@ -94,11 +94,37 @@ /* Only first two entries of LUT are init'd */ XStoreNamedColor (srgpx__display, srgpx__colormap, "white", COLORINDEX(0), -1); + srgp__colorindex[0]=XWHITE; XStoreNamedColor (srgpx__display, srgpx__colormap, "black", COLORINDEX(1), -1); + srgp__colorindex[1]=XBLACK; } + else { /* May be TrueColor */ + /****** PERFORMED FOR COLOR DISPLAYS */ + XColor def, closest; + SRGP_BLACK = 1; + SRGP_WHITE = 0; + + /***** APPL WANTS TO SHARE COLOR TABLE WITH THE OTHER CLIENTS */ + if ((requested_planes == 0) || + (requested_planes > srgp__available_depth)) +/* srgp__application_depth = srgp__available_depth;*/ + srgp__application_depth = 8; + else + srgp__application_depth = requested_planes; + srgp__max_pixel_value = (1 << srgp__application_depth) - 1; + srgp__colorindex = (unsigned long *)malloc(sizeof(unsigned long)*srgp__max_pixel_value); + srgpx__colormap = DefaultColormap(srgpx__display,srgpx__screen); + XAllocNamedColor + (srgpx__display, srgpx__colormap, "white", &closest, &def); + srgp__colorindex[0]=closest.pixel; + XAllocNamedColor + (srgpx__display, srgpx__colormap, "black", &closest, &def); + srgp__colorindex[1]=closest.pixel; + } + /*** DONE FOR ALL CONFIGURATIONS. */ XSetWindowBackground (srgpx__display, srgp__curActiveCanvasSpec.drawable.win, XWHITE); @@ -157,12 +183,19 @@ xcurcs->blue = bluei[j]; } - XStoreColors (srgpx__display, srgpx__colormap, x_color_structs, count); + if (srgp__available_depth == 8 || srgp__visual_class == PseudoColor) + XStoreColors (srgpx__display, srgpx__colormap, x_color_structs, count); + else + for (i=startentry, j=0, xcurcs=x_color_structs; ipixel = COLORINDEX(i); + if (srgp__available_depth == 8 || srgp__visual_class == PseudoColor) + xcurcs->pixel = COLORINDEX(i); + else + xcurcs->pixel = srgp__colorindex[i]; xcurcs->flags = -1; } @@ -233,6 +269,14 @@ srgp_check_pixel_value (entry, "start/end"); } - XStoreNamedColor - (srgpx__display, srgpx__colormap, name, COLORINDEX(entry), -1); + if (srgp__available_depth == 8 || srgp__visual_class == PseudoColor) { + XStoreNamedColor + (srgpx__display, srgpx__colormap, name, COLORINDEX(entry), -1); + srgp__colorindex[entry]=COLORINDEX(entry); + } else { + XColor def, closest; + XAllocNamedColor + (srgpx__display, srgpx__colormap, name, &closest, &def); + srgp__colorindex[entry]=closest.pixel; + } } diff -dru SRGP_DISTRIB/src/srgp/srgplocal.h SRGP_DISTRIB.fjo/src/srgp/srgplocal.h --- SRGP_DISTRIB/src/srgp/srgplocal.h Thu Dec 21 04:32:03 1995 +++ SRGP_DISTRIB.fjo/src/srgp/srgplocal.h Mon Nov 29 23:10:04 2004 @@ -294,6 +294,7 @@ #define COLORINDEX(c) \ ( (unsigned long)(c) | (unsigned long)srgp__base_colorindex ) +unsigned long *srgp__colorindex; #endif #ifdef THINK_C #define COLORINDEX(c) ((int)(c|srgp__base_colorindex)) Only in SRGP_DISTRIB.fjo/src/srgp: srgplocal.h~