Added match_matchPatternOnce().
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2844 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
Changes towards version 0.7:
|
Changes towards version 0.7:
|
||||||
|
- Added match_matchPatternOnce() - SvdB
|
||||||
- Fixed a problem with blue ships after Avatar's tractor beam,
|
- Fixed a problem with blue ships after Avatar's tractor beam,
|
||||||
along with some other fill-stamp situations; bug #929 - Alex
|
along with some other fill-stamp situations; bug #929 - Alex
|
||||||
- Added TFB_Canvas_Lock(), TFB_Canvas_Unlock() and TFB_Canvas_GetStride()
|
- Added TFB_Canvas_Lock(), TFB_Canvas_Unlock() and TFB_Canvas_GetStride()
|
||||||
|
|||||||
@@ -65,6 +65,16 @@ static inline void match_freeRegexContext(match_RegexContext *context);
|
|||||||
|
|
||||||
// *** General part ***
|
// *** General part ***
|
||||||
|
|
||||||
|
static inline match_MatchContext *
|
||||||
|
match_allocMatchContext(void) {
|
||||||
|
return uio_malloc(sizeof (match_MatchContext));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
match_freeMatchContext(match_MatchContext *context) {
|
||||||
|
uio_free(context);
|
||||||
|
}
|
||||||
|
|
||||||
// NB: Even if this function fails, *contextPtr contains a context
|
// NB: Even if this function fails, *contextPtr contains a context
|
||||||
// which needs to be freed.
|
// which needs to be freed.
|
||||||
match_Result
|
match_Result
|
||||||
@@ -133,6 +143,7 @@ match_matchPattern(match_MatchContext *context, const char *string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// context may be NULL
|
||||||
const char *
|
const char *
|
||||||
match_errorString(match_MatchContext *context, match_Result result) {
|
match_errorString(match_MatchContext *context, match_Result result) {
|
||||||
switch (result) {
|
switch (result) {
|
||||||
@@ -145,12 +156,16 @@ match_errorString(match_MatchContext *context, match_Result result) {
|
|||||||
case match_ENOTINIT:
|
case match_ENOTINIT:
|
||||||
return "Uninitialised use";
|
return "Uninitialised use";
|
||||||
case match_ECUSTOM:
|
case match_ECUSTOM:
|
||||||
// Depends on match type.
|
// Depends on match type. Printed below.
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return "Unknown error";
|
return "Unknown error";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (context == NULL)
|
||||||
|
return "Unknown match-type specific error.";
|
||||||
|
// We can't be any more specific if no 'context' is supplied.
|
||||||
|
|
||||||
switch (context->type) {
|
switch (context->type) {
|
||||||
#if 0
|
#if 0
|
||||||
case match_MATCH_LITTERAL:
|
case match_MATCH_LITTERAL:
|
||||||
@@ -206,14 +221,21 @@ match_freeContext(match_MatchContext *context) {
|
|||||||
match_freeMatchContext(context);
|
match_freeMatchContext(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline match_MatchContext *
|
match_Result
|
||||||
match_allocMatchContext(void) {
|
match_matchPatternOnce(const char *pattern, match_MatchType type,
|
||||||
return uio_malloc(sizeof (match_MatchContext));
|
const char *string) {
|
||||||
}
|
match_MatchContext *context;
|
||||||
|
match_Result result;
|
||||||
|
|
||||||
static inline void
|
result = match_prepareContext(pattern, &context, type);
|
||||||
match_freeMatchContext(match_MatchContext *context) {
|
if (result != match_OK)
|
||||||
uio_free(context);
|
goto out;
|
||||||
|
|
||||||
|
result = match_matchPattern(context, string);
|
||||||
|
|
||||||
|
out:
|
||||||
|
match_freeContext(context);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ match_Result match_matchPattern(match_MatchContext *context,
|
|||||||
const char *match_errorString(match_MatchContext *context,
|
const char *match_errorString(match_MatchContext *context,
|
||||||
match_Result result);
|
match_Result result);
|
||||||
void match_freeContext(match_MatchContext *context);
|
void match_freeContext(match_MatchContext *context);
|
||||||
|
match_Result match_matchPatternOnce(const char *pattern, match_MatchType type,
|
||||||
|
const char *string);
|
||||||
|
|
||||||
|
|
||||||
/* *** Internal definitions follow *** */
|
/* *** Internal definitions follow *** */
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ struct uio_MountInfo {
|
|||||||
char *dirName;
|
char *dirName;
|
||||||
/* The path inside the mounted fs leading to pDirHandle */
|
/* The path inside the mounted fs leading to pDirHandle */
|
||||||
uio_PDirHandle *pDirHandle;
|
uio_PDirHandle *pDirHandle;
|
||||||
/* The pDirHandle belonging to this mount type */
|
/* The pDirHandle belonging to this mount */
|
||||||
uio_MountTree *mountTree;
|
uio_MountTree *mountTree;
|
||||||
/* The MountTree node for the mountpoint */
|
/* The MountTree node for the mountpoint */
|
||||||
uio_AutoMount **autoMount;
|
uio_AutoMount **autoMount;
|
||||||
|
|||||||
Reference in New Issue
Block a user