fox@rudolf.nscl.msu.edu (Ron Fox) (02/27/91)
-- The following illustrate problems with GKS-3d C bindings on ULTRIX. Neither program has problems running on VMS GKS-3D. The problems are: 1. INQUIRE TEXT FACILITIES returns garbage for the list of fonts and precisions for workstation 211 (DECWINDOWS). I do not know if this is a problem for other workstation types. This is illustrated by the first attached program (gksfail.c) 2. MESSAGE produces a dialog box on w.s. 211 which, if it overlays a highlighted segment does not properly restore that segment when it is dismissed. This is illustrated by the second attached program gksfail2.c I do not know of workarounds or patches to either of these two bugs. I have submitted these problems to DSNLINK, yesterday (Feb 26, 1991), and so far just have the automated responses. Bug 1 seems sort of inexcusable. You'd think that elementary testing would catch this. Bug 2 looks careless. Ron ---------------------------- gksfail.c ---------------------------------- /* ** Test program for gtmaxtxtprec function which seems to be haywire **/ #include <stdio.h> #include <errno.h> #ifdef ultrix #include <GKS3D/GKS3Dcbnd.h> #define DISPLAY "0:0.0" #endif #ifdef VMS #include <GKS3D$CBND.H> #define DISPLAY "DECW$DISPLAY" #endif #include <stdlib.h> #include <string.h> void gtmaxtxtprec(int wstype); main () { Gint wstype; Glong memsize; /* Open gks and a workstation: */ memsize = 1024; gopengks(stderr, &memsize); wstype = 211; gopenws(1, DISPLAY, &wstype); /* Open decwindows on default screen */ gtmaxtxtprec(211); exit(0); } /* ** Functional Description: ** gtmaxtxtprec - This function displays the set of fonts and ** precisions for the given workstation type ** Formal Parameters: ** Gint wtype - Type of workstation we're asking about. ** Gtxtprec *p - Pointer to a font/precision structure. */ void gtmaxtxtprec(Gint wtype) { Gtxfac buf; /* Text facilities buffer. */ int siz; /* Number of fonts. */ int i; Gtxfp *fp, dummy; int err; /* Error indicator. */ /* We inquire text facilities twice. The first time tells us how */ /* big a list of fonts we need to support, the second actually */ /* Retrieves the font/precision list. */ buf.fp_list = &dummy; /* Start out with dummy list... */ ginqtextfacil(&wtype, 1, &siz, &buf, &err); /* Get number of fonts in list in siz */ printf("Siz after = %d\n", siz); printf("buf.fps = %d\n", buf.fps); if(err != 0) { fprintf(stderr, "Unable to ginqtextfacil in gtmaxtxtprec for sizing %d\n", err); exit(err); } /* Now we allocate the storage needed for the font list. */ /* and do ginqtextpacil again to get the data */ fp = (Gtxfp *)malloc(siz*3*sizeof(Gtxfp)); if(fp == (Gtxfp *)NULL) { fprintf(stderr, "Unable to malloc a buffer for %d fonts in gtmaxtxtprec\n", siz); perror("malloc failed due to "); exit(errno); } memset(fp, 0, siz*3*sizeof(Gtxfp)); /* Zero the buffer... */ buf.fp_list = fp; /* Verify the buffer is zeroed... */ for(i=1; i < siz*3; i++) { printf("Font %d Precision %d\n", buf.fp_list[i].font, buf.fp_list[i].prec); } printf("-----------------------------------------\n"); /* Now inquire the text facilities into the buffer. */ i = siz*3; ginqtextfacil(&wtype, i, &siz, &buf, &err); /* Get the font list now. */ if(err != 0) { fprintf(stderr, "Unable to ginqtextfacil in gtmaxtxtprec for effect %d\n", err); exit(err); } /* List out the set of font and precisions found: */ printf("Now buf.fps = %d\n", buf.fps); for(i = 0; i<buf.fps; i++) { printf("Font: %d, prec= %d\n", buf.fp_list[i].font, buf.fp_list[i].prec); } free(fp); /* Release storage */ printf("A few other bits of data: \n"); printf(" buf.,heights %d\n", buf.heights); printf(" buf.min_ht %f\n", buf.min_ht); printf(" buf.max_ht %f\n", buf.max_ht); printf(" buf.expansions %d\n", buf.expansions); printf(" buf.min_exp %f\n", buf.min_exp); printf(" buf.max_exp %f\n", buf.max_exp); printf(" buf.predefined %d\n", buf.predefined); } ----------------------------gksfail2.c-------------------------------- /* ** Test program for gtmaxtxtprec function which seems to be haywire **/ #include <stdio.h> #include <errno.h> #ifdef ultrix #include <GKS3D/GKS3Dcbnd.h> #define DISPLAY "0:0.0" #endif #ifdef VMS #include <GKS3D$CBND.H> #define DISPLAY "DECW$DISPLAY" #endif #include <stdlib.h> #include <string.h> void dobox(Gfloat x1, Gfloat y1, Gfloat x2, Gfloat y2); main () { char c; Gint wstype; Glong memsize; Gcobundl co; Glimit ndc; /* Open gks and a workstation: */ memsize = 1024; gopengks(stderr, &memsize); wstype = 211; gopenws(1, DISPLAY, &wstype); /* Open decwindows on default screen */ ndc.xmin = 0.0; ndc.xmax = 2.54 * 6.0/100.0; /* 6 inches. in x. */ ndc.ymin = 0.0; ndc.ymax = 2.54 * 6.0/100.0; gsetwsviewport(1, &ndc); gactivatews(1); /* Turn on the workstation */ co.comp1 = 0.0; co.comp2 = 0.0; co.comp3 = 0.0; gsetcolourrep(1, 0, &co); /* Black background... */ co.comp1 = 1.0; co.comp2 = 1.0; co.comp3 = 1.0; gsetcolourrep(1, 1, &co); /* White foreground */ gclearws(1, GALWAYS); /* Clear to black. */ gsetlinecolourind(1); /* Use white to draw lines. */ printf("Now drawing boxes in segments and highlighting first one.\n"); gcreateseg(1); dobox((Gfloat)0.01, (Gfloat)0.01, (Gfloat)0.5, (Gfloat)0.5); gcloseseg(); gsetvis(1, GVISIBLE); gupdatews(1, GPERFORM); gsethighlight(1, GHIGHLIGHTED); gcreateseg(2); dobox((Gfloat)0.5, (Gfloat)0.5, (Gfloat)0.9, (Gfloat)0.9); gcloseseg(); gsetvis(2, GVISIBLE); gupdatews(1, GPERFORM); printf("Hit return to continue: "); scanf("%c", &c); printf("Now popping up a message.. dismiss it for first humorous problem\n"); gmessage(1, "Dismiss this message please"); printf("Hit return for next humorous problem "); scanf("%c", &c); gsethighlight(1, GNORMAL); gsethighlight(2, GHIGHLIGHTED); gupdatews(1, GPERFORM); printf("Note the exclusive or effect in the resulting highlighting\n"); printf ("Hit return to exit"); scanf("%c", &c); exit(0); } void dobox(Gfloat x1, Gfloat y1, Gfloat x2, Gfloat y2) /* Draw a rectangle bounded by (x1,y1)-(x2,y2) */ { Gpoint pts[5]; pts[0].x = x1; pts[0].y = y1; pts[1].x = x1; pts[1].y = y2; pts[2].x = x2; pts[2].y = y2; pts[3].x = x2; pts[3].y = y1; pts[4].x = x1; pts[4].y = y1; gpolyline(5, pts); } Ron Fox | FOX@MSUNSCL.BITNET | Where the name NSCL | FOX@RUDOLF.NSCL.MSU.EDU | goes on before Michigan State University | MSUHEP::RUDOLF::FOX | the quality East Lansing, MI 48824-1321 | | goes in. USA