🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #812

Re: Defaults Database management

#812
From: Brad Nelson
Date: Mon, 07 Sep 1992 15:44
55 lines
2791 bytes
In article <15314@umd5.umd.edu> matthews@oberon.umd.edu (Mike Matthews)  
writes:
>I've looked through the Next Developer files in Librarian 
>and have read the section on defaults, but I must be 
>extremely dense because I still can't figure this one out. 

That makes two of us.

>How can I flush the registration table of defaults to the 
>.NeXTdefaults database? NXWriteDefaultsVector() takes 
>what's in your vector and dumps it to the database and 
>puts the new values into the registration table. 
>
>I tried changing the vector information (a la strcpy) but 
>that gave an "invalid operands to binary +" error on 
>compile so there's something going on behind the scenes 
>that I don't grok too well. 

I think that's because the vector is static - it's supposed
to be the "default defaults".

[munch]

>It's gotta be simple. 
>
>Doesn't it? 

I must be dense too, I couldn't figure out a simple way to do
that.  The thing that confused me was that I assumed that
NXWriteDefaults() was simply a batched version of NXWriteDefault().
Bzzzt!  The two functions don't do the same thing at all.  I can't
imagine why NXWriteDefaults() even exists, given the way it works.
(It writes the vector to disk, not the table)

The values in your NXDefaultsVector will always be available to your
program as soon as you NXRegisterDefaults(), so why would you ever
want to write the _vector_ to the defaults database?  Wouldn't it
make more sense to have NXWriteDefaults() write the _table_ to the
database rather than the vector?  Or, better yet, NXWriteDefaults()
could go through the table and write only the values that are 
different from the ones in the vector.

I guess the thing that confused me was that the docs say "To 
maximize efficiency, you should use one call to NXWriteDefaults() 
rather than several calls to NXWriteDefault() to write multiple values." 
Sure, sure.  You use NXSetDefault() to update a value in the table,
then you call NXWriteDefaults() to write the vector to the database
and re-register, which overwrites the value you just NXSetDefault()ed
with the one in the vector.  

Can anyone explain why this stuff works the way it does?  Is there
an easy way to write the defaults in the _table_ out to the 
database, rather than NXWriteDefault()-ing them individually?

-Brad        brad%raven@kakwa.ucs.ualberta.ca
Technical Details
Message-ID: <1992Sep7.154405.15512@raven.uucp>
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!gumby!destroyer!ubc-cs!alberta!kakwa.ucs.ualberta.ca!raven!brad
References: <15314@umd5.umd.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!gumby!destroyer!ubc-cs!alberta!kakwa.ucs.ualberta.ca!raven!brad
From: brad%raven@kakwa.ucs.ualberta.ca  (Brad Nelson)
Subject: Re: Defaults Database management
Message-ID: <1992Sep7.154405.15512@raven.uucp>
Sender: brad@raven.uucp (Brad Nelson)
References: <15314@umd5.umd.edu>
Date: Mon, 7 Sep 1992 15:44:05 GMT
Lines: 56