🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #37851

bug in XtGetApplicationResources()?

#37851
From: Brian V. Smith
Date: Fri, 09 Mar 1990 01:14
95 lines
4118 bytes
Certain command-line options for xfig that used to work aren't
parsed correctly any more on a Sun 4 with Sunos 4.0 and X11R4.

Things worked correctly under R3, and they still work on a Vaxstation
running Ultrix and X11R4.

The two options that don't have any effect any more are -portrait
and -notrack.

Here is the relevant information and code from main.c:

extern int		DEBUG;
extern int		RHS_PANEL;
extern int		INVERSE;
extern int		TRACKING;
extern int		landscape;

Widget			tool;
int			WINDOW_WIDTH, WINDOW_HEIGHT;

static int	true = True;
static int	false = False;
static int	zero = 0;
static float	tmp_width = 0.0, tmp_height = 0.0;

static XtResource application_resources[] = {
	{XtNjustify, XtCJustify, XtRBoolean, sizeof(int),
		 (Cardinal)&RHS_PANEL, XtRBoolean, (caddr_t)&false},
	{"debug", "Debug", XtRBoolean, sizeof(int),
		 (Cardinal)&DEBUG, XtRBoolean, (caddr_t)&false},
	{"landscape", XtCOrientation, XtRBoolean, sizeof(int),
		 (Cardinal)&landscape, XtRBoolean, (caddr_t)&true},
	{XtNwidth, XtCWidth, XtRFloat, sizeof(float),
		 (Cardinal)&tmp_width, XtRInt, (caddr_t)&zero},
	{XtNheight, XtCHeight, XtRFloat, sizeof(float),
		 (Cardinal)&tmp_height, XtRInt, (caddr_t)&zero},
	{XtNreverseVideo, XtCReverseVideo, XtRBoolean, sizeof(int),
		 (Cardinal)&INVERSE, XtRBoolean, (caddr_t)&false},
	{"trackCursor", "Track", XtRBoolean, sizeof(int),
		 (Cardinal)&TRACKING, XtRBoolean, (caddr_t)&false},
 	{"inches", "Inches", XtRBoolean, sizeof(int),
 		 (Cardinal)&INCHES, XtRBoolean, (caddr_t)&true},
	{"boldFont", "BoldFont", XtRString, sizeof(caddr_t),
		(Cardinal)&boldFont, XtRString, (caddr_t)NULL},
	{"normalFont", "NormalFont", XtRString, sizeof(caddr_t),
		(Cardinal)&normalFont, XtRString, (caddr_t)NULL},	
};

static XrmOptionDescRec options[] =
{
	{"-right", ".justify", XrmoptionNoArg, "True" },
	{"-left", ".justify", XrmoptionNoArg, "False"},
	{"-debug", ".debug", XrmoptionNoArg, "True"},
	{"-landscape", ".landscape", XrmoptionNoArg, "True"},
	{"-Landscape", ".landscape", XrmoptionNoArg, "True"},
	{"-portrait", ".landscape", XrmoptionNoArg, "False"},
	{"-Portrait", ".landscape", XrmoptionNoArg, "False"},
	{"-width", ".width", XrmoptionSepArg, 0},
	{"-height", ".height", XrmoptionSepArg, 0},
	{"-inverse", ".reverseVideo", XrmoptionNoArg, "True"},
	{"-notrack", ".trackCursor", XrmoptionNoArg, "False"},
	{"-track", ".trackCursor", XrmoptionNoArg, "True"},
 	{"-inches", ".inches", XrmoptionNoArg, "True"},
 	{"-imperial", ".inches", XrmoptionNoArg, "True"},
 	{"-centimeters", ".inches", XrmoptionNoArg, "False"},
 	{"-metric", ".inches", XrmoptionNoArg, "False"},
	{"-boldFont", ".boldFont", XrmoptionSepArg, 0},
	{"-normalFont", ".normalFont", XrmoptionSepArg, 0},
};

main(argc,argv)
char *argc;
int *argv[];
	{
	tool = XtInitialize("fig", "Fig", options, XtNumber(options),
		&argc, argv);

	XtAddConverter("String", "Float", CvtStringToFloat, NULL, 0);
        XtAddConverter("Int", "Float", CvtIntToFloat, NULL, 0);
	XtGetApplicationResources(tool, 0, application_resources,
                                   XtNumber(application_resources), NULL, 0 );
	if (argc > 1)
		file = argv[1];

When starting xfig with -landscape, after the call to
XtGetApplicationResources, dbx shows that landscape = 1 instead of 0(False).

Is this a known bug in XtGetApplicationResources?
All of the other options work fine except -notrack.

_____________________________________
Brian V. Smith    (bvsmith@lbl.gov)
Lawrence Berkeley Laboratory
I don't speak for LBL, these non-opinions are all mine.
Technical Details
Message-ID: <5030@helios.ee.lbl.gov>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!pasteur!helios.ee.lbl.gov!epb2.lbl.gov!envbvs

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!pasteur!helios.ee.lbl.gov!epb2.lbl.gov!envbvs
From: envbvs@epb2.lbl.gov (Brian V. Smith)
Newsgroups: comp.windows.x
Subject: bug in XtGetApplicationResources()?
Message-ID: <5030@helios.ee.lbl.gov>
Date: 9 Mar 90 01:14:50 GMT
Sender: usenet@helios.ee.lbl.gov
Reply-To: envbvs@epb2.lbl.gov (Brian V. Smith)
Organization: lbl
Lines: 95
X-Local-Date: 8 Mar 90 17:14:50 PST