[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

476.0. "DECW$XDEFAULTS.DAT" by TLE::DANIELS (Brad Daniels, VAX C RTL whipping boy) Fri Mar 24 1989 17:59

I'm sure  there  has  been  some  discussion  of this somewhere in the "old"
conference, but I can't find it...

I am  trying  to  make configure my clock to appear in a certain position on
the  screen.  I  prefer  DECW$CLOCK  to the clock provided with banner, so I
can't just do the BANNER customization.

I have  tried  putting  the following in DECW$XDEFAULTS.DAT, DECW$CLOCK.DAT,
and  in  DECW$CLOCK_DEFAULT.DAT, but have had no success in getting anything
to change about the way the clock behaves:

DECW$CLOCK.x:			927
DECW$CLOCK.y:			104
DECW$CLOCK.width:		106
DECW$CLOCK.height:		125

I have  also  tried  substituting  "Clock"  for  "DECW$CLOCK", again with no
noticeable results.

What am  I  doing wrong? Has someone gathered together a list of what can be
put  into  which  resource  files,  and  what their effect will be? If so, a
pointer/copy would be appreciated.

- Brad

T.RTitleUserPersonal
Name
DateLines
476.1Try "geometry"STAR::BECK2B or D4 - that is the questionFri Mar 24 1989 18:146
    I believe you need to use the "geometry" setting, a la
    
Clock.geometry:			135x95+1-1
    
    which goes in DECW$CLOCK.DAT.

476.2DECW$XDEFAULTS.DAT or DECW$CLOCK.DATOIWS20::BRYSONFri Mar 24 1989 18:547
    The geometry setting may be placed in SYS$LOGIN:DECW$XDEFAULTS.DAT or
    SYS$LOGIN:DECW$CLOCK.DAT for only a single account's customization, or
    in DECW$SYSTEM_DEFAULTS:DECW$CLOCK.DAT for a system-wide customization
    of Clock.
    
    David

476.3How can I make the changes take?36191::NEWMANWhat, me worry? YOU BET!Wed May 24 1989 16:348
    I have another question regarding DECW$XDEFAULTS.DAT
    
    Once I am logged into my system and I make edits to DECW$XDEFAULTS.DAT,
    how can I make the changes take place other than logging out and back
    in again.
    
    Thanks

476.4STAR::MFOLEYRebel without a ClueWed May 24 1989 17:249

	DIR/ALL/AUTHOR=PORTER  or DIR SMAUG::DAVES_BITSHOP:

	You should find something written by Dave Porter that will
	do this for you...

							mike

476.52199::VANNOYJake VanNoyThu May 25 1989 11:589
>    Once I am logged into my system and I make edits to DECW$XDEFAULTS.DAT,
>    how can I make the changes take place other than logging out and back
>    in again.
    
Pick "Used Last Saved Settings" in the session manager.  Any application
starting up after that will use the new resource database.



476.638863::DERAMODaniel V. {AITG,ZFC}:: D'EramoThu May 25 1989 19:336
	re .4:  That's SMAUG::DAVES_BITSHOP:RELOAD.C and RELOAD.EXE.
	I had to increase the constant MAXLEN before I could use it,
	because my defaults file was too long.

	Dan

476.7why is the sky blue, daddy?NEURON::NICHOLSONA belly as big as an oil spillTue Jun 06 1989 19:3651
    In looking at DECW$XDEFAULTS files that have been posted in this
    conference, I had come to the misguided conclusion that an exclamation
    point served as a comment character when placed in front of a line
    in a resource file.
    
    Today I "commented" out a line in my DECW$XDEFAULTS file and after
    logging out and back in (I didn't realize that you could use the
    method .5 suggests - thanks .5) I had a different color background
    for my DECterm windows.  The line I commented out had nothing to
    do with DECterm resources (it was "Notes*mumble...").  If I removed
    the "comment" character and logged out and in again, DECterm windows
    went back to the way they were before.
    
    It had something to do with the fact that in my DECW$XDEFAULTS.DAT file
    I have a line "*background: some-color" and from DECW$SM_COLOR.DAT it
    picks up the line "*Background: some-other-color".  Always before, by
    DECterm windows were the color from the specific resource "*background"
    instead of the class resource "*Background".  Adding an exclamation
    point to an unrelated line had the side effect of causing DECterm to
    use the class resource for some reason. 

    I'm not really concerned about this specific problem (removing a
    bunch of other lines with ! in front of them cleared it up!) but
    I was wondering how many other people might assume that an ! is
    a comment character to Xrm and get bit and also I was wondering
    whether there should be a comment character that would cause a line
    in a resource file NOT to get loaded.

    Comments?
    
    Also, in playing with geometry I noticed that if I had lines like
    
    	mumble.x:	-20
    	mumble.y:	-20
    
    it would position mumble's window 20 pixels to the left of 0,0 and
    would override the y value (the window manager not wanting the title
    bar off the screen).
    
    If I used something like
    
    	mumble.geometry:	400x300-20-20
    
    however, it would position the window offset -20 in both the x and
    y direction from the bottom right hand corner.

    I can live with this - is this how it's supposed to work?
    
    Thanks,
    Mark

476.8MU::PORTERwe have seen the enemy and it is usWed Jun 07 1989 10:144
I believe that # functions as a comment character.   At least,
lines in DECW$XDEFAULTS that begin with `#' don't appear to get
stored on the root window.

476.9! is comment, # is a control lineMIPSBX::thomasThe Code WarriorWed Jun 07 1989 13:028
! as in
#ifdef COLOR
Mail*foreground:	purple
#endif
#ifndef COLOR
Mail*background:	black
#endif

476.10hope we get to the bottom of thisNEURON::NICHOLSONA belly as big as an oil spillWed Jun 07 1989 15:4719
    re: .8

    Thanks, that's right.
    
    I thought about the # character, but when I looked at what
    was in the RESOURCE_MANAGER property (which gets loaded using the
    Xrm routines) I saw the "#augment \n\" lines so I didn't think the
    # was it.  Those lines, however, are continuations of other lines,
    so # does in deed act as a comment character if it appears at the
    beginning of a line.

re: .9
    
    In looking at the source code for XrmGetFileDatabase (which is what
    gets used to read resource files into Xrm databases), it calls
    PutLineResources which skips lines that start with a #, but treats
    lines that start with an ! just like any other line.  So, unless
    I'm missing something, ! is not a comment, but # is.

476.11MU::PORTERwe have seen the enemy and it is usWed Jun 07 1989 19:4113
    I base my statement on that "# is a comment, and ! is not" on
    the observation that the stored resource string (property 
    XA_RESOURCE_MANAGER on the root window) contains lines from
    my DECW$XDEFAULTS that start with a shriek, and doesn't contain
    lines that start with a hash.
    
    Now, maybe the hash really serves as an introducer for some
    kind of directive, and bogus directives are quietly dropped -- 
    I dunno about that.  
    
    (This under VMS, by the way).
    

476.12#=comment,DECWIN::JACKIEJackie FergusonThu Jun 08 1989 08:5410
Dave is correct, # is the comment character.

Lines that begin with ! might be ignored, they might cause strange results,
just like any illegal resource name.  

This will be documented in the xrm chapter of the guide to xlib programming
which will be out with the next release.

Jackie

476.13DECW$XDEFAULTS.DAT documented anywhere?5063::HARROWJeff - The Network *IS* the System!Thu Jun 08 1989 10:015
Is there currently any documentation for the DECW$XDEFAULTS.DAT file contents?

Jeff
	

476.14LESLIE::LESLIEAndy ��� LeslieThu Jun 08 1989 10:072
    Nope.

476.16FLUME::dikeThu Jun 08 1989 12:144
I don't know about VMS, but Ultrix uses '#' in .Xdefaults files for cpp
directives and '!' for comments.
				Jeff

476.17DECWIN::FISHERBurns Fisher 381-1466, ZKO3-4/W23Thu Jun 08 1989 12:376
I thought we had the same xrm in Ultrix and VMS.  Who is running this whole
thing through cpp?  Not that it is not a good idea to have some control
lines, but we should also have some consistency.

Burns

476.18UWS Programming, Volume 3, XUI Intrinsics, Appendix AMIPSBX::thomasThe Code WarriorThu Jun 08 1989 16:1117
A resource file contains text represnting the default resource values for
an application or set of applications.  The resource file in an ASCII text
file that consists of a number of lines with following EBNF syntax:

resourcefile	= {line "\n"}.
line		= (comment | production).
comment		= "!" string.
production	= resourcename ":" string.
resourcename	= ["*"] name {("." | "*") name}.
string		= { <any character not including eol> }.
name		= {"A" - "Z" | "a" - "z" | "0" - "9"}.

If the last character on a line is a backslash (\), that line is assumed to
continue on the next line.

To include a newline character in a string, use "\n".

476.19FLUME::dikeThu Jun 08 1989 17:145
Xrm never sees #'s, or it ignores them if it sees them.  xrdb is the
guy who runs your resources though cpp, after feeling your server
and defining (or undefining) things like COLOR.
				Jeff

476.20!'s seem to work better than #'sAGBEAR::HORNERA.G.Bear, Low tech teddy bearFri Jun 09 1989 08:0110
    I'm not sure if all this applies to VMS or Ultrix or both, but I tried
    changing the !'s that I had been using at the beginning of comment lines
    to #'s to see if this would eliminate some strange behavior that I've
    had in the past.  My VMS xdefaults file seemed to be sensitive to the
    ordering of some of the comment lines, and I thought this might be
    the solution.  To sum it all up, the #'s were a disaster, and I'm back
    to !'s.

              Dave

476.21but then reality got in the wayNEURON::NICHOLSONA belly as big as an oil spillFri Jun 09 1989 14:1711
    re: .20
    
    however, reality is that a # in front of a line causes Xrm to treat
    it as a comment (i.e. throw it away) unless the line is a continuation
    line and a ! does nothing but give you a resource that you'll probably
    never match (and possible nasty side effects).
    
    Can you explain how the # were a disaster?
    
    Mark

476.22It seemed to confuse session managerAGBEAR::HORNERA.G.Bear, Low tech teddy bearFri Jun 09 1989 14:5812
    Re: -.1

    When I put #'s in my xdefaults file, logged out, and logged back in,
    session manager apparently didn't read (or use?) anything out of the
    SM_COLOR and SM_GENERAL files.  I lost every piece of customization
    that is done through session manager and got a default vanilla system.
    I deleted the # version of the xdefaults file, logged out, logged back
    in, and session manager customization was back.  I didn't pursue it
    any further after that.

                Dave

476.23Most applications use !SEAN::DAVIDSONFri Jun 09 1989 15:3910
re: .21

I don't know about Ultrix but on VMS all but one application I've found uses
the ! as a comment line in their default files in SYS$LIBRARY:.  That includes
the session manager .DAT file.  It would be nice if this could be agreed upon
so that it would be uniform for everyone.


Sean

476.24?HANNAH::MESSENGERBob MessengerMon Jun 12 1989 19:0311
Re: .23

>I don't know about Ultrix but on VMS all but one application I've found uses
>the ! as a comment line in their default files in SYS$LIBRARY:. 

What's the one application, and how does an application "use" the ! as a
comment line?  Do you mean that all but one application ignore resources
that start with !?

				-- Bob

476.25MU::PORTERl&#039;enregistrement electriqueMon Jun 12 1989 21:1515
    What he means is this:  many DECwindows developers believe that
    "!" is a comment symbol, because many of the DECW$foo.DAT files
    supplied by DECwindows contain lines which start with "!".
    
    (Actually, I don't suppose there's any guarantee that DECW$foo.DAT
     files use the same convention as DECW$XDEFAULTS.DAT, so this could
     be false logic!).
    
    Looks like this mess needs to be sorted out.
    
    Presumably, the 'correct' comment symbol in Xdefaults is 
    defined by the Xlib specification, and so all we have to
    do is read the spec, make the code follow suit, and then
    promulgate the information to all developers?  Right?

476.26! looks like the de facto comment characterHANNAH::MESSENGERBob MessengerMon Jun 12 1989 21:3916
Re: .25

Oh, that makes sense; I'd forgotten about those files.  A quick check of
sys$library on my workstation reveals that Bookreader, Calc, Calendar,
Cardfiler, Clock, Mail and Puzzle use ! for comments and Banner, Notepad,
Paint, DECterm and the Window Manager do not.  None of the decw$*.dat
files use # for comments.

The description of the resource manager on pages 324 to 339 of "X Window
System  C Library and Protocol Reference" doesn't say anything about
comment characters.  It's unlikely that any application would be so
rude as to use ! as part of a valid resource name, but it might be a good
idea to make that a formal convention.

				-- Bob

476.27MU::PORTERl&#039;enregistrement electriqueTue Jun 13 1989 10:3085
Well, the applications are the ones that made a mistake -- I think *they*
should change to obey the already-existing comment convention!   (Seriously,
whatever is chosen, it ought to be the same for VMS and Ultrix).

In case it's of use to anyone, here's the program I used to figure this
out: it gets the resource manager string from the root window, and looks
for lines which start with "!" or "#".   

On VMS, all "!" lines are retained (well, subject to elimination of
duplicates).  In fact, they're not only retained, they're reformatted
as resource database lines: thus "!comment" becomes "!comment:".

Conversely, all "#" lines are discarded (but only if the "#" is at the
beginning of the line -- in the session manager's "#augment" stuff, the
hash sign is in the middle of a line).

-------------------------------------------------------------------------------

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <decw$include/Xlib.h>
#include <decw$include/Xutil.h>
#include <decw$include/Xatom.h>
#include <decw$include/Xresource.h>

#define XDEFAULTS "sys$login:decw$xdefaults.dat"
#define MAXLEN 4096L	/* 4K chars */

main(argc, argv)
int argc;
char *argv[];
{
    Display *dpy;
    Screen *scr;
    Window root;
    Atom ptype;
    int pform;
    unsigned long nitems, nafter;
    unsigned char *prop;
    int i;
    unsigned char *p1, *p2;

    dpy = XOpenDisplay(0);
    if (dpy==0) {
	printf("can't open display\n");
	exit(-1);
	}

    scr = XDefaultScreenOfDisplay(dpy);
    root = XRootWindowOfScreen(scr);

    XGetWindowProperty(
		      dpy, root, 
		      XA_RESOURCE_MANAGER,
		      0L, MAXLEN/4, 0, AnyPropertyType,
		      &ptype, &pform, &nitems, &nafter, &prop);
    if (ptype==None) {
	printf("property not found on root\n");
	exit(-1);
	}
    if (ptype!=XA_STRING || pform!=8) {
	printf("unexpected property data read\n");
	exit(-1);
	}
    if (nafter) {
	printf("property too big (%ld bytes)\n", nitems+nafter);
	exit(-1);
	}

    printf("size: %ld bytes\n", nitems);
    
    p1 = prop;
    while (p1<prop+nitems && *p1!='\0') {
	p2 = p1;
	while (p2<prop+nitems && *p2!='\0' && (*p2!='\n' || *(p2-1)=='\\')) p2++;
	if (*p1=='#' || *p1=='!') {
	    *p2 = '\0';
	    printf("%s\n", p1);
	    }
	p1 = p2 + 1;
	}

}

476.28SEAN::DAVIDSONWed Jun 14 1989 15:3217
re:

You got it Dave.

When the first IFT DECwindows and applications came out I used the '!' as
comment lines and was promptly told by another person in my group that I should
NOT do that because that line will be created as a resource, duplicates
excluded, and slow things down a bit because now all the garbage resource names
were created.

I thought the comment line was already a standard but I guess not.  Comments
can really help out some of those cryptic resource names, for those of use who
want to hack things up.


Sean