Literacy.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3771 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -473,7 +473,7 @@ debugCmdExec(DebugContext *debugContext, int argc, char *argv[]) {
|
||||
O_RDONLY, tempDir);
|
||||
if (handles[i - 1] == NULL) {
|
||||
if (errno == ENOENT) {
|
||||
// No match; we keep what's typed litterally.
|
||||
// No match; we keep what's typed literally.
|
||||
newArgs[i - 1] = argv[i];
|
||||
continue;
|
||||
}
|
||||
@@ -703,7 +703,7 @@ listOneDir(DebugContext *debugContext, const char *arg) {
|
||||
match_MATCH_PREFIX);
|
||||
} else {
|
||||
dirList = uio_getDirList(debugContext->cwd, cpath, pattern,
|
||||
match_MATCH_LITTERAL);
|
||||
match_MATCH_LITERAL);
|
||||
}
|
||||
#endif
|
||||
if (dirList == NULL) {
|
||||
|
||||
+27
-27
@@ -37,9 +37,9 @@
|
||||
static inline match_MatchContext *match_allocMatchContext(void);
|
||||
static inline void match_freeMatchContext(match_MatchContext *context);
|
||||
|
||||
static inline match_LitteralContext *match_newLitteralContext(char *pattern);
|
||||
static inline match_LitteralContext *match_allocLitteralContext(void);
|
||||
static inline void match_freeLitteralContext(match_LitteralContext *context);
|
||||
static inline match_LiteralContext *match_newLiteralContext(char *pattern);
|
||||
static inline match_LiteralContext *match_allocLiteralContext(void);
|
||||
static inline void match_freeLiteralContext(match_LiteralContext *context);
|
||||
static inline match_PrefixContext *match_newPrefixContext(char *pattern);
|
||||
static inline match_PrefixContext *match_allocPrefixContext(void);
|
||||
static inline void match_freePrefixContext(match_PrefixContext *context);
|
||||
@@ -85,9 +85,9 @@ match_prepareContext(const char *pattern, match_MatchContext **contextPtr,
|
||||
*contextPtr = match_allocMatchContext();
|
||||
(*contextPtr)->type = type;
|
||||
switch (type) {
|
||||
case match_MATCH_LITTERAL:
|
||||
result = match_prepareLitteral(pattern,
|
||||
&(*contextPtr)->u.litteral);
|
||||
case match_MATCH_LITERAL:
|
||||
result = match_prepareLiteral(pattern,
|
||||
&(*contextPtr)->u.literal);
|
||||
break;
|
||||
case match_MATCH_PREFIX:
|
||||
result = match_preparePrefix(pattern, &(*contextPtr)->u.prefix);
|
||||
@@ -122,8 +122,8 @@ match_prepareContext(const char *pattern, match_MatchContext **contextPtr,
|
||||
match_Result
|
||||
match_matchPattern(match_MatchContext *context, const char *string) {
|
||||
switch (context->type) {
|
||||
case match_MATCH_LITTERAL:
|
||||
return match_matchLitteral(context->u.litteral, string);
|
||||
case match_MATCH_LITERAL:
|
||||
return match_matchLiteral(context->u.literal, string);
|
||||
case match_MATCH_PREFIX:
|
||||
return match_matchPrefix(context->u.prefix, string);
|
||||
case match_MATCH_SUFFIX:
|
||||
@@ -168,8 +168,8 @@ match_errorString(match_MatchContext *context, match_Result result) {
|
||||
|
||||
switch (context->type) {
|
||||
#if 0
|
||||
case match_MATCH_LITTERAL:
|
||||
return match_errorStringLitteral(context->u.litteral, result);
|
||||
case match_MATCH_LITERAL:
|
||||
return match_errorStringLiteral(context->u.literal, result);
|
||||
case match_MATCH_PREFIX:
|
||||
return match_errorStringPrefix(context->u.prefix, result);
|
||||
case match_MATCH_SUFFIX:
|
||||
@@ -193,8 +193,8 @@ match_errorString(match_MatchContext *context, match_Result result) {
|
||||
void
|
||||
match_freeContext(match_MatchContext *context) {
|
||||
switch (context->type) {
|
||||
case match_MATCH_LITTERAL:
|
||||
match_freeLitteral(context->u.litteral);
|
||||
case match_MATCH_LITERAL:
|
||||
match_freeLiteral(context->u.literal);
|
||||
break;
|
||||
case match_MATCH_PREFIX:
|
||||
match_freePrefix(context->u.prefix);
|
||||
@@ -239,43 +239,43 @@ out:
|
||||
}
|
||||
|
||||
|
||||
// *** Litteral part ***
|
||||
// *** Literal part ***
|
||||
|
||||
match_Result
|
||||
match_prepareLitteral(const char *pattern,
|
||||
match_LitteralContext **contextPtr) {
|
||||
*contextPtr = match_newLitteralContext(uio_strdup(pattern));
|
||||
match_prepareLiteral(const char *pattern,
|
||||
match_LiteralContext **contextPtr) {
|
||||
*contextPtr = match_newLiteralContext(uio_strdup(pattern));
|
||||
return match_OK;
|
||||
}
|
||||
|
||||
match_Result
|
||||
match_matchLitteral(match_LitteralContext *context, const char *string) {
|
||||
match_matchLiteral(match_LiteralContext *context, const char *string) {
|
||||
return (strcmp(context->pattern, string) == 0) ?
|
||||
match_MATCH : match_NOMATCH;
|
||||
}
|
||||
|
||||
void
|
||||
match_freeLitteral(match_LitteralContext *context) {
|
||||
match_freeLiteral(match_LiteralContext *context) {
|
||||
uio_free(context->pattern);
|
||||
match_freeLitteralContext(context);
|
||||
match_freeLiteralContext(context);
|
||||
}
|
||||
|
||||
static inline match_LitteralContext *
|
||||
match_newLitteralContext(char *pattern) {
|
||||
match_LitteralContext *result;
|
||||
static inline match_LiteralContext *
|
||||
match_newLiteralContext(char *pattern) {
|
||||
match_LiteralContext *result;
|
||||
|
||||
result = match_allocLitteralContext();
|
||||
result = match_allocLiteralContext();
|
||||
result->pattern = pattern;
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline match_LitteralContext *
|
||||
match_allocLitteralContext(void) {
|
||||
return uio_malloc(sizeof (match_LitteralContext));
|
||||
static inline match_LiteralContext *
|
||||
match_allocLiteralContext(void) {
|
||||
return uio_malloc(sizeof (match_LiteralContext));
|
||||
}
|
||||
|
||||
static inline void
|
||||
match_freeLitteralContext(match_LitteralContext *context) {
|
||||
match_freeLiteralContext(match_LiteralContext *context) {
|
||||
uio_free(context);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ typedef struct match_MatchContext match_MatchContext;
|
||||
|
||||
|
||||
typedef enum {
|
||||
match_MATCH_LITTERAL = 0,
|
||||
match_MATCH_LITERAL = 0,
|
||||
match_MATCH_PREFIX,
|
||||
match_MATCH_SUFFIX,
|
||||
match_MATCH_SUBSTRING,
|
||||
@@ -52,7 +52,7 @@ typedef int match_Result;
|
||||
#define match_ECUSTOM -3
|
||||
#define match_ENOTINIT -4
|
||||
|
||||
typedef struct match_LitteralContext match_LitteralContext;
|
||||
typedef struct match_LiteralContext match_LiteralContext;
|
||||
typedef struct match_PrefixContext match_PrefixContext;
|
||||
typedef struct match_SuffixContext match_SuffixContext;
|
||||
typedef struct match_SubStringContext match_SubStringContext;
|
||||
@@ -87,7 +87,7 @@ match_Result match_matchPatternOnce(const char *pattern, match_MatchType type,
|
||||
struct match_MatchContext {
|
||||
match_MatchType type;
|
||||
union {
|
||||
match_LitteralContext *litteral;
|
||||
match_LiteralContext *literal;
|
||||
match_PrefixContext *prefix;
|
||||
match_SuffixContext *suffix;
|
||||
match_SubStringContext *subString;
|
||||
@@ -100,7 +100,7 @@ struct match_MatchContext {
|
||||
} u;
|
||||
};
|
||||
|
||||
struct match_LitteralContext {
|
||||
struct match_LiteralContext {
|
||||
char *pattern;
|
||||
};
|
||||
|
||||
@@ -134,11 +134,11 @@ struct match_RegexContext {
|
||||
};
|
||||
#endif
|
||||
|
||||
match_Result match_prepareLitteral(const char *pattern,
|
||||
match_LitteralContext **contextPtr);
|
||||
match_Result match_matchLitteral(match_LitteralContext *context,
|
||||
match_Result match_prepareLiteral(const char *pattern,
|
||||
match_LiteralContext **contextPtr);
|
||||
match_Result match_matchLiteral(match_LiteralContext *context,
|
||||
const char *string);
|
||||
void match_freeLitteral(match_LitteralContext *context);
|
||||
void match_freeLiteral(match_LiteralContext *context);
|
||||
|
||||
match_Result match_preparePrefix(const char *pattern,
|
||||
match_PrefixContext **contextPtr);
|
||||
|
||||
Reference in New Issue
Block a user