ftp.nice.ch/pub/next/tools/dock/Locus.1.0.NI.bs.tar.gz#/Locus/TechDocs/DynamicItems.rtf

This is DynamicItems.rtf in view mode; [Download] [Up]

Copyright 1993  Jeremy Slade.

You are free to use all or any parts of the Locus project
however you wish, just give credit where credit is due.
The author (Jeremy Slade) shall not be held responsible
for any damages that result out of use or misuse of any
part of this project.

JGS Tue Apr 13 18:45:41 PDT 1993


Dynamic Items

	Because it is annoying to have to manually add new items all the time, especially for something that is changing all the time such as a source directory, there is a need to have the ability to automatically add items to a Group.  This is done through Dynamic Items.
	Dynamic Items are a collection of items that are part of the Group at run-time only -- i.e. they don't get archived/save as part of the group.  Dynamic items are used by setting a "dynamic item specification" through the Group inspector pane.  The DynamicItemSpec (which is the name of the class use to keep track of these things) is a file-globbing expression such as is used by the shells.  For example, a spec of '*.[hm]' would mean to dynamically load all .h and .m files in the group's default path at run-time.  Specs can specify full or relative paths (where relative paths are taken from the group's default path).
	The DynamicItemSpec is also responsible for scanning the directories and finding matching items, which are then passed back to the group.  The group can either update its dynamic items automatically on some user-definable interval, or only do it manually.  When it is time to update, it goes through its list of DynamicItemSpecs and tells each of them to update.  The returned items are then added to the group, and the group is redisplayed.
	Once the dynamic items are in a group, they behave exactly like standard items, except that they will be skipped when archiving.  Also, if any of their properties are changed (through the inspector), then they are made static items, and become a permanant part of the Group.
	
	
Dynamic Item Specifications

	The DynamicItemSpecs are shell-style file globbing expressions.  There is no built in support for matching this kind of expression, so they must be translated into regular expressions for use in the directory scanning.  This is done through a globbing-to-regular expression translating method that is part of the DynamicItemSpec class.  When a DynamicItemSpec is set to a new expression, the regular expression is compiled at that time and stored in another instance variable so it will not have to be recreated each time it is used.  The translation algorithm is as follows:
	The string is parsed beginning to end, one character at a time.  For characters that don't have any special meaning, they are ouput to the dest string automatically.  When special characters are encountered, they must be taken care of individually.
	When a period is encountered, it is output to the dest string with a '\' before it.
	When a question mark is encountered, it is replaced with a period.
	An asterisk is replaced with '.*'
	A character range (bounded by []) is output the same, with the exception that if the first character following the '[' is !, it is replaced by ^.	
	Shell Syntax	Reg-Exp Syntax	Purpose
	*	.*	Match any chars
	?	.	Match single char
	[...]	[...]	Match from range of chars
	[!...]	[^...]	Match from all but range of chars
	
	
	

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.