[comp.windows.x] #if in resource file?

harald@itk.unit.no (02/06/90)

I am trying to detect the server type in my resource file:

	#if VENDOR == "MIT X Consortium"
		....
	#endif

This is based on the predefined symbols in xrdb:

    % xrdb -s
     -DHOST=unix -DSERVERHOST=unix -DCLIENTHOST=tone -DVERSION=11 -DREVISION=0 -DVEN
    DOR="MIT X Consortium" -DRELEASE=4 -DWIDTH=1152 -DHEIGHT=900 -DX_RESOLUTION=3545
     -DY_RESOLUTION=3543 -DPLANES=8 -DBITS_PER_RGB=8 -DCLASS=PseudoColor -DCOLOR

But my test in the resource file fails:

	% xrdb -merge resourcefile
	34: syntax error (in preprocessor if)

Why?


System: X11R4, SunOS 4.0.3.c, Sun4

Regards, Harald Backer

////////////////////////////////////////////////////////////////////////
/ Harald Backer                          /  harald@itk.unit.no         /
/ SINTEF Automatic Control               /  (+47 7) 594375 Switchboard /
/ The Norwegian Institute of Technology  /  (+47 7) 594399 Fax         /
/ N-7034 Trondheim                       /                             /
/ NORWAY                                 /                             /
////////////////////////////////////////////////////////////////////////

BTW, how can I store a symbol in the resource data base - permanently?
In
	%xrdb -Dsym=value resourcefile
the definition of `sym' lasts only for this single run.

casey@gauss.llnl.gov (Casey Leedom) (02/07/90)

| From: harald@itk.unit.no
| 
| I am trying to detect the server type in my resource file:
| 
| 	#if VENDOR == "MIT X Consortium"
| 		....
| 	#endif
| 
| But my test in the resource file fails:
| 
| 	% xrdb -merge resourcefile
| 	34: syntax error (in preprocessor if)

  That's because cpp only knows how to compare numeric constants with
"==".  You'll have to think up a way to cast what you want to do into a
numeric or boolean (#ifdef) domain.  You can't compare strings.