home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-05-09 | 3.0 KB | 85 lines | [TEXT/KAHL] |
- // match.h matching functions for the wildcard AppleScript extension
- //
- // 93/11/19 File created
- // 94/01/24 *** released Wild 1.0.0 ***
- // 94/05/09 Totally removed the licensing mechanism and added the GNU comments
- //
- //--------------------------------------------------------------------------------------------------
- // Copyright © 1993, 1994 by Rainbow Hill Pty Ltd.
- //
- // This program is free software; you can redistribute it and/or modify it under the terms of
- // the GNU General Public License as published by the Free Software Foundation; either version 2
- // of the License, or any later version.
- //
- // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- // See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along with this program;
- // if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- //
- #pragma once
-
- #include <Errors.h>
- #include "wild.h"
-
-
- //
- // wildcarding
- //
- // A single '?' is memorised as a wildcard with min = 1 and max = 1.
- // A single '*' is memorised as a wildcard with min = 0 and max = WILD_maxFilenameLen.
- // Consecutive wildcards are collapsed into a single wildcard entry.
- // Such a combined entry might turn out to have a 'max' exceeding
- // WILD_maxFilenameLen. This is considered to be irrelevant
- //
- // Example: A????BC?*?D k offset size min max
- //
- // 01 0 1
- // 1234 0 4
- // 1234 0 4 4
- //
- // 012 1 2
- // 123 1 3
- // 1 2 1 2 > max filename size
- // * 1 > max filename size
- //
- // Note that 'size', as a counter, starts from 1; while 'offset' starts from 0.
- //
- struct match_wild_struct {
- short offset; // distance from previous wildcard within string
- short size; // number of wild characters
- short min; // minimum number of characters in wildcard
- short max; // maximum number of characters in wildcard
- };
- typedef struct match_wild_struct match_wild_t;
-
-
- // match_criteria checks the type of the item (folder or file), the file creator, and the file type
- extern Boolean match_criteria(
- CInfoPBRec *, // --> Cat Info Param block of the item
- wild_parm_t * // --> flags and wildcarded strings
- );
-
- extern Boolean match_OSType(
- OSType, // --> OSType to be matched
- OSType, // --> against this
- Boolean, // --> do wildcarding
- char // --> wildcard character
- );
-
- // match_setWild returns the number of wildcards
- extern short match_setWild(
- char *, // --> wildcarded filename
- wild_parm_t *, // --> flags and wildcarded strings
- match_wild_t * // <-- list of wildcards
- );
-
- extern Boolean match_string(
- char *, // --> string to be matched
- char *, // --> wildcarded filename
- match_wild_t *, // --> list of wildcards
- short, // --> number of wildcards
- Boolean // --> true: case sensitive
- );
-