home *** CD-ROM | disk | FTP | other *** search
- # include "BlobMgr.h"
-
-
- /* -------------------------------------------------------------------- */
- /* Blob Match Testing Operations */
- /* -------------------------------------------------------------------- */
-
-
- /*
- * Return true if b1 is in b2's match set.
- */
-
- pascal Boolean
- InBlobMatchSet (BlobHandle b1, BlobHandle b2)
- {
- MatchHandle m;
- Boolean result;
-
- result = false;
- for (m = (**b2).matches; m != nil; m = (**m).nextMatch)
- {
- if ((**m).mBlob == b1)
- {
- result = true; /* found it */
- break;
- }
- }
- return (result);
- }
-
-
- /*
- * Default quiet test procedure.
- *
- * A blob requiring an explicit match is quiet if it has a glob and
- * the glob is a member of the match set, or, if the match set is
- * empty, it has no glob. A blob not requiring an
- * explicit match is quiet if it has an explicit match, or if it
- * has a glob but an empty match set, or if it has no glob.
- *
- * Otherwise the blob is noisy.
- */
-
- static pascal Boolean
- DefaultQuietTest (BlobHandle b)
- {
- BlobHandle g;
- Boolean needGlob;
- Boolean result;
-
- g = (**b).glob;
- needGlob = (TestBlobFlags (b, bNeedGlobMask) != 0);
- /*
- * If the blob has no glob, it is matched if it's a non-explicit
- * blob. If it's an explicit blob, it's matched if the match set
- * is empty.
- */
- if (g == nil)
- result = (needGlob ? (**b).matches == nil : true);
- else /* has a glob - is it ok? */
- {
- /*
- * If the blob doesn't need a glob but has one, then it's still
- * quiet if the match set is empty ("any glob will do").
- */
- if (!needGlob && ((**b).matches == nil))
- result = true;
- else
- result = InBlobMatchSet (g, b); /* see if in match set */
- }
- return (result);
- }
-
-
- static BQuietProcPtr bQuietTest = (BQuietProcPtr) DefaultQuietTest;
-
-
- pascal Boolean
- BlobQuiet (BlobHandle b)
- {
- return ((*bQuietTest) (b));
- }
-
-
- /*
- * Install quiet test function for BlobQuiet. Pass nil to restore
- * default.
- */
-
- pascal void
- SetBQuietTest (BQuietProcPtr f)
- {
- bQuietTest = (f == (BQuietProcPtr) nil ? DefaultQuietTest : f);
- }
-
-
- pascal Boolean
- BlobSetQuiet (BlobSetHandle bSet)
- {
- BlobHandle b;
- Boolean result;
-
- result = true;
- for (b = FirstBlob (bSet); b != nil; b = NextBlob (b))
- {
- if (!BlobQuiet (b))
- {
- result = false;
- break;
- }
- }
- return (result);
- }
-