• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ parser_free函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中parser_free函数的典型用法代码示例。如果您正苦于以下问题:C++ parser_free函数的具体用法?C++ parser_free怎么用?C++ parser_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了parser_free函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: parse_section_start

static dbus_bool_t
parse_section_start (BusDesktopFileParser *parser, DBusError *error)
{
  int line_end, eol_len;
  char *section_name;

  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
    
  if (!_dbus_string_find_eol (&parser->data, parser->pos, &line_end, &eol_len))
    line_end = parser->len;
  
  if (line_end - parser->pos <= 2 ||
      _dbus_string_get_byte (&parser->data, line_end - 1) != ']')
    {
      report_error (parser, "Invalid syntax for section header", BUS_DESKTOP_PARSE_ERROR_INVALID_SYNTAX, error);
      parser_free (parser);
      return FALSE;
    }

  section_name = unescape_string (parser,
                                  &parser->data, parser->pos + 1, line_end - 1,
                                  error);

  if (section_name == NULL)
    {
      parser_free (parser);
      return FALSE;
    }

  if (!is_valid_section_name (section_name))
    {
      report_error (parser, "Invalid characters in section name", BUS_DESKTOP_PARSE_ERROR_INVALID_CHARS, error);
      parser_free (parser);
      dbus_free (section_name);
      return FALSE;
    }

  if (open_section (parser, section_name) == NULL)
    {
      dbus_free (section_name);
      parser_free (parser);
      BUS_SET_OOM (error);
      return FALSE;
    }

  if (line_end == parser->len)
    parser->pos = parser->len;
  else
    parser->pos = line_end + eol_len;
  
  parser->line_num += 1;

  dbus_free (section_name);
  
  return TRUE;
}
开发者ID:d-bus,项目名称:dbus,代码行数:56,代码来源:desktop-file.c


示例2: subst_list_eval_funcs__

static void subst_list_eval_funcs__(const subst_list_type * subst_list , buffer_type * buffer) {
  parser_type     * parser     = parser_alloc( "," , "\"\'" , NULL , " \t" , NULL , NULL );

  subst_list_eval_funcs____( subst_list , parser , buffer );

  parser_free( parser );
}
开发者ID:akva2,项目名称:ResInsight,代码行数:7,代码来源:subst_list.c


示例3: config_load_file

int config_load_file(FILE *config_file, struct Config *dest) {
    char *rdbuf = malloc(CONFIG_CHUNK_SIZE);
    int ret = -1;
    xmpp_ctx_t *ctx = xmpp_ctx_new(NULL, NULL);
    parser_t *parser = parser_new(ctx,
        NULL,
        NULL,
        config_parse_stanza,
        dest);

    size_t read_bytes;
    do {
        read_bytes = fread(rdbuf, 1, CONFIG_CHUNK_SIZE, config_file);
        if (!parser_feed(parser, rdbuf, read_bytes)) {
            ret = 2;
            goto __cleanup__;
        }
    } while (read_bytes == CONFIG_CHUNK_SIZE);
    if (errno != 0) {
        ret = 1;
    } else {
        ret = 0;
    }

__cleanup__:
    free(rdbuf);
    parser_free(parser);
    xmpp_ctx_free(ctx);
    return ret;
}
开发者ID:horazont,项目名称:lcdd,代码行数:30,代码来源:config.c


示例4: test_message

void
test_message (const struct message *message)
{
  parser_init(message->type);

  size_t read;

  read = parse(message->raw, strlen(message->raw));
  if (read != strlen(message->raw)) {
    print_error(message->raw, read);
    exit(1);
  }

  read = parse(NULL, 0);
  if (read != 0) {
    print_error(message->raw, read);
    exit(1);
  }

  if (num_messages != 1) {
    printf("\n*** num_messages != 1 after testing '%s' ***\n\n", message->name);
    exit(1);
  }

  if(!message_eq(0, message)) exit(1);

  parser_free();
}
开发者ID:humbletim,项目名称:http-parser,代码行数:28,代码来源:test.c


示例5: START_TEST

END_TEST

START_TEST (absolute_multi_step)
{
    char *expression = "$.foo.baz..yobble.thingum";
    reset_errno();
    parser_context *context = make_parser((uint8_t *)expression, strlen(expression));
    assert_not_null(context);
    assert_noerr();

    jsonpath *path = parse(context);
    
    assert_parser_success(expression, context, path, ABSOLUTE_PATH, 5);
    assert_root_step(path);
    assert_single_name_step(path, 1, "foo");
    assert_single_name_step(path, 2, "baz");
    assert_recursive_name_step(path, 3, "yobble");
    assert_single_name_step(path, 4, "thingum");
    assert_no_predicate(path, 1);
    assert_no_predicate(path, 2);
    assert_no_predicate(path, 3);
    assert_no_predicate(path, 4);

    path_free(path);    
    parser_free(context);
}
开发者ID:kazufusa,项目名称:kanabo,代码行数:26,代码来源:parser_test.c


示例6: config_load

void config_load( )
{
    char file_name[512];
    PData *pd, *sub; 
    /* set to defaults */
    config_check_dir();
    config_reset();
    /* load config */
    sprintf( file_name, "%s/%s", config.dir_name, CONFIG_FILE_NAME );
    if ( ( pd = parser_read_file( "config", file_name ) ) == 0 ) {
        fprintf( stderr, "%s\n", parser_get_error() );
        return;
    }
    /* parse config */
    parser_get_int( pd, "gametype", &config.gametype );
    parser_get_int( pd, "starting_level", &config.starting_level );
    if (config.starting_level > 9 || config.starting_level < 0) {
	    config.starting_level = 0;
    }
    parser_get_int( pd, "preview", &config.preview );
    parser_get_int( pd, "help", &config.help );
    parser_get_int( pd, "expert", &config.expert );
    parser_get_int( pd, "center_preview", &config.center_preview );
    parser_get_int( pd, "holes", &config.holes );
    parser_get_int( pd, "rand_holes", &config.rand_holes );
    parser_get_int( pd, "send_all", &config.send_all );
    parser_get_int( pd, "send_tetris", &config.send_tetris );
    if ( parser_get_pdata( pd, "player1", &sub ) )
        parse_player( sub, &config.player1 );
    if ( parser_get_pdata( pd, "player2", &sub ) )
        parse_player( sub, &config.player2 );
    if ( parser_get_pdata( pd, "player3", &sub ) )
        parse_player( sub, &config.player3 );
    parser_get_int( pd, "clear_keystate", &config.clear_keystate );
    parser_get_int( pd, "cpu_aggr", &config.cpu_aggr );
    parser_get_int( pd, "cpu_delay", &config.cpu_delay );
    parser_get_int( pd, "cpu_rot_delay", &config.cpu_rot_delay );
    parser_get_int( pd, "sound", &config.sound );
    parser_get_int( pd, "volume", &config.volume );
    parser_get_int( pd, "transparency", &config.trp );
    parser_get_int( pd, "animations", &config.anim );
    parser_get_int( pd, "fullscreen", &config.fullscreen );
    parser_get_int( pd, "fading", &config.fade );
    parser_get_int( pd, "fps", &config.fps );
    parser_get_int( pd, "background", &config.bkgnd );
    parser_get_int( pd, "static_background", &config.keep_bkgnd );
    parser_get_int( pd, "smooth_hori", &config.smooth_hori );
    parser_get_int( pd, "hori_delay", &config.hori_delay );
    parser_get_int( pd, "vert_delay", &config.vert_delay );
    parser_get_int( pd, "pause_key", &config.pause_key );
    parser_get_int( pd, "block_by_block", &config.block_by_block );
    parser_get_int( pd, "motion_mod", &config.motion_mod );
    parser_get_int( pd, "relative_motion", &config.rel_motion );
    parser_get_int( pd, "grap_input", &config.grab );
    parser_get_int( pd, "invert_mouse", &config.invert );
    parser_get_int( pd, "quick_help", &config.quick_help );
    parser_get_int( pd, "async_collision_check", &config.async_col_check );
    parser_free( &pd );
}
开发者ID:hhirsch,项目名称:tetromino,代码行数:59,代码来源:config.c


示例7: cartdb_kill

void cartdb_kill()
{
	if(cartxml) {
		parser_free(cartxml);
		parser_verifymemory();
	}
	cartxml = 0;
}
开发者ID:Aleyr,项目名称:nesemu2,代码行数:8,代码来源:cartdb.c


示例8: parser_fread_alloc_file_content

char * parser_fread_alloc_file_content(const char * filename , const char * quote_set , const char * delete_set , const char * comment_start , const char * comment_end) {
  parser_type * parser = parser_alloc( NULL , quote_set , NULL , delete_set , comment_start , comment_end);
  char * buffer              = util_fread_alloc_file_content( filename , NULL);
  
  parser_strip_buffer( parser , &buffer );
  parser_free( parser );
  return buffer;
}
开发者ID:akva2,项目名称:ResInsight,代码行数:8,代码来源:parser.c


示例9: parser_test

/* test the parser and visualize the results                             */
void parser_test(char* input)
{
	cmds* cmd = NULL;
	printf("input:  %s\n",input);
	cmd = parser_parse(input);
	printf("result: %s @ %d:%d\n",parser_message,error_line,error_column);
	printf("---\n");
	parser_print(cmd);
	printf("---\n \n");
	parser_free(cmd);
}
开发者ID:aruscher,项目名称:OS-Projekt-2,代码行数:12,代码来源:parser.c


示例10: parser_read_file

PData* parser_read_file( const char *tree_name, const char *fname )
{
    int size;
    char magic = 0;
    ParserState state = { fname, 0, 1, 0 };
    ParserState *st = &state;
    PData *top = 0;
    /* open file */
    if ( ( state.file = fopen( fname, "rb" ) ) == 0 ) {
        sprintf( parser_error, tr("%s: file not found"), fname );
        return 0;
    }
    /* create common tree data */
    st->ctd = common_tree_data_create(fname);
    /* create top level pdata */
    top = parser_create_pdata(strdup( tree_name ), 0, st->lineno, st->ctd);
    top->entries = list_create( LIST_NO_AUTO_DELETE, LIST_NO_CALLBACK );
    /* parse */
    FILE_READCHAR( st, st->ch );
    magic = st->ch;
    if ( magic == '@' ) {
        /* get the whole contents -- 1 and CBUFFER_SIZE are switched */
        fseek( st->file, 0, SEEK_END ); size = ftell( st->file ) - 2;
        if ( size >= CBUFFER_SIZE ) {
            fprintf( stderr, tr("%s: file's too big to fit the compact buffer (%dKB)\n"), fname, CBUFFER_SIZE / 1024 );
            size = CBUFFER_SIZE - 1;
        }
        fseek( st->file, 2, SEEK_SET );
        _fread( cbuffer, 1, size, st->file );
        cbuffer[size] = 0;
        /* set indicator to beginning of text */
        cbuffer_pos = cbuffer;
        /* parse cbuffer */
        if ( !parser_read_file_compact( st, top ) ) {
            parser_set_parse_error( st, parser_sub_error );
            goto failure;
        }
    }
    else {
        parser_read_token(st);
        if ( !parser_read_file_full( st, top ) ) {
            parser_set_parse_error( st, parser_sub_error );
            goto failure;
        }
    }
    /* finalize */
    fclose( st->file );
    return top;
failure:
    fclose( st->file );
    parser_free( &top );
    return 0;
}
开发者ID:basiliscos,项目名称:c-lgeneral-clone,代码行数:53,代码来源:parser.c


示例11: raise_error

/* a long jump.                                                          */
static void raise_error(enum parser_errors code)
{
	parser_status = code;
	parser_message = messages[code];
	if (code>=PARSER_INVALID_STATE)
	{
		error_line=line;
		error_column=col;
	}
	/* cleanup before returning                                          */
	parser_free(root);
	longjmp(error_env,1);
}
开发者ID:aruscher,项目名称:OS-Projekt-2,代码行数:14,代码来源:parser.c


示例12: ecl_util_get_unit_set

ecl_unit_enum ecl_util_get_unit_set(const char * data_file) {
  ecl_unit_enum units = ECL_METRIC_UNITS;
  parser_type * parser = parser_alloc(" \t\r\n" , "\"\'" , NULL , NULL , "--" , "\n");
  FILE * stream = util_fopen(data_file , "r");

  if (parser_fseek_string( parser , stream , "FIELD" , true , true)) {  /* Seeks case insensitive. */
    units = ECL_FIELD_UNITS;
  } else if (parser_fseek_string( parser , stream , "LAB" , true , true)) {  /* Seeks case insensitive. */
    units = ECL_LAB_UNITS;
  }

  parser_free( parser );
  fclose(stream);
  return units;
}
开发者ID:danielfmva,项目名称:ert,代码行数:15,代码来源:ecl_util.c


示例13: parse_section_start

static gboolean
parse_section_start (AnjutaPluginDescriptionParser *parser, GError **error)
{
  gchar *line_end;
  gchar *section_name;

  line_end = strchr (parser->line, '\n');
  if (line_end == NULL)
    line_end = parser->line + strlen (parser->line);

  if (line_end - parser->line <= 2 ||
      line_end[-1] != ']')
    {
      report_error (parser, "Invalid syntax for section header", ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_SYNTAX, error);
      parser_free (parser);
      return FALSE;
    }

  section_name = unescape_string (parser->line + 1, line_end - parser->line - 2);

  if (section_name == NULL)
    {
      report_error (parser, "Invalid escaping in section name", ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_ESCAPES, error);
      parser_free (parser);
      return FALSE;
    }

  open_section (parser, section_name);
  
  parser->line = (line_end) ? line_end + 1 : NULL;
  parser->line_nr++;

  g_free (section_name);
  
  return TRUE;
}
开发者ID:weynhamz,项目名称:GNOME-anjuta,代码行数:36,代码来源:anjuta-plugin-description.c


示例14: parse_section_start

static gboolean
parse_section_start (GnomeThemeFileParser *parser, GError **error)
{
  gchar *line_end;
  gchar *section_name;

  line_end = strchr (parser->line, '\n');
  if (line_end == NULL)
    line_end = parser->line + strlen (parser->line);

  if (line_end - parser->line <= 2 ||
      line_end[-1] != ']')
    {
      report_error (parser, "Invalid syntax for section header", GNOME_THEME_FILE_PARSE_ERROR_INVALID_SYNTAX, error);
      parser_free (parser);
      return FALSE;
    }

  section_name = unescape_string (parser->line + 1, line_end - parser->line - 2);

  if (section_name == NULL)
    {
      report_error (parser, "Invalid escaping in section name", GNOME_THEME_FILE_PARSE_ERROR_INVALID_ESCAPES, error);
      parser_free (parser);
      return FALSE;
    }

  open_section (parser, section_name);
  
  parser->line = (line_end) ? line_end + 1 : NULL;
  parser->line_nr++;

  g_free (section_name);
  
  return TRUE;
}
开发者ID:DarkAngelII,项目名称:libgnomeui,代码行数:36,代码来源:gnome-theme-parser.c


示例15: parser_free

/*
====================================================================
This function frees a PData tree struct.
====================================================================
*/
void parser_free( PData **pdata )
{
    PData *entry = 0;
    if ( (*pdata) == 0 ) return;
    if ( (*pdata)->entries ) {
        list_reset( (*pdata)->entries );
        while ( ( entry = list_next( (*pdata)->entries ) ) )
            parser_free( &entry );
        list_delete( (*pdata)->entries );
    }
    if ( (*pdata)->name ) free( (*pdata)->name );
    if ( (*pdata)->values ) list_delete( (*pdata)->values );
    common_tree_data_deref((*pdata)->ctd);
    free( *pdata ); *pdata = 0;
}
开发者ID:basiliscos,项目名称:c-lgeneral-clone,代码行数:20,代码来源:parser.c


示例16: ecl_util_get_num_cpu

int ecl_util_get_num_cpu(const char * data_file) { 
  int num_cpu = 1; 
  parser_type * parser = parser_alloc(" \t\r\n" , "\"\'" , NULL , NULL , "--" , "\n");
  FILE * stream = util_fopen(data_file , "r");
  
  if (parser_fseek_string( parser , stream , "PARALLEL" , true , true)) {  /* Seeks case insensitive. */
    num_cpu = ecl_util_get_num_parallel_cpu__(parser, stream, data_file); 
  } else if (parser_fseek_string( parser , stream , "SLAVES" , true , true)) {  /* Seeks case insensitive. */
    num_cpu = ecl_util_get_num_slave_cpu__(parser, stream, data_file) + 1; 
    fprintf(stderr, "Information: \"SLAVES\" option found, returning %d number of CPUs", num_cpu); 
  }

  parser_free( parser );
  fclose(stream);
  return num_cpu;
}
开发者ID:danielfmva,项目名称:ert,代码行数:16,代码来源:ecl_util.c


示例17: ecl_config_set_data_file

void ecl_config_set_data_file( ecl_config_type * ecl_config , const char * data_file) {
  ecl_config->data_file = util_realloc_string_copy( ecl_config->data_file , data_file );
  {
    FILE * stream        = util_fopen( ecl_config->data_file , "r");
    parser_type * parser = parser_alloc(NULL , NULL , NULL , NULL , "--" , "\n" );
    char * init_tag      = enkf_util_alloc_tagged_string( "INIT" );
    
    ecl_config->can_restart = parser_fseek_string( parser , stream , init_tag , false , true ); 
    
    free( init_tag );
    parser_free( parser );
    fclose( stream );
  }
  ecl_config->start_date = ecl_util_get_start_date( ecl_config->data_file );
  ecl_config->num_cpu    = ecl_util_get_num_cpu( ecl_config->data_file );
}
开发者ID:JacobStoren,项目名称:ert,代码行数:16,代码来源:ecl_config.c


示例18: string_util_sscanf_alloc_active_list

static int_vector_type * string_util_sscanf_alloc_active_list(const char * range_string ) {
  int_vector_type *active_list = NULL;
  bool valid = valid_characters( range_string );

  if (valid)
  {
    parser_type * parser = parser_alloc( ","   , /* No ordinary split characters. */
                                         NULL  , /* No quoters. */
                                         NULL  , /* No special split */
                                         " \t" , /* Removing ' ' and '\t' */
                                         NULL  , /* No comment */
                                         NULL  );
    stringlist_type * tokens;
    int item;
    active_list = int_vector_alloc(0,0);
    tokens = parser_tokenize_buffer( parser , range_string , true);
    
    for (item = 0; item < stringlist_get_size( tokens ); item++) {
      const char * string_item = stringlist_iget( tokens , item );
      char * pos_ptr = (char *) string_item;
      int value1 , value2;
      
      value1 = strtol( string_item , &pos_ptr , 10);
      if (*pos_ptr == '\0') 
        // The pos_ptr points to the end of the string, i.e. this was a single digit.
        value2 = value1;
      else {
        // OK - this is a range; skip spaces and the range dash '-'
        while (isspace(*pos_ptr) || *pos_ptr == '-')
          pos_ptr++;
        util_sscanf_int( pos_ptr , &value2);
      } 
      
      {
        int value;
        for (value = value1; value <= value2; value++) 
          int_vector_append( active_list , value );
      }
    }
    
    
    stringlist_free( tokens );
    parser_free( parser );
  }
  
  return active_list;
}
开发者ID:joelmheim,项目名称:ResInsight,代码行数:47,代码来源:string_util.c


示例19: engine_free

void
engine_free(Engine *engine) {
  dictRelease(engine->queries);
  if(engine->data_dir) {
    pstring_free(engine->data_dir);
  }
  parser_free(engine->parser);
  ring_buffer_free(engine->stream);
  if(engine->auth) pstring_free(engine->auth);
  lrw_dict_free(engine->term_dictionary);
  plist_pool_free(engine->postings);
  if(engine->docs->on_evict)callback_free(engine->docs->on_evict);
  ring_buffer_free(engine->docs);
  dictRelease(engine->ints);
  if(engine->doc_set) dictRelease(engine->doc_set);
  free(engine);
}
开发者ID:fizx,项目名称:sit,代码行数:17,代码来源:engine.c


示例20: parser_init

static PARSER* parser_init(const char *file, FILE *io, int reload)
{
	PARSER *p = calloc(1, sizeof(PARSER));
	if (!p) {
		pgr_abort(ABORT_MEMFAIL);
	}

	p->backends = make_backend(NULL);
	p->f = parse_top;
	p->l = lexer_init(file, io);
	if (!p->l) {
		parser_free(p);
		return NULL;
	}

	return p;
}
开发者ID:jhunt,项目名称:pgrouter,代码行数:17,代码来源:config.c



注:本文中的parser_free函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ parser_getstr函数代码示例发布时间:2022-05-30
下一篇:
C++ parser_errposition函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap