Beispiel #1
0
node *OSbinop (node *arg_node, info *arg_info)
{
  DBUG_ENTER("OSbinop");

  /*
   * Extremely important:
   *  we must continue to traverse the abstract syntax tree !!
   */
  BINOP_LEFT( arg_node) = TRAVdo( BINOP_LEFT( arg_node), arg_info);
  BINOP_RIGHT( arg_node) = TRAVdo( BINOP_RIGHT( arg_node), arg_info);

  if (BINOP_OP( arg_node) == BO_sub) {
    if ((NODE_TYPE( BINOP_LEFT( arg_node)) == N_var)
	&& (NODE_TYPE( BINOP_RIGHT( arg_node)) == N_var)
	&& STReq( VAR_NAME( BINOP_LEFT( arg_node)), VAR_NAME( BINOP_RIGHT( arg_node)))) {
      arg_node = FREEdoFreeTree( arg_node);
      arg_node = TBmakeNum( 0);
    }
    else if  ((NODE_TYPE( BINOP_LEFT( arg_node)) == N_num)
	      && (NODE_TYPE( BINOP_RIGHT( arg_node)) == N_num)
	      && (NUM_VALUE( BINOP_LEFT( arg_node)) == NUM_VALUE( BINOP_RIGHT( arg_node)))) {
      arg_node = FREEdoFreeTree( arg_node);
      arg_node = TBmakeNum( 0);
    }
  }

  DBUG_RETURN( arg_node);
}
Beispiel #2
0
node *MDUNPACKdefs( node *arg_node, info *arg_info )
{
  node *temp;

  DBUG_ENTER("MDUNPACKmodule");

  if(DEFS_DEF(arg_node) != NULL) {
    DEFS_DEF(arg_node) = TRAVdo(DEFS_DEF(arg_node), arg_info);
  }

  if(DEFS_NEXT(arg_node) != NULL) {
    DEFS_NEXT(arg_node) = TRAVdo(DEFS_NEXT(arg_node), arg_info);
  }

  if(DEFS_DEF(arg_node) == NULL) {

    temp = DEFS_NEXT(arg_node);

    FREEdoFreeNode(arg_node);

    arg_node = temp;
  }

  DBUG_RETURN(arg_node);
}
Beispiel #3
0
/** <!--******************************************************************-->
 *
 * @fn MERRCODEtagexpr
 *
 * @brief Sets error code for the node and its sons
 *
 * @param arg_node TagExpr node to process
 * @param arg_info pointer to info structure
 *
 * @return processed node
 *
 ***************************************************************************/
node *MERRCODEtagexpr( node *arg_node, info *arg_info ){
  DBUG_ENTER("MERRCODEtagexpr");

  /* Set error code */
  NODE_ERRCODE(arg_node)= STRcpy(INFO_ERRCODE(arg_info));

  /* Visit sons */
  if(TAGEXPR_STAG( arg_node)!= NULL){
    TAGEXPR_STAG( arg_node)= TRAVdo( TAGEXPR_STAG( arg_node), arg_info);
  }
  if(TAGEXPR_BTAG( arg_node)!= NULL){
    TAGEXPR_BTAG( arg_node)= TRAVdo( TAGEXPR_BTAG( arg_node), arg_info);
  }
  if(TAGEXPR_CONDITION( arg_node)!= NULL){
    TAGEXPR_CONDITION( arg_node)= TRAVdo( TAGEXPR_CONDITION( arg_node), arg_info);
  }
  if(TAGEXPR_LEFT( arg_node)!= NULL){
    TAGEXPR_LEFT( arg_node)= TRAVdo( TAGEXPR_LEFT( arg_node), arg_info);
  }
  if(TAGEXPR_RIGHT( arg_node)!= NULL){
    TAGEXPR_RIGHT( arg_node)= TRAVdo( TAGEXPR_RIGHT( arg_node), arg_info);
  }

  /* Return value */
  DBUG_RETURN(arg_node);
}
node *COPbinop (node *arg_node, info *arg_info)
{
  DBUG_ENTER("COPbinop");

  switch (BINOP_OP( arg_node)) {
  case BO_add:
    INFO_ADD( arg_info) = INFO_ADD( arg_info) + 1;
    break;
  case BO_sub:
    INFO_SUB( arg_info) = INFO_SUB( arg_info) + 1;
    break;
    case BO_mul:
    INFO_MUL( arg_info) = INFO_MUL( arg_info) + 1;
    break;
    case BO_div:
    INFO_DIV( arg_info) = INFO_DIV( arg_info) + 1;
    break;
    case BO_mod:
    INFO_MOD( arg_info) = INFO_MOD( arg_info) + 1;
    break;
  default:
    break;
  }

  /*
   * Extremely important:
   *  we must continue to traverse the abstract syntax tree !!
   */
  BINOP_LEFT( arg_node) = TRAVdo( BINOP_LEFT( arg_node), arg_info);
  BINOP_RIGHT( arg_node) = TRAVdo( BINOP_RIGHT( arg_node), arg_info);

  DBUG_RETURN( arg_node);
}
Beispiel #5
0
//check parametertypes of funcall and give type of function to info_type
	node *CTfuncall(node *arg_node, info *arg_info){
		DBUG_ENTER("CTfuncall");

	//check parameter types, if there are any
		if(FUNCALL_ARGS(arg_node)!=NULL){
			node *args = FUNCALL_ARGS(arg_node);
		//check param type against expression type
			node * param = FUNDEF_PARAMS(FSYMBOL_FUNCTION(FUNCALL_DECL(arg_node)));
			EXPRS_EXPRS(args) = TRAVdo(EXPRS_EXPRS(args), arg_info);
			type exprtype = INFO_TYPE(arg_info);
			type paramtype = PARAM_TYPE(param);
			if(exprtype != paramtype){
				CTIerrorLine(NODE_LINE(arg_node), "argument type does not match function definition");
			}

		//keep checking till there are no parameters left
			while(EXPRS_NEXT(args)!=NULL){
				args = EXPRS_NEXT(args);
				param = PARAM_NEXT(param);
				EXPRS_EXPRS(args) = TRAVdo(EXPRS_EXPRS(args), arg_info);
				exprtype = INFO_TYPE(arg_info);
				paramtype = PARAM_TYPE(param);
				if(exprtype != paramtype){
					CTIerrorLine(NODE_LINE(arg_node), "argument type does not match function definition");
				}
			}
		}

	//set info_type to return type of the function
		INFO_TYPE(arg_info) = FUNDEF_TYPE(FSYMBOL_FUNCTION(FUNCALL_DECL(arg_node)));

		DBUG_RETURN(arg_node);
	}
Beispiel #6
0
	node *CTfor(node *arg_node, info *arg_info){
		DBUG_ENTER("CTfor");

		FOR_START(arg_node) = TRAVdo(FOR_START(arg_node), arg_info);
		if (INFO_TYPE(arg_info) != T_int){
			CTIerrorLine(NODE_LINE(arg_node), "Start type does not match int");
		}
		FOR_STOP(arg_node) = TRAVdo(FOR_STOP(arg_node), arg_info);
		if(INFO_TYPE(arg_info) != T_int){
			CTIerrorLine(NODE_LINE(arg_node), "Stop type does not match int");
		}
		if(FOR_STEP(arg_node) != NULL){
			FOR_STEP(arg_node) = TRAVdo(FOR_STEP(arg_node), arg_info);
			if(INFO_TYPE(arg_info) != T_int){
				CTIerrorLine(NODE_LINE(arg_node), "Step type does not match int");
			}
		}

		if(FOR_BLOCK(arg_node) != NULL){
			FOR_BLOCK(arg_node) = TRAVdo(FOR_BLOCK(arg_node), arg_info);
		} else if (FOR_BLOCKSINGLE(arg_node) != NULL){
			FOR_BLOCKSINGLE(arg_node) = TRAVdo(FOR_BLOCKSINGLE(arg_node), arg_info);
		}

		DBUG_RETURN(arg_node);

	}
Beispiel #7
0
/** <!--******************************************************************-->
 *
 * @fn MERRCODEmodule
 *
 * @brief Sets error code for the node and its sons
 *
 * @param arg_node Module node to process
 * @param arg_info pointer to info structure
 *
 * @return processed node
 *
 ***************************************************************************/
node *MERRCODEmodule( node *arg_node, info *arg_info ){
  DBUG_ENTER("MERRCODEmodule");

  /* Set error code */
  NODE_ERRCODE(arg_node)= STRcpy(INFO_ERRCODE(arg_info));

  /* Visit sons */
  if(MODULE_DEFS( arg_node)!= NULL){
    MODULE_DEFS( arg_node)= TRAVdo( MODULE_DEFS( arg_node), arg_info);
  }
  if(MODULE_FIELDS( arg_node)!= NULL){
    MODULE_FIELDS( arg_node)= TRAVdo( MODULE_FIELDS( arg_node), arg_info);
  }
  if(MODULE_STAGS( arg_node)!= NULL){
    MODULE_STAGS( arg_node)= TRAVdo( MODULE_STAGS( arg_node), arg_info);
  }
  if(MODULE_BTAGS( arg_node)!= NULL){
    MODULE_BTAGS( arg_node)= TRAVdo( MODULE_BTAGS( arg_node), arg_info);
  }
  if(MODULE_INTERFACES( arg_node)!= NULL){
    MODULE_INTERFACES( arg_node)= TRAVdo( MODULE_INTERFACES( arg_node), arg_info);
  }

  /* Return value */
  DBUG_RETURN(arg_node);
}
Beispiel #8
0
/** <!--******************************************************************-->
 *
 * @fn MERRCODEnetdef
 *
 * @brief Sets error code for the node and its sons
 *
 * @param arg_node NetDef node to process
 * @param arg_info pointer to info structure
 *
 * @return processed node
 *
 ***************************************************************************/
node *MERRCODEnetdef( node *arg_node, info *arg_info ){
  const char *temp;

  DBUG_ENTER("MERRCODEnetdef");

  /* Get new error code */
  temp = INFO_ERRCODE(arg_info);
  INFO_ERRCODE(arg_info)= MDUtilMetadataGetKey(NETDEF_METADATA( arg_node), METADATA_KEY_ERR_CODE);

  /* Set error code */
  NODE_ERRCODE(arg_node)= STRcpy(INFO_ERRCODE(arg_info));

  /* Visit sons */
  if(NETDEF_SIGN( arg_node)!= NULL){
    NETDEF_SIGN( arg_node)= TRAVdo( NETDEF_SIGN( arg_node), arg_info);
  }
  if(NETDEF_BODY( arg_node)!= NULL){
    NETDEF_BODY( arg_node)= TRAVdo( NETDEF_BODY( arg_node), arg_info);
  }
  if(NETDEF_METADATA( arg_node)!= NULL){
    NETDEF_METADATA( arg_node)= TRAVdo( NETDEF_METADATA( arg_node), arg_info);
  }
  /* Reset error code */ 
  INFO_ERRCODE(arg_info)= temp;

  /* Return value */
  DBUG_RETURN(arg_node);
}
Beispiel #9
0
node *PREPTCHECKguardpatterns(node *arg_node, info *arg_info)
{
  DBUG_ENTER("PREPTCHECKguardpatterns");

  /* Store the guardpattern pattern for checks and continue traveling as normal */

  INFO_PATTERN(arg_info) = GUARDPATTERNS_ENTRIES(arg_node);

  if(GUARDPATTERNS_ENTRIES(arg_node) != NULL) {
    GUARDPATTERNS_ENTRIES(arg_node) = TRAVdo(GUARDPATTERNS_ENTRIES(arg_node), arg_info);
  }
  if(GUARDPATTERNS_CONDITION(arg_node) != NULL) {

    if(evaluatesToBoolean(GUARDPATTERNS_CONDITION(arg_node)) == FALSE){
	errorExpectingB(arg_node, "if");
    }

    /* if sentence must have expression that evaluates to boolean value */
    INFO_TAGS(arg_info) = 0;
    GUARDPATTERNS_CONDITION(arg_node) = TRAVdo(GUARDPATTERNS_CONDITION(arg_node), arg_info);

    if(INFO_TAGS(arg_info) == 0) {
      warnStaticGuard(arg_node);
    }
  }
  if(GUARDPATTERNS_NEXT(arg_node) != NULL) {
    GUARDPATTERNS_NEXT(arg_node) = TRAVdo(GUARDPATTERNS_NEXT(arg_node), arg_info);
  }

  DBUG_RETURN(arg_node);
}
Beispiel #10
0
node *MDUNPACKmetadatadefs( node *arg_node, info *arg_info )
{
  node *temp;

  DBUG_ENTER("MDUNPACKmetadatadefs");

  if(METADATADEFS_DEF(arg_node) != NULL) {
    METADATADEFS_DEF(arg_node) = TRAVdo(METADATADEFS_DEF(arg_node), arg_info);
  }

  if(METADATADEFS_NEXT(arg_node) != NULL) {
    METADATADEFS_NEXT(arg_node) = TRAVdo(METADATADEFS_NEXT(arg_node), arg_info);
  }

  if(METADATADEFS_DEF(arg_node) == NULL) {

    temp = METADATADEFS_NEXT(arg_node);

    METADATADEFS_NEXT(arg_node) = NULL;

    FREEdoFreeTree(arg_node);

    arg_node = temp;
  }

  DBUG_RETURN(arg_node);
}
Beispiel #11
0
node *PREPTCHECKguardactions(node *arg_node, info *arg_info)
{
  DBUG_ENTER("PREPTCHECKguardactions");

  /* Just the normal traveling, with one type check */

  if(GUARDACTIONS_TAGEXPR(arg_node) != NULL) {
    /* if sentence must have expression that evaluates to boolean value */
    if(evaluatesToBoolean(GUARDACTIONS_TAGEXPR(arg_node)) == FALSE){
      errorExpectingB(arg_node, "if");
    }
    INFO_TAGS(arg_info) = 0;
    GUARDACTIONS_TAGEXPR(arg_node) = TRAVdo(GUARDACTIONS_TAGEXPR(arg_node), arg_info);

    if(INFO_TAGS(arg_info) == 0) {
      warnStaticGuard(arg_node);
    }
  } 
     
  if(GUARDACTIONS_ACTION(arg_node) != NULL) {
    GUARDACTIONS_ACTION(arg_node) = TRAVdo(GUARDACTIONS_ACTION(arg_node), arg_info);
  }    

  if(GUARDACTIONS_NEXT(arg_node) != NULL) {
    GUARDACTIONS_NEXT(arg_node) = TRAVdo(GUARDACTIONS_NEXT(arg_node), arg_info);
  }  

  DBUG_RETURN(arg_node);
}
Beispiel #12
0
node *MDREMDUPmetadatakeylist( node *arg_node, info *arg_info )
{
  node *temp;

  DBUG_ENTER("MDREMDUPmetadatakeylist");

  if(!INFO_IS_CHECKING(arg_info)) {
    /* See if this node has a duplicate */
    
    INFO_IS_CHECKING(arg_info) = TRUE;
    INFO_CURRENT(arg_info) = arg_node;
    INFO_IS_DUPLICATE(arg_info) = FALSE;

    /* Search for duplicate */
    if(METADATAKEYLIST_NEXT(arg_node) != NULL) {
      METADATAKEYLIST_NEXT(arg_node) = TRAVdo(METADATAKEYLIST_NEXT(arg_node), arg_info);
    }

    if(INFO_IS_DUPLICATE(arg_info)) {
      /* Handle rest of the lsit and then remove this node */

      INFO_IS_CHECKING(arg_info) = FALSE;

      if(METADATAKEYLIST_NEXT(arg_node) != NULL) {
	temp = TRAVdo(METADATAKEYLIST_NEXT(arg_node), arg_info);
      } 

      METADATAKEYLIST_NEXT(arg_node) = NULL;

      FREEdoFreeNode(arg_node);
      arg_node = temp;

    } else {
      /* Handle rest of the list */
      INFO_IS_CHECKING(arg_info) = FALSE;
      
      if(METADATAKEYLIST_NEXT(arg_node) != NULL) {
	METADATAKEYLIST_NEXT(arg_node) = TRAVdo(METADATAKEYLIST_NEXT(arg_node), arg_info);
      } 
    } 

  } else {
    /* Check if this node is a duplicate with the current node */
  
    if(STReq(METADATAKEYLIST_KEY(INFO_CURRENT(arg_info)), METADATAKEYLIST_KEY(arg_node))) {

      INFO_IS_DUPLICATE(arg_info) = TRUE;

    } else {

      if(METADATAKEYLIST_NEXT(arg_node) != NULL) {
	METADATAKEYLIST_NEXT(arg_node) = TRAVdo(METADATAKEYLIST_NEXT(arg_node), arg_info);
      }
    }
   
  }

  DBUG_RETURN(arg_node);
}
Beispiel #13
0
//check types of operands of binop and rewrite binop if neccessary
	node * CTbinop(node *arg_node, info *arg_info){
		DBUG_ENTER("CTbinop");
		node *leftexpr = BINOP_LEFT(arg_node);
		node *rightexpr = BINOP_RIGHT(arg_node);
		
	//compare types of operands
		BINOP_LEFT(arg_node) = TRAVdo(BINOP_LEFT(arg_node), arg_info);
		type typeleft = INFO_TYPE(arg_info);
		BINOP_RIGHT(arg_node) = TRAVdo(BINOP_RIGHT(arg_node), arg_info);
		type typeright = INFO_TYPE(arg_info);
		if(typeleft != typeright){
			CTIerrorLine(NODE_LINE(arg_node), "Types of left and right expressions of the binop do not match");
		}

	//check if the right type of operands are used with the right operators
		if((BINOP_OP(arg_node) == BO_and || BINOP_OP(arg_node) == BO_or)&&INFO_TYPE(arg_info)!=T_boolean){
			CTIerrorLine(NODE_LINE(arg_node), "The used &&(and) or ||(or) operator can only compare two booleans");
		}
		if((BINOP_OP(arg_node) == BO_lt || BINOP_OP(arg_node) == BO_le ||BINOP_OP(arg_node) == BO_gt || BINOP_OP(arg_node) == BO_ge) 
			&& INFO_TYPE(arg_info) == T_boolean){
			CTIerrorLine(NODE_LINE(arg_node), "The used operator can only compare two integers or floats");
	}
	if(BINOP_OP(arg_node) == BO_add ||BINOP_OP(arg_node) == BO_mul ||BINOP_OP(arg_node) == BO_sub ||BINOP_OP(arg_node) == BO_div ||
		BINOP_OP(arg_node) == BO_mod ){
		BINOP_OPTYPE(arg_node) = typeleft;
}

	//set info_type to boolean
if(BINOP_OP(arg_node) == BO_lt || BINOP_OP(arg_node) == BO_le ||BINOP_OP(arg_node) == BO_gt || BINOP_OP(arg_node) == BO_ge ||
	BINOP_OP(arg_node) == BO_eq || BINOP_OP(arg_node) == BO_ne || BINOP_OP(arg_node) == BO_and || BINOP_OP(arg_node) == BO_or){
	INFO_TYPE(arg_info) = T_boolean;
BINOP_OPTYPE(arg_node) = typeleft;
}
else{
	BINOP_OPTYPE(arg_node) = typeleft;
}

	//rewrite and
if(BINOP_OP(arg_node)==BO_and){

	node *then = TBmakeBool(0);
	arg_node = TBmakeConditionexpr(leftexpr, then, rightexpr);
}

  	//rewrite or
else if(BINOP_OP(arg_node) == BO_or){
	node *orthen = TBmakeBool(1);
	arg_node = TBmakeConditionexpr(leftexpr, rightexpr, orthen);
}
DBUG_RETURN(arg_node);
}
Beispiel #14
0
node *PPLOCbranchlist( node *arg_node, info *arg_info )
{
  DBUG_ENTER("PPLOCbranchlist");

  int loc = INFO_LOC(arg_info);
  BRANCHLIST_BRANCH(arg_node) = TRAVdo(BRANCHLIST_BRANCH(arg_node), arg_info);
  INFO_LOC(arg_info) = loc;

  if (BRANCHLIST_NEXT(arg_node) != NULL) {
    BRANCHLIST_NEXT(arg_node) = TRAVdo(BRANCHLIST_NEXT(arg_node), arg_info);
  }

  DBUG_RETURN(arg_node);
}
Beispiel #15
0
//check type assign
	node *CTassign(node *arg_node, info *arg_info){
		DBUG_ENTER("CTassign");

	//compare varlet type with assignent expression type
		ASSIGN_LET(arg_node) = TRAVdo(ASSIGN_LET(arg_node), arg_info);
		type vartype = INFO_TYPE(arg_info);
		ASSIGN_EXPR(arg_node) = TRAVdo(ASSIGN_EXPR(arg_node), arg_info);
		type exprtype = INFO_TYPE(arg_info);
		if(vartype != exprtype){
			CTIerrorLine(NODE_LINE(arg_node), "The expression type of the assign does not match the variable type");
		}

		DBUG_RETURN(arg_node);
	}
Beispiel #16
0
node *PREPTCHECKfilt(node *arg_node, info *arg_info)
{
  DBUG_ENTER("PREPTCHECKfilt");

  /* Store the filter pattern for checks and continue traveling as normal */
  INFO_PATTERN(arg_info) = FILT_PATTERN(arg_node);

  if(FILT_PATTERN(arg_node) != NULL) {
    FILT_PATTERN(arg_node) = TRAVdo(FILT_PATTERN(arg_node), arg_info);
  }  
  if(FILT_GUARDACTIONS(arg_node) != NULL){
    FILT_GUARDACTIONS(arg_node) = TRAVdo(FILT_GUARDACTIONS(arg_node), arg_info);
  }
  
  DBUG_RETURN(arg_node);
}
Beispiel #17
0
//check type of monop with operand
node *CTmonop(node *arg_node, info *arg_info){
	DBUG_ENTER("CTmonop");

	//get type of operand in info_type
	MONOP_OPERAND(arg_node) = TRAVdo(MONOP_OPERAND(arg_node), arg_info);
	

	//check if type is boolean.

	if(MONOP_OP(arg_node) == MO_not && INFO_TYPE(arg_info) != T_boolean){
		CTIerrorLine(NODE_LINE(arg_node), "!(not) can only be used with a boolean operand");
	}
	else{
		MONOP_OPTYPE(arg_node) = T_boolean;
	}
	if(MONOP_OP(arg_node) == MO_neg && INFO_TYPE(arg_info) == T_boolean){
		CTIerrorLine(NODE_LINE(arg_node), "-(neg) can only be used with a boolean operand");
	}
	else if(INFO_TYPE(arg_info) == T_int){
		MONOP_OPTYPE(arg_node) = T_int;
	}
	else{
		MONOP_OPTYPE(arg_node) = T_float;
	}

	DBUG_RETURN(arg_node);
}
Beispiel #18
0
node *
PRTassign (node * arg_node, info * arg_info)
{
  DBUG_ENTER ("PRTassign");

  if (ASSIGN_LET( arg_node) != NULL) {
    ASSIGN_LET( arg_node) = TRAVdo( ASSIGN_LET( arg_node), arg_info);
    printf( " = ");
  }
  
  ASSIGN_EXPR( arg_node) = TRAVdo( ASSIGN_EXPR( arg_node), arg_info);
  
  printf( ";\n");
  
  DBUG_RETURN (arg_node);
}
Beispiel #19
0
node *
PRTerror (node * arg_node, info * arg_info)
{
  bool first_error;

  DBUG_ENTER ("PRTerror");

  if (NODE_ERROR (arg_node) != NULL) {
    NODE_ERROR (arg_node) = TRAVdo (NODE_ERROR (arg_node), arg_info);
  }

  first_error = INFO_FIRSTERROR( arg_info);

  if( (global.outfile != NULL)
      && (ERROR_ANYPHASE( arg_node) == global.compiler_anyphase)) {

    if ( first_error) {
      printf ( "\n/******* BEGIN TREE CORRUPTION ********\n");
      INFO_FIRSTERROR( arg_info) = FALSE;
    }

    printf ( "%s\n", ERROR_MESSAGE( arg_node));

    if (ERROR_NEXT (arg_node) != NULL) {
      TRAVopt (ERROR_NEXT (arg_node), arg_info);
    }

    if ( first_error) {
      printf ( "********  END TREE CORRUPTION  *******/\n");
      INFO_FIRSTERROR( arg_info) = TRUE;
    }
  }

  DBUG_RETURN (arg_node);
}
Beispiel #20
0
node 
*PRTdoPrint( node *syntaxtree)
{
  info *info;
  
  DBUG_ENTER("PRTdoPrint");

  DBUG_ASSERT( (syntaxtree!= NULL), "PRTdoPrint called with empty syntaxtree");

  printf( "\n\n------------------------------\n\n");

  info = MakeInfo();
  
  TRAVpush( TR_prt);

  syntaxtree = TRAVdo( syntaxtree, info);

  TRAVpop();

  info = FreeInfo(info);

  printf( "\n\n------------------------------\n\n");

  DBUG_RETURN( syntaxtree);
}
Beispiel #21
0
node *MDUNPACKnetdef( node *arg_node, info *arg_info )
{
  node *temp;
  node *keys;
  node *childs;

  DBUG_ENTER("MDUNPACKnetdef");

  temp = dequeuePopNextMatch(INFO_NETDEQUEUE(arg_info), NETDEF_NAME(arg_node));

  if(temp != NULL) {
    NETDEF_METADATA(arg_node) = METADATANETDEF_KEYS(temp);

    METADATANETDEF_KEYS(temp) = NULL;

    INFO_CHILDS(arg_info) = METADATANETDEF_CHILDS(temp);

    METADATANETDEF_CHILDS(temp) = NULL;

    FREEdoFreeTree(temp);

    while((temp = dequeuePopNextMatch(INFO_NETDEQUEUE(arg_info), NETDEF_NAME(arg_node))) != NULL) { 
      
      keys = NETDEF_METADATA(arg_node);

      if(keys != NULL) {
	while(METADATAKEYLIST_NEXT(keys) != NULL) {
	  keys = METADATAKEYLIST_NEXT(keys);
	}
      
	METADATAKEYLIST_NEXT(keys) = METADATANETDEF_KEYS(temp);

	METADATANETDEF_KEYS(temp) = NULL;
      }

      childs = INFO_CHILDS(arg_info);

      if(childs != NULL) {

	while(METADATADEFS_NEXT(childs) != NULL) {
	  childs = METADATADEFS_NEXT(childs);
	}

	METADATADEFS_NEXT(childs) = METADATANETDEF_CHILDS(temp);

	METADATANETDEF_CHILDS(temp) = NULL;
      }

      FREEdoFreeTree(temp);

    }
  }

  if(NETDEF_BODY(arg_node) != NULL) {
    NETDEF_BODY(arg_node) = TRAVdo(NETDEF_BODY(arg_node), arg_info);
  }

  DBUG_RETURN(arg_node);
}
Beispiel #22
0
/** <!--******************************************************************-->
 *
 * @fn MERRCODEbtaginit
 *
 * @brief Sets error code for the node and its sons
 *
 * @param arg_node BTagInit node to process
 * @param arg_info pointer to info structure
 *
 * @return processed node
 *
 ***************************************************************************/
node *MERRCODEbtaginit( node *arg_node, info *arg_info ){
  DBUG_ENTER("MERRCODEbtaginit");

  /* Set error code */
  NODE_ERRCODE(arg_node)= STRcpy(INFO_ERRCODE(arg_info));

  /* Visit sons */
  if(BTAGINIT_BTAG( arg_node)!= NULL){
    BTAGINIT_BTAG( arg_node)= TRAVdo( BTAGINIT_BTAG( arg_node), arg_info);
  }
  if(BTAGINIT_INIT( arg_node)!= NULL){
    BTAGINIT_INIT( arg_node)= TRAVdo( BTAGINIT_INIT( arg_node), arg_info);
  }

  /* Return value */
  DBUG_RETURN(arg_node);
}
Beispiel #23
0
/** <!--******************************************************************-->
 *
 * @fn MERRCODEnetbody
 *
 * @brief Sets error code for the node and its sons
 *
 * @param arg_node NetBody node to process
 * @param arg_info pointer to info structure
 *
 * @return processed node
 *
 ***************************************************************************/
node *MERRCODEnetbody( node *arg_node, info *arg_info ){
  DBUG_ENTER("MERRCODEnetbody");

  /* Set error code */
  NODE_ERRCODE(arg_node)= STRcpy(INFO_ERRCODE(arg_info));

  /* Visit sons */
  if(NETBODY_DEFS( arg_node)!= NULL){
    NETBODY_DEFS( arg_node)= TRAVdo( NETBODY_DEFS( arg_node), arg_info);
  }
  if(NETBODY_CONNECT( arg_node)!= NULL){
    NETBODY_CONNECT( arg_node)= TRAVdo( NETBODY_CONNECT( arg_node), arg_info);
  }

  /* Return value */
  DBUG_RETURN(arg_node);
}
Beispiel #24
0
/** <!--******************************************************************-->
 *
 * @fn MERRCODEfilt
 *
 * @brief Sets error code for the node and its sons
 *
 * @param arg_node Filt node to process
 * @param arg_info pointer to info structure
 *
 * @return processed node
 *
 ***************************************************************************/
node *MERRCODEfilt( node *arg_node, info *arg_info ){
  DBUG_ENTER("MERRCODEfilt");

  /* Set error code */
  NODE_ERRCODE(arg_node)= STRcpy(INFO_ERRCODE(arg_info));

  /* Visit sons */
  if(FILT_PATTERN( arg_node)!= NULL){
    FILT_PATTERN( arg_node)= TRAVdo( FILT_PATTERN( arg_node), arg_info);
  }
  if(FILT_GUARDACTIONS( arg_node)!= NULL){
    FILT_GUARDACTIONS( arg_node)= TRAVdo( FILT_GUARDACTIONS( arg_node), arg_info);
  }

  /* Return value */
  DBUG_RETURN(arg_node);
}
Beispiel #25
0
/** <!--******************************************************************-->
 *
 * @fn MERRCODEfieldinit
 *
 * @brief Sets error code for the node and its sons
 *
 * @param arg_node FieldInit node to process
 * @param arg_info pointer to info structure
 *
 * @return processed node
 *
 ***************************************************************************/
node *MERRCODEfieldinit( node *arg_node, info *arg_info ){
  DBUG_ENTER("MERRCODEfieldinit");

  /* Set error code */
  NODE_ERRCODE(arg_node)= STRcpy(INFO_ERRCODE(arg_info));

  /* Visit sons */
  if(FIELDINIT_FIELD( arg_node)!= NULL){
    FIELDINIT_FIELD( arg_node)= TRAVdo( FIELDINIT_FIELD( arg_node), arg_info);
  }
  if(FIELDINIT_INIT( arg_node)!= NULL){
    FIELDINIT_INIT( arg_node)= TRAVdo( FIELDINIT_INIT( arg_node), arg_info);
  }

  /* Return value */
  DBUG_RETURN(arg_node);
}
Beispiel #26
0
/** <!--******************************************************************-->
 *
 * @fn MERRCODEdefs
 *
 * @brief Sets error code for the node and its sons
 *
 * @param arg_node Defs node to process
 * @param arg_info pointer to info structure
 *
 * @return processed node
 *
 ***************************************************************************/
node *MERRCODEdefs( node *arg_node, info *arg_info ){
  DBUG_ENTER("MERRCODEdefs");

  /* Set error code */
  NODE_ERRCODE(arg_node)= STRcpy(INFO_ERRCODE(arg_info));

  /* Visit sons */
  if(DEFS_DEF( arg_node)!= NULL){
    DEFS_DEF( arg_node)= TRAVdo( DEFS_DEF( arg_node), arg_info);
  }
  if(DEFS_NEXT( arg_node)!= NULL){
    DEFS_NEXT( arg_node)= TRAVdo( DEFS_NEXT( arg_node), arg_info);
  }

  /* Return value */
  DBUG_RETURN(arg_node);
}
Beispiel #27
0
/** <!--******************************************************************-->
 *
 * @fn MERRCODEboxtypes
 *
 * @brief Sets error code for the node and its sons
 *
 * @param arg_node BoxTypes node to process
 * @param arg_info pointer to info structure
 *
 * @return processed node
 *
 ***************************************************************************/
node *MERRCODEboxtypes( node *arg_node, info *arg_info ){
  DBUG_ENTER("MERRCODEboxtypes");

  /* Set error code */
  NODE_ERRCODE(arg_node)= STRcpy(INFO_ERRCODE(arg_info));

  /* Visit sons */
  if(BOXTYPES_ENTRIES( arg_node)!= NULL){
    BOXTYPES_ENTRIES( arg_node)= TRAVdo( BOXTYPES_ENTRIES( arg_node), arg_info);
  }
  if(BOXTYPES_NEXT( arg_node)!= NULL){
    BOXTYPES_NEXT( arg_node)= TRAVdo( BOXTYPES_NEXT( arg_node), arg_info);
  }

  /* Return value */
  DBUG_RETURN(arg_node);
}
Beispiel #28
0
/** <!--******************************************************************-->
 *
 * @fn MERRCODEboxsign
 *
 * @brief Sets error code for the node and its sons
 *
 * @param arg_node BoxSign node to process
 * @param arg_info pointer to info structure
 *
 * @return processed node
 *
 ***************************************************************************/
node *MERRCODEboxsign( node *arg_node, info *arg_info ){
  DBUG_ENTER("MERRCODEboxsign");

  /* Set error code */
  NODE_ERRCODE(arg_node)= STRcpy(INFO_ERRCODE(arg_info));

  /* Visit sons */
  if(BOXSIGN_INTYPE( arg_node)!= NULL){
    BOXSIGN_INTYPE( arg_node)= TRAVdo( BOXSIGN_INTYPE( arg_node), arg_info);
  }
  if(BOXSIGN_OUTTYPES( arg_node)!= NULL){
    BOXSIGN_OUTTYPES( arg_node)= TRAVdo( BOXSIGN_OUTTYPES( arg_node), arg_info);
  }

  /* Return value */
  DBUG_RETURN(arg_node);
}
Beispiel #29
0
/** <!--******************************************************************-->
 *
 * @fn MERRCODEtypesigns
 *
 * @brief Sets error code for the node and its sons
 *
 * @param arg_node TypeSigns node to process
 * @param arg_info pointer to info structure
 *
 * @return processed node
 *
 ***************************************************************************/
node *MERRCODEtypesigns( node *arg_node, info *arg_info ){
  DBUG_ENTER("MERRCODEtypesigns");

  /* Set error code */
  NODE_ERRCODE(arg_node)= STRcpy(INFO_ERRCODE(arg_info));

  /* Visit sons */
  if(TYPESIGNS_TYPESIG( arg_node)!= NULL){
    TYPESIGNS_TYPESIG( arg_node)= TRAVdo( TYPESIGNS_TYPESIG( arg_node), arg_info);
  }
  if(TYPESIGNS_NEXT( arg_node)!= NULL){
    TYPESIGNS_NEXT( arg_node)= TRAVdo( TYPESIGNS_NEXT( arg_node), arg_info);
  }

  /* Return value */
  DBUG_RETURN(arg_node);
}
Beispiel #30
0
/** <!--******************************************************************-->
 *
 * @fn MERRCODEmetadatalist
 *
 * @brief Sets error code for the node and its sons
 *
 * @param arg_node MetadataList node to process
 * @param arg_info pointer to info structure
 *
 * @return processed node
 *
 ***************************************************************************/
node *MERRCODEmetadatalist( node *arg_node, info *arg_info ){
  DBUG_ENTER("MERRCODEmetadatalist");

  /* Set error code */
  NODE_ERRCODE(arg_node)= STRcpy(INFO_ERRCODE(arg_info));

  /* Visit sons */
  if(METADATALIST_ENTRY( arg_node)!= NULL){
    METADATALIST_ENTRY( arg_node)= TRAVdo( METADATALIST_ENTRY( arg_node), arg_info);
  }
  if(METADATALIST_NEXT( arg_node)!= NULL){
    METADATALIST_NEXT( arg_node)= TRAVdo( METADATALIST_NEXT( arg_node), arg_info);
  }

  /* Return value */
  DBUG_RETURN(arg_node);
}