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

C++ chunk_get_head函数代码示例

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

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



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

示例1: add_file_header

static void add_file_header()
{
   if (!chunk_is_comment(chunk_get_head()))
   {
      /*TODO: detect the typical #ifndef FOO / #define FOO sequence */
      tokenize(cpd.file_hdr.data, chunk_get_head());
   }
}
开发者ID:GerHobbelt,项目名称:uncrustify,代码行数:8,代码来源:uncrustify.cpp


示例2: do_parens

void do_parens(void)
{
   LOG_FUNC_ENTRY();

   if (cpd.settings[UO_mod_full_paren_if_bool].b)
   {
      chunk_t *pc = chunk_get_head();
      while ((pc = chunk_get_next_ncnl(pc)) != nullptr)
      {
         if (  pc->type != CT_SPAREN_OPEN
            || (  pc->parent_type != CT_IF
               && pc->parent_type != CT_ELSEIF
               && pc->parent_type != CT_SWITCH))
         {
            continue;
         }

         // Grab the close sparen
         chunk_t *pclose = chunk_get_next_type(pc, CT_SPAREN_CLOSE, pc->level, scope_e::PREPROC);
         if (pclose != nullptr)
         {
            check_bool_parens(pc, pclose, 0);
            pc = pclose;
         }
      }
   }
}
开发者ID:Unity-Technologies,项目名称:uncrustify,代码行数:27,代码来源:parens.cpp


示例3: pawn_scrub_vsemi

/**
 * Turns certain virtual semicolons invisible.
 *  - after a close brace with a parent of switch, case, else, if
 */
void pawn_scrub_vsemi(void)
{
   if (!cpd.settings[UO_mod_pawn_semicolon].b)
   {
      return;
   }

   chunk_t *pc;
   chunk_t *prev;

   for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc))
   {
      if (pc->type != CT_VSEMICOLON)
      {
         continue;
      }
      prev = chunk_get_prev_ncnl(pc);
      if ((prev != NULL) && (prev->type == CT_BRACE_CLOSE))
      {
         if ((prev->parent_type == CT_IF) ||
             (prev->parent_type == CT_ELSE) ||
             (prev->parent_type == CT_SWITCH) ||
             (prev->parent_type == CT_CASE) ||
             (prev->parent_type == CT_WHILE_OF_DO))
         {
            pc->str.clear();
         }
      }
   }
}
开发者ID:AndrianDTR,项目名称:codelite,代码行数:34,代码来源:lang_pawn.cpp


示例4: pawn_prescan

/**
 * Does a scan of level 0 BEFORE stuff in combine.cpp is called.
 * At this point, VSemis have been added only in VBraces.
 * Otherwise, all level info is correct, except for unbraced functions.
 *
 * We are looking for unbraced functions.
 */
void pawn_prescan(void)
{
   /* Start at the beginning and step through the entire file, and clean up
    * any questionable stuff
    */

   chunk_t *pc;
   bool    did_nl = true;

   pc = chunk_get_head();
   while (pc != NULL)
   {
      if (did_nl && (pc->type != CT_PREPROC) &&
          !chunk_is_newline(pc) && (pc->level == 0))
      {
         /* pc now points to the start of a line */
         pc = pawn_process_line(pc);
      }
      /* note that continued lines are ignored */
      if (pc != NULL)
      {
         did_nl = (pc->type == CT_NEWLINE);
      }

      pc = chunk_get_next_nc(pc);
   }
}
开发者ID:AndrianDTR,项目名称:codelite,代码行数:34,代码来源:lang_pawn.cpp


示例5: do_parens

void do_parens(void)
{
    LOG_FUNC_ENTRY();
    chunk_t *pc;
    chunk_t *pclose;

    if (cpd.settings[UO_mod_full_paren_if_bool].b)
    {
        pc = chunk_get_head();
        while ((pc = chunk_get_next_ncnl(pc)) != NULL)
        {
            if ((pc->type != CT_SPAREN_OPEN) ||
                    ((pc->parent_type != CT_IF) &&
                     (pc->parent_type != CT_ELSEIF) &&
                     (pc->parent_type != CT_SWITCH)))
            {
                continue;
            }

            /* Grab the close sparen */
            pclose = chunk_get_next_type(pc, CT_SPAREN_CLOSE, pc->level, CNAV_PREPROC);
            if (pclose != NULL)
            {
                check_bool_parens(pc, pclose, 0);
                pc = pclose;
            }
        }
    }
}
开发者ID:githhhh,项目名称:uncrustify,代码行数:29,代码来源:parens.cpp


示例6: quick_align_again

void quick_align_again(void)
{
   chunk_t    *pc;
   chunk_t    *tmp;
   AlignStack as;

   LOG_FMT(LALAGAIN, "%s:\n", __func__);
   for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc))
   {
      if ((pc->align.next != NULL) && (pc->flags & PCF_ALIGN_START))
      {
         as.Start(100, 0);
         as.m_right_align = pc->align.right_align;
         as.m_star_style  = (AlignStack::StarStyle)pc->align.star_style;
         as.m_amp_style   = (AlignStack::StarStyle)pc->align.amp_style;
         as.m_gap         = pc->align.gap;

         LOG_FMT(LALAGAIN, "   [%.*s:%d]", pc->len, pc->str, pc->orig_line);
         as.Add(pc->align.start);
         pc->flags |= PCF_WAS_ALIGNED;
         for (tmp = pc->align.next; tmp != NULL; tmp = tmp->align.next)
         {
            tmp->flags |= PCF_WAS_ALIGNED;
            as.Add(tmp->align.start);
            LOG_FMT(LALAGAIN, " => [%.*s:%d]", tmp->len, tmp->str, tmp->orig_line);
         }
         LOG_FMT(LALAGAIN, "\n");
         as.End();
      }
   }
}
开发者ID:jscipione,项目名称:Paladin,代码行数:31,代码来源:align.cpp


示例7: output_parsed

void output_parsed(FILE *pfile)
{
   chunk_t *pc;
   int     cnt;

   output_options(pfile);
   output_defines(pfile);
   output_types(pfile);

   fprintf(pfile, "-=====-\n");
   fprintf(pfile, "Line      Tag          Parent     Columns  Br/Lvl/pp Flg Nl  Text");
   for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc))
   {
      fprintf(pfile, "\n%3d> %13.13s[%13.13s][%2d/%2d/%2d][%d/%d/%d][%6x][%d-%d]",
              pc->orig_line, get_token_name(pc->type),
              get_token_name(pc->parent_type),
              pc->column, pc->orig_col, pc->orig_col_end,
              pc->brace_level, pc->level, pc->pp_level,
              pc->flags, pc->nl_count, pc->after_tab);

      if ((pc->type != CT_NEWLINE) && (pc->len != 0))
      {
         for (cnt = 0; cnt < pc->column; cnt++)
         {
            fprintf(pfile, " ");
         }
         fprintf(pfile, "%.*s", pc->len, pc->str);
      }
   }
   fprintf(pfile, "\n-=====-\n");
   fflush(pfile);
}
开发者ID:7vikram7,项目名称:uncrustify,代码行数:32,代码来源:output.cpp


示例8: do_code_width

void do_code_width(void)
{
   LOG_FUNC_ENTRY();
   LOG_FMT(LSPLIT, "%s(%d)\n", __func__, __LINE__);

   for (chunk_t *pc = chunk_get_head(); pc != nullptr; pc = chunk_get_next(pc))
   {
      if (  !chunk_is_newline(pc)
         && !chunk_is_comment(pc)
         && pc->type != CT_SPACE
         && is_past_width(pc))
      {
         if (  pc->type == CT_VBRACE_CLOSE // don't break if a vbrace close
            && chunk_is_last_on_line(*pc)) // is the last chunk on its line
         {
            continue;
         }

         bool split_OK = split_line(pc);
         if (split_OK)
         {
            LOG_FMT(LSPLIT, "%s(%d): on orig_line=%zu, orig_col=%zu, for %s\n",
                    __func__, __LINE__, pc->orig_line, pc->orig_col, pc->text());
         }
         else
         {
            LOG_FMT(LSPLIT, "%s(%d): Bailed on orig_line=%zu, orig_col=%zu, for %s\n",
                    __func__, __LINE__, pc->orig_line, pc->orig_col, pc->text());
            break;
         }
      }
   }
}
开发者ID:CDanU,项目名称:uncrustify,代码行数:33,代码来源:width.cpp


示例9: uncrustify_end

static void uncrustify_end()
{
   /* Free all the memory */
   chunk_t *pc;

   while ((pc = chunk_get_head()) != NULL)
   {
      chunk_del(pc);
   }

   if (cpd.bom != NULL)
   {
      chunk_del(cpd.bom);
      cpd.bom = NULL;
   }

   /* Clean up some state variables */
   cpd.unc_off     = false;
   cpd.al_cnt      = 0;
   cpd.did_newline = true;
   cpd.frame_count = 0;
   cpd.pp_level    = 0;
   cpd.changes     = 0;
   cpd.in_preproc  = CT_NONE;
   cpd.consumed    = false;
   memset(cpd.le_counts, 0, sizeof(cpd.le_counts));
   cpd.preproc_ncnl_count = 0;
}
开发者ID:EricMusic,项目名称:uncrustify,代码行数:28,代码来源:uncrustify.cpp


示例10: remove_extra_semicolons

/**
 * Removes superfluous semicolons:
 *  - after brace close whose parent is IF, ELSE, SWITCH, WHILE, FOR, NAMESPACE
 *  - after another semicolon where parent is not FOR
 *  - (D) after brace close whose parent is ENUM/STRUCT/UNION
 *  - after an open brace
 *  - when not in a #DEFINE
 */
void remove_extra_semicolons(void)
{
   chunk_t *pc;
   chunk_t *next;
   chunk_t *prev;

   pc = chunk_get_head();
   while (pc != NULL)
   {
      next = chunk_get_next_ncnl(pc);

      if ((pc->type == CT_SEMICOLON) && !(pc->flags & PCF_IN_PREPROC) &&
          ((prev = chunk_get_prev_ncnl(pc)) != NULL))
      {
         LOG_FMT(LSCANSEMI, "Semi on %d:%d, prev = '%s' [%s/%s]\n",
                 pc->orig_line, pc->orig_col, prev->str.c_str(),
                 get_token_name(prev->type), get_token_name(prev->parent_type));

         if ((prev->type == CT_BRACE_CLOSE) &&
             ((prev->parent_type == CT_IF) ||
              (prev->parent_type == CT_ELSEIF) ||
              (prev->parent_type == CT_ELSE) ||
              (prev->parent_type == CT_SWITCH) ||
              (prev->parent_type == CT_WHILE) ||
              (prev->parent_type == CT_USING_STMT) ||
              (prev->parent_type == CT_FOR) ||
              (prev->parent_type == CT_FUNC_DEF) ||
              (prev->parent_type == CT_OC_MSG_DECL) ||
              (prev->parent_type == CT_FUNC_CLASS) ||
              (prev->parent_type == CT_NAMESPACE)))
         {
            remove_semicolon(pc);
         }
         else if ((prev->type == CT_BRACE_CLOSE) &&
                  (prev->parent_type == CT_NONE))
         {
            check_unknown_brace_close(pc, prev);
         }
         else if ((prev->type == CT_SEMICOLON) &&
                  (prev->parent_type != CT_FOR))
         {
            remove_semicolon(pc);
         }
         else if ((cpd.lang_flags & LANG_D) &&
                  ((prev->parent_type == CT_ENUM) ||
                   (prev->parent_type == CT_UNION) ||
                   (prev->parent_type == CT_STRUCT)))
         {
            remove_semicolon(pc);
         }
         else if (prev->type == CT_BRACE_OPEN)
         {
            remove_semicolon(pc);
         }
      }

      pc = next;
   }
}
开发者ID:HPChen,项目名称:uncrustify,代码行数:67,代码来源:semicolons.cpp


示例11: examine_Data

void examine_Data(const char *func_name, int theLine, int what)
{
   chunk_t *pc;

   LOG_FMT(LGUY, "\n%s:", func_name);
   switch (what) {
   case 1:
      for (pc = chunk_get_head(); pc != NULL; pc = pc->next)
      {
         if ((pc->type == CT_SQUARE_CLOSE) ||
             (pc->type == CT_TSQUARE)) {
           LOG_FMT(LGUY, "\n");
           LOG_FMT(LGUY, "1:(%d),", theLine);
           LOG_FMT(LGUY, "%s, orig_col=%d, orig_col_end=%d\n", pc->text(), pc->orig_col, pc->orig_col_end);
         }
      }
      break;
   case 2:
      LOG_FMT(LGUY, "2:(%d)\n", theLine);
      for (pc = chunk_get_head(); pc != NULL; pc = pc->next)
      {
        if (pc->orig_line == 7) {
          if (pc->type == CT_NEWLINE) {
            LOG_FMT(LGUY, "(%d)<NL> col=%d\n\n", pc->orig_line, pc->orig_col);
          } else {
            LOG_FMT(LGUY, "(%d)%s %s, col=%d, column=%d\n", pc->orig_line, pc->text(), get_token_name(pc->type), pc->orig_col, pc->column);
          }
        }
      }
      break;
   case 3:
      LOG_FMT(LGUY, "3:(%d)\n", theLine);
      for (pc = chunk_get_head(); pc != NULL; pc = pc->next)
      {
         if (pc->type == CT_SEMICOLON) {
           if (pc->type == CT_NEWLINE) {
             LOG_FMT(LGUY, "(%d)<NL> col=%d\n\n", pc->orig_line, pc->orig_col);
           } else {
             LOG_FMT(LGUY, "(%d)%s %s, col=%d, column=%d\n", pc->orig_line, pc->text(), get_token_name(pc->type), pc->orig_col, pc->column);
           }
         }
      }
      break;
   }
}
开发者ID:7vikram7,项目名称:uncrustify,代码行数:45,代码来源:unc_tools.cpp


示例12: foo

void foo(void)
{
  List<byte> bob = new List<byte>();

  /* Align assignments */
  align_assign(chunk_get_head(),
               cpd.settings [UO_align_assign_span].n,
               cpd.settings [UO_align_assign_thresh].n);
}
开发者ID:7vikram7,项目名称:uncrustify,代码行数:9,代码来源:30012-misc2.cpp


示例13: space_text_balance_nested_parens

/**
 * Marches through the whole file and adds spaces around nested parens
 */
void space_text_balance_nested_parens(void)
{
   chunk_t *first;
   chunk_t *next;
   chunk_t *cur;
   chunk_t *prev;

   first = chunk_get_head();
   while (first != NULL)
   {
      next = chunk_get_next(first);
      if (next == NULL)
      {
         break;
      }

      if (chunk_is_str(first, "(", 1) && chunk_is_str(next, "(", 1))
      {
         /* insert a space between the two opening parens */
         space_add_after(first, 1);

         /* find the closing paren that matches the 'first' open paren and force
          * a space before it */
         cur  = next;
         prev = cur;
         while ((cur = chunk_get_next(cur)) != NULL)
         {
            if (cur->level == first->level)
            {
               space_add_after(prev, 1);
               break;
            }
            prev = cur;
         }
      }
      else if (chunk_is_str(first, ")", 1) && chunk_is_str(next, ")", 1))
      {
         /* insert a space between the two closing parens */
         space_add_after(first, 1);

         /* find the opening paren that matches the 'next' close paren and force
          * a space after it */
         cur = first;
         while ((cur = chunk_get_prev(cur)) != NULL)
         {
            if (cur->level == next->level)
            {
               space_add_after(cur, 1);
               break;
            }
         }
      }

      first = next;
   }
}
开发者ID:billcox,项目名称:uncrustify,代码行数:59,代码来源:space.cpp


示例14: align_oc_msg_colons

/**
 * Aligns OC messages
 */
static void align_oc_msg_colons()
{
   chunk_t *pc;

   for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc))
   {
      if ((pc->type == CT_SQUARE_OPEN) && (pc->parent_type == CT_OC_MSG))
      {
         align_oc_msg_colon(pc);
      }
   }
}
开发者ID:jscipione,项目名称:Paladin,代码行数:15,代码来源:align.cpp


示例15: prot_the_line

void prot_the_line(int theLine)
{
   chunk_t *pc;
   LOG_FMT(LGUY, "P:(%d) ", theLine);
   for (pc = chunk_get_head(); pc != NULL; pc = pc->next)
   {
      if (pc->type == CT_NEWLINE) {
        LOG_FMT(LGUY, "<NL>\n");
      } else {
        LOG_FMT(LGUY, " %s", pc->text());
      }
   }
   LOG_FMT(LGUY, "\n");
}
开发者ID:7vikram7,项目名称:uncrustify,代码行数:14,代码来源:unc_tools.cpp


示例16: align_left_shift

/**
 * Align '<<' (CT_ARITH?)
 */
static void align_left_shift(void)
{
   chunk_t    *pc;
   chunk_t    *start = NULL;
   AlignStack as;

   as.Start(2);

   pc = chunk_get_head();
   while (pc != NULL)
   {
      if (chunk_is_newline(pc))
      {
         as.NewLines(pc->nl_count);
      }
      else if ((start != NULL) && (pc->level < start->level))
      {
         /* A drop in level restarts the aligning */
         as.Flush();
         start = NULL;
      }
      else if ((start != NULL) && (pc->level > start->level))
      {
         /* Ignore any deeper levels when aligning */
      }
      else if (pc->type == CT_SEMICOLON)
      {
         /* A semicolon at the same level flushes */
         as.Flush();
         start = NULL;
      }
      else if (chunk_is_str(pc, "<<", 2))
      {
         if (as.m_aligned.Empty())
         {
            /* first one can be anywhere */
            as.Add(pc);
            start = pc;
         }
         else if (chunk_is_newline(chunk_get_prev(pc)))
         {
            /* subsequent ones must be after a newline */
            as.Add(pc);
         }
      }

      pc = chunk_get_next(pc);
   }
   as.End();
}
开发者ID:jscipione,项目名称:Paladin,代码行数:53,代码来源:align.cpp


示例17: align_func_proto

/**
 * Aligns all function prototypes in the file.
 */
static void align_func_proto(int span)
{
   chunk_t    *pc;
   bool       look_bro = false;
   AlignStack as;
   AlignStack as_br;

   LOG_FMT(LALIGN, "%s\n", __func__);
   as.Start(span, 0);
   as.m_gap = cpd.settings[UO_align_func_proto_gap].n;

   as_br.Start(span, 0);
   as_br.m_gap = cpd.settings[UO_align_single_line_brace_gap].n;

   for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc))
   {
      if (chunk_is_newline(pc))
      {
         look_bro = false;
         as.NewLines(pc->nl_count);
         as_br.NewLines(pc->nl_count);
      }
      else if ((pc->type == CT_FUNC_PROTO) ||
               ((pc->type == CT_FUNC_DEF) &&
                cpd.settings[UO_align_single_line_func].b))
      {
         if ((pc->parent_type == CT_OPERATOR) &&
             cpd.settings[UO_align_on_operator].b)
         {
            as.Add(chunk_get_prev_ncnl(pc));
         }
         else
         {
            as.Add(pc);
         }
         look_bro = (pc->type == CT_FUNC_DEF) &&
                    cpd.settings[UO_align_single_line_brace].b;
      }
      else if (look_bro &&
               (pc->type == CT_BRACE_OPEN) &&
               (pc->flags & PCF_ONE_LINER))
      {
         as_br.Add(pc);
         look_bro = false;
      }
   }
   as.End();
   as_br.End();
}
开发者ID:jscipione,项目名称:Paladin,代码行数:52,代码来源:align.cpp


示例18: align_backslash_newline

/**
 * Aligns all backslash-newline combos in the file.
 * This should be done LAST.
 */
void align_backslash_newline(void)
{
   chunk_t *pc;

   pc = chunk_get_head();
   while (pc != NULL)
   {
      if (pc->type != CT_NL_CONT)
      {
         pc = chunk_get_next_type(pc, CT_NL_CONT, -1);
         continue;
      }
      pc = align_nl_cont(pc);
   }
}
开发者ID:jscipione,项目名称:Paladin,代码行数:19,代码来源:align.cpp


示例19: align_struct_initializers

void align_struct_initializers(void)
{
   LOG_FUNC_ENTRY();
   chunk_t *pc = chunk_get_head();
   while (pc != nullptr)
   {
      chunk_t *prev = chunk_get_prev_ncnl(pc);
      if (  chunk_is_token(prev, CT_ASSIGN)
         && (  chunk_is_token(pc, CT_BRACE_OPEN)
            || (language_is_set(LANG_D) && chunk_is_token(pc, CT_SQUARE_OPEN))))
      {
         align_init_brace(pc);
      }
      pc = chunk_get_next_type(pc, CT_BRACE_OPEN, -1);
   }
} // align_struct_initializers
开发者ID:paolodedios,项目名称:uncrustify,代码行数:16,代码来源:align_struct_initializers.cpp


示例20: do_code_width

/**
 * Step forward until a token goes beyond the limit and then call split_line()
 * to split the line at or before that point.
 */
void do_code_width(void)
{
   chunk_t *pc;

   LOG_FMT(LSPLIT, "%s\n", __func__);

   for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc))
   {
      if (!chunk_is_newline(pc) &&
          !chunk_is_comment(pc) &&
          (pc->type != CT_SPACE) &&
          is_past_width(pc))
      {
         split_line(pc);
      }
   }
}
开发者ID:Limsik,项目名称:e17,代码行数:21,代码来源:width.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ chunk_get_next_ncnl函数代码示例发布时间:2022-05-30
下一篇:
C++ chunk_free函数代码示例发布时间: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