Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
ba662b5b
Commit
ba662b5b
authored
Oct 11, 2018
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up co_regex
parent
908795a9
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
274 additions
and
570 deletions
+274
-570
src/lib/co/src/co_regex.c
src/lib/co/src/co_regex.c
+255
-457
src/lib/co/src/co_regex.h
src/lib/co/src/co_regex.h
+19
-8
src/lib/co/src/co_regex_def.h
src/lib/co/src/co_regex_def.h
+0
-103
src/lib/co/src/co_time.c
src/lib/co/src/co_time.c
+0
-2
No files found.
src/lib/co/src/co_regex.c
View file @
ba662b5b
This diff is collapsed.
Click to expand it.
src/lib/co/src/co_regex.h
View file @
ba662b5b
...
...
@@ -44,13 +44,26 @@ extern "C" {
#endif
typedef
struct
regex
{
char
*
buffer
;
long
allocated
;
long
used
;
char
*
fastmap
;
char
*
translate
;
char
*
buffer
;
/* Space holding the compiled pattern commands. */
long
allocated
;
/* Size of space that `buffer' points to. */
long
used
;
/* Length of portion of buffer actually occupied */
char
*
fastmap
;
/* Pointer to fastmap, if any, or zero if none. */
/* re_search uses the fastmap, if there is one,
to skip over totally implausible characters. */
char
*
translate
;
/* Translate table to apply to all characters before
comparing, or zero for no translation.
The translation is applied to a pattern when it is
compiled and to data when it is matched. */
char
fastmap_accurate
;
char
can_be_null
;
/* Set to zero when a new pattern is stored,
set to one when the fastmap is updated from it. */
char
can_be_null
;
/* Set to one by compiling fastmap
if this pattern might match the null string.
It does not necessarily match the null string
in that case, but if this is zero, it cannot.
2 as value means can match null string
but at end of range or before a character
listed in the fastmap. */
}
regex_t
;
typedef
struct
regmatch
{
...
...
@@ -116,8 +129,6 @@ int regexec(regex_t* preg, char* string, size_t nmatch, regmatch_t pmatch[],
void
regfree
(
regex_t
*
preg
);
char
*
regerror
(
int
errcode
);
#if defined __cplusplus
}
#endif
...
...
src/lib/co/src/co_regex_def.h
View file @
ba662b5b
...
...
@@ -32,9 +32,6 @@
/* Maximum number of duplicates an interval can allow. */
#define RE_DUP_MAX ((1 << 15) - 1)
/* This defines the various regexp syntaxes. */
extern
int
obscure_syntax
;
/* The following bits are used in the obscure_syntax variable to choose among
alternative regexp syntaxes. */
...
...
@@ -136,104 +133,4 @@ extern int obscure_syntax;
If it isn't, then it can. */
#define RE_NO_HYPHEN_RANGE_END (1 << 18)
/* Define combinations of bits for the standard possibilities. */
#define RE_SYNTAX_POSIX_AWK \
(RE_NO_BK_PARENS | RE_NO_BK_VBAR | RE_CONTEXT_INDEP_OPS)
#define RE_SYNTAX_AWK \
(RE_NO_BK_PARENS | RE_NO_BK_VBAR | RE_CONTEXT_INDEP_OPS | RE_AWK_CLASS_HACK)
#define RE_SYNTAX_EGREP \
(RE_NO_BK_PARENS | RE_NO_BK_VBAR | RE_CONTEXT_INDEP_OPS | RE_NEWLINE_OR)
#define RE_SYNTAX_GREP (RE_BK_PLUS_QM | RE_NEWLINE_OR)
#define RE_SYNTAX_EMACS 0
#define RE_SYNTAX_POSIX_BASIC \
(RE_INTERVALS | RE_BK_PLUS_QM | RE_CHAR_CLASSES | RE_DOT_NOT_NULL \
| RE_HAT_NOT_NEWLINE | RE_NO_EMPTY_BK_REF | RE_NO_EMPTY_BRACKETS \
| RE_LIMITED_OPS | RE_NO_EMPTY_RANGES | RE_NO_HYPHEN_RANGE_END)
#define RE_SYNTAX_POSIX_EXTENDED \
(RE_INTERVALS | RE_NO_BK_CURLY_BRACES | RE_NO_BK_VBAR | RE_NO_BK_PARENS \
| RE_HAT_NOT_NEWLINE | RE_CHAR_CLASSES | RE_NO_EMPTY_BRACKETS \
| RE_CONTEXTUAL_INVALID_OPS | RE_NO_BK_REFS | RE_NO_EMPTY_RANGES \
| RE_NO_HYPHEN_RANGE_END)
/* This data structure is used to represent a compiled pattern. */
struct
re_pattern_buffer
{
char
*
buffer
;
/* Space holding the compiled pattern commands. */
long
allocated
;
/* Size of space that `buffer' points to. */
long
used
;
/* Length of portion of buffer actually occupied */
char
*
fastmap
;
/* Pointer to fastmap, if any, or zero if none. */
/* re_search uses the fastmap, if there is one,
to skip over totally implausible characters. */
char
*
translate
;
/* Translate table to apply to all characters before
comparing, or zero for no translation.
The translation is applied to a pattern when it is
compiled and to data when it is matched. */
char
fastmap_accurate
;
/* Set to zero when a new pattern is stored,
set to one when the fastmap is updated from it. */
char
can_be_null
;
/* Set to one by compiling fastmap
if this pattern might match the null string.
It does not necessarily match the null string
in that case, but if this is zero, it cannot.
2 as value means can match null string
but at end of range or before a character
listed in the fastmap. */
};
/* search.c (search_buffer) needs this one value. It is defined both in
regex.c and here. */
#define RE_EXACTN_VALUE 1
/* Structure to store register contents data in.
Pass the address of such a structure as an argument to re_match, etc.,
if you want this information back.
For i from 1 to RE_NREGS - 1, start[i] records the starting index in
the string of where the ith subexpression matched, and end[i] records
one after the ending index. start[0] and end[0] are analogous, for
the entire pattern. */
struct
re_registers
{
int
start
[
RE_NREGS
];
int
end
[
RE_NREGS
];
};
#ifdef __STDC__
extern
int
re_compile_pattern
(
char
*
,
int
,
struct
re_pattern_buffer
*
);
/* Is this really advertised? */
extern
void
re_compile_fastmap
(
struct
re_pattern_buffer
*
);
extern
int
re_search
(
struct
re_pattern_buffer
*
,
char
*
,
int
,
int
,
int
,
struct
re_registers
*
);
extern
int
re_search_2
(
struct
re_pattern_buffer
*
,
char
*
,
int
,
char
*
,
int
,
int
,
int
,
struct
re_registers
*
,
int
);
extern
int
re_match
(
struct
re_pattern_buffer
*
,
char
*
,
int
,
int
,
struct
re_registers
*
);
extern
int
re_match_2
(
struct
re_pattern_buffer
*
,
char
*
,
int
,
char
*
,
int
,
int
,
struct
re_registers
*
,
int
);
/* 4.2 bsd compatibility. */
extern
char
*
re_comp
(
char
*
);
extern
int
re_exec
(
char
*
);
#else
/* !__STDC__ */
extern
int
re_compile_pattern
();
/* Is this really advertised? */
extern
void
re_compile_fastmap
();
extern
int
re_search
(),
re_search_2
();
extern
int
re_match
(),
re_match_2
();
/* 4.2 bsd compatibility. */
extern
char
*
re_comp
();
extern
int
re_exec
();
#endif
/* __STDC__ */
#ifdef SYNTAX_TABLE
extern
char
*
re_syntax_table
;
#endif
#endif
/* !__REGEXP_LIBRARY */
src/lib/co/src/co_time.c
View file @
ba662b5b
...
...
@@ -103,8 +103,6 @@ int clock_gettime(clockid_t clockid, struct timespec* pt)
}
#endif
static
pwr_tStatus
validateTm
(
struct
tm
*
tms
);
/* Validate data in struct tm. */
static
pwr_tStatus
validateTm
(
struct
tm
*
tms
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment