コード例 #1
0
void ofp_build_node_traversal(ATerm arg, char * src_suffix, int depth)
{
#ifdef OBSOLETE
   ATbool isOptType;
   char * arg_name = ofp_getArgNameStr(arg, &arg_name);

   indent(depth);  printf("====================================\n");
   indent(depth);  printf("   arg: %s%s.term: %s\n", arg_name, src_suffix, ATwriteToString(arg));
   indent(depth);  printf("------------------------------------\n");
   ATerm type = ofp_getArgType(arg, &isOptType);
   ATerm kind = ofp_getArgKind(arg);
   ATerm name = ofp_getArgName(arg);
   printf(".....arg....... %s\n", ATwriteToString(arg));
   printf(".....type...... %s\n", ATwriteToString(type));
   printf(".....kind...... %s\n", ATwriteToString(kind));
   printf(".....name...... %s\n", ATwriteToString(name));

   switch (ofp_getArgDataType(arg)) {
   case STRING:
      ofp_build_string_match(arg, src_suffix, depth+1);
      break;
   case LIST:
      ofp_build_list_traversal(arg, src_suffix, depth+1);
      break;
   case OR:
      ofp_build_or_traversal(arg, src_suffix, depth+1);
      break;
   default:
      ofp_build_old_node_traversal(ofp_getArgName(arg), arg, kind);
   }
#endif
}
コード例 #2
0
//========================================================================================
// 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;
}
コード例 #3
0
//========================================================================================
// 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;
}
コード例 #4
0
//========================================================================================
// 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;
}
コード例 #5
0
//========================================================================================
// 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;
}
コード例 #6
0
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;
}
コード例 #7
0
ATbool ofp_traverse_OpDeclInj(ATerm term, pOFP_Traverse OpDeclInj)
{
   ATerm name, 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, &name)) {
         if (ATmatch(type, "[ConstType(Sort(<term>,<term>))]", &opt, &type)) {
            // MATCHED option object type
            if (ATmatch(type, "[SortNoArgs(<term>)]", &type) && ATisEqual(opt, ATmake("\"Option\""))) {
               isOptType = 1;
            } else return ATfalse;
         }
         else if (ATmatch(type, "[ConstType(SortNoArgs(<term>))]", &type)) {
            // MATCHED object type
         }
         if (ATmatch(name, "ConstType(SortNoArgs(<term>))", &name)) {
            // MATCHED object name
         } else return ATfalse;
      } else return ATfalse;

      if (isOptType) {
         OpDeclInj->term = ATmake("OptType(<term>,[<term>])", name, type);
      }
      else {
         OpDeclInj->term = ATmake("Type(<term>,[<term>])", name, type);
      }

      return ATtrue;
   }
   return ATfalse;
}
コード例 #8
0
//========================================================================================
// 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;
}
コード例 #9
0
//========================================================================================
// SgUntypedAssignmentStatement
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedAssignmentStatement(ATerm term, SgUntypedAssignmentStatement** var_SgUntypedAssignmentStatement)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedAssignmentStatement: %s\n", ATwriteToString(term));
#endif

  ATerm term2, term3, term4;
  char* arg1;
  //CER-FIXME  SgToken::ROSE_Fortran_Keywords* arg2;
  SgToken::ROSE_Fortran_Keywords arg2;
  SgUntypedExpression* arg3;
  SgUntypedExpression* arg4;
  
  *var_SgUntypedAssignmentStatement = NULL;
  if (ATmatch(term, "SgUntypedAssignmentStatement(<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_SgUntypedExpression(term3, &arg3)) {
      // SgUntypedExpression
    } else return ATfalse;
    if (traverse_SgUntypedExpression(term4, &arg4)) {
      // SgUntypedExpression
    } else return ATfalse;
  } else return ATfalse;

  *var_SgUntypedAssignmentStatement = new SgUntypedAssignmentStatement(arg1,arg2,arg3,arg4);

  return ATtrue;
}
コード例 #10
0
//========================================================================================
// 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;
}
コード例 #11
0
ATbool ofp_traverse_Constructors(ATerm term, pOFP_Traverse Constructors)
{
#ifdef DEBUG_PRINT
   printf("\nConstructors: %s\n", ATwriteToString(term));
#endif

   OFP_Traverse OpDecl_list;
   if (ATmatch(term, "Constructors(<term>)", &OpDecl_list.term) ) {
      gTypeProductions = (ATermList) ATmake("[]");

      /* First build the type aliase table.  It is needed when matching productions.
       */
      ATermList OpDeclInj_tail = (ATermList) ATmake("<term>", OpDecl_list.term);
      while (! ATisEmpty(OpDeclInj_tail)) {
         OFP_Traverse OpDeclInj;
         OpDeclInj.term = ATgetFirst(OpDeclInj_tail);
         OpDeclInj_tail = ATgetNext(OpDeclInj_tail);

         if (ofp_traverse_OpDeclInj(OpDeclInj.term, &OpDeclInj)) {
            // MATCHED OpDeclInj
            gTypeProductions = ATappend(gTypeProductions, OpDeclInj.term);
         }
      }

      /* Coalesce the type table so there is one name per list of types
       */
      gTypeProductions = ofp_coalesceAliasTable(gTypeProductions);

      ATermList OpDecl_tail = (ATermList) ATmake("<term>", OpDecl_list.term);
      while (! ATisEmpty(OpDecl_tail)) {
         OFP_Traverse OpDecl;
         OpDecl.term = ATgetFirst(OpDecl_tail);
         OpDecl_tail = ATgetNext(OpDecl_tail);

         if (ofp_traverse_OpDecl(OpDecl.term, &OpDecl)) {
            // MATCHED OpDecl
         }
      }

      printf("\nPRODUCTIONS: %s\n", ATwriteToString((ATerm) gTypeProductions));

      return ATtrue;
   }

   return ATfalse;
}
コード例 #12
0
void ofp_build_or_traversal(ATerm arg, char * src_suffix, int depth)
{
   int i;
   ATbool isOptType;
   char * arg_name = ofp_getArgNameStr(arg, &arg_name);
   ATerm kind = ofp_getArgKind(arg);
   ATerm type = ofp_getArgType(arg, &isOptType);
   ATermList nameList = (ATermList) type;

   indent(depth);  printf("OR traversal......... %s;\n", ATwriteToString(type));

   for (i = 0; i < ATgetLength(nameList); i++) {
      printf("OR traversal.........kind=%s\n", ATwriteToString(kind));
      //      ATerm argi = ATmake("[<term>,<term>]", kind, ATelementAt(nameList, i));
      //      ofp_build_node_traversal(argi, "", depth);
   }

   // This is a production with or rules so one of the traversals must have
   // matched and returned ATtrue. So return ATfalse in case none matched.
   indent(depth);  printf("return ATfalse; /* for set of OR productions */\n");

}
コード例 #13
0
ATbool ofp_traverse_FunType_result(ATerm term, pOFP_Traverse FunType_result)
{
#ifdef DEBUG_PRINT
   printf("\nFunType_result: %s\n", ATwriteToString(term));
#endif

   if (ATmatch(term, "ConstType(SortNoArgs(<str>))", &FunType_result->post)) {
      // MATCHED FunType_result
      return ATtrue;
   }

   return ATfalse;
}
コード例 #14
0
ファイル: system-io-term.c プロジェクト: pSub/strategoxt
ATerm SSL_write_term_to_string(ATerm term) {
    ATerm result_term;

    /* result points to some internal buffer of the ATerm lib */
    char* result = ATwriteToString(term);

    if(result == NULL) {
        perror("SRTS/write_term_to_string");
        _fail(term);
    }

    result_term = ATmakeString(result);
    return result_term;
}
コード例 #15
0
//========================================================================================
// SgUntypedDeclarationStatementList
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedDeclarationStatementList(ATerm term, SgUntypedDeclarationStatementList** var_SgUntypedDeclarationStatementList)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedDeclarationStatementList: %s\n", ATwriteToString(term));
#endif

  ATerm term1;

  *var_SgUntypedDeclarationStatementList = NULL;
  if (ATmatch(term, "SgUntypedDeclarationStatementList(<term>)", &term1)) {
     SgUntypedDeclarationStatementList* plist = new SgUntypedDeclarationStatementList();

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

        if (traverse_SgUntypedModuleDeclaration(head, (SgUntypedModuleDeclaration**) &arg)) {
           // SgUntypedModuleDeclaration
           plist->get_decl_list().push_back(arg);
           continue;
        }
        if (traverse_SgUntypedFunctionDeclaration(head, (SgUntypedFunctionDeclaration**) &arg)) {
           // SgUntypedFunctionDeclaration
           plist->get_decl_list().push_back(arg);
           continue;
        }
        if (traverse_SgUntypedVariableDeclaration(head, (SgUntypedVariableDeclaration**) &arg)) {
           // SgUntypedVariableDeclaration
           plist->get_decl_list().push_back(arg);
           continue;
        }
        if (traverse_SgUntypedImplicitDeclaration(head, (SgUntypedImplicitDeclaration**) &arg)) {
           // SgUntypedImplicitDeclaration
           plist->get_decl_list().push_back(arg);
           continue;
        }

        delete plist;
        return ATfalse;
     }
     *var_SgUntypedDeclarationStatementList = plist;
  }
  else return ATfalse;

  return ATtrue;
}
コード例 #16
0
static int lengthOfAttr(PT_Attr attr)
{
  ATerm attribute;

  if (PT_isAttrAssoc(attr)) {
    attribute = PT_AssociativityToTerm(PT_getAttrAssoc(attr));
  }
  else if (PT_isAttrTerm(attr)) {
    attribute = PT_getAttrValue(attr);
  }
  else {
    attribute = PT_AttrToTerm(attr);
  }

  return strlen(ATwriteToString(attribute));
}
コード例 #17
0
//========================================================================================
// bool
//----------------------------------------------------------------------------------------
ATbool traverse_bool(ATerm term, bool** var_bool)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_bool: %s\n", ATwriteToString(term));
#endif

  int arg1;

  *var_bool = NULL;
  if (ATmatch(term, "bool(<int>)", &arg1)) {
  } else return ATfalse;

  *var_bool = new bool(arg1);

  return ATtrue;
}
コード例 #18
0
//========================================================================================
// SgUntypedNode
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedNode(ATerm term, SgUntypedNode** var_SgUntypedNode)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedNode: %s\n", ATwriteToString(term));
#endif


  *var_SgUntypedNode = NULL;
  //CER-FIXME  if (ATmatch(term, "SgUntypedNode()", )) {
  if (ATmatch(term, "SgUntypedNode()")) {
  } else return ATfalse;

  *var_SgUntypedNode = new SgUntypedNode();

  return ATtrue;
}
コード例 #19
0
//========================================================================================
// SgUntypedFunctionDeclaration
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedFunctionDeclaration(ATerm term, SgUntypedFunctionDeclaration** var_SgUntypedFunctionDeclaration)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedFunctionDeclaration: %s\n", ATwriteToString(term));
#endif

  char* arg1;

  *var_SgUntypedFunctionDeclaration = NULL;
  if (ATmatch(term, "SgUntypedFunctionDeclaration(<str>)", &arg1)) {
  } else return ATfalse;

  *var_SgUntypedFunctionDeclaration = new SgUntypedFunctionDeclaration(arg1);

  return ATtrue;
}
コード例 #20
0
//========================================================================================
// SgLocatedNodeSupport
//----------------------------------------------------------------------------------------
ATbool traverse_SgLocatedNodeSupport(ATerm term, SgLocatedNodeSupport** var_SgLocatedNodeSupport)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgLocatedNodeSupport: %s\n", ATwriteToString(term));
#endif


  *var_SgLocatedNodeSupport = NULL;
  //CER-FIXME  if (ATmatch(term, "SgLocatedNodeSupport()", )) {
  if (ATmatch(term, "SgLocatedNodeSupport()")) {
  } else return ATfalse;

  *var_SgLocatedNodeSupport = new SgLocatedNodeSupport();

  return ATtrue;
}
コード例 #21
0
//========================================================================================
// SgToken_ROSE_Fortran_Operators
//----------------------------------------------------------------------------------------
//CER-FIXME ATbool traverse_SgToken_ROSE_Fortran_Operators(ATerm term, SgToken::ROSE_Fortran_Operators** var_SgToken_ROSE_Fortran_Operators)
ATbool traverse_SgToken_ROSE_Fortran_Operators(ATerm term, SgToken::ROSE_Fortran_Operators* var_SgToken_ROSE_Fortran_Operators)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgToken_ROSE_Fortran_Operators: %s\n", ATwriteToString(term));
#endif

  int arg1;

  //CER-FIXME *var_SgToken_ROSE_Fortran_Operators = NULL;
  if (ATmatch(term, "SgToken_ROSE_Fortran_Operators(<int>)", &arg1)) {
  } else return ATfalse;

//CER-FIXME   *var_SgToken_ROSE_Fortran_Operators = new SgToken::ROSE_Fortran_Operators(arg1);
  *var_SgToken_ROSE_Fortran_Operators = (SgToken::ROSE_Fortran_Operators) arg1;

  return ATtrue;
}
コード例 #22
0
//========================================================================================
// SgUntypedType_type_enum
//----------------------------------------------------------------------------------------
//CER-FIXME ATbool traverse_SgUntypedType_type_enum(ATerm term, SgUntypedType::type_enum** var_SgUntypedType_type_enum)
ATbool traverse_SgUntypedType_type_enum(ATerm term, SgUntypedType::type_enum* var_SgUntypedType_type_enum)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedType_type_enum: %s\n", ATwriteToString(term));
#endif

  int arg1;

  //CER-FIXME *var_SgUntypedType_type_enum = NULL;
  if (ATmatch(term, "SgUntypedType_type_enum(<int>)", &arg1)) {
  } else return ATfalse;

//CER-FIXME   *var_SgUntypedType_type_enum = new SgUntypedType_type_enum(arg1);
  *var_SgUntypedType_type_enum = (SgUntypedType::type_enum) arg1;

  return ATtrue;
}
コード例 #23
0
ATbool ofp_traverse_OpDecl(ATerm term, pOFP_Traverse OpDecl)
{
#ifdef DEBUG_PRINT
   printf("\nOpDecl: %s\n", ATwriteToString(term));
#endif

   OFP_Traverse Name, FunType;
   if (ATmatch(term, "OpDecl(<term>,<term>)", &Name.term, &FunType.term) ) {

      char * String;
      if (ATmatch(Name.term, "<str>", &String)) {
         // MATCHED OpDecl name
         FunType.pre  = String;
         OpDecl->post = String;
      }
      return ATtrue;
   }
   return ATfalse;
}
コード例 #24
0
//========================================================================================
// SgUntypedArrayType
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedArrayType(ATerm term, SgUntypedArrayType** var_SgUntypedArrayType)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedArrayType: %s\n", ATwriteToString(term));
#endif

  ATerm term2, term9, term12, term13;
  char* arg1;
  SgUntypedExpression* arg2;
  int arg3;
  int arg4;
  int arg5;
  int arg6;
  int arg7;
  int arg8;
  SgUntypedExpression* arg9;
  char* arg10;
  int arg11;
  //CER-FIXME  SgUntypedType::type_enum* arg12;
  SgUntypedType::type_enum arg12;
  SgUntypedExpression* arg13;
  
  //CER-FIXME *var_SgUntypedArrayType = NULL;
  if (ATmatch(term, "SgUntypedArrayType(<str>,<term>,<int>,<int>,<int>,<int>,<int>,<int>,<term>,<str>,<int>,<term>,<term>)", &arg1,&term2,&arg3,&arg4,&arg5,&arg6,&arg7,&arg8,&term9,&arg10,&arg11,&term12,&term13)) {
    if (traverse_SgUntypedExpression(term2, &arg2)) {
      // SgUntypedExpression
    } else return ATfalse;
    if (traverse_SgUntypedExpression(term9, &arg9)) {
      // SgUntypedExpression
    } else return ATfalse;
    if (traverse_SgUntypedType_type_enum(term12, &arg12)) {
      // SgUntypedType_type_enum
    } else return ATfalse;
    if (traverse_SgUntypedExpression(term13, &arg13)) {
      // SgUntypedExpression
    } else return ATfalse;
  } else return ATfalse;

  *var_SgUntypedArrayType = new SgUntypedArrayType(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13);

  return ATtrue;
}
コード例 #25
0
ファイル: absint.c プロジェクト: jkeiren/muCRL
ATerm getTermSort(ATerm term){
	ATerm sort;
	if(isVariable(term)){
		sort = ATtableGet(var_tab, term);
	}
	else if(isParameter(term)){
		sort = ATtableGet(par_tab, term);
	} 	
	else {
		sort =  (ATerm) ATmake("<str>",ATgetName(MCRLgetSort(term)));
	}
	if(!strcmp("\"<int>\"", ATwriteToString(sort))){
		PP("ERROR: ");
		PP(ATgetName(MCRLgetSort(term)));
		fprintf(stderr, " %d ", nSum);
		pTerm(term);
		exit(0);
	}
	return sort;
}
コード例 #26
0
//========================================================================================
// SgUntypedFile
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedFile(ATerm term, SgUntypedFile** var_SgUntypedFile)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedFile: %s\n", ATwriteToString(term));
#endif

  ATerm term1;
  SgUntypedGlobalScope* arg1;

  *var_SgUntypedFile = NULL;
  if (ATmatch(term, "SgUntypedFile(<term>)", &term1)) {
    if (traverse_SgUntypedGlobalScope(term1, &arg1)) {
      // SgUntypedGlobalScope
    } else return ATfalse;
  } else return ATfalse;

  *var_SgUntypedFile = new SgUntypedFile(arg1);

  return ATtrue;
}
コード例 #27
0
static int 
yieldAttr(PT_Attr attr, int idx, char *buf, int bufSize)
{
  char *str; 
  ATerm attribute;

  if (PT_isAttrAssoc(attr)) {
    attribute = PT_AssociativityToTerm(PT_getAttrAssoc(attr));
  }
  else if (PT_isAttrTerm(attr)) {
    attribute = PT_getAttrValue(attr);
  }
  else {
    attribute = PT_AttrToTerm(attr);
  }

  str = ATwriteToString(attribute);
  strcpy(buf+idx,str);

  return idx + strlen(str);
}
コード例 #28
0
//========================================================================================
// SgUntypedInitializedName
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedInitializedName(ATerm term, SgUntypedInitializedName** var_SgUntypedInitializedName)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedInitializedName: %s\n", ATwriteToString(term));
#endif

  ATerm term1;
  SgUntypedType* arg1;
  char* arg2;

  *var_SgUntypedInitializedName = NULL;
  if (ATmatch(term, "SgUntypedInitializedName(<term>,<str>)", &term1,&arg2)) {
    if (traverse_SgUntypedType(term1, &arg1)) {
      // SgUntypedType
    } else return ATfalse;
  } else return ATfalse;

  *var_SgUntypedInitializedName = new SgUntypedInitializedName(arg1,arg2);

  return ATtrue;
}
コード例 #29
0
//========================================================================================
// SgUntypedFunctionCallStatement
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedFunctionCallStatement(ATerm term, SgUntypedFunctionCallStatement** var_SgUntypedFunctionCallStatement)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedFunctionCallStatement: %s\n", ATwriteToString(term));
#endif

  ATerm term2;
  char* arg1;
  //CER-FIXME  SgToken::ROSE_Fortran_Keywords* arg2;
  SgToken::ROSE_Fortran_Keywords arg2;
  
  *var_SgUntypedFunctionCallStatement = NULL;
  if (ATmatch(term, "SgUntypedFunctionCallStatement(<str>,<term>)", &arg1,&term2)) {
    if (traverse_SgToken_ROSE_Fortran_Keywords(term2, &arg2)) {
      // SgToken_ROSE_Fortran_Keywords
    } else return ATfalse;
  } else return ATfalse;

  *var_SgUntypedFunctionCallStatement = new SgUntypedFunctionCallStatement(arg1,arg2);

  return ATtrue;
}
コード例 #30
0
//========================================================================================
// SgUntypedAttribute
//----------------------------------------------------------------------------------------
ATbool traverse_SgUntypedAttribute(ATerm term, SgUntypedAttribute** var_SgUntypedAttribute)
{
#ifdef PRINT_ATERM_TRAVERSAL
  printf("... traverse_SgUntypedAttribute: %s\n", ATwriteToString(term));
#endif

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

  *var_SgUntypedAttribute = NULL;
  if (ATmatch(term, "SgUntypedAttribute(<term>,<str>)", &term1,&arg2)) {
    if (traverse_SgToken_ROSE_Fortran_Keywords(term1, &arg1)) {
      // SgToken_ROSE_Fortran_Keywords
    } else return ATfalse;
  } else return ATfalse;

  *var_SgUntypedAttribute = new SgUntypedAttribute(arg1,arg2);

  return ATtrue;
}