本文整理汇总了C++中parse_list函数的典型用法代码示例。如果您正苦于以下问题:C++ parse_list函数的具体用法?C++ parse_list怎么用?C++ parse_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_list函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse_rdma_header
static guint parse_rdma_header(tvbuff_t *tvb, guint offset, proto_tree *tree)
{
offset = parse_list(tvb, offset, tree, hf_rpcordma_reads_count, "Reads", TRUE);
offset = parse_list(tvb, offset, tree, hf_rpcordma_writes_count, "Writes", FALSE);
offset = parse_list(tvb, offset, tree, hf_rpcordma_reply_count, "Reply", FALSE);
return offset;
}
示例2: c14nMain
int c14nMain(int argc, char **argv) {
int ret = -1, nonet = 1;
/*
* Init libxml
*/
xmlInitParser();
LIBXML_TEST_VERSION
/*
* Parse command line and process file
*/
if (argc > 2 && strcmp(argv[2], "--net") == 0) {
nonet = 0;
/* TODO: parse options properly */
argc--;
argv++;
}
if (argc < 4) {
if (argc >= 3)
{
if (strcmp(argv[2], "--help") == 0 || strcmp(argv[2], "-h") == 0)
c14nUsage(argv[0], EXIT_SUCCESS);
}
ret = run_c14n((argc > 2)? argv[2] : "-", 1, 0, NULL, NULL, nonet);
} else if(strcmp(argv[2], "--with-comments") == 0) {
ret = run_c14n(argv[3], 1, 0, (argc > 4) ? argv[4] : NULL, NULL, nonet);
} else if(strcmp(argv[2], "--without-comments") == 0) {
ret = run_c14n(argv[3], 0, 0, (argc > 4) ? argv[4] : NULL, NULL, nonet);
} else if(strcmp(argv[2], "--exc-with-comments") == 0) {
xmlChar **list;
/* load exclusive namespace from command line */
list = (argc > 5) ? parse_list((xmlChar *)argv[5]) : NULL;
ret = run_c14n(argv[3], 1, 1, (argc > 4) ? argv[4] : NULL, list, nonet);
if(list != NULL) xmlFree(list);
} else if(strcmp(argv[2], "--exc-without-comments") == 0) {
xmlChar **list;
/* load exclusive namespace from command line */
list = (argc > 5) ? parse_list((xmlChar *)argv[5]) : NULL;
ret = run_c14n(argv[3], 0, 1, (argc > 4) ? argv[4] : NULL, list, nonet);
if(list != NULL) xmlFree(list);
} else {
fprintf(stderr, "error: bad arguments.\n");
c14nUsage(argv[0], EXIT_BAD_ARGS);
}
/*
* Shutdown libxml
*/
xmlCleanupParser();
xmlMemoryDump();
return ret;
}
示例3: parse_block
/* parse_block • parsing of one block, returning next char to parse */
static void
parse_block(struct buf *ob, struct render *rndr, char *data, size_t size)
{
size_t beg, end, i;
char *txt_data;
beg = 0;
if (rndr->work.size > rndr->max_nesting)
return;
while (beg < size) {
txt_data = data + beg;
end = size - beg;
if (data[beg] == '#')
beg += parse_atxheader(ob, rndr, txt_data, end);
else if (data[beg] == '<' && rndr->make.blockhtml &&
(i = parse_htmlblock(ob, rndr, txt_data, end, 1)) != 0)
beg += i;
else if ((i = is_empty(txt_data, end)) != 0)
beg += i;
else if (is_hrule(txt_data, end)) {
if (rndr->make.hrule)
rndr->make.hrule(ob, rndr->make.opaque);
while (beg < size && data[beg] != '\n')
beg++;
beg++;
}
else if ((rndr->ext_flags & MKDEXT_FENCED_CODE) != 0 &&
(i = parse_fencedcode(ob, rndr, txt_data, end)) != 0)
beg += i;
else if ((rndr->ext_flags & MKDEXT_TABLES) != 0 &&
(i = parse_table(ob, rndr, txt_data, end)) != 0)
beg += i;
else if (prefix_quote(txt_data, end))
beg += parse_blockquote(ob, rndr, txt_data, end);
else if (prefix_code(txt_data, end))
beg += parse_blockcode(ob, rndr, txt_data, end);
else if (prefix_uli(txt_data, end))
beg += parse_list(ob, rndr, txt_data, end, 0);
else if (prefix_oli(txt_data, end))
beg += parse_list(ob, rndr, txt_data, end, MKD_LIST_ORDERED);
else
beg += parse_paragraph(ob, rndr, txt_data, end);
}
}
示例4: do_state_init
static void do_state_init(char *ibuf, char **pscan)
{
if (**pscan == '#'){
stack_push(&state_stack, current_state);
current_state = STATE_SHARP;
++*pscan;
} else if (**pscan == '\''){
stack_push(&state_stack, current_state);
current_state = STATE_QUOTE;
++*pscan;
do_state_init(ibuf, pscan);
}else if (**pscan == '.'){
stack_push(&state_stack, current_state);
current_state = STATE_DOT;
++*pscan;
} else if (**pscan == '+'){
stack_push(&state_stack, current_state);
current_state = STATE_ADD;
++*pscan;
} else if (**pscan == '-'){
stack_push(&state_stack, current_state);
current_state = STATE_SUB;
++*pscan;
} else if (is_digit(**pscan)){
stack_push(&state_stack, current_state);
current_state = STATE_NUM;
} else if (is_initial(**pscan)){
stack_push(&state_stack, current_state);
current_state = STATE_SYM;
} else if (**pscan == '"'){
stack_push(&state_stack, current_state);
current_state = STATE_STR;
++*pscan;
} else if (**pscan == '('){
parse_list(ibuf, pscan);
} else if (**pscan == ')'){
if (current_state == STATE_LIST){
parse_list(ibuf, pscan);
}else if (current_state == STATE_VEC){
parse_vector(ibuf, pscan);
}else {
printf("Error: unexpected ')' -- READ\n");
do_input_error(pscan);
}
} else if(is_atmosphere(**pscan)){
eat_atmosphere(pscan);
} else{
perror("Error: Bad input. -- READ\n");
do_input_error(pscan);
}
}
示例5: main
int main(int argc, char **argv) {
int ret = -1;
/*
* Init libxml
*/
xmlInitParser();
LIBXML_TEST_VERSION
/*
* Parse command line and process file
*/
if( argc < 3 ) {
fprintf(stderr, "Error: wrong number of arguments.\n");
usage(argv[0]);
} else if(strcmp(argv[1], "--with-comments") == 0) {
ret = test_c14n(argv[2], 1, XML_C14N_1_0, (argc > 3) ? argv[3] : NULL, NULL);
} else if(strcmp(argv[1], "--without-comments") == 0) {
ret = test_c14n(argv[2], 0, XML_C14N_1_0, (argc > 3) ? argv[3] : NULL, NULL);
} else if(strcmp(argv[1], "--1-1-with-comments") == 0) {
ret = test_c14n(argv[2], 1, XML_C14N_1_1, (argc > 3) ? argv[3] : NULL, NULL);
} else if(strcmp(argv[1], "--1-1-without-comments") == 0) {
ret = test_c14n(argv[2], 0, XML_C14N_1_1, (argc > 3) ? argv[3] : NULL, NULL);
} else if(strcmp(argv[1], "--exc-with-comments") == 0) {
xmlChar **list;
/* load exclusive namespace from command line */
list = (argc > 4) ? parse_list((xmlChar *)argv[4]) : NULL;
ret = test_c14n(argv[2], 1, XML_C14N_EXCLUSIVE_1_0, (argc > 3) ? argv[3] : NULL, list);
if(list != NULL) xmlFree(list);
} else if(strcmp(argv[1], "--exc-without-comments") == 0) {
xmlChar **list;
/* load exclusive namespace from command line */
list = (argc > 4) ? parse_list((xmlChar *)argv[4]) : NULL;
ret = test_c14n(argv[2], 0, XML_C14N_EXCLUSIVE_1_0, (argc > 3) ? argv[3] : NULL, list);
if(list != NULL) xmlFree(list);
} else {
fprintf(stderr, "Error: bad option.\n");
usage(argv[0]);
}
/*
* Shutdown libxml
*/
xmlCleanupParser();
xmlMemoryDump();
return((ret >= 0) ? 0 : 1);
}
示例6: ParseCommon
static void ParseCommon(map_string_t *settings, const char *conf_filename)
{
const char *value;
value = get_map_string_item_or_NULL(settings, "OpenGPGCheck");
if (value)
{
settings_bOpenGPGCheck = string_to_bool(value);
remove_map_string_item(settings, "OpenGPGCheck");
}
value = get_map_string_item_or_NULL(settings, "BlackList");
if (value)
{
settings_setBlackListedPkgs = parse_list(value);
remove_map_string_item(settings, "BlackList");
}
value = get_map_string_item_or_NULL(settings, "BlackListedPaths");
if (value)
{
settings_setBlackListedPaths = parse_list(value);
remove_map_string_item(settings, "BlackListedPaths");
}
value = get_map_string_item_or_NULL(settings, "ProcessUnpackaged");
if (value)
{
settings_bProcessUnpackaged = string_to_bool(value);
remove_map_string_item(settings, "ProcessUnpackaged");
}
value = get_map_string_item_or_NULL(settings, "Interpreters");
if (value)
{
settings_Interpreters = parse_list(value);
remove_map_string_item(settings, "Interpreters");
}
map_string_iter_t iter;
const char *name;
/*char *value; - already declared */
init_map_string_iter(&iter, settings);
while (next_map_string_iter(&iter, &name, &value))
{
error_msg("Unrecognized variable '%s' in '%s'", name, conf_filename);
}
}
示例7: parse_template
static Node *
parse_template (TextgenTemplate *tpl, const gchar *text, gint length,
GError **error)
{
GList *tokens = NULL;
Node *node = NULL;
GError *tmp_error = NULL;
tokens = tokenize (tpl, text, length, &tmp_error);
if (tmp_error)
{
g_propagate_error (error, tmp_error);
goto finish;
}
node = parse_list (tpl, tokens, NULL, NULL, &tmp_error);
if (tmp_error)
{
g_propagate_error (error, tmp_error);
goto finish;
}
finish:
g_list_free_full (tokens, free_token);
return node;
}
示例8: lex
struct AstNode *parse_source(
char *source,
void *data,
ParserAstCallback acb)
{
struct DomNode *dom;
struct AstNode *ast;
struct ParserState state = { data, acb };
dom = lex(source);
if (err_state()) {
err_push("PARSE", "Failed parsing source");
return NULL;
}
ast = parse_list(dom, &state);
if (err_state()) {
err_push("PARSE", "Failed parsing DOM list");
dom_free(dom);
return NULL;
}
dom_free(dom);
return ast;
}
示例9: soup_header_parse_list
/**
* soup_header_parse_list:
* @header: a header value
*
* Parses a header whose content is described by RFC2616 as
* "#something", where "something" does not itself contain commas,
* except as part of quoted-strings.
*
* Return value: (transfer full) (element-type utf8): a #GSList of
* list elements, as allocated strings
**/
GSList *
soup_header_parse_list (const char *header)
{
g_return_val_if_fail (header != NULL, NULL);
return parse_list (header, ',');
}
示例10: my_init_serveur
void my_init_serveur(t_server *s_info) {
fd_set readfds;
int i = 0;
time_t *t;
struct timeval *time;
create_socket_s(s_info);
s_info->graph = 0;
my_prompt_welc(s_info);
s_info->list = NULL;
s_info->egg = NULL;
create_ele_fct(s_info);
while (check_victory(s_info) != 1) {
time->tv_sec= 1;
FD_ZERO(&readfds);
FD_SET(socket_s, &readfds);
parc_sock(s_info);
s_info->list = parse_list(s_info);
i = 0;
while (socket_com[i].socket != -2) {
if (socket_com[i].socket != -1)
FD_SET(socket_com[i].socket, &readfds);
i++;
}
select_s(s_info, &readfds, time);
}
}
示例11: header_allow
void header_allow(const char *s)
{
if (parse_list(s, &re_token, 0, UINT_MAX, 0))
lookup("ok");
else
lookup("badallow");
}
示例12: header_pragma
void header_pragma(const char *s)
{
if (parse_list(s, &re_token_value, 1, UINT_MAX, 0))
lookup("ok");
else
lookup("badpragma");
}
示例13: xmlDocGetRootElement
void
RL::Heap::parse_doc (std::string raw)
{
doc = std::tr1::shared_ptr<xmlDoc> (xmlRecoverMemory (raw.c_str (), raw.length ()), xmlFreeDoc);
if ( !doc)
doc = std::tr1::shared_ptr<xmlDoc> (xmlNewDoc (BAD_CAST "1.0"), xmlFreeDoc);
xmlNodePtr doc_root = xmlDocGetRootElement (doc.get ());
if (doc_root == NULL
|| doc_root->name == NULL
|| !xmlStrEqual (BAD_CAST "resource-lists", doc_root->name)) {
std::cout << "Invalid document in " << __PRETTY_FUNCTION__ << std::endl;
// FIXME: warn the user somehow?
doc.reset ();
} else {
for (xmlNodePtr child = doc_root->children;
child != NULL;
child = child->next)
if (child->type == XML_ELEMENT_NODE
&& child->name != NULL
&& xmlStrEqual (BAD_CAST ("list"), child->name)) {
parse_list (child);
break; // read only one!
}
}
}
示例14: xlog
/* @data is a string of form [email protected][+host][:[email protected][+host]]
*/
static struct servers *method_list(char *data)
{
char *copy, *ptr=data;
char **list;
int i, listsize;
struct servers *rv=NULL;
xlog(L_NOTICE, "method_list(%s)", data);
for (ptr--, listsize=1; ptr; ptr=index(ptr, ':'), listsize++)
ptr++;
list = malloc(listsize * sizeof(char *));
copy = strdup(data);
if (copy)
xlog(L_NOTICE, "converted to %s", copy);
if (list && copy) {
ptr = copy;
for (i=0; i<listsize; i++) {
list[i] = strsep(&ptr, ":");
}
rv = parse_list(list);
}
free(copy);
free(list);
replicas_print(rv);
return rv;
}
示例15: stream_peek
static json_t *parse_value(stream_t *stream, size_t flags, json_error_t *error)
{
json_t *result = NULL;
char *string;
int c = stream_peek(stream);
switch (c) {
case 'd':
result = parse_dict(stream, flags, error);
break;
case 'l':
result = parse_list(stream, flags, error);
break;
case 'i':
stream_getc(stream);
result = parse_integer(stream, flags, error);
break;
case EOF:
error_set(error, stream, "unexpected EOF");
break;
default:
if (json_isdigit(c)) {
string = parse_string(stream, flags, error);
if (string) {
result = json_string_nocheck(string);
jsonp_free(string);
}
} else {
error_set(error, stream, "invalid character: %c", c);
}
}
return result;
}