From 0d60175bd684cf6a14f750579d82dbd1ba97fcbc Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Wed, 6 Mar 2013 01:11:59 -0800 Subject: contrib/qemu: Import qemu block source code This qemu block format source code and its minimal dependency files will be used in the next patch to implement a qemu-block format translator. Change-Id: Ic87638972f7ea9b3df84d7a0539512a250c11c1c BUG: 986775 Signed-off-by: Anand Avati Reviewed-on: http://review.gluster.org/5366 Tested-by: Gluster Build System Reviewed-by: Brian Foster --- contrib/qemu/include/qapi/qmp/json-lexer.h | 51 ++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 contrib/qemu/include/qapi/qmp/json-lexer.h (limited to 'contrib/qemu/include/qapi/qmp/json-lexer.h') diff --git a/contrib/qemu/include/qapi/qmp/json-lexer.h b/contrib/qemu/include/qapi/qmp/json-lexer.h new file mode 100644 index 00000000000..cdff0460a83 --- /dev/null +++ b/contrib/qemu/include/qapi/qmp/json-lexer.h @@ -0,0 +1,51 @@ +/* + * JSON lexer + * + * Copyright IBM, Corp. 2009 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef QEMU_JSON_LEXER_H +#define QEMU_JSON_LEXER_H + +#include "qapi/qmp/qstring.h" +#include "qapi/qmp/qlist.h" + +typedef enum json_token_type { + JSON_OPERATOR = 100, + JSON_INTEGER, + JSON_FLOAT, + JSON_KEYWORD, + JSON_STRING, + JSON_ESCAPE, + JSON_SKIP, + JSON_ERROR, +} JSONTokenType; + +typedef struct JSONLexer JSONLexer; + +typedef void (JSONLexerEmitter)(JSONLexer *, QString *, JSONTokenType, int x, int y); + +struct JSONLexer +{ + JSONLexerEmitter *emit; + int state; + QString *token; + int x, y; +}; + +void json_lexer_init(JSONLexer *lexer, JSONLexerEmitter func); + +int json_lexer_feed(JSONLexer *lexer, const char *buffer, size_t size); + +int json_lexer_flush(JSONLexer *lexer); + +void json_lexer_destroy(JSONLexer *lexer); + +#endif -- cgit