aboutsummaryrefslogtreecommitdiffstats
path: root/parse-events.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse-events.c')
-rw-r--r--parse-events.c48
1 files changed, 36 insertions, 12 deletions
diff --git a/parse-events.c b/parse-events.c
index 1592fa3..b29a8d5 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -44,6 +44,19 @@ static void init_input_buf(const char *buf, unsigned long long size)
44 input_buf_ptr = 0; 44 input_buf_ptr = 0;
45} 45}
46 46
47/**
48 * pevent_buffer_init - init buffer for parsing
49 * @buf: buffer to parse
50 * @size: the size of the buffer
51 *
52 * For use with pevent_read_token(), this initializes the internal
53 * buffer that pevent_read_token() will parse.
54 */
55void pevent_buffer_init(const char *buf, unsigned long long size)
56{
57 init_input_buf(buf, size);
58}
59
47void breakpoint(void) 60void breakpoint(void)
48{ 61{
49 static int x; 62 static int x;
@@ -551,18 +564,6 @@ static struct event_format *alloc_event(void)
551 return event; 564 return event;
552} 565}
553 566
554enum event_type {
555 EVENT_ERROR,
556 EVENT_NONE,
557 EVENT_SPACE,
558 EVENT_NEWLINE,
559 EVENT_OP,
560 EVENT_DELIM,
561 EVENT_ITEM,
562 EVENT_DQUOTE,
563 EVENT_SQUOTE,
564};
565
566static void add_event(struct pevent *pevent, struct event_format *event) 567static void add_event(struct pevent *pevent, struct event_format *event)
567{ 568{
568 int i; 569 int i;
@@ -914,6 +915,29 @@ static enum event_type read_token(char **tok)
914 return EVENT_NONE; 915 return EVENT_NONE;
915} 916}
916 917
918/**
919 * pevent_read_token - access to utilites to use the pevent parser
920 * @tok: The token to return
921 *
922 * This will parse tokens from the string given by
923 * pevent_init_data().
924 *
925 * Returns the token type.
926 */
927enum event_type pevent_read_token(char **tok)
928{
929 return read_token(tok);
930}
931
932/**
933 * pevent_free_token - free a token returned by pevent_read_token
934 * @token: the token to free
935 */
936void pevent_free_token(char *token)
937{
938 free_token(token);
939}
940
917/* no newline */ 941/* no newline */
918static enum event_type read_token_item(char **tok) 942static enum event_type read_token_item(char **tok)
919{ 943{