Subject: Re: proplib changes
To: Trevor Talbot <quension@gmail.com>
From: John Nemeth <jnemeth@victoria.tc.ca>
List: tech-kern
Date: 06/26/2007 02:31:48
On Nov 15,  7:41pm, "Trevor Talbot" wrote:
} On 6/26/07, Thor Lancelot Simon <tls@rek.tjls.com> wrote:
} > On Mon, Jun 25, 2007 at 11:12:58PM -0700, Trevor Talbot wrote:
} > > On 6/25/07, Thor Lancelot Simon <tls@rek.tjls.com> wrote:
} 
} > > >What harm is done if we have 8,000 different syntaxes, if the tools do
} > > >seamless conversion between them all?
} 
} > > Er, I thought the point of having a human-editable format was to avoid
} > > requiring the use of tools.
} 
} > What you're missing is that "the tools" in this case means "any
} > proplib-using application".  It doesn't matter if you write a boot
} > properties list in XML or SCN, it looks the same to proplib internally;
} > and, similarly, it can output that list of boot properties in XML or
} > SCN, as you like.
} 
} But the issue is what happens when there's an existing configuration
} file I want to edit.  If it's in one of the 7,999 formats I'm not
} comfortable with, I have to use another tool just to get it into a
} form where I can edit it.  (And there's still the issue of
} transporting comments in this case.)

     If the file isn't in the format that you want then all you need to
is set an environment variable and cause the application to write the
file (otherwise an application that simply reads and writes the file
can get it into the proper format and once converted, it can be left in
that format).  As for comments, I don't know if plists allow for them.

} It doesn't matter that the particular application can read any format,
} or that proplib provides the ability to write any format (it's
} unlikely all the proplib users will expose that), if I still have to
} jump through hoops just to make simple configuration changes.

     There is nothing for the "user" to do.  An application simply
calls prop_dictionary_internalize_from_file(<path to file>);.  proplib
will open the file, read the beginning of it to determine the format,
parse the rest of the file into a dictionary, and finally return a
prop_dictionary_t to the application.  If the application wants to
write a file all it has to is call
prop_dictionary_externalize_to_file(<dictionary>, <path to file>);.
proplib will look for an environment variable specifying the preferred
format, select the default format if the environment variable doesn't
exist, and create the file in the specified format.  One of the main
features of proplib is that the application doesn't need to concern
itself with parsing or creating the external format.  This is handled
completely by the library.

}-- End of excerpt from "Trevor Talbot"