当前位置: 首页>>代码示例>>C++>>正文


C++ ATmatch函数代码示例

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


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

示例1: ofp_isOptionOrKind

static ATbool ofp_isOptionOrKind(ATerm kind)
{
   if (ATmatch(kind, "\"Option\"") || ATmatch(kind, "\"Or\"")) {
      return ATtrue;
   }
   return ATfalse;
}
开发者ID:OpenFortranProject,项目名称:ofp-sdf,代码行数:7,代码来源:traversal_f.c

示例2: ofp_getArgType

static ATerm ofp_getArgType(ATerm term, ATbool * isOptType)
{
   int i;
   ATerm kind, name;

   if (ATmatch(term, "[<term>,<term>]", &kind, &name)) {
      // MATCHED (kind, name)
   }
   else {
      *isOptType = ATfalse;
      return ATmake("None");
   }

   for (i = 0; i <  ATgetLength(gTypeTable); i++) {
      ATerm typeName, typeList;
      ATbool matched = ATfalse;
      ATerm name_type = ATelementAt(gTypeTable, i);
      if (ATmatch(name_type, "Type(<term>,<term>)", &typeName, &typeList)) {
         matched = ATtrue;
         *isOptType = ATfalse;
      }
      else if (ATmatch(name_type, "OptType(<term>,<term>)", &typeName, &typeList)) {
         matched = ATtrue;
         *isOptType = ATtrue;
      }
      if (matched && ATisEqual(name, typeName)) {
         return typeList;
      }
   }

   *isOptType = ATfalse;
   return ATmake("None");
}
开发者ID:OpenFortranProject,项目名称:ofp-sdf,代码行数:33,代码来源:traversal_f.c

示例3: ofp_traverse_OpDeclInj

ATbool ofp_traverse_OpDeclInj(ATerm term, pOFP_Traverse OpDeclInj)
{
   ATerm alias, type, opt;
   int isOptType = 0;

   if (ATmatch(term, "OpDeclInj(<term>)", &OpDeclInj->term)) {
#ifdef DEBUG_PRINT
      printf("\nofp_traverse_OpDeclInj: %s\n", ATwriteToString(OpDeclInj->term));
#endif
      if (ATmatch(OpDeclInj->term, "FunType(<term>,<term>)", &type, &alias)) {
         ATermList list;
         if (ATmatch(type, "<term>", &list)) {
            // not a simple alias
            if (ATgetLength(list) > 1) return ATfalse;
         } else return ATfalse;
         if (ATmatch(type, "[ConstType(SortNoArgs(<term>))]", &type)) {
            // MATCHED object type
         } else return ATfalse;
         if (ATmatch(alias, "ConstType(SortNoArgs(<term>))", &alias)) {
            // MATCHED object alias
         } else return ATfalse;
      } else return ATfalse;

      OpDeclInj->term = ATmake("Alias(<term>,<term>)", type, alias);

      return ATtrue;
   }
   return ATfalse;
}
开发者ID:Fortran-FOSS-Programmers,项目名称:ofp-sdf,代码行数:29,代码来源:build_productions.c

示例4: ofp_isArgOptionOptionKind

static ATbool ofp_isArgOptionOptionKind(ATerm list)
{
   ATerm kind, name;
   assert(ATmatch(list, "[<term>,<term>]", &kind, &name));
   if (ATmatch(kind, "\"OptionOption\"")) {
      return ATtrue;
   }
   return ATfalse;
}
开发者ID:OpenFortranProject,项目名称:ofp-sdf,代码行数:9,代码来源:traversal_f.c

示例5: ofp_coalesceTypeTable

ATermList ofp_coalesceTypeTable(ATermList oldTable)
{
   // Assumes:
   //  1. Contains list of terms Type(<str>,<list>) or OptType(<str>,<list>)
   //      a. <str> is type name
   //      b. <list> is [type] of length 1
   //  2. Portions of table to be coalesced are in order
   //  3. If OptType must match "(Some(<term>))"
   //
   ATerm head;
   int isOptType;

   ATermList table = (ATermList) ATmake("[]");
   ATermList types = (ATermList) ATmake("[]");
   ATermList tail  = (ATermList) ATmake("<term>", oldTable);

   if (ATisEmpty(tail)) {
      return oldTable;
   }

   head = ATgetFirst(tail);
   tail = ATgetNext(tail);

   while (1) {
      ATerm headName, headType, next, nextName, nextType;

      if (ATisEmpty(tail)) next = ATmake("Type(None,[None])");
      else                 next = ATgetFirst(tail);

      if      ( ATmatch(head, "Type(<term>,[<term>])",    &headName, &headType) ) isOptType = 0;
      else if ( ATmatch(head, "OptType(<term>,[<term>])", &headName, &headType) ) isOptType = 1;
      else assert(0); 

      assert(    ATmatch(next, "Type(<term>,[<term>])",    &nextName, &nextType)
              || ATmatch(next, "OptType(<term>,[<term>])", &nextName, &nextType)
            );

      types = ATappend(types, headType);

      // check for need to coalesce
      if (! ATisEqual(headName, nextName)) {
         if (isOptType) {
            table = ATappend((ATermList)table, ATmake("OptType(<term>,<term>)", headName, types));
         } else {
            table = ATappend((ATermList)table, ATmake(   "Type(<term>,<term>)", headName, types));
         }
         types = (ATermList) ATmake("[]");
         if (ATisEmpty(tail)) break;
      }

      head = ATgetFirst(tail);
      tail = ATgetNext(tail);
   }

   return table;
}
开发者ID:OpenFortranProject,项目名称:ofp-sdf,代码行数:56,代码来源:traversal_f.c

示例6: SSL_int_to_string

ATerm SSL_int_to_string(ATerm x)
{ int k;
  double r;
  char buf[32];
  if(ATmatch(x, "<int>", &k)) 
    ;
  else if(ATmatch(x, "<real>", &r))
    k = r;
  else
    _fail(x);

  sprintf(buf, "%d", k);
  return((ATerm) ATmakeString(buf));
}
开发者ID:AaronNGray,项目名称:strategoxt,代码行数:14,代码来源:term-integer.c

示例7: if

void *_int(void)
{ int k;
  double r; 
  if(ATmatch(Ttop(), "<int>", &k))
    {
      return NULL; 
    } 
  else if(ATmatch(Ttop(), "<real>", &r))
    {
      Tset((ATerm) ATmakeInt((int)r));
      return NULL; 
    } 
  else return fail_address; 
}
开发者ID:metaborg,项目名称:stratego-releases,代码行数:14,代码来源:number.c

示例8: generateHeader

static void generateHeader(FILE *file, ATermList terms, ATermList afuns)
{
  if (opt_gen_date) {
    time_t now = time(NULL);
    fprintf(file, "/*\n * Generated at %s", ctime(&now));
    fprintf(file, " */\n\n");
  }

  fprintf(file, "#ifndef __%s_H\n", code_prefix);
  fprintf(file, "#define __%s_H\n\n", code_prefix);
  fprintf(file, "#include <aterm2.h>\n\n");
  fprintf(file, "#include <assert.h>\n\n");

  while (!ATisEmpty(afuns)) {
    ATerm afun, alias, pair = ATgetFirst(afuns);
    afuns = ATgetNext(afuns);

    if (!ATmatch(pair, "[<term>,<term>]", &alias, &afun)) {
      ATfprintf(stderr, "malformed [alias,afun] pair: %t\n", pair);
      exit(1);
    }

    checkAlias(alias);
    checkAFun(afun);

    ATfprintf(file, "extern AFun %t;\n", alias);
  }

  fprintf(file, "\n");

  while (!ATisEmpty(terms)) {
    ATerm term, alias, pair = ATgetFirst(terms);
    terms = ATgetNext(terms);

    if (!ATmatch(pair, "[<term>,<term>]", &alias, &term)) {
      ATfprintf(stderr, "malformed [alias,term] pair: %t\n", pair);
      exit(1);
    }

    checkAlias(alias);

    ATfprintf(file, "extern ATerm %t;\n", alias);
  }

  fprintf(file, "\nextern void init_%s();\n", code_prefix);

  fprintf(file, "\n#endif /* __%s_H */\n", code_prefix);
}
开发者ID:jianglili007,项目名称:aterm,代码行数:48,代码来源:dicttoc.c

示例9: traverse_SgUntypedInitializedNameList

//========================================================================================
// SgUntypedInitializedNameList
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedInitializedNameList(ATerm term, SgUntypedInitializedNameList** var_SgUntypedInitializedNameList)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedInitializedNameList: %s\n", ATwriteToString(term));
#endif

  ATerm term1;
  
  *var_SgUntypedInitializedNameList = NULL;
  if (ATmatch(term, "SgUntypedInitializedNameList(<term>)", &term1)) {
     SgUntypedInitializedNameList* plist = new SgUntypedInitializedNameList();

     ATermList tail = (ATermList) ATmake("<term>", term1);
     while (! ATisEmpty(tail)) {
        SgUntypedInitializedName* arg;
        ATerm head = ATgetFirst(tail);
        tail = ATgetNext(tail);

        if (traverse_SgUntypedInitializedName(head, (SgUntypedInitializedName**) &arg)) {
           // SgUntypedInitializedName
           plist->get_name_list().push_back(arg);
           continue;
        }

        delete plist;
        return ATfalse;
     }
     *var_SgUntypedInitializedNameList = plist;
  }
  else return ATfalse;
  // turn on build functions (using BuildStmt) in sage-to-traverse.str

  return ATtrue;
}
开发者ID:ian-bertolacci,项目名称:rose-develop,代码行数:37,代码来源:traverse_SgUntypedNodes.cpp

示例10: traverse_SgUntypedExpression

//========================================================================================
// SgUntypedExpression
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedExpression(ATerm term, SgUntypedExpression** var_SgUntypedExpression)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedExpression: %s\n", ATwriteToString(term));
#endif

  ATerm term1;
  //CER-FIXME  SgToken::ROSE_Fortran_Keywords* arg1;
  SgToken::ROSE_Fortran_Keywords arg1;

  *var_SgUntypedExpression = NULL;
  if (traverse_SgUntypedReferenceExpression(term, (SgUntypedReferenceExpression**) var_SgUntypedExpression)) {
    // SgUntypedReferenceExpression
  }
  else if (traverse_SgUntypedValueExpression(term, (SgUntypedValueExpression**) var_SgUntypedExpression)) {
    // SgUntypedValueExpression
  }
  else if (traverse_SgUntypedBinaryOperator(term, (SgUntypedBinaryOperator**) var_SgUntypedExpression)) {
    // SgUntypedBinaryOperator
  }
  else if (ATmatch(term, "SgUntypedExpression(<term>)", &term1)) {
    if (traverse_SgToken_ROSE_Fortran_Keywords(term1, &arg1)) {
      // SgToken_ROSE_Fortran_Keywords
    } else return ATfalse;
    *var_SgUntypedExpression = new SgUntypedExpression(arg1);
  }
  else return ATfalse;

  return ATtrue;
}
开发者ID:ian-bertolacci,项目名称:rose-develop,代码行数:33,代码来源:traverse_SgUntypedNodes.cpp

示例11: traverse_SgUntypedVariableDeclaration

//========================================================================================
// SgUntypedVariableDeclaration
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedVariableDeclaration(ATerm term, SgUntypedVariableDeclaration** var_SgUntypedVariableDeclaration)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedVariableDeclaration: %s\n", ATwriteToString(term));
#endif

  //CER-FIXME (arguments)
  ATerm term2, term3, term4;
  char* arg1;
  SgToken::ROSE_Fortran_Keywords arg2;
  SgUntypedType* arg3;
  SgUntypedInitializedNameList* arg4;

  *var_SgUntypedVariableDeclaration = NULL;
  if (ATmatch(term, "SgUntypedVariableDeclaration(<str>,<term>,<term>,<term>)", &arg1,&term2,&term3,&term4)) {
    if (traverse_SgToken_ROSE_Fortran_Keywords(term2, &arg2)) {
      // SgToken_ROSE_Fortran_Keywords
    } else return ATfalse;
    if (traverse_SgUntypedType(term3, &arg3)) {
      // SgUntypedType
    } else return ATfalse;
    if (traverse_SgUntypedInitializedNameList(term4, &arg4)) {
       // SgUntypedInitializedNameList
    } else return ATfalse;
  } else return ATfalse;

  *var_SgUntypedVariableDeclaration = new SgUntypedVariableDeclaration(arg1,arg2,arg3,arg4);

  return ATtrue;
}
开发者ID:ian-bertolacci,项目名称:rose-develop,代码行数:33,代码来源:traverse_SgUntypedNodes.cpp

示例12: traverse_SgUntypedValueExpression

//========================================================================================
// SgUntypedValueExpression
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedValueExpression(ATerm term, SgUntypedValueExpression** var_SgUntypedValueExpression)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedValueExpression: %s\n", ATwriteToString(term));
#endif

  ATerm term1, term3;
  //CER-FIXME  SgToken::ROSE_Fortran_Keywords* arg1;
  SgToken::ROSE_Fortran_Keywords arg1;
  char* arg2;
  SgUntypedType* arg3;

  *var_SgUntypedValueExpression = NULL;
  if (ATmatch(term, "SgUntypedValueExpression(<term>,<str>,<term>)", &term1,&arg2,&term3)) {
    if (traverse_SgToken_ROSE_Fortran_Keywords(term1, &arg1)) {
      // SgToken_ROSE_Fortran_Keywords
    } else return ATfalse;
    if (traverse_SgUntypedType(term3, &arg3)) {
      // SgUntypedType
    } else return ATfalse;
  } else return ATfalse;

  *var_SgUntypedValueExpression = new SgUntypedValueExpression(arg1,arg2,arg3);

  return ATtrue;
}
开发者ID:ian-bertolacci,项目名称:rose-develop,代码行数:29,代码来源:traverse_SgUntypedNodes.cpp

示例13: traverse_SgUntypedBinaryOperator

//========================================================================================
// SgUntypedBinaryOperator
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedBinaryOperator(ATerm term, SgUntypedBinaryOperator** var_SgUntypedBinaryOperator)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedBinaryOperator: %s\n", ATwriteToString(term));
#endif

  ATerm term1, term2, term4, term5;
//CER-FIXME   SgToken::ROSE_Fortran_Keywords* arg1;
//CER-FIXME   SgToken::ROSE_Fortran_Operators* arg2;
  SgToken::ROSE_Fortran_Keywords arg1;
  SgToken::ROSE_Fortran_Operators arg2;
  char* arg3;
  SgUntypedExpression* arg4;
  SgUntypedExpression* arg5;

  *var_SgUntypedBinaryOperator = NULL;
  if (ATmatch(term, "SgUntypedBinaryOperator(<term>,<term>,<str>,<term>,<term>)", &term1,&term2,&arg3,&term4,&term5)) {
    if (traverse_SgToken_ROSE_Fortran_Keywords(term1, &arg1)) {
      // SgToken_ROSE_Fortran_Keywords
    } else return ATfalse;
    if (traverse_SgToken_ROSE_Fortran_Operators(term2, &arg2)) {
      // SgToken_ROSE_Fortran_Operators
    } else return ATfalse;
    if (traverse_SgUntypedExpression(term4, &arg4)) {
      // SgUntypedExpression
    } else return ATfalse;
    if (traverse_SgUntypedExpression(term5, &arg5)) {
      // SgUntypedExpression
    } else return ATfalse;
  } else return ATfalse;

  *var_SgUntypedBinaryOperator = new SgUntypedBinaryOperator(arg1,arg2,arg3,arg4,arg5);

  return ATtrue;
}
开发者ID:ian-bertolacci,项目名称:rose-develop,代码行数:38,代码来源:traverse_SgUntypedNodes.cpp

示例14: traverse_SgUntypedGlobalScope

//========================================================================================
// SgUntypedGlobalScope
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedGlobalScope(ATerm term, SgUntypedGlobalScope** var_SgUntypedGlobalScope)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedGlobalScope: %s\n", ATwriteToString(term));
#endif

  ATerm term2, term3, term4, term5;
  char* arg1;
  SgToken::ROSE_Fortran_Keywords arg2;
  SgUntypedDeclarationStatementList* arg3;
  SgUntypedStatementList* arg4;
  SgUntypedFunctionDeclarationList* arg5;
  
  *var_SgUntypedGlobalScope = NULL;
  if (ATmatch(term, "SgUntypedGlobalScope(<str>,<term>,<term>,<term>,<term>)", &arg1,&term2,&term3,&term4,&term5)) {
    if (traverse_SgToken_ROSE_Fortran_Keywords(term2, &arg2)) {
      // SgToken_ROSE_Fortran_Keywords
    } else return ATfalse;
    if (traverse_SgUntypedDeclarationStatementList(term3, &arg3)) {
      // SgUntypedDeclarationStatementList
    } else return ATfalse;
    if (traverse_SgUntypedStatementList(term4, &arg4)) {
      // SgUntypedStatementList
    } else return ATfalse;
    if (traverse_SgUntypedFunctionDeclarationList(term5, &arg5)) {
      // SgUntypedFunctionDeclarationList
    } else return ATfalse;
  } else return ATfalse;

  *var_SgUntypedGlobalScope = new SgUntypedGlobalScope(arg1,arg2,arg3,arg4,arg5);

  return ATtrue;
}
开发者ID:ian-bertolacci,项目名称:rose-develop,代码行数:36,代码来源:traverse_SgUntypedNodes.cpp

示例15: ofp_getArgName

static ATerm ofp_getArgName(ATerm term)
{
   ATerm kind, name;

   assert(ATmatch(term, "[<term>,<term>]", &kind, &name));
   return name;
}
开发者ID:OpenFortranProject,项目名称:ofp-sdf,代码行数:7,代码来源:traversal_f.c


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