Literacy.

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